Imported from libpng-1.0.8rc1.tar
diff --git a/ANNOUNCE b/ANNOUNCE
index 0bba759..f8fe297 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,5 +1,5 @@
 
-Libpng 1.0.8beta4 - July 14, 2000
+Libpng 1.0.8rc1 - July 17, 2000
 
 This is a public release of libpng, intended for use in production codes.
 
@@ -18,6 +18,7 @@
   Added the files pngbar.png and pngbar.jpg to the distribution.
   Added cygwin subdirectory, makefile.cygwin, and cygwin support in pngconf.h
   Added PNG_NO_ZALLOC_ZERO macro (makes png_zalloc skip zeroing memory)
+  Revised png_debug() macros and statements to eliminate compiler warnings.
 
 Send comments/corrections/commendations to
 png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
diff --git a/CHANGES b/CHANGES
index 15cd3cc..307dc38 100644
--- a/CHANGES
+++ b/CHANGES
@@ -797,7 +797,7 @@
   Fixed "DJBPP" typo in pnggccrd.c introduced in beta18.
 version 1.0.7 [July 1, 2000]
   Revised the definition of "trans_values" in libpng.3/libpng.txt
-version 1.0.8beta4 [July 14, 2000]
+version 1.0.8rc1 [July 17, 2000]
 version 1.0.8beta1 [July 8, 2000]
   Added png_free(png_ptr, key) two places in pngpread.c to stop memory leaks.
   Changed PNG_NO_STDIO to PNG_NO_CONSOLE_IO, several places in pngrutil.c and
@@ -818,6 +818,8 @@
   Added the files pngbar.png and pngbar.jpg to the distribution.
   Added cygwin subdirectory, makefile.cygwin, and cygwin support in pngconf.h
   Added PNG_NO_ZALLOC_ZERO macro (makes png_zalloc skip zeroing memory)
+version 1.0.8rc1 [July 17, 2000]
+  Revised png_debug() macros and statements to eliminate compiler warnings.
 
 Send comments/corrections/commendations to
 png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
diff --git a/INSTALL b/INSTALL
index 26a3b63..b382e8d 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,5 +1,5 @@
 
-Installing libpng version 1.0.8beta4 - July 14, 2000
+Installing libpng version 1.0.8rc1 - July 17, 2000
 
 Before installing libpng, you must first install zlib.  zlib
 can usually be found wherever you got libpng.  zlib can be
@@ -10,7 +10,7 @@
 version of zlib that's installed.
 
 You can rename the directories that you downloaded (they
-might be called "libpng-1.0.8beta4" or "lpng107" and "zlib-1.1.3"
+might be called "libpng-1.0.8rc1" or "lpng107" and "zlib-1.1.3"
 or "zlib113") so that you have directories called "zlib" and "libpng".
 
 Your directory structure should look like this:
@@ -57,8 +57,8 @@
 include
 
  makefile.std      =>  Generic UNIX makefile (cc, creates static libpng.a)
- makefile.linux    =>  Linux/ELF makefile (gcc, creates libpng.so.2.1.0.8beta4)
- makefile.gcmmx    =>  Linux/ELF makefile (gcc, creates libpng.so.2.1.0.8beta4,
+ makefile.linux    =>  Linux/ELF makefile (gcc, creates libpng.so.2.1.0.8rc1)
+ makefile.gcmmx    =>  Linux/ELF makefile (gcc, creates libpng.so.2.1.0.8rc1,
                        uses assembler code tuned for Intel MMX platform)
  makefile.gcc      =>  Generic makefile (gcc, creates static libpng.a)
  makefile.knr      =>  Archaic UNIX Makefile that converts files with
@@ -70,9 +70,9 @@
  makefile.intel    =>  Intel C/C++ version 4.0 and later
  libpng.icc        =>  Project file for IBM VisualAge/C++ version 4.0 or later
  makefile.sgi      =>  Silicon Graphics IRIX makefile (cc, creates static lib)
- makefile.sggcc    =>  Silicon Graphics (gcc, creates libpng.so.2.1.0.8beta4)
+ makefile.sggcc    =>  Silicon Graphics (gcc, creates libpng.so.2.1.0.8rc1)
  makefile.sunos    =>  Sun makefile
- makefile.solaris  =>  Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.8beta4)
+ makefile.solaris  =>  Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.8rc1)
  makefile.sco      =>  For SCO OSr5  ELF and Unixware 7 with Native cc
  makefile.mips     =>  MIPS makefile
  makefile.acorn    =>  Acorn makefile
diff --git a/LICENSE b/LICENSE
index 2cbd383..573b80a 100644
--- a/LICENSE
+++ b/LICENSE
@@ -4,7 +4,7 @@
 If you modify libpng you may insert additional notices immediately following
 this sentence.
 
-libpng version 1.0.8beta4, July 14, 2000 is Copyright (c) 2000 Glenn Randers-Pehrson
+libpng version 1.0.8rc1, July 17, 2000 is Copyright (c) 2000 Glenn Randers-Pehrson
 Distributed according to the same disclaimer and license as libpng-1.0.6
 with the following individuals added to the list of Contributing Authors
 
@@ -94,4 +94,4 @@
 
 Glenn Randers-Pehrson
 randeg@alum.rpi.edu
-July 14, 2000
+July 17, 2000
diff --git a/README b/README
index bff2733..dc75e15 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-README for libpng 1.0.8beta4 - July 14, 2000 (shared library 2.1)
+README for libpng 1.0.8rc1 - July 17, 2000 (shared library 2.1)
 See the note about version numbers near the top of png.h
 
 See INSTALL for instructions on how to install libpng.
@@ -177,9 +177,9 @@
        descrip.mms      =>  VMS makefile for MMS or MMK
        makefile.std     =>  Generic UNIX makefile (cc, creates static libpng.a)
        makefile.linux   =>  Linux/ELF makefile
