[devel] Imported from libpng-1.5.3beta05.tar
diff --git a/ANNOUNCE b/ANNOUNCE
index 0181bd0..067b019 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,5 +1,5 @@
 
-Libpng 1.5.3beta05 - May 5, 2011
+Libpng 1.5.3beta05 - May 6, 2011
 
 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.
@@ -76,7 +76,7 @@
   Changed png_struct jmp_buf member name from png_jmpbuf to tmp_jmpbuf to
     avoid a clash with the png_jmpbuf macro on some platforms.
 
-Version 1.5.3beta05 [May 5, 2011]
+Version 1.5.3beta05 [May 6, 2011]
   Added appropriate feature test macros to ensure libpng sees the correct API
    _POSIX_SOURCE is defined in pngpriv.h, pngtest.c and pngvalid.c to ensure
     that POSIX conformant systems disable non-POSIX APIs.  _ISOC99_SOURCE is
@@ -89,12 +89,13 @@
     PNG_NO_WARNINGS does actually work now.
   Added PNG_WRITE_OPTIMIZE_CMF_SUPPORTED macro to make the zlib "CMF" byte
     optimization configureable.
-  IDAT compression failed if preceded by a compressed text chunk
-    This was because the attempt to reset the zlib stream in png_write_IDAT
-    happened after the first IDAT chunk had been deflated - much too late.
-    In this change internal functions are added to claim/release the z_stream
-    and, hopefully, make the code more robust.  Also deflateEnd checking is
-    added - previously libpng would ignore an error at the end of the stream.
+  IDAT compression failed if preceded by a compressed text chunk (bug
+    introduced in libpng-1.5.3beta01-02).  This was because the attempt to
+    reset the zlib stream in png_write_IDAT happened after the first IDAT
+    chunk had been deflated - much too late.  In this change internal
+    functions were added to claim/release the z_stream and, hopefully, make
+    the code more robust.  Also deflateEnd checking is added - previously
+    libpng would ignore an error at the end of the stream.
 
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
diff --git a/CHANGES b/CHANGES
index 46aa680..39490e7 100644
--- a/CHANGES
+++ b/CHANGES
@@ -3337,7 +3337,7 @@
   Changed png_struct jmp_buf member name from png_jmpbuf to tmp_jmpbuf to
     avoid a possible clash with the png_jmpbuf macro on some platforms.
 
-Version 1.5.3beta05 [May 5, 2011]
+Version 1.5.3beta05 [May 6, 2011]
   Added the "_POSIX_SOURCE" feature test macro to ensure libpng sees the
     correct API. _POSIX_SOURCE is defined in pngpriv.h, pngtest.c and
     pngvalid.c to ensure that POSIX conformant systems disable non-POSIX APIs.
@@ -3348,12 +3348,13 @@
     PNG_NO_WARNINGS does actually work now.
   Added PNG_WRITE_OPTIMIZE_CMF_SUPPORTED macro to make the zlib "CMF" byte
     optimization configureable.
-  IDAT compression failed if preceded by a compressed text chunk
-    This was because the attempt to reset the zlib stream in png_write_IDAT
-    happened after the first IDAT chunk had been deflated - much too late.
-    In this change internal functions are added to claim/release the z_stream
-    and, hopefully, make the code more robust.  Also deflateEnd checking is
-    added - previously libpng would ignore an error at the end of the stream.
+  IDAT compression failed if preceded by a compressed text chunk (bug
+    introduced in libpng-1.5.3beta01-02).  This was because the attempt to
+    reset the zlib stream in png_write_IDAT happened after the first IDAT
+    chunk had been deflated - much too late.  In this change internal
+    functions were added to claim/release the z_stream and, hopefully, make
+    the code more robust.  Also deflateEnd checking is added - previously
+    libpng would ignore an error at the end of the stream.
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
diff --git a/LICENSE b/LICENSE
index d1c3448..6dc420b 100644
--- a/LICENSE
+++ b/LICENSE
@@ -10,7 +10,7 @@
 
 This code is released under the libpng license.
 
