From 70c2db8b9f6dc95150aa72a923fa80227b7a3281 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Tue, 2 Jun 2009 06:41:57 -0500 Subject: [PATCH] Updated documentation about the git repository and libpng coding style. --- CHANGES | 6 +- libpng-1.2.37rc01.txt => libpng-1.2.37.txt | 116 ++++++++++++++++++++- 2 files changed, 116 insertions(+), 6 deletions(-) rename libpng-1.2.37rc01.txt => libpng-1.2.37.txt (97%) diff --git a/CHANGES b/CHANGES index 46f29bbe..1a19f2b4 100644 --- a/CHANGES +++ b/CHANGES @@ -2393,9 +2393,13 @@ version 1.2.37beta03 [May 20, 2009] version 1.2.37rc01 [May 27, 2009] No changes. -version 1.2.37 [May 31, 2009] +version 1.2.37 [June 2, 2009] Reformatted several remaining "else statement;" and "if () statment;" into two lines. + Added "#define PNG_NO_WRITE_SWAP" to contrib/pngminim/encoder/pngusr.h + and "define PNG_NO_READ_SWAP" to decoder/pngusr.h and preader/pngusr.h + Added sections about the git repository and our coding style to the + documentation (merged from libpng-1.4.0beta62) Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/libpng-1.2.37rc01.txt b/libpng-1.2.37.txt similarity index 97% rename from libpng-1.2.37rc01.txt rename to libpng-1.2.37.txt index 5c242d50..ff6f0a86 100644 --- a/libpng-1.2.37rc01.txt +++ b/libpng-1.2.37.txt @@ -1,6 +1,6 @@ libpng.txt - A description on how to use and modify libpng - libpng version 1.2.37rc01 - May 27, 2009 + libpng version 1.2.37 - June 2, 2009 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2009 Glenn Randers-Pehrson @@ -9,7 +9,7 @@ libpng.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.2.37rc01 - May 27, 2009 + libpng versions 0.97, January 1998, through 1.2.37 - June 2, 2009 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2009 Glenn Randers-Pehrson @@ -2945,15 +2945,121 @@ We replaced all of these functions with simple stubs in libpng-1.2.20, when the Intel assembler code was removed due to a licensing issue. IX. (Omitted) -X. Y2K Compliance in libpng -May 27, 2009 +X. Source code repository + +Since about February 2009, version 1.2.34, libpng has been under "git" source +control. The git repository was built from old libpng-x.y.z.tar.gz files +going back to version 0.70. You can access the git repository (read only) +at + + git://libpng.git.sourceforge.net/gitroot/libpng + +or you can browse it via "gitweb" at + + http://libpng.git.sourceforge.net/git/gitweb.cgi?p=libpng + +Patches can be sent to glennrp at users.sourceforge.net or to +png-mng-implement at lists.sourceforge.net or you can upload them to +the libpng bug tracker at + + http://libpng.sourceforge.net + +XI. Coding style + +Our coding style is similar to the "Allman" style, with curly +braces on separate lines: + + if (condition) + { + action; + } + + else if (another condition) + { + another action; + } + +The braces can be omitted from simple one-line actions: + + if (condition) + return (0); + +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. + +Comments appear with the leading "/*" at the same indentation as +the statement that follows the comment: + + /* Single-line comment */ + statement; + + /* Multiple-line + * comment + */ + statement; + +Very short comments can be placed at the end of the statement +to which they pertain: + + statement; /* comment */ + +We don't use C++ style ("//") comments. We have, however, +used them in the past in some now-abandoned MMX assembler +code. + +Functions and their curly brackets are not indented, and +exported functions are marked with PNGAPI: + + /* This is a public function that is visible to + * application programers. It does thus-and-so. + */ + void PNGAPI + png_exported_function(png_ptr, png_info, foo) + { + body; + } + +The prototypes for all exported functions appear in png.h. + +We mark all non-exported functions with "/* PRIVATE */"": + + void /* PRIVATE */ + png_non_exported_function(png_ptr, png_info, foo) + { + body; + } + +The prototypes for non-exported functions can appear in +pngpriv.h or in the file where the function is located. + +The names of all exported functions and variables begin +with "png_", and all publicly visible C preprocessor +macros begin with "PNG_". + +We put a space after each comma and after each semicolon +in "for" statments, and we put spaces before and after each +C binary operator and after "for" or "while". We don't +put a space between a typecast and the expression being +cast, nor do we put one between a function name and the +left parenthesis that follows it: + + for (i = 2; i > 0; --i) + x[i] = a(x) + (int)b; + +Other rules can be inferred by inspecting the libpng +source. + +XII. Y2K Compliance in libpng + +June 2, 2009 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.2.37rc01 are Y2K compliant. It is my belief that earlier +upward through 1.2.37 are Y2K compliant. It is my belief that earlier versions were also Y2K compliant. Libpng only has three year fields. One is a 2-byte unsigned integer that