-                            (gcc, creates libpng.so.2.1.0.8beta4)
+                            (gcc, creates libpng.so.2.1.0.8rc1)
        makefile.gcmmx   =>  Linux/ELF makefile (gcc, creates
-                            libpng.so.2.1.0.8beta4, uses assembler code
+                            libpng.so.2.1.0.8rc1, uses assembler code
                             tuned for Intel MMX platform)
        makefile.gcc     =>  Generic makefile (gcc, creates static libpng.a)
        makefile.knr     =>  Archaic UNIX Makefile that converts files with
@@ -191,10 +191,10 @@
        makefile.intel   =>  Intel C/C++ version 4.0 and later
        libpng.icc       =>  Project file, IBM VisualAge/C++ 4.0 or later
        makefile.sgi     =>  Silicon Graphics IRIX (cc, creates static lib)
-       makefile.sggcc   =>  Silicon Graphics (gcc, creates libpng.so.2.1.0.8beta4)
+       makefile.sggcc   =>  Silicon Graphics (gcc, creates libpng.so.2.1.0.8rc1)
        makefile.sunos   =>  Sun makefile
        makefile.solaris =>  Solaris 2.X makefile
-                            (gcc, creates libpng.so.2.1.0.8beta4)
+                            (gcc, creates libpng.so.2.1.0.8rc1)
        makefile.sco     =>  For SCO OSr5  ELF and Unixware 7 with Native cc
        makefile.mips    =>  MIPS makefile
        makefile.acorn   =>  Acorn makefile
diff --git a/Y2KINFO b/Y2KINFO
index c301bcb..8d8eb24 100644
--- a/Y2KINFO
+++ b/Y2KINFO
@@ -1,13 +1,13 @@
    Y2K compliance in libpng:
    =========================
 
-      July 14, 2000
+      July 17, 2000
 
       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.0.8beta4 are Y2K compliant.  It is my belief that earlier
+      upward through 1.0.8rc1 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
diff --git a/configure b/configure
index d5720bf..7e3f233 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 echo "
-  There is no \"configure\" script for Libpng-1.0.8beta4.  Instead, please
+  There is no \"configure\" script for Libpng-1.0.8rc1.  Instead, please
   copy the appropriate makefile for your system from the \"scripts\"
   directory.  Read the INSTALL file for more details.
 "
diff --git a/example.c b/example.c
index 88726df..aa920fe 100644
--- a/example.c
+++ b/example.c
@@ -755,11 +755,13 @@
       allocated it with malloc() instead of png_malloc(), use free() instead
       of png_free(). */
    png_free(png_ptr, palette);
+   palette=NULL;
 
    /* Similarly, if you png_malloced any data that you passed in with
       png_set_something(), such as a hist or trans array, free it here,
       when you can be sure that libpng is through with it. */
    png_free(png_ptr, trans);
+   trans=NULL;
 
    /* clean up after the write, and free any memory allocated */
    png_destroy_write_struct(&png_ptr, &info_ptr);
diff --git a/libpng.3 b/libpng.3
index aef2110..184425f 100644
--- a/libpng.3
+++ b/libpng.3
@@ -1,6 +1,6 @@
-.TH LIBPNG 3 "July 14, 2000"
+.TH LIBPNG 3 "July 17, 2000"
 .SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.0.8beta4
+libpng \- Portable Network Graphics (PNG) Reference Library 1.0.8rc1
 .SH SYNOPSIS
 \fI\fB
 
@@ -747,7 +747,7 @@
 .SH LIBPNG.TXT
 libpng.txt - A description on how to use and modify libpng
 
- libpng version 1.0.8beta4 - July 14, 2000
+ libpng version 1.0.8rc1 - July 17, 2000
  Updated and distributed by Glenn Randers-Pehrson
  <randeg@alum.rpi.edu>
  Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@@ -3381,13 +3381,13 @@
 
 .SH VII. Y2K Compliance in libpng
 
-July 14, 2000
+July 17, 2000
 
 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.0.8beta4 are Y2K compliant.  It is my belief that earlier
+upward through 1.0.8rc1 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
@@ -3528,7 +3528,7 @@
 
 Thanks to Frank J. T. Wojcik for helping with the documentation.
 
-Libpng version 1.0.8beta4 - July 14, 2000:
+Libpng version 1.0.8rc1 - July 17, 2000:
 Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
 Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).
 
@@ -3541,7 +3541,7 @@
 If you modify libpng you may insert additional notices immediately following
 this sentence.
 
-libpng version 1.0.8beta4, July 14, 2000 is
+libpng version 1.0.8rc1, July 17, 2000 is
 Copyright (c) 2000 Glenn Randers-Pehrson
 Distributed according to the same disclaimer and license as libpng-1.0.6
 with the following individuals added to the list of Contributing Authors
@@ -3632,7 +3632,7 @@
 
 Glenn Randers-Pehrson
 randeg@alum.rpi.edu
-July 14, 2000
+July 17, 2000
 
 .\" end of man page
 
diff --git a/libpng.txt b/libpng.txt
index 14306fe..60dc200 100644
--- a/libpng.txt
+++ b/libpng.txt
@@ -1,6 +1,6 @@
 libpng.txt - A description on how to use and modify libpng
 
- libpng version 1.0.8beta4 - July 14, 2000
+ libpng version 1.0.8rc1 - July 17, 2000
  Updated and distributed by Glenn Randers-Pehrson
  <randeg@alum.rpi.edu>
  Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@@ -2634,13 +2634,13 @@
 
 VII. Y2K Compliance in libpng
 
-July 14, 2000
+July 17, 2000
 
 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.0.8beta4 are Y2K compliant.  It is my belief that earlier
+upward through 1.0.8rc1 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
diff --git a/libpngpf.3 b/libpngpf.3
index a5479d6..4967bc6 100644
--- a/libpngpf.3
+++ b/libpngpf.3
@@ -1,6 +1,6 @@
-.TH LIBPNGPF 3 "July 14, 2000"
+.TH LIBPNGPF 3 "July 17, 2000"
 .SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.0.8beta4