-libpng versions 1.2.6, August 15, 2004, through 1.5.3beta05, April 29, 2011, are
+libpng versions 1.2.6, August 15, 2004, through 1.5.3beta05, May 6, 2011, are
 Copyright (c) 2004, 2006-2011 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
@@ -108,4 +108,4 @@
 
 Glenn Randers-Pehrson
 glennrp at users.sourceforge.net
-April 29, 2011
+May 6, 2011
diff --git a/README b/README
index c7801c4..8197c38 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-README for libpng version 1.5.3beta05 - April 29, 2011 (shared library 15.0)
+README for libpng version 1.5.3beta05 - May 6, 2011 (shared library 15.0)
 See the note about version numbers near the top of png.h
 
 See INSTALL for instructions on how to install libpng.
diff --git a/example.c b/example.c
index 782c555..f151763 100644
--- a/example.c
+++ b/example.c
@@ -2,7 +2,7 @@
 #if 0 /* in case someone actually tries to compile this */
 
 /* example.c - an example of using libpng
- * Last changed in libpng 1.5.2 [March 31, 2011]
+ * Last changed in libpng 1.5.3 [(PENDING RELEASE)]
  * This file has been placed in the public domain by the authors.
  * Maintained 1998-2011 Glenn Randers-Pehrson
  * Maintained 1996, 1997 Andreas Dilger)
@@ -22,6 +22,10 @@
  * see also the programs in the contrib directory.
  */
 
