[devel] Update png_compress_chunk() rewrite.
diff --git a/ANNOUNCE b/ANNOUNCE
index 986df06..642363b 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,5 +1,5 @@
 
-Libpng 1.4.1beta11 - February 12, 2010
+Libpng 1.5.0beta05 - February 13, 2010
 
 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.
@@ -9,79 +9,45 @@
 Source files with LF line endings (for Unix/Linux) and with a
 "configure" script
 
-   1.4.1beta11.tar.xz (LZMA-compressed, recommended)
-   1.4.1beta11.tar.gz
-   1.4.1beta11.tar.bz2
+   1.5.0beta05.tar.xz (LZMA-compressed, recommended)
+   1.5.0beta05.tar.gz
+   1.5.0beta05.tar.bz2
 
 Source files with CRLF line endings (for Windows), without the
 "configure" script
 
-   lp141b11.zip
-   lp141b11.7z
+   lp150b05.zip
+   lp150b05.7z
 
 Other information:
 
-   1.4.1beta11-README.txt
-   1.4.1beta11-LICENSE.txt
+   1.5.0beta05-README.txt
+   1.5.0beta05-LICENSE.txt
 
-Changes since the last public release (1.4.0):
+Changes since the last public release (1.4.1):
 
-version 1.4.1beta01 [January 10, 2010]
-  Updated CMakeLists.txt for consistent indentation and to avoid an
-    unclosed if-statement warning (Philip Lowman).
-  Revised Makefile.am and Makefile.in to remove references to Y2KINFO,
-    KNOWNBUG, and libpng.la (Robert Schwebel).
-  Revised the makefiles to install the same files and symbolic
-    links as configure, except for libpng.la and libpng14.la.
-  Make png_set|get_compression_buffer_size() available even when
-    PNG_WRITE_SUPPORTED is not enabled.
-  Revised Makefile.am and Makefile.in to simplify their maintenance.
-  Revised scripts/makefile.linux to install a link to libpng14.so.14.1
+version 1.5.0beta01 [February 7, 2010]
+  Moved declaration of png_struct into private pngstruct.h and png_info
+    into pnginfo.h
 
-version 1.4.1beta02 [January 9, 2010]
-  Revised the rest of the makefiles to install a link to libpng14.so.14.1
-
-version 1.4.1beta03 [January 10, 2010]
-  Removed png_set_premultiply_alpha() from scripts/*.def
-
-version 1.4.1rc01 [January 16, 2010]
-  No changes.
-
-version 1.4.1beta04 [January 23, 2010]
-  Revised png_decompress_chunk() to improve speed and memory usage when
-    decoding large chunks.
-  Added png_set|get_chunk_malloc_max() functions.
-
-version 1.4.1beta05 [January 26, 2010]
-  Relocated "int k" declaration in pngtest.c to minimize its scope.
-
-version 1.4.1beta06 [January 28, 2010]
-  Revised png_decompress_chunk() to use a two-pass method suggested by
-    John Bowler.
-
-version 1.4.1beta07 [February 6, 2010]
-  Folded some long lines in the source files.
-  Added defineable PNG_USER_CHUNK_CACHE_MAX and PNG_USER_CHUNK_MALLOC_MAX
-  Eliminated use of png_ptr->irowbytes and reused the slot in png_ptr as
-    png_ptr->png_user_chunk_malloc_max.
-  Revised png_push_save_buffer() to do fewer but larger png_malloc() calls.
-
-version 1.4.1beta08 [February 6, 2010]
-  Minor cleanup and updating of dates and copyright year.
-
-version 1.4.1beta09 [February 7, 2010]
+version 1.5.0beta02 [February 7, 2010]
   Reverted to original png_push_save_buffer() code.
 
-version 1.4.1beta10 [February 9, 2010]
-  Return allocated "old_buffer" in png_push_save_buffer() before calling
-    png_error(), to avoid a potential memory leak.
+version 1.5.0beta03 [February 8, 2010]
+  Return allocated "old_buffer" in png_push_save_buffer() before
+    calling png_error().
+  Updated configure script to use SO number 15.
 
-version 1.4.1beta11 [February 12, 2010]
+version 1.5.0beta04 [February 9, 2010]
+  Removed malformed "incomplete struct declaration" of png_info from png.h
+
+version 1.5.0beta05 [February 13, 2010]
+  Removed PNG_DEPSTRUCT markup in pngstruct.h and pnginfo.h, and undid the
+    linewrapping that it entailed.
+  Revised comments in pngstruct.h and pnginfo.h and added pointers to
+    the libpng license.
+  Changed PNG_INTERNAL to PNG_EXPOSE_INTERNAL_STRUCTURES
   Removed the cbuilder5 project, which has not been updated to 1.4.0.
-  Removed unused "buffer_size" variable from png_decompress_chunk().
-  Relocated misplaced closing curley bracket in png_decompress_chunk().
-  Reverted to original png_decompress_chunk() plus counting pass.
-
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
diff --git a/CHANGES b/CHANGES
index bd6006d..6e7f8a4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2412,8 +2412,8 @@
   Revised scripts/makefile.netbsd, makefile.openbsd, and makefile.sco
     to put png.h and pngconf.h in $prefix/include, like the other scripts,
     instead of in $prefix/include/libpng.  Also revised makefile.sco
-    to put them in $prefix/include/libpng14 instead of in
-    $prefix/include/libpng/libpng14.
+    to put them in $prefix/include/libpng15 instead of in
+    $prefix/include/libpng/libpng15.
 
 version 1.4.0beta108 [December 11, 2009]
   Removed leftover "-DPNG_CONFIGURE_LIBPNG" from contrib/pngminim/*/makefile