+libpng \- Portable Network Graphics (PNG) Reference Library 1.0.8rc1
 (private functions)
 .SH SYNOPSIS
 \fB#include <png.h>\fP
diff --git a/msvc/README.txt b/msvc/README.txt
index 19f8db6..b6404b3 100644
--- a/msvc/README.txt
+++ b/msvc/README.txt
@@ -1,5 +1,5 @@
 Microsoft Developer Studio Build File, Format Version 6.00 for
-libpng 1.0.8beta4 (July 14, 2000) and zlib
+libpng 1.0.8rc1 (July 17, 2000) and zlib
 
 Copyright (C) 2000 Simon-Pierre Cadieux
 For conditions of distribution and use, see copyright notice in png.h
diff --git a/msvc/png32ms.def b/msvc/png32ms.def
index 5685ec4..5e94e5c 100644
--- a/msvc/png32ms.def
+++ b/msvc/png32ms.def
@@ -6,7 +6,7 @@
 DESCRIPTION "PNG image compression library for Windows"
 
 EXPORTS
-;Version 1.0.8beta4
+;Version 1.0.8rc1
   png_build_grayscale_palette  @1
   png_check_sig        @2
   png_chunk_error      @3
diff --git a/png.5 b/png.5
index 1e8d316..0e5cfc2 100644
--- a/png.5
+++ b/png.5
@@ -1,4 +1,4 @@
-.TH PNG 5 "July 14, 2000"
+.TH PNG 5 "July 17, 2000"
 .SH NAME
 png \- Portable Network Graphics (PNG) format
 .SH DESCRIPTION
diff --git a/png.c b/png.c
index 1d28fa3..325e1d0 100644
--- a/png.c
+++ b/png.c
@@ -1,7 +1,7 @@
 
 /* png.c - location for general purpose libpng functions
  *
- * libpng version 1.0.8beta4 - July 14, 2000
+ * libpng version 1.0.8rc1 - July 17, 2000
  * Copyright (c) 1998, 1999, 2000 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.)
@@ -13,14 +13,14 @@
 #include "png.h"
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_0_8beta4 Your_png_h_is_not_version_1_0_8beta4;
+typedef version_1_0_8rc1 Your_png_h_is_not_version_1_0_8rc1;
 
 /* Version information for C files.  This had better match the version
  * string defined in png.h.  */
 
 #ifdef PNG_USE_GLOBAL_ARRAYS
 /* png_libpng_ver was changed to a function in version 1.0.5c */
-char png_libpng_ver[12] = "1.0.8beta4";
+char png_libpng_ver[12] = "1.0.8rc1";
 
 /* png_sig was changed to a function in version 1.0.5c */
 /* Place to hold the signature string for a PNG file. */
@@ -363,7 +363,10 @@
     {
         int i;
         for (i = 0; i < (int)info_ptr->pcal_nparams; i++)
+        {
           png_free(png_ptr, info_ptr->pcal_params[i]);
+          info_ptr->pcal_params[i]=NULL;
+        }
         png_free(png_ptr, info_ptr->pcal_params);
         info_ptr->pcal_params = NULL;
     }
@@ -493,7 +496,10 @@
     {
        int row;
        for (row = 0; row < (int)info_ptr->height; row++)
+       {
           png_free(png_ptr, info_ptr->row_pointers[row]);
+          info_ptr->row_pointers[row]=NULL;
+       }
        png_free(png_ptr, info_ptr->row_pointers);
        info_ptr->row_pointers=NULL;
     }
@@ -524,6 +530,7 @@
    if (png_ptr->num_chunk_list)
    {
        png_free(png_ptr, png_ptr->chunk_list);
+       png_ptr->chunk_list=NULL;
        png_ptr->num_chunk_list=0;
    }
 #endif
@@ -618,11 +625,11 @@
 png_get_copyright(png_structp png_ptr)
 {
    if (png_ptr != NULL || png_ptr == NULL)  /* silence compiler warning */
-   return ("\n libpng version 1.0.8beta4 - July 14, 2000\n\
+   return ((png_charp) "\n libpng version 1.0.8rc1 - July 17, 2000\n\
    Copyright (c) 1998-2000 Glenn Randers-Pehrson\n\
    Copyright (c) 1996, 1997 Andreas Dilger\n\
    Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n");
-   return ("");
+   return ((png_charp) "");
 }
 
 /* The following return the library version as a short string in the
@@ -636,8 +643,8 @@
 {
    /* Version of *.c files used when building libpng */
    if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
-      return("1.0.8beta4");
-   return("1.0.8beta4");
+      return((png_charp) "1.0.8rc1");
+   return((png_charp) "1.0.8rc1");
 }
 
 png_charp PNGAPI
@@ -645,8 +652,8 @@
 {
    /* Version of *.h files used when building libpng */
    if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
-      return(PNG_LIBPNG_VER_STRING);
-   return(PNG_LIBPNG_VER_STRING);
+      return((png_charp) PNG_LIBPNG_VER_STRING);
+   return((png_charp) PNG_LIBPNG_VER_STRING);
 }
 
 png_charp PNGAPI
@@ -654,8 +661,8 @@
 {
    /* Returns longer string containing both version and date */
    if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
-      return(PNG_HEADER_VERSION_STRING);
-   return(PNG_HEADER_VERSION_STRING);
+      return((png_charp) PNG_HEADER_VERSION_STRING);
+   return((png_charp) PNG_HEADER_VERSION_STRING);
 }
 
 #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