+#define _POSIX_SOURCE 1  /* libpng and zlib are POSIX-compliant.  You may
+                          * change this if your application uses non-POSIX
+                          * extensions. */
+
 #include "png.h"
 
  /* The png_jmpbuf() macro, used in error handling, became available in
diff --git a/libpng-manual.txt b/libpng-manual.txt
index 2d517f9..424e4ca 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.5.3beta05 - April 29, 2011
+ libpng version 1.5.3beta05 - May 6, 2011
  Updated and distributed by Glenn Randers-Pehrson
  <glennrp at users.sourceforge.net>
  Copyright (c) 1998-2011 Glenn Randers-Pehrson
@@ -11,7 +11,7 @@
 
  Based on:
 
- libpng versions 0.97, January 1998, through 1.5.3beta05 - April 29, 2011
+ libpng versions 0.97, January 1998, through 1.5.3beta05 - May 6, 2011
  Updated and distributed by Glenn Randers-Pehrson
  Copyright (c) 1998-2011 Glenn Randers-Pehrson
 
@@ -4193,7 +4193,7 @@
 
 XIV. Y2K Compliance in libpng
 
-April 29, 2011
+May 6, 2011
 
 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 1a19426..c8963d9 100644
--- a/libpng.3
+++ b/libpng.3
@@ -1,4 +1,4 @@
-.TH LIBPNG 3 "April 29, 2011"
+.TH LIBPNG 3 "May 6, 2011"
 .SH NAME
 libpng \- Portable Network Graphics (PNG) Reference Library 1.5.3beta05
 .SH SYNOPSIS
@@ -943,7 +943,7 @@
 .SH LIBPNG.TXT
 libpng-manual.txt - A description on how to use and modify libpng
 
- libpng version 1.5.3beta05 - April 29, 2011
+ libpng version 1.5.3beta05 - May 6, 2011
  Updated and distributed by Glenn Randers-Pehrson
  <glennrp at users.sourceforge.net>
  Copyright (c) 1998-2011 Glenn Randers-Pehrson
@@ -954,7 +954,7 @@
 
  Based on:
 
- libpng versions 0.97, January 1998, through 1.5.3beta05 - April 29, 2011
+ libpng versions 0.97, January 1998, through 1.5.3beta05 - May 6, 2011
  Updated and distributed by Glenn Randers-Pehrson
  Copyright (c) 1998-2011 Glenn Randers-Pehrson
 
@@ -5136,7 +5136,7 @@
 
 .SH XIV. Y2K Compliance in libpng
 
-April 29, 2011
+May 6, 2011
 
 Since the PNG Development group is an ad-hoc body, we can't make
 an official declaration.
@@ -5388,7 +5388,7 @@
 
 Thanks to Frank J. T. Wojcik for helping with the documentation.
 
-Libpng version 1.5.3beta05 - April 29, 2011:
+Libpng version 1.5.3beta05 - May 6, 2011:
 Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
 Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
 
@@ -5411,7 +5411,7 @@
 
 This code is released under the libpng license.
 
-libpng versions 1.2.6, August 15, 2004, through 1.5.3beta05, April 29, 2011, are
+libpng versions 1.2.6, August 15, 2004, through 1.5.3beta05, May 6, 2011, 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
@@ -5510,7 +5510,7 @@
 
 Glenn Randers-Pehrson
 glennrp at users.sourceforge.net
-April 29, 2011
+May 6, 2011
 
 .\" end of man page
 
diff --git a/libpngpf.3 b/libpngpf.3
index b835b95..786211f 100644
--- a/libpngpf.3
+++ b/libpngpf.3
@@ -1,4 +1,4 @@
-.TH LIBPNGPF 3 "April 29, 2011"
+.TH LIBPNGPF 3 "May 6, 2011"
 .SH NAME
 libpng \- Portable Network Graphics (PNG) Reference Library 1.5.3beta05
 (private functions)
diff --git a/png.5 b/png.5
index 40a41d3..3448a66 100644
--- a/png.5
+++ b/png.5
@@ -1,4 +1,4 @@
-.TH PNG 5 "April 29, 2011"
+.TH PNG 5 "May 6, 2011"
 .SH NAME
 png \- Portable Network Graphics (PNG) format
 .SH DESCRIPTION
diff --git a/png.c b/png.c
index 0c30061..45f4817 100644
--- a/png.c
+++ b/png.c
@@ -619,13 +619,13 @@
 #else
 #  ifdef __STDC__
    return PNG_STRING_NEWLINE \
-     "libpng version 1.5.3beta05 - May 5, 2011" PNG_STRING_NEWLINE \
+     "libpng version 1.5.3beta05 - May 6, 2011" PNG_STRING_NEWLINE \
      "Copyright (c) 1998-2011 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.5.3beta05 - May 5, 2011\
+      return "libpng version 1.5.3beta05 - May 6, 2011\
       Copyright (c) 1998-2011 Glenn Randers-Pehrson\
       Copyright (c) 1996-1997 Andreas Dilger\
       Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
diff --git a/png.h b/png.h
index 4d1d53c..e7b80d2 100644
--- a/png.h
+++ b/png.h
@@ -1,7 +1,7 @@
 
 /* png.h - header file for PNG reference library
  *
- * libpng version 1.5.3beta05 - May 5, 2011
+ * libpng version 1.5.3beta05 - May 6, 2011
  * Copyright (c) 1998-2011 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.5.3beta05 - May 5, 2011: Glenn
+ *   libpng versions 0.97, January 1998, through 1.5.3beta05 - May 6, 2011: Glenn
  *   See also "Contributing Authors", below.
  *
  * Note about libpng version numbers:
@@ -182,7 +182,7 @@
  *
  * This code is released under the libpng license.
  *
- * libpng versions 1.2.6, August 15, 2004, through 1.5.3beta05, May 5, 2011, are
+ * libpng versions 1.2.6, August 15, 2004, through 1.5.3beta05, May 6, 2011, are
  * Copyright (c) 2004, 2006-2011 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:
@@ -294,7 +294,7 @@
  * Y2K compliance in libpng:
  * =========================
  *
- *    May 5, 2011
+ *    May 6, 2011
  *
  *    Since the PNG Development group is an ad-hoc body, we can't make
  *    an official declaration.
@@ -357,7 +357,7 @@
 /* Version information for png.h - this should match the version in png.c */
 #define PNG_LIBPNG_VER_STRING "1.5.3beta05"
 #define PNG_HEADER_VERSION_STRING \
