[devel] Avoid deprecated references to png_ptr-io_ptr and png_ptr->error_ptr

    in pngtest.c
diff --git a/ANNOUNCE b/ANNOUNCE
index a4c4871..476f426 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,5 +1,5 @@
 
-Libpng 1.4.0rc07 - January 1, 2010
+Libpng 1.4.0rc08 - January 2, 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,20 +9,20 @@
 Source files with LF line endings (for Unix/Linux) and with a
 "configure" script
 
-   1.4.0rc07.tar.xz (LZMA-compressed, recommended)
-   1.4.0rc07.tar.gz
-   1.4.0rc07.tar.bz2
+   1.4.0rc08.tar.xz (LZMA-compressed, recommended)
+   1.4.0rc08.tar.gz
+   1.4.0rc08.tar.bz2
 
 Source files with CRLF line endings (for Windows), without the
 "configure" script
 
-   lp140r07.zip
-   lp140r07.7z
+   lp140r08.zip
+   lp140r08.7z
 
 Other information:
 
-   1.4.0rc07-README.txt
-   1.4.0rc07-LICENSE.txt
+   1.4.0rc08-README.txt
+   1.4.0rc08-LICENSE.txt
 
 Changes since the last public release (1.2.10):
 
@@ -764,7 +764,11 @@
   Use png_calloc() instead of png_malloc(); png_memset() in pngrutil.c
   Update copyright year to 2010.
 
-version 1.4.0 [January 1, 2010]
+version 1.4.0rc08 [January 2, 2010]
+  Avoid deprecated references to png_ptr-io_ptr and png_ptr->error_ptr
+    in pngtest.c
+
+version 1.4.0 [January 2, 2010]
   No changes.
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
diff --git a/CHANGES b/CHANGES
index 60aad20..45e43de 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2451,7 +2451,11 @@
   Use png_calloc() instead of png_malloc(); png_memset() in pngrutil.c
   Update copyright year to 2010.
 
-version 1.4.0 [January 1, 2010]
+version 1.4.0rc08 [January 2, 2010]
+  Avoid deprecated references to png_ptr-io_ptr and png_ptr->error_ptr
+    in pngtest.c
+
+version 1.4.0 [January 2, 2010]
   No changes.
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
diff --git a/pngtest.c b/pngtest.c
index 75d4327..39f3778 100644
--- a/pngtest.c
+++ b/pngtest.c
@@ -1,7 +1,7 @@
 
 /* pngtest.c - a simple test program to test libpng
  *
- * Last changed in libpng 1.4.0 [January 1, 2010]
+ * Last changed in libpng 1.4.0 [January 2, 2010]
  * Copyright (c) 1998-2010 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.)
@@ -267,12 +267,17 @@
 static void
 pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
 {
-   png_size_t check;
+   png_size_t check = 0;
+   png_voidp io_ptr;
 
    /* fread() returns 0 on error, so it is OK to store this in a png_size_t
     * instead of an int, which is what fread() actually returns.
     */
-   check = fread(data, 1, length, (png_FILE_p)png_ptr->io_ptr);
+   io_ptr = png_get_io_ptr(png_ptr);
+   if (io_ptr != NULL)
+   {
+      check = fread(data, 1, length, (png_FILE_p)io_ptr);
+   }
 
    if (check != length)
    {
@@ -412,9 +417,12 @@
 pngtest_warning(png_structp png_ptr, png_const_charp message)
 {
    PNG_CONST char *name = "UNKNOWN (ERROR!)";
-   if (png_ptr != NULL && png_ptr->error_ptr != NULL)
-      name = png_ptr->error_ptr;
-   fprintf(STDERR, "%s: libpng warning: %s\n", name, message);
+   char *test;
+   test = png_get_error_ptr(png_ptr);
+   if (test == NULL)
+     fprintf(STDERR, "%s: libpng warning: %s\n", name, message);
+   else
+     fprintf(STDERR, "%s: libpng warning: %s\n", test, message);
 }
 
 /* This is the default error handling function.  Note that replacements for
@@ -1619,4 +1627,4 @@
 }
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_4_0rc07 your_png_h_is_not_version_1_4_0rc07;
+typedef version_1_4_0rc08 your_png_h_is_not_version_1_4_0rc08;