diff --git a/png.h b/png.h
index 38e017b..aeb86ef 100644
--- a/png.h
+++ b/png.h
@@ -1,7 +1,7 @@
 
 /* png.h - header file for PNG reference library
  *
- * libpng version 1.0.8beta4 - July 14, 2000
+ * libpng version 1.0.8rc1 - July 17, 2000
  * Copyright (c) 1998, 1999, 2000 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.)
@@ -9,7 +9,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.0.8beta4 - July 14, 2000: Glenn
+ *  libpng versions 0.97, January 1998, through 1.0.8rc1 - July 17, 2000: Glenn
  *  See also "Contributing Authors", below.
  *
  * Note about libpng version numbers:
@@ -55,7 +55,8 @@
  *    1.0.7beta11-18                10007  2.1.0.7beta11-18 (binary compatible)
  *    1.0.7rc1-2                    10007  2.1.0.7rc1-2 (binary compatible)
  *    1.0.7                         10007  (still compatible)
- *    1.0.7beta1-2                  10008  2.1.0.8beta1-2
+ *    1.0.8beta1-4                  10008  2.1.0.8beta1-4
+ *    1.0.8rc1                      10008  2.1.0.8rc1
  *
  *    Henceforth the source version will match the shared-library major
  *    and minor numbers; the shared-library major version number will be
@@ -82,7 +83,7 @@
  * If you modify libpng you may insert additional notices immediately following
  * this sentence.
  *
- * libpng version 1.0.8beta4, July 14, 2000, is
+ * libpng version 1.0.8rc1, July 17, 2000, is
  * Copyright (c) 2000 Glenn Randers-Pehrson
  * Distributed according to the same disclaimer and license as libpng-1.0.6
  * with the following individuals added to the list of Contributing Authors
@@ -187,13 +188,13 @@
  * Y2K compliance in libpng:
  * =========================
  *
- *    July 14, 2000
+ *    July 17, 2000
  *
  *    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.0.8beta4 are Y2K compliant.  It is my belief that earlier
+ *    upward through 1.0.8rc1 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
@@ -249,7 +250,7 @@
  */
 
 /* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.0.8beta4"
+#define PNG_LIBPNG_VER_STRING "1.0.8rc1"
 
 #define PNG_LIBPNG_VER_SONUM   2
 
@@ -259,7 +260,7 @@
 #define PNG_LIBPNG_VER_RELEASE 8
 /* This should match the numeric part of the final component of
  * PNG_LIBPNG_VER_STRING, omitting any leading zero: */
-#define PNG_LIBPNG_VER_BUILD   4
+#define PNG_LIBPNG_VER_BUILD   1
 
 /* Careful here.  At one time, Guy wanted to use 082, but that would be octal.
  * We must not include leading zeros.
@@ -1147,9 +1148,9 @@
 };
 
 /* This prevents a compiler error in png_get_copyright() in png.c if png.c
-and png.h are both at * version 1.0.8beta4
+and png.h are both at * version 1.0.8rc1
  */
-typedef png_structp version_1_0_8beta4;
+typedef png_structp version_1_0_8rc1;
 
 typedef png_struct FAR * FAR * png_structpp;
 
@@ -2131,25 +2132,35 @@
 #if (PNG_DEBUG > 0)
 #if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
 #include <crtdbg.h>
-#define png_debug(l,m) if (PNG_DEBUG > l) _RPT0(_CRT_WARN,m)
-#define png_debug1(l,m,p1) if (PNG_DEBUG > l) _RPT1(_CRT_WARN,m,p1)
-#define png_debug2(l,m,p1,p2) if (PNG_DEBUG > l) _RPT2(_CRT_WARN,m,p1,p2)
+#if (PNG_DEBUG > 1)
+#define png_debug(l,m)  _RPT0(_CRT_WARN,m)
+#define png_debug1(l,m,p1)  _RPT1(_CRT_WARN,m,p1)
+#define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m,p1,p2)
+#endif
 #else /* PNG_DEBUG_FILE || !_MSC_VER */
 #ifndef PNG_DEBUG_FILE
 #define PNG_DEBUG_FILE stderr
 #endif /* PNG_DEBUG_FILE */
+#if (PNG_DEBUG > 1)
 #define png_debug(l,m) \