@@ -2502,20 +2502,29 @@
 version 1.4.1beta08 [February 6, 2010]
   Minor cleanup and updating of dates and copyright year.
 
-version 1.4.1beta09 [February 7, 2010]
+
+version 1.5.0beta01 [February 7, 2010]
+  Moved declaration of png_struct into private pngstruct.h and png_info
+    into pnginfo.h
+
+version 1.4.1beta09 and 1.5.0beta02 [February 7, 2010]
   Reverted to original png_push_save_buffer() code.
 
-version 1.4.1beta10 [February 9, 2010]
-  Return allocated "old_buffer" in png_push_save_buffer() before calling
-    png_error(), to avoid a potential memory leak.
+version 1.4.1beta10 and 1.5.0beta03 [February 8, 2010]
+  Return allocated "old_buffer" in png_push_save_buffer() before
+    calling png_error(), to avoid a potential memory leak.
+  Updated configure script to use SO number 15.
 
-version 1.4.1beta11 [February 12, 2010]
-  Relocated misplaced closing curley bracket in png_decompress_chunk().
-  Removed unused "buffer_size" variable from png_decompress_chunk().
+version 1.5.0beta04 [February 9, 2010]
+  Removed malformed "incomplete struct declaration" of png_info from png.h
+
+version 1.5.0beta05 [February 13, 2010]
+  Removed PNG_DEPSTRUCT markup in pngstruct.h and pnginfo.h, and undid the
+    linewrapping that it entailed.
+  Revised comments in pngstruct.h and pnginfo.h and added pointers to
+    the libpng license.
+  Changed PNG_INTERNAL to PNG_EXPOSE_INTERNAL_STRUCTURES
   Removed the cbuilder5 project, which has not been updated to 1.4.0.
-  Reverted to original png_decompress_chunk() plus counting pass.
-
-version 1.4.1rc02 [February 12, 2010]
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
diff --git a/pngrutil.c b/pngrutil.c
index 1d1e6d9..b5c94ab 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -14,6 +14,7 @@
  * libpng itself during the course of reading an image.
  */
 
+#define PNG_EXPOSE_INTERNAL_STRUCTURES
 #define PNG_NO_PEDANTIC_WARNINGS
 #include "png.h"
 #ifdef PNG_READ_SUPPORTED