-     " libpng version 1.5.3beta05 - May 5, 2011\n"
+     " libpng version 1.5.3beta05 - May 6, 2011\n"
 
 #define PNG_LIBPNG_VER_SONUM   15
 #define PNG_LIBPNG_VER_DLLNUM  15
diff --git a/pngconf.h b/pngconf.h
index 58a5ace..79beee6 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -1,7 +1,7 @@
 
 /* pngconf.h - machine configurable file for libpng
  *
- * libpng version 1.5.3beta05 - May 5, 2011 
+ * libpng version 1.5.3beta05 - May 6, 2011 
  *
  * Copyright (c) 1998-2011 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngtrans.c b/pngtrans.c
index 8a536c5..16582d1 100644
--- a/pngtrans.c
+++ b/pngtrans.c
@@ -443,8 +443,8 @@
     * it is copied to.  ep always points just beyond the end of the row, so
     * the loop simply copies (channels-1) channels until sp reaches ep.
     *
-    * at_start:  0 -- convert AG, XG, ARGB, XRGB, AAGG, XXGG, etc.
-    *         :  nonzero -- convert GA, GX, RGBA, RGBX, GGAA, RRGGBBXX, etc.
+    * at_start:        0 -- convert AG, XG, ARGB, XRGB, AAGG, XXGG, etc.
+    *            nonzero -- convert GA, GX, RGBA, RGBX, GGAA, RRGGBBXX, etc.
     */
 
    /* GA, GX, XG cases */
@@ -454,7 +454,7 @@
       {
          if (at_start) /* Skip initial filler */
             ++sp;
-         else          /* Skip initial channels and, for sp, the filler */
+         else          /* Skip initial channel and, for sp, the filler */
             sp += 2, ++dp;
 
          /* For a 1 pixel wide image there is nothing to do */
@@ -466,9 +466,9 @@
 
       else if (row_info->bit_depth == 16)
       {
-         if (at_start)
+         if (at_start) /* Skip initial filler */
             sp += 2;
-         else
+         else          /* Skip initial channel and, for sp, the filler */
             sp += 4, dp += 2;
 
          while (sp < ep)
@@ -506,9 +506,9 @@
 
       else if (row_info->bit_depth == 16)
       {
-         if (at_start)
+         if (at_start) /* Skip initial filler */
             sp += 2;
-         else
+         else          /* Skip initial channels and, for sp, the filler */
             sp += 8, dp += 6;
 
          while (sp < ep)
diff --git a/projects/vstudio/readme.txt b/projects/vstudio/readme.txt
index 07f4502..1416d7e 100644
--- a/projects/vstudio/readme.txt
+++ b/projects/vstudio/readme.txt
@@ -1,7 +1,7 @@
 
 VisualStudio instructions
 
-libpng version 1.5.3beta05 - April 29, 2011
+libpng version 1.5.3beta05 - May 6, 2011
 
 Copyright (c) 1998-2010 Glenn Randers-Pehrson
 
diff --git a/projects/vstudio/zlib.props b/projects/vstudio/zlib.props
index f9909da..c6a4b7f 100644
--- a/projects/vstudio/zlib.props
+++ b/projects/vstudio/zlib.props
@@ -2,7 +2,7 @@
 <!--
  * zlib.props - location of zlib source
  *
- * libpng version 1.5.3beta05 - April 29, 2011
+ * libpng version 1.5.3beta05 - May 6, 2011
  *
  * Copyright (c) 1998-2011 Glenn Randers-Pehrson
  *
diff --git a/scripts/README.txt b/scripts/README.txt
index b7bb3eb..752af3c 100644
--- a/scripts/README.txt
+++ b/scripts/README.txt
@@ -1,5 +1,5 @@
 
-Makefiles for  libpng version 1.5.3beta05 - April 29, 2011
+Makefiles for  libpng version 1.5.3beta05 - May 6, 2011
 
 pnglibconf.h.prebuilt       =>  Stores configuration settings
  makefile.linux    =>  Linux/ELF makefile