-   if (PNG_DEBUG > l)  \
-     fprintf(PNG_DEBUG_FILE,"%s"m,(l==1 ? "\t" : \
-       (l==2 ? "\t\t":(l>2 ? "\t\t\t":""))))
+{ \
+     int num_tabs=l; \
+     fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
+       (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
+}
 #define png_debug1(l,m,p1) \
-   if (PNG_DEBUG > l) \
-     fprintf(PNG_DEBUG_FILE,"%s"m,(l==1 ? "\t" : \
-       (l==2 ? "\t\t":(l>2 ? "\t\t\t":""))),p1)
+{ \
+     int num_tabs=l; \
+     fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
+       (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
+}
 #define png_debug2(l,m,p1,p2) \
-   if (PNG_DEBUG > l) \
-     fprintf(PNG_DEBUG_FILE,"%s"m,(l==1 ? "\t" : \
-       (l==2 ? "\t\t":(l>2 ? "\t\t\t":""))),p1,p2)
+{ \
+     int num_tabs=l; \
+     fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
+       (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
+}
+#endif /* (PNG_DEBUG > 1) */
 #endif /* _MSC_VER */
 #endif /* (PNG_DEBUG > 0) */
 #endif /* PNG_DEBUG */
@@ -2171,7 +2182,7 @@
 extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr));
 
 #define PNG_HEADER_VERSION_STRING \
-   " libpng version 1.0.8beta4 - July 14, 2000 (header)\n"
+   " libpng version 1.0.8rc1 - July 17, 2000 (header)\n"
 
 #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
 /* With these routines we avoid an integer divide, which will be slower on
diff --git a/pngasmrd.h b/pngasmrd.h
index 6eda7b1..3e08d6c 100644
--- a/pngasmrd.h
+++ b/pngasmrd.h
@@ -1,6 +1,6 @@
 /* pngasmrd.h - assembler version of utilities to read a PNG file
  *
- * libpng 1.0.8beta4 - July 14, 2000
+ * libpng 1.0.8rc1 - July 17, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1999, 2000 Glenn Randers-Pehrson
  *
diff --git a/pngconf.h b/pngconf.h
index 22866ef..0f83e28 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -1,6 +1,6 @@
 /* pngconf.h - machine configurable file for libpng
  *
- * libpng 1.0.8beta4 - July 14, 2000
+ * libpng 1.0.8rc1 - July 17, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngerror.c b/pngerror.c
index 29c80c7..cf79308 100644
--- a/pngerror.c
+++ b/pngerror.c
@@ -1,7 +1,7 @@
 
 /* pngerror.c - stub functions for i/o and memory allocation
  *
- * libpng 1.0.8beta4 - July 14, 2000
+ * libpng 1.0.8rc1 - July 17, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pnggccrd.c b/pnggccrd.c
index 7402ca5..24115aa 100644
--- a/pnggccrd.c
+++ b/pnggccrd.c
@@ -6,7 +6,7 @@
  *     and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm
  *     for Intel's performance analysis of the MMX vs. non-MMX code.
  *
- * libpng version 1.0.8beta4 - July 14, 2000
+ * libpng version 1.0.8rc1 - July 17, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
  * Copyright (c) 1998, Intel Corporation
diff --git a/pngget.c b/pngget.c
index e6375bf..ef63066 100644
--- a/pngget.c
+++ b/pngget.c
@@ -1,7 +1,7 @@
 
 /* pngget.c - retrieval of values from info struct
  *
- * libpng 1.0.8beta4 - July 14, 2000
+ * libpng 1.0.8rc1 - July 17, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngmem.c b/pngmem.c
index 9a5ab26..12126bc 100644
--- a/pngmem.c
+++ b/pngmem.c
@@ -1,7 +1,7 @@
 
 /* pngmem.c - stub functions for memory allocation
  *
- * libpng 1.0.8beta4 - July 14, 2000
+ * libpng 1.0.8rc1 - July 17, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngpread.c b/pngpread.c
index 13fd413..e621cc8 100644
--- a/pngpread.c
+++ b/pngpread.c
@@ -1,7 +1,7 @@
 
 /* pngpread.c - read a png file in push mode
  *
- * libpng 1.0.8beta4 - July 14, 2000
+ * libpng 1.0.8rc1 - July 17, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngread.c b/pngread.c
index fea208c..ac65208 100644
--- a/pngread.c
+++ b/pngread.c
@@ -1,7 +1,7 @@
 
 /* pngread.c - read a PNG file
  *
- * libpng 1.0.8beta4 - July 14, 2000
+ * libpng 1.0.8rc1 - July 17, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -62,6 +62,7 @@
 #endif
    {
       png_free(png_ptr, png_ptr->zbuf);
+      png_ptr->zbuf=NULL;
       png_destroy_struct(png_ptr);
       return (png_structp)NULL;
    }
@@ -315,7 +316,7 @@
       png_reset_crc(png_ptr);
       png_crc_read(png_ptr, png_ptr->chunk_name, 4);
 
-      png_debug2(0, "Reading %s chunk, length=%d.\n", png_ptr->chunk_name,
+      png_debug2(0, "Reading %s chunk, length=%lu.\n", png_ptr->chunk_name,
          length);
 
       /* This should be a binary subdivision search or a hash for
@@ -465,7 +466,7 @@
    const int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
 #endif
    int ret;
-   png_debug2(1, "in png_read_row (row %d, pass %d)\n",
+   png_debug2(1, "in png_read_row (row %lu, pass %d)\n",
       png_ptr->row_number, png_ptr->pass);
    /* save jump buffer and error functions */
    if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
@@ -697,7 +698,7 @@
  * not called png_set_interlace_handling(), the display_row buffer will
  * be ignored, so pass NULL to it.
  *
- * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.8beta4
+ * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.8rc1
  */
 
 void PNGAPI
@@ -746,7 +747,7 @@
  * only call this function once.  If you desire to have an image for
  * each pass of a interlaced image, use png_read_rows() instead.
  *
- * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.8beta4
+ * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.8rc1
  */
 void PNGAPI
 png_read_image(png_structp png_ptr, png_bytepp image)
diff --git a/pngrio.c b/pngrio.c
index 82c0c45..8e9a6b3 100644
--- a/pngrio.c
+++ b/pngrio.c
@@ -1,7 +1,7 @@
 
 /* pngrio.c - functions for data input
  *
- * libpng 1.0.8beta4 - July 14, 2000
+ * libpng 1.0.8rc1 - July 17, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngrtran.c b/pngrtran.c
index 3e53fa8..d84c6a2 100644
--- a/pngrtran.c
+++ b/pngrtran.c
@@ -1,7 +1,7 @@
 
 /* pngrtran.c - transforms the data in a row for PNG readers
  *
- * libpng 1.0.8beta4 - July 14, 2000
+ * libpng 1.0.8rc1 - July 17, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngrutil.c b/pngrutil.c
index 45e1755..2be3c87 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -1,7 +1,7 @@
 
 /* pngrutil.c - utilities to read a PNG file
  *
- * libpng 1.0.8beta4 - July 14, 2000
+ * libpng 1.0.8rc1 - July 17, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -388,7 +388,7 @@
       (png_uint_32)png_ptr->pixel_depth + 7) >> 3);
    png_debug1(3,"bit_depth = %d\n", png_ptr->bit_depth);
    png_debug1(3,"channels = %d\n", png_ptr->channels);
-   png_debug1(3,"rowbytes = %d\n", png_ptr->rowbytes);
+   png_debug1(3,"rowbytes = %lu\n", png_ptr->rowbytes);
    png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth,
       color_type, interlace_type, compression_type, filter_type);
 }
@@ -1541,7 +1541,7 @@
       return;
    }
 
-   png_debug1(2, "Allocating and reading pCAL chunk data (%d bytes)\n",
+   png_debug1(2, "Allocating and reading pCAL chunk data (%lu bytes)\n",
       length + 1);
    purpose = (png_charp)png_malloc(png_ptr, length + 1);
    slength = (png_size_t)length;
@@ -1661,7 +1661,7 @@
       return;
    }
 
-   png_debug1(2, "Allocating and reading sCAL chunk data (%d bytes)\n",
+   png_debug1(2, "Allocating and reading sCAL chunk data (%lu bytes)\n",
       length + 1);
    buffer = (png_charp)png_malloc(png_ptr, length + 1);
    slength = (png_size_t)length;
@@ -2576,7 +2576,7 @@
    png_bytep prev_row, int filter)
 {
    png_debug(1, "in png_read_filter_row\n");
-   png_debug2(2,"row = %d, filter = %d\n", png_ptr->row_number, filter);
+   png_debug2(2,"row = %lu, filter = %d\n", png_ptr->row_number, filter);
    switch (filter)
    {
       case PNG_FILTER_VALUE_NONE:
@@ -2990,12 +2990,12 @@
 
    png_memset_check(png_ptr, png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
 
-   png_debug1(3, "width = %d,\n", png_ptr->width);
-   png_debug1(3, "height = %d,\n", png_ptr->height);
-   png_debug1(3, "iwidth = %d,\n", png_ptr->iwidth);
-   png_debug1(3, "num_rows = %d\n", png_ptr->num_rows);
-   png_debug1(3, "rowbytes = %d,\n", png_ptr->rowbytes);
-   png_debug1(3, "irowbytes = %d,\n", png_ptr->irowbytes);
+   png_debug1(3, "width = %lu,\n", png_ptr->width);
+   png_debug1(3, "height = %lu,\n", png_ptr->height);
+   png_debug1(3, "iwidth = %lu,\n", png_ptr->iwidth);
+   png_debug1(3, "num_rows = %lu\n", png_ptr->num_rows);
+   png_debug1(3, "rowbytes = %lu,\n", png_ptr->rowbytes);
+   png_debug1(3, "irowbytes = %lu,\n", png_ptr->irowbytes);
 
    png_ptr->flags |= PNG_FLAG_ROW_INIT;
 }
diff --git a/pngset.c b/pngset.c
index 72d5227..eb6fb9e 100644
--- a/pngset.c
+++ b/pngset.c
@@ -1,7 +1,7 @@
 
 /* pngset.c - storage of image information into info struct
  *
- * libpng 1.0.8beta4 - July 14, 2000
+ * libpng 1.0.8rc1 - July 17, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -212,7 +212,7 @@
       return;
 
    length = png_strlen(purpose) + 1;
-   png_debug1(3, "allocating purpose for info (%d bytes)\n", length);
+   png_debug1(3, "allocating purpose for info (%lu bytes)\n", length);
    info_ptr->pcal_purpose = (png_charp)png_malloc(png_ptr, length);
    png_memcpy(info_ptr->pcal_purpose, purpose, (png_size_t)length);
 
@@ -223,7 +223,7 @@
    info_ptr->pcal_nparams = (png_byte)nparams;
 
    length = png_strlen(units) + 1;
-   png_debug1(3, "allocating units for info (%d bytes)\n", length);
+   png_debug1(3, "allocating units for info (%lu bytes)\n", length);
    info_ptr->pcal_units = (png_charp)png_malloc(png_ptr, length);
    png_memcpy(info_ptr->pcal_units, units, (png_size_t)length);
 
@@ -234,7 +234,7 @@
    for (i = 0; i < nparams; i++)
    {
       length = png_strlen(params[i]) + 1;
-      png_debug2(3, "allocating parameter %d for info (%d bytes)\n", i, length);
+      png_debug2(3, "allocating parameter %d for info (%lu bytes)\n", i, length);
       info_ptr->pcal_params[i] = (png_charp)png_malloc(png_ptr, length);
       png_memcpy(info_ptr->pcal_params[i], params[i], (png_size_t)length);
    }
@@ -556,7 +556,7 @@
       textp->key = (png_charp)png_malloc(png_ptr,
          (png_uint_32)(key_len + text_length + lang_len + lang_key_len + 4));
       png_debug2(2, "Allocated %d bytes at %x in png_set_text\n",
-         key_len + lang_len + lang_key_len + text_length + 4, textp->key);
+         key_len + lang_len + lang_key_len + text_length + 4, (int)textp->key);
 
       png_memcpy(textp->key, text_ptr[i].key,
          (png_size_t)(key_len));
@@ -659,6 +659,7 @@
     png_memcpy(np, info_ptr->splt_palettes,
            info_ptr->splt_palettes_num * sizeof(png_sPLT_t));
     png_free(png_ptr, info_ptr->splt_palettes);
+    info_ptr->splt_palettes=NULL;
 
     for (i = 0; i < nentries; i++)
     {
@@ -703,6 +704,7 @@
     png_memcpy(np, info_ptr->unknown_chunks,
            info_ptr->unknown_chunks_num * sizeof(png_unknown_chunk));
     png_free(png_ptr, info_ptr->unknown_chunks);
+    info_ptr->unknown_chunks=NULL;
 
     for (i = 0; i < num_unknowns; i++)
     {
@@ -739,7 +741,7 @@
 void PNGAPI
 png_permit_empty_plte (png_structp png_ptr, int empty_plte_permitted)
 {
-   png_debug1(1, "in png_permit_empty_plte\n", "");
+   png_debug(1, "in png_permit_empty_plte\n");
    if (png_ptr == NULL)
       return;
    png_ptr->empty_plte_permitted=(png_byte)empty_plte_permitted;
@@ -774,6 +776,7 @@
     {
        png_memcpy(new_list, png_ptr->chunk_list, 5*old_num_chunks);
        png_free(png_ptr, png_ptr->chunk_list);
+       png_ptr->chunk_list=NULL;
     }
     png_memcpy(new_list+5*old_num_chunks, chunk_list, 5*num_chunks);
     for (p=new_list+5*old_num_chunks+4, i=0; i<num_chunks; i++, p+=5)
diff --git a/pngtest.c b/pngtest.c
index 2694094..f08bbb4 100644
--- a/pngtest.c
+++ b/pngtest.c
@@ -1,7 +1,7 @@
 
 /* pngtest.c - a simple test program to test libpng
  *
- * libpng 1.0.8beta4 - July 14, 2000
+ * libpng 1.0.8rc1 - July 17, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -104,6 +104,8 @@
 static int status_dots=1;
 
 void
+read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass);
+void
 read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass)
 {
     if(png_ptr == NULL || row_number > PNG_MAX_UINT) return;
@@ -123,6 +125,8 @@
 }
 
 void
+write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass);
+void
 write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass)
 {
     if(png_ptr == NULL || row_number > PNG_MAX_UINT || pass > 7) return;
@@ -136,6 +140,8 @@
    5 in case illegal filter values are present.) */
 static png_uint_32 filters_used[256];
 void
+count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data);
+void
 count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data)
 {
     if(png_ptr != NULL && row_info != NULL)
@@ -150,6 +156,8 @@
 static png_uint_32 zero_samples;
 
 void
+count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data);
+void
 count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data)
 {
    png_bytep dp = data;
@@ -517,6 +525,7 @@
                the memory that is to be freed. */
             memset(ptr, 0x55, pinfo->size);
             png_free_default(png_ptr, pinfo);
+            pinfo=NULL;
             break;
          }
          if (pinfo->next == NULL)
@@ -534,6 +543,7 @@
       printf("Freeing %x\n",ptr);
 #endif
    png_free_default(png_ptr, ptr);
+   ptr=NULL;
 }
 #endif /* PNG_USER_MEM_SUPPORTED */
 /* END of code to test memory allocation/deallocation */
@@ -878,22 +888,24 @@
 #ifdef PNG_FLOATING_POINT_SUPPORTED
    {
       int unit;
-      double width, height;
+      double scal_width, scal_height;
 
-      if (png_get_sCAL(read_ptr, read_info_ptr, &unit, &width, &height))
+      if (png_get_sCAL(read_ptr, read_info_ptr, &unit, &scal_width,
+         &scal_height))
       {
-         png_set_sCAL(write_ptr, write_info_ptr, unit, width, height);
+         png_set_sCAL(write_ptr, write_info_ptr, unit, scal_width, scal_height);
       }
    }
 #else
 #ifdef PNG_FIXED_POINT_SUPPORTED
    {
       int unit;
-      png_charp width, height;
+      png_charp scal_width, scal_height;
 
-      if (png_get_sCAL_s(read_ptr, read_info_ptr, &unit, &width, &height))
+      if (png_get_sCAL_s(read_ptr, read_info_ptr, &unit, &scal_width,
+          &scal_height))
       {
-         png_set_sCAL_s(write_ptr, write_info_ptr, unit, width, height);
+         png_set_sCAL_s(write_ptr, write_info_ptr, unit, scal_width, scal_height);
       }
    }
 #endif
@@ -1091,6 +1103,7 @@
 
    png_debug(0, "Destroying data structs\n");
    png_free(read_ptr, row_buf);
+   row_buf=NULL;
    png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr);
    png_destroy_info_struct(write_ptr, &write_end_info_ptr);
    png_destroy_write_struct(&write_ptr, &write_info_ptr);
@@ -1435,4 +1448,4 @@
 }
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_0_8beta4 your_png_h_is_not_version_1_0_8beta4;
+typedef version_1_0_8rc1 your_png_h_is_not_version_1_0_8rc1;
diff --git a/pngtrans.c b/pngtrans.c
index fe7c49f..77d69b5 100644
--- a/pngtrans.c
+++ b/pngtrans.c
@@ -1,7 +1,7 @@
 
 /* pngtrans.c - transforms the data in a row (used by both readers and writers)
  *
- * libpng 1.0.8beta4 - July 14, 2000
+ * libpng 1.0.8rc1 - July 17, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngvcrd.c b/pngvcrd.c
index e6d5339..c446bf3 100644
--- a/pngvcrd.c
+++ b/pngvcrd.c
@@ -2,7 +2,7 @@
  *
  * For Intel x86 CPU and Microsoft Visual C++ compiler
  *
- * libpng 1.0.8beta4 - July 14, 2000
+ * libpng 1.0.8rc1 - July 17, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
  * Copyright (c) 1998, Intel Corporation
diff --git a/pngwio.c b/pngwio.c
index 3d5bc52..9e61616 100644
--- a/pngwio.c
+++ b/pngwio.c
@@ -1,7 +1,7 @@
 
 /* pngwio.c - functions for data output
  *
- * libpng 1.0.8beta4 - July 14, 2000
+ * libpng 1.0.8rc1 - July 17, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngwrite.c b/pngwrite.c
index 97d0ff9..7c1150c 100644
--- a/pngwrite.c
+++ b/pngwrite.c
@@ -1,7 +1,7 @@
 
 /* pngwrite.c - general routines to write a PNG file
  *
- * libpng 1.0.8beta4 - July 14, 2000
+ * libpng 1.0.8rc1 - July 17, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -447,6 +447,7 @@
 #endif
    {
       png_free(png_ptr, png_ptr->zbuf);
+      png_ptr->zbuf=NULL;
       png_destroy_struct(png_ptr);
       return ((png_structp)NULL);
    }
@@ -737,11 +738,11 @@
       (png_uint_32)png_ptr->row_info.pixel_depth + 7) >> 3);
 
    png_debug1(3, "row_info->color_type = %d\n", png_ptr->row_info.color_type);
-   png_debug1(3, "row_info->width = %d\n", png_ptr->row_info.width);
+   png_debug1(3, "row_info->width = %lu\n", png_ptr->row_info.width);
    png_debug1(3, "row_info->channels = %d\n", png_ptr->row_info.channels);
    png_debug1(3, "row_info->bit_depth = %d\n", png_ptr->row_info.bit_depth);
    png_debug1(3, "row_info->pixel_depth = %d\n", png_ptr->row_info.pixel_depth);
-   png_debug1(3, "row_info->rowbytes = %d\n", png_ptr->row_info.rowbytes);
+   png_debug1(3, "row_info->rowbytes = %lu\n", png_ptr->row_info.rowbytes);
 
    /* Copy user's row into buffer, leaving room for filter byte. */
    png_memcpy_check(png_ptr, png_ptr->row_buf + 1, row,
@@ -866,6 +867,7 @@
       if (png_ptr->num_chunk_list)
       {
          png_free(png_ptr, png_ptr->chunk_list);
+         png_ptr->chunk_list=NULL;
          png_ptr->num_chunk_list=0;
       }
 #endif
diff --git a/pngwtran.c b/pngwtran.c
index c0efa9e..78999ea 100644
--- a/pngwtran.c
+++ b/pngwtran.c
@@ -1,7 +1,7 @@
 
 /* pngwtran.c - transforms the data in a row for PNG writers
  *
- * libpng 1.0.8beta4 - July 14, 2000
+ * libpng 1.0.8rc1 - July 17, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngwutil.c b/pngwutil.c
index b41cc09..b414474 100644
--- a/pngwutil.c
+++ b/pngwutil.c
@@ -1,7 +1,7 @@
 
 /* pngwutil.c - utilities to write a PNG file
  *
- * libpng 1.0.8beta4 - July 14, 2000
+ * libpng 1.0.8rc1 - July 17, 2000
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -77,7 +77,7 @@
    png_uint_32 length)
 {
    png_byte buf[4];
-   png_debug2(0, "Writing %s chunk (%d bytes)\n", chunk_name, length);
+   png_debug2(0, "Writing %s chunk (%lu bytes)\n", chunk_name, length);
 
    /* write the length */
    png_save_uint_32(buf, length);
@@ -339,9 +339,11 @@
       png_write_chunk_data(png_ptr,(png_bytep)comp->output_ptr[i],
          png_ptr->zbuf_size);
       png_free(png_ptr, comp->output_ptr[i]);
+      comp->output_ptr[i]=NULL;
    }
    if (comp->max_output_ptr != 0)
       png_free(png_ptr, comp->output_ptr);
+      comp->output_ptr=NULL;
    /* write anything left in zbuf */
    if (png_ptr->zstream.avail_out < (png_uint_32)png_ptr->zbuf_size)
       png_write_chunk_data(png_ptr, png_ptr->zbuf,
@@ -1400,7 +1402,7 @@
    for (i = 0; i < nparams; i++)
    {
       params_len[i] = png_strlen(params[i]) + (i == nparams - 1 ? 0 : 1);
-      png_debug2(3, "pCAL parameter %d length = %d\n", i, params_len[i]);
+      png_debug2(3, "pCAL parameter %d length = %lu\n", i, params_len[i]);
       total_len += (png_size_t)params_len[i];
    }
 
diff --git a/scripts/makefile.beos b/scripts/makefile.beos
index 46d4623..ef90394 100644
--- a/scripts/makefile.beos
+++ b/scripts/makefile.beos
@@ -31,7 +31,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.8beta4
+PNGMIN = 1.0.8rc1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 # where make install puts libpng.a, libpng.so*, and png.h
diff --git a/scripts/makefile.dec b/scripts/makefile.dec
index 4d07518..ce18ead 100644
--- a/scripts/makefile.dec
+++ b/scripts/makefile.dec
@@ -14,7 +14,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.8beta4
+PNGMIN = 1.0.8rc1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 CC=cc
diff --git a/scripts/makefile.gcmmx b/scripts/makefile.gcmmx
index 87c8d91..e5b261c 100644
--- a/scripts/makefile.gcmmx
+++ b/scripts/makefile.gcmmx
@@ -36,7 +36,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.8beta4
+PNGMIN = 1.0.8rc1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 INCPATH=$(prefix)/include
diff --git a/scripts/makefile.linux b/scripts/makefile.linux
index ca7a465..adf3af3 100644
--- a/scripts/makefile.linux
+++ b/scripts/makefile.linux
@@ -34,7 +34,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.8beta4
+PNGMIN = 1.0.8rc1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 INCPATH=$(prefix)/include
diff --git a/scripts/makefile.sco b/scripts/makefile.sco
index ec4b18a..f02012b 100644
--- a/scripts/makefile.sco
+++ b/scripts/makefile.sco
@@ -25,7 +25,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.8beta4
+PNGMIN = 1.0.8rc1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 INCPATH=$(prefix)/include
diff --git a/scripts/makefile.sggcc b/scripts/makefile.sggcc
index 6935884..1e0953b 100644
--- a/scripts/makefile.sggcc
+++ b/scripts/makefile.sggcc
@@ -19,8 +19,8 @@
 LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
 LDSHARED=gcc -shared
 
-VER=1.0.8beta4
-LIBS=libpng.so.1.0.8beta4
+VER=1.0.8rc1
+LIBS=libpng.so.1.0.8rc1
 SHAREDLIB=libpng.so
 libdir=$(prefix)/lib32
 
diff --git a/scripts/makefile.solaris b/scripts/makefile.solaris
index 7f47da3..d8a6766 100644
--- a/scripts/makefile.solaris
+++ b/scripts/makefile.solaris
@@ -31,7 +31,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.8beta4
+PNGMIN = 1.0.8rc1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 INCPATH=$(prefix)/include
diff --git a/scripts/pngdef.pas b/scripts/pngdef.pas
index ff073c1..a6a7df1 100644
--- a/scripts/pngdef.pas
+++ b/scripts/pngdef.pas
@@ -5,7 +5,7 @@
 interface
 
 const
-  PNG_LIBPNG_VER_STRING = '1.0.8beta4';
+  PNG_LIBPNG_VER_STRING = '1.0.8rc1';
   PNG_LIBPNG_VER        =  10008;
 
 type