Imported from libpng-1.0.2.tar
diff --git a/ANNOUNCE b/ANNOUNCE
index 8448585..2862fd7 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,12 +1,10 @@
 
-Libpng 1.0.1e - June 6, 1998
+Libpng 1.0.2 - June 14, 1998
 
-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.
+This is a public release of libpng, intended for use in production codes.
 
-Changes since the last public release:
+Changes since the previous public release (1.0.1):
 
-version 1.0.1a [April 21, 1998]
   Optimized Paeth calculations by replacing abs() function calls with intrinsics
   plus other loop optimizations. Improves avg decoding speed by about 20%.
   Commented out i386istic "align" compiler flags in makefile.lnx.
@@ -21,20 +19,13 @@
     than num_palette entries -- test was done before num_palette was defined.
   Fixed a png_convert_to_rfc1123() bug that converts day 31 to 0 (Steve Eddins).
   Changed compiler flags in makefile.wat for better optimization (Pawel Mrochen).
-version 1.0.1b [May 2, 1998]
   Relocated png_do_gray_to_rgb() within png_do_read_transformations() (Greg).
   Relocated the png_composite macros from pngrtran.c to png.h (Greg).
   Added makefile.sco (contributed by Mike Hopkirk).
-  Fixed two bugs (missing definitions of "istop") introduced in libpng-1.0.1a.
   Fixed a bug in pngrtran.c that would set channels=5 under some circumstances.
-  More work on the Paeth-filtering, achieving imperceptible speedup (A Kleinert).
-  More work on loop optimization which may help when compiled with C++ compilers.
   Added warnings when people try to use transforms they've defined out.
   Collapsed 4 "i" and "c" loops into single "i" loops in pngrtran and pngwtran.
   Revised paragraph about png_set_expand() in libpng.txt and libpng.3 (Greg)
-version 1.0.1c [May 11, 1998]
-  Fixed a bug in pngrtran.c (introduced in libpng-1.0.1a) where the masks for
-    filler bytes should have been 0xff instead of 0xf.
   Added max_pixel_depth=32 in pngrutil.c when using FILLER with palette images.
   Moved PNG_WRITE_WEIGHTED_FILTER_SUPPORTED and PNG_WRITE_FLUSH_SUPPORTED
     out of the PNG_WRITE_TRANSFORMS_NOT_SUPPORTED block of pngconf.h
@@ -44,9 +35,6 @@
     to make it easier to remove unwanted capabilities via the compile line
   Made some corrections to grammar (which, it's) in documentation (Greg).
   Corrected example.c, use of row_pointers in png_write_image().
-version 1.0.1d [May 24, 1998]
-  Corrected several statements that used side effects illegally in pngrutil.c
-    and pngtrans.c, that were introduced in version 1.0.1b
   Revised png_read_rows() to avoid repeated if-testing for NULL (A Kleinert)
   More corrections to example.c, use of row_pointers in png_write_image()
     and png_read_rows().
@@ -54,7 +42,6 @@
     Bob Dellaca, to make a png32bd.dll with Borland C++ 4.5
   Fixed error in example.c with png_set_text: num_text is 3, not 2 (Guido V.)
   Changed several loops from count-down to count-up, for consistency.
-version 1.0.1e [June 5, 1998]
   Revised libpng.txt and libpng.3 description of png_set_read|write_fn(), and
     added warnings when people try to set png_read_fn and png_write_fn in
     the same structure.
@@ -69,8 +56,12 @@
   Added capability for user-provided malloc_fn() and free_fn() functions,
     and revised pngtest.c to demonstrate their use, replacing the
     PNGTEST_DEBUG_MEM feature.
+  Added makefile.w32, for Microsoft C++ 4.0 and later (Tim Wegner).
+  Fixed two bugs in makefile.bor
 
 Send comments/corrections/commendations to
 png-implement@dworkin.wustl.edu or to randeg@alumni.rpi.edu
 
-Glenn R-P
+Glenn Randers-Pehrson
+libpng maintainer
+PNG Development Group
diff --git a/CHANGES b/CHANGES
index 458cb1f..6243b1a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -334,7 +334,7 @@
     Bob Dellaca, to make a png32bd.dll with Borland C++ 4.5
   Fixed error in example.c with png_set_text: num_text is 3, not 2 (Guido V.)
   Changed several loops from count-down to count-up, for consistency.
-version 1.0.1e [June 6, 1998]
+version 1.0.2 [June 14, 1998]
   Revised libpng.txt and libpng.3 description of png_set_read|write_fn(), and
     added warnings when people try to set png_read_fn and png_write_fn in
     the same structure.
@@ -349,3 +349,5 @@
   Added capability for user-provided malloc_fn() and free_fn() functions,
     and revised pngtest.c to demonstrate their use, replacing the
     PNGTEST_DEBUG_MEM feature.
+  Added makefile.w32, for Microsoft C++ 4.0 and later (Tim Wegner).
+  Fixed two bugs in makefile.bor
diff --git a/INSTALL b/INSTALL
index 3141d2e..74b546b 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,5 +1,5 @@
 
-Installing libpng version 1.0.1e - June 6, 1998
+Installing libpng version 1.0.2 - June 14, 1998
 
 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.1e" or "lpng102" and "zlib-1.1.2"
+might be called "libpng-1.0.2" or "lpng102" and "zlib-1.1.2"
 or "zlib112") so that you have directories called "zlib" and "libpng".
 
 Your directory structure should look like this:
@@ -56,6 +56,7 @@
       build.bat     =>  MS-DOS batch file for Borland compiler
       makefile.dj2  =>  DJGPP 2 makefile
       makefile.msc  =>  Microsoft C makefile
+      makefile.w32  =>  makefile for Microsoft Visual C++ 4.0 and later
       makefile.tc3  =>  Turbo C 3.0 makefile
       makefile.os2  =>  OS/2 Makefile (gcc and emx, requires pngos2.def)
       pngos2.def    =>  OS/2 module definition file used by makefile.os2
diff --git a/KNOWNBUG b/KNOWNBUG
index 0ad6432..2ff29e6 100644
--- a/KNOWNBUG
+++ b/KNOWNBUG
@@ -1,196 +1,19 @@
 
-Known bugs and suggested enhancements in libpng-1.0.1
+Known bugs and suggested enhancements in libpng-1.0.2
 
-1. March 13, 1998 -- BUG -- pngtrans.c:
 
-   row_info->channels should be updated --
-   row_info->color_type should be updated --
-
-   STATUS: I think this is all fixed in libpng-1.0.1a but needs
-   to be tested.
-
-2. March 14, 1998 -- ENHANCEMENT -- Glenn
-
-   We should add the G>GA, G>GX, G>AG, and G>XG transformations
-   in png_do_read_filler()
-
-   STATUS:  Implemented in libpng-1.0.1a
-
-3. March 14, 1998 -- BUG? -- Greg Roelofs
-
-   pngrtran.c:  if-test for channels/FILLER may be incorrect
-
-   STATUS: Under investigation.  Appears to be working correctly
-   in libpng-1.0.1c.
-
-4. March 15, 1998 -- BUG -- Kevin Bracey
-
-   pngwtran.c:
-      line 306: loop should count to row_info->width, not to
-             row_info->width*row_info->channnels
-
-   STATUS: Fixed in libpng-1.0.1a
-
-5. March 15, 1998 -- OPTIMIZATION -- Kevin Bracey
+1. March 15, 1998 -- OPTIMIZATION -- Kevin Bracey
 
    Loops need to be optimized everywhere
 
-   a. Make them count down instead of up -- Kevin Bracey
+   Make them count down instead of up -- Kevin Bracey
    
-      Optimizing compilers don't need this, and making
-      the change would be error prone -- Tom Lane, Glenn R-P
+   Optimizing compilers don't need this, and making
+   the change would be error prone -- Tom Lane, Glenn R-P
 
-      Question whether i-- or --i is better.
+   Question whether i-- or --i is better.
 
-      STATUS: Under investigation.  About 150 loops turned around
-      in libpng-1.0.1d, for testing.  Object files and executables
-      are about 20k smaller in SGI and gcc-compiled codes.  
+   STATUS: Under investigation, postponed until after
+   libpng-1.0.2.  About 160 loops turned around
+   in libpng-1.0.2a, for testing.
 
-   b. Remove products and structure members from loop tests -- Glenn R-P
-
-      Can be accomplished without messing with loop guts.  This
-      was shown to be effective on optimized SGI compiler:
-
-              replace
-                  png_uint_32 i;
-                  for(i=0; i < s->a*s->b; i++)
-              with
-                  png_uint_32 i, istop;
-                  istop = s->a*s->b;
-                  for(i=0; i<istop; i++)
-
-      STATUS: Mostly done in libpng-1.0.1a, done for all important loops.
-              More done in libpng-1.0.1b.
-
-   c. Replace abs() with intrinsic ternary operations in Paeth
-      filtering -- Glenn R-P
-
-      STATUS: Done in libpng-1.0.1a
-      (can be restored to original behavior with #define PNG_USE_ABS)
-
-   d. In pngwutil.c, make separate simple loops to use when filter 
-      heuristic sums aren't needed. -- Glenn R-P
-
-      STATUS: Done in libpng-1.0.1a
-
-6. April 6, 1998 -- BUG -- bug in pngset.c (rowbytes too large) -- Bob Dellaca
-
-   pngset.c has a bug, introduced in version 0.99c, that sets rowbytes
-     too large when writing an image with bit_depth < 8
-
-   STATUS: Fixed in libpng-1.0.1a
-              
-7. April 10, 1998 -- BUG -- pngwutil weighted filtering bugs -- Glenn R-P
-
-   pngwutil.c has some bugs in the experimental weighted filter
-   algorithm (PNG_FILTER_XXX should be PNG_FILTER_VALUE_XXX in
-   several places)
-
-   STATUS: Andreas concurs.  Fixed in libpng-1.0.1a
-
-8. April 10, 1998 -- ENHANCEMENT -- run-time selection of malloc function
-   -- Bob Dellaca
-
-   pngmem.c currently provides a compile-time option to replace
-   png_malloc() and png_free().  It's been requested that these
-   be made possible at run time, via calls to new png_set_malloc_fn()
-   and png_set_free_fn() functions.
-
-   STATUS: Under consideration
-
-9. April 11, 1998 -- BUG -- incorrect truncation of tRNS data in
-   illegal PNG file where tRNS precedes PLTE -- Larry Reeve
-
-   There is a misplaced pngrutil code block that truncates tRNS if it has
-   more than num_palette entries -- test was done before num_palette was
-   defined.  Although the PNG file is illegal, it shouldn't crash apps.
-   There is a simple fix; just moving the test to the point after
-   num_palette has been defined.
-
-   STATUS: Fixed in libpng-1.0.1a
-
-10. April 16, 1998 -- BUG -- incorrect operation of png_convert_to_rfc1123
-   with 31st day of the month -- Steve Eddins
-
-   The "ptime->date % 31" is wrong, should be "ptime->date % 32".
-
-   STATUS: Fixed in libpng-1.0.1a
-
-11. April 21, 1998 -- ENHANCEMENT -- relocation of composite macros
-
-   png_composite() and png_composite_16() relocated to png.h
-
-   STATUS: Done in libpng-1.0.1b
-
-12. April 22, 1998 -- ENHANCEMENT -- makefile.sco
-
-   Mike Hopkirk contributed a makefile for SCO osr5 and sco UW7
-
-   STATUS: Added to libpng-1.0.1b distribution
-
-13: April 30, 1998 -- ENHANCEMENT -- warnings
-
-   When people define out some of the read transformations and then
-   try to use them, the request is silently ignored.  It was suggested
-   that a warning be issued in such cases.
-
-   STATUS: Done in libpng-1.0.1b
-
-14. May 2, 1998 -- BUG -- incorrect mask for filler bytes
-
-   In pngrtran.c, png_do_filler(), the masks for hi_filler and low_filler
-   should be 0xff instead of 0xf
-
-   STATUS: Fixed in libpng-1.0.1c
-
-15. May 3, 1998 -- BUG -- buffer overflow in png_do_read_filler()
-
-   In pngrutil.c, max_pixel_depth needs to be set to 32 when using
-   png_do_read_filler with palette images.
-
-   STATUS: Fixed in libpng-1.0.1c (see also items 1 and 3 above).
-
-16. May 3, 1998 -- BUG -- type definitions wrong on error functions -- Tom Lane
-
-   In png_create_xxx_struct(), the error functions should have typedef
-   png_voidp instead of (void *).  Needs to be corrected in the functions,
-   the prototypes in png.h, the example.c file, and libpng.txt and libpng.3
-
-   
-   STATUS: Fixed in libpng-1.0.1c
-
-17. May 10, 1998 -- DOCUMENTATION -- Greg
-
-   There are a number of incorrect usages of "which" and "it's" in the
-   comments.
-
-   STATUS:
-
-   Fixed in libpng-1.0.1c
-
-18. May 20, 1998 -- BUG -- illegal use of side effects -- Magnus Holmgren
-
-   In libpng-1.0.1b several illegal uses of side effects were
-   introduced while tuning loops in pngrutil.c; also one in pngtrans.c.
-
-   STATUS:
-
-   Fixed in libpng-1.0.1d
-
-19. May 20, 1998 -- ENHANCEMENT --  script for making DLL -- Bob Dellaca
-
-   Bob Dellaca contributed script for making PNG DLL on Borland C++ 4.5
-
-   STATUS:
-
-   Added to distribution in libpng-1.0.1d 
-
-20. May 26, 1998 -- BUG -- png_do_gamma is skipped -- Magnus Holmgren
-
-   When a background color is defined for a truecolor image, but no
-   transparent color is defined, gamma correction is not done.
-   The test in pngrtran should include " && !png_ptr->trans_values"
-
-   STATUS:
-
-   Fixed in libpng-1.0.1e
diff --git a/README b/README
index b913b23..b5ece1d 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-README for libpng 1.0.1e - June 6, 1998 (shared library 2.1)
+README for libpng 1.0.2 - June 14, 1998 (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.
@@ -173,6 +173,7 @@
         build.bat     =>  MS-DOS batch file for Borland compiler
         makefile.dj2  =>  DJGPP 2 makefile
         makefile.msc  =>  Microsoft C makefile
+        makefile.w32  =>  makefile for Microsoft Visual C++ 4.0 and later
         makefile.tc3  =>  Turbo C 3.0 makefile
         makefile.os2  =>  OS/2 Makefile (gcc and emx, requires pngos2.def)
         makefile.wat  =>  Watcom 10a+ Makefile, 32-bit flat memory model
diff --git a/libpng.3 b/libpng.3
index 4e5836e..955a85c 100644
--- a/libpng.3
+++ b/libpng.3
@@ -1,6 +1,6 @@
-.TH LIBPNG 3 "June 6, 1998"
+.TH LIBPNG 3 "June 14, 1998"
 .SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.0.1e - June 6, 1998
+libpng \- Portable Network Graphics (PNG) Reference Library 1.0.2 - June 14, 1998
 .SH SYNOPSIS
 
 #include <png.h>
@@ -414,7 +414,7 @@
 .SH LIBPNG.TXT
 libpng.txt - A description on how to use and modify libpng
 
- libpng version 1.0.1e - June 6, 1998
+ libpng version 1.0.2 - June 14, 1998
  Updated and distributed by Glenn Randers-Pehrson
  <randeg@alumni.rpi.edu>
  Copyright (c) 1998, Glenn Randers-Pehrson
@@ -1417,8 +1417,8 @@
           new_row);
 
     /* where old_row is what was displayed for
-       previous rows.  Note that the first pass
-       (pass == 0, really) will completely cover
+       previously for the row.  Note that the first
+       pass (pass == 0, really) will completely cover
        the old row, so the rows do not have to be
        initialized.  After the first pass (and only
        for interlaced images), you will have to pass
@@ -2413,7 +2413,7 @@
 
 Thanks to Frank J. T. Wojcik for helping with the documentation.
   
-Libpng version 1.0.1e - June 6, 1998:
+Libpng version 1.0.2 - June 14, 1998:
 Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
 Currently maintained by Glenn Randers-Pehrson (randeg@alumni.rpi.edu).
 
diff --git a/libpng.txt b/libpng.txt
index 7fb5a68..eac50e2 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.1e - June 6, 1998
+ libpng version 1.0.2 - June 14, 1998
  Updated and distributed by Glenn Randers-Pehrson
  <randeg@alumni.rpi.edu>
  Copyright (c) 1998, Glenn Randers-Pehrson
@@ -1003,8 +1003,8 @@
           new_row);
 
     /* where old_row is what was displayed for
-       previous rows.  Note that the first pass
-       (pass == 0, really) will completely cover
+       previously for the row.  Note that the first
+       pass (pass == 0, really) will completely cover
        the old row, so the rows do not have to be
        initialized.  After the first pass (and only
        for interlaced images), you will have to pass
diff --git a/libpngpf.3 b/libpngpf.3
index bd0be6b..0b21c3a 100644
--- a/libpngpf.3
+++ b/libpngpf.3
@@ -1,6 +1,6 @@
-.TH LIBPNGPF 3 "June 6, 1998"
+.TH LIBPNGPF 3 "June 14, 1998"
 .SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.0.1e - June 6, 1998
+libpng \- Portable Network Graphics (PNG) Reference Library 1.0.2 - June 14, 1998
 (private functions)
 .SH SYNOPSIS
 #include <png.h>
diff --git a/png.5 b/png.5
index a5f90b6..c3aabb6 100644
--- a/png.5
+++ b/png.5
@@ -1,4 +1,4 @@
-.TH PNG 5 "June 6, 1998"
+.TH PNG 5 "June 14, 1998"
 .SH NAME
 png \- Portable Network Graphics (PNG) format
 .SH DESCRIPTION
diff --git a/png.c b/png.c
index a4f3352..4601de0 100644
--- a/png.c
+++ b/png.c
@@ -1,7 +1,7 @@
 
 /* png.c - location for general purpose libpng functions
  *
- * libpng 1.0.1e - June 6, 1998
+ * libpng 1.0.2 - June 14, 1998
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
@@ -15,7 +15,7 @@
 /* Version information for C files.  This had better match the version
  * string defined in png.h.
  */
-char png_libpng_ver[12] = "1.0.1e";
+char png_libpng_ver[12] = "1.0.2";
 
 /* Place to hold the signature string for a PNG file. */
 png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};
diff --git a/png.h b/png.h
index 6fe00e8..0183b49 100644
--- a/png.h
+++ b/png.h
@@ -1,7 +1,7 @@
 
 /* png.h - header file for PNG reference library
  *
- * libpng 1.0.1e - June 6, 1998
+ * libpng 1.0.2 - June 14, 1998
  * For conditions of distribution and use, see the COPYRIGHT NOTICE below.
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
@@ -117,7 +117,7 @@
  */
 
 /* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.0.1e"
+#define PNG_LIBPNG_VER_STRING "1.0.2"
 
 /* Careful here.  At one time, Guy wanted to use 082, but that would be octal.
  * We must not include leading zeros.
diff --git a/pngconf.h b/pngconf.h
index 0973f0f..e18ba19 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -1,7 +1,7 @@
 
 /* pngconf.h - machine configurable file for libpng
  *
- * libpng 1.0.1e - June 6, 1998
+ * libpng 1.0.2 - June 14, 1998
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
diff --git a/pngerror.c b/pngerror.c
index e9a24e7..e3772ca 100644
--- a/pngerror.c
+++ b/pngerror.c
@@ -1,7 +1,7 @@
 
 /* pngerror.c - stub functions for i/o and memory allocation
  *
- * libpng 1.0.1e - June 6, 1998
+ * libpng 1.0.2 - June 14, 1998
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
@@ -130,7 +130,7 @@
 
 /* This function is called when there is a warning, but the library thinks
  * it can continue anyway.  Replacement functions don't have to do anything
- * here if you don't want to.  In the default configuration, png_ptr is
+ * here if you don't want them to.  In the default configuration, png_ptr is
  * not used, but it is passed in case it may be useful.
  */
 static void
diff --git a/pngget.c b/pngget.c
index 9d03314..c6aef6f 100644
--- a/pngget.c
+++ b/pngget.c
@@ -1,7 +1,7 @@
 
 /* pngget.c - retrieval of values from info struct
  *
- * libpng 1.0.1e - June 6, 1998
+ * libpng 1.0.2 - June 14, 1998
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
diff --git a/pngmem.c b/pngmem.c
index 0b98055..0aeab68 100644
--- a/pngmem.c
+++ b/pngmem.c
@@ -1,15 +1,17 @@
 
 /* pngmem.c - stub functions for memory allocation
  *
- * libpng 1.0.1e - June 6, 1998
+ * libpng 1.0.2 - June 14, 1998
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
  * Copyright (c) 1998, Glenn Randers-Pehrson
  *
  * This file provides a location for all memory allocation.  Users who
- * need special memory handling are expected to modify the code in this file
- * to meet their needs.  See the instructions at each function.
+ * need special memory handling are expected to supply replacement
+ * functions for png_malloc() and png_free(), and to use
+ * png_create_read_struct_2() and png_create_write_struct_2() to
+ * identify the replacement functions.
  */
 
 #define PNG_INTERNAL
diff --git a/pngpread.c b/pngpread.c
index 5386060..dad6499 100644
--- a/pngpread.c
+++ b/pngpread.c
@@ -1,7 +1,7 @@
 
 /* pngpread.c - read a png file in push mode
  *
- * libpng 1.0.1e - June 6, 1998
+ * libpng 1.0.2 - June 14, 1998
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
@@ -77,8 +77,9 @@
 
 /* Read any remaining signature bytes from the stream and compare them with
  * the correct PNG signature.  It is possible that this routine is called
- * with bytes already read from the signature, whether because they have been
- * checked by the calling application, or from multiple calls to this routine.
+ * with bytes already read from the signature, either because they have been
+ * checked by the calling application, or because of multiple calls to this
+ * routine.
  */
 void
 png_push_read_sig(png_structp png_ptr, png_infop info_ptr)
@@ -1116,7 +1117,7 @@
 png_progressive_combine_row (png_structp png_ptr,
    png_bytep old_row, png_bytep new_row)
 {
-   if (new_row != NULL)
+   if (new_row != NULL)    /* new_row must == png_ptr->row_buf here. */
       png_combine_row(png_ptr, old_row, png_pass_dsp_mask[png_ptr->pass]);
 }
 
diff --git a/pngread.c b/pngread.c
index 8af9e5b..f3097f4 100644
--- a/pngread.c
+++ b/pngread.c
@@ -1,7 +1,7 @@
 
 /* pngread.c - read a PNG file
  *
- * libpng 1.0.1e - June 6, 1998
+ * libpng 1.0.2 - June 14, 1998
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
@@ -281,7 +281,7 @@
 
 /* Initialize palette, background, etc, after transformations
  * are set, but before any reading takes place.  This allows
- * the user to obtail a gamma corrected palette, for example.
+ * the user to obtain a gamma-corrected palette, for example.
  * If the user doesn't call this, we will do it ourselves.
  */
 void
@@ -530,7 +530,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.1e.
+ * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.2.
  */
 
 void
@@ -570,7 +570,7 @@
 }
 
 /* Read the entire image.  If the image has an alpha channel or a tRNS
- * chunk, and you have called png_handle_alpha(), you will need to
+ * chunk, and you have called png_handle_alpha()[*], you will need to
  * initialize the image to the current image that PNG will be overlaying.
  * We set the num_rows again here, in case it was incorrectly set in
  * png_read_start_row() by a call to png_read_update_info() or
@@ -578,6 +578,8 @@
  * prior to either of these functions like it should have been.  You can
  * 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.2.
  */
 void
 png_read_image(png_structp png_ptr, png_bytepp image)
diff --git a/pngrio.c b/pngrio.c
index b57b563..b9a3645 100644
--- a/pngrio.c
+++ b/pngrio.c
@@ -1,7 +1,7 @@
 
 /* pngrio.c - functions for data input
  *
- * libpng 1.0.1e - June 6, 1998
+ * libpng 1.0.2 - June 14, 1998
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
diff --git a/pngrtran.c b/pngrtran.c
index a5542f4..f426c92 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.1e - June 6, 1998
+ * libpng 1.0.2 - June 14, 1998
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
@@ -523,7 +523,7 @@
 
 #if defined(PNG_READ_EXPAND_SUPPORTED)
 /* Expand paletted images to rgb, expand grayscale images of
- * less then 8 bit depth to 8 bit depth, and expand tRNS chunks
+ * less than 8 bit depth to 8 bit depth, and expand tRNS chunks
  * to alpha channels.
  */
 void
@@ -2819,7 +2819,7 @@
 
 #if defined(PNG_READ_GAMMA_SUPPORTED)
 /* Gamma correct the image, avoiding the alpha channel.  Make sure
- * you do this after you deal with the trasparency issue on grayscale
+ * you do this after you deal with the transparency issue on grayscale
  * or rgb images. If your bit depth is 8, use gamma_table, if it
  * is 16, use gamma_16_table and gamma_shift.  Build these with
  * build_gamma_table().
diff --git a/pngrutil.c b/pngrutil.c
index a45c008..a4ca3ab 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -1,7 +1,7 @@
 
 /* pngrutil.c - utilities to read a PNG file
  *
- * libpng 1.0.1e - June 6, 1998
+ * libpng 1.0.2 - June 14, 1998
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
@@ -1466,13 +1466,13 @@
    }
 }
 
-/* Combines the row recently read in with the previous row.
-   This routine takes care of alpha and transparency if requested.
+/* Combines the row recently read in with the existing pixels in the
+   row.  This routine takes care of alpha and transparency if requested.
    This routine also handles the two methods of progressive display
    of interlaced images, depending on the mask value.
    The mask value describes which pixels are to be combined with
    the row.  The pattern always repeats every 8 pixels, so just 8
-   bits are needed.  A one indicates the pixels is to be combined,
+   bits are needed.  A one indicates the pixel is to be combined,
    a zero indicates the pixel is to be skipped.  This is in addition
    to any alpha or transparency value associated with the pixel.  If
    you want all pixels to be combined, pass 0xff (255) in mask.  */
@@ -2156,7 +2156,7 @@
             if (!(png_ptr->num_rows))
                continue;
          }
-         if (png_ptr->transformations & PNG_INTERLACE)
+         else  /* if (png_ptr->transformations & PNG_INTERLACE) */
             break;
       } while (png_ptr->iwidth == 0);
 
diff --git a/pngset.c b/pngset.c
index 293f023..89b727b 100644
--- a/pngset.c
+++ b/pngset.c
@@ -1,7 +1,7 @@
 
 /* pngset.c - storage of image information into info struct
  *
- * libpng 1.0.1e - June 6, 1998
+ * libpng 1.0.2 - June 14, 1998
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
diff --git a/pngtest.c b/pngtest.c
index 84e84c3..9685474 100644
--- a/pngtest.c
+++ b/pngtest.c
@@ -1,7 +1,7 @@
 
 /* pngtest.c - a simple test program to test libpng
  *
- * libpng 1.0.1e -June 6, 1998
+ * libpng 1.0.2 -June 14, 1998
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
@@ -13,7 +13,7 @@
  * properly.  It does not currently test all of the transforms, although
  * it probably should.
  *
- * The program will fail in certain legitimate cases:
+ * The program will report "FAIL" in certain legitimate cases:
  * 1) when the compression level or filter selection method is changed.
  * 2) when the chunk size is not 8K.
  * 3) unknown ancillary chunks exist in the input file.
@@ -39,7 +39,7 @@
 
 #if defined(PNG_TIME_RFC1123_SUPPORTED)
 static int tIME_chunk_present=0;
-static png_charp tIME_string = "no tIME chunk present in file";
+static char tIME_string[30] = "no tIME chunk present in file";
 #endif /* PNG_TIME_RFC1123_SUPPORTED */
 
 int test_one_file PNGARG((PNG_CONST char *inname, PNG_CONST char *outname));
diff --git a/pngtrans.c b/pngtrans.c
index 9b1149a..3b23dfa 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.1e - June 6, 1998
+ * libpng 1.0.2 - June 14, 1998
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
@@ -130,7 +130,7 @@
    png_ptr->transformations |= PNG_INVERT_MONO;
 }
 
-/* invert monocrome grayscale data */
+/* invert monochrome grayscale data */
 void
 png_do_invert(png_row_infop row_info, png_bytep row)
 {
diff --git a/pngwio.c b/pngwio.c
index f1826dd..5e47099 100644
--- a/pngwio.c
+++ b/pngwio.c
@@ -1,7 +1,7 @@
 
 /* pngwio.c - functions for data output
  *
- * libpng 1.0.1e - June 6, 1998
+ * libpng 1.0.2 - June 14, 1998
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
@@ -22,7 +22,7 @@
    writes to a file pointer.  Note that this routine sometimes gets called
    with very small lengths, so you should implement some kind of simple
    buffering if you are using unbuffered writes.  This should never be asked
-   to write more then 64K on a 16 bit machine.  */
+   to write more than 64K on a 16 bit machine.  */
 
 void
 png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
diff --git a/pngwrite.c b/pngwrite.c
index 4190efb..a47b5a6 100644
--- a/pngwrite.c
+++ b/pngwrite.c
@@ -1,7 +1,7 @@
    
 /* pngwrite.c - general routines to write a PNG file
  *
- * libpng 1.0.1e - June 6, 1998
+ * libpng 1.0.2 - June 14, 1998
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
@@ -15,7 +15,7 @@
 /* Writes all the PNG information.  This is the suggested way to use the
  * library.  If you have a new chunk to add, make a function to write it,
  * and put it in the correct location here.  If you want the chunk written
- * after the image data, put it in png_write_end().  I strongly encurage
+ * after the image data, put it in png_write_end().  I strongly encourage
  * you to supply a PNG_INFO_ flag, and check info_ptr->valid before writing
  * the chunk, as that will keep the code from breaking if you want to just
  * write a plain PNG file.  If you have long comments, I suggest writing
diff --git a/pngwtran.c b/pngwtran.c
index 9b02eba..896d324 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.1e - June 6, 1998
+ * libpng 1.0.2 - June 14, 1998
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
@@ -11,7 +11,7 @@
 #define PNG_INTERNAL
 #include "png.h"
 
-/* Transform the data according to the users wishes.  The order of
+/* Transform the data according to the user's wishes.  The order of
  * transformations is significant.
  */
 void
diff --git a/pngwutil.c b/pngwutil.c
index 969386e..8d0c6ee 100644
--- a/pngwutil.c
+++ b/pngwutil.c
@@ -1,7 +1,7 @@
 
 /* pngwutil.c - utilities to write a PNG file
  *
- * libpng 1.0.1e - June 6, 1998
+ * libpng 1.0.2 - June 14, 1998
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  * Copyright (c) 1996, 1997 Andreas Dilger
@@ -273,7 +273,7 @@
 }
 
 /* write the palette.  We are careful not to trust png_color to be in the
- * correct order for PNG, so people can redefine it to any convient
+ * correct order for PNG, so people can redefine it to any convenient
  * structure.
  */
 void
@@ -835,7 +835,7 @@
          png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
          png_ptr->zstream.next_out = png_ptr->zbuf;
       }
-   /* continue until we don't have anymore to compress */
+   /* continue until we don't have any more to compress */
    } while (png_ptr->zstream.avail_in);
 
    /* finish the compression */
diff --git a/scripts/makefile.lnx b/scripts/makefile.lnx
index 9ea04db..1049de9 100644
--- a/scripts/makefile.lnx
+++ b/scripts/makefile.lnx
@@ -29,7 +29,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.1e
+PNGMIN = 1.0.2
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 # where make install puts libpng.a, libpng.so*, and png.h
diff --git a/scripts/makefile.s2x b/scripts/makefile.s2x
index 9d19e73..c54c021 100644
--- a/scripts/makefile.s2x
+++ b/scripts/makefile.s2x
@@ -29,7 +29,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.1e
+PNGMIN = 1.0.2
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 # where make install puts libpng.a, libpng.so*, and png.h
diff --git a/scripts/makefile.sco b/scripts/makefile.sco
index a88772a..323e378 100644
--- a/scripts/makefile.sco
+++ b/scripts/makefile.sco
@@ -22,7 +22,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.1e
+PNGMIN = 1.0.2
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 # where make install puts libpng.a, libpng.so*, and png.h
diff --git a/scripts/makefile.w32 b/scripts/makefile.w32
new file mode 100644
index 0000000..3893600
--- /dev/null
+++ b/scripts/makefile.w32
@@ -0,0 +1,85 @@
+# makefile for libpng
+# Copyright (C) 1998 Tim Wegner
+# For conditions of distribution and use, see copyright notice in png.h
+# Assumes that zlib.lib, zconf.h, and zlib.h have been copied to ..\zlib
+# To use, do "nmake /f scripts\makefile.w32"
+
+# ------------- Microsoft Visual C++ 4.0 and later -------------
+MODEL=- 
+CFLAGS=-Ox -GA3s -nologo -W3 -I..\zlib
+
+CC=cl
+LD=link
+LDFLAGS= 
+O=.obj
+
+#uncomment next to put error messages in a file
+ERRFILE= >> pngerrs
+
+# variables
+OBJS1 = png$(O) pngset$(O) pngget$(O) pngrutil$(O) pngtrans$(O) pngwutil$(O)
+OBJS2 = pngmem$(O) pngpread$(O) pngread$(O) pngerror$(O) pngwrite$(O)
+OBJS3 = pngrtran$(O) pngwtran$(O) pngrio$(O) pngwio$(O)
+
+all: libpng.lib
+
+png$(O): png.h pngconf.h
+		  $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
+
+pngset$(O): png.h pngconf.h
+        $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
+
+pngget$(O): png.h pngconf.h
+        $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
+
+pngread$(O): png.h pngconf.h
+        $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
+
+pngpread$(O): png.h pngconf.h
+		  $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
+
+pngrtran$(O): png.h pngconf.h
+        $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
+
+pngrutil$(O): png.h pngconf.h
+        $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
+
+pngerror$(O): png.h pngconf.h
+        $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
+
+pngmem$(O): png.h pngconf.h
+        $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
+
+pngrio$(O): png.h pngconf.h
+        $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
+
+pngwio$(O): png.h pngconf.h
+        $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
+
+pngtest$(O): png.h pngconf.h
+        $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
+
+pngtrans$(O): png.h pngconf.h
+        $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
+
+pngwrite$(O): png.h pngconf.h
+        $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
+
+pngwtran$(O): png.h pngconf.h
+        $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
+
+pngwutil$(O): png.h pngconf.h
+        $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
+
+libpng.lib: $(OBJS1) $(OBJS2) $(OBJS3)
+        del libpng.lib
+	lib /OUT:libpng.lib $(OBJS1) $(OBJS2) $(OBJS3)
+
+pngtest.exe: pngtest.obj libpng.lib 
+	$(LD) $(LDFLAGS) pngtest.obj libpng.lib ..\zlib\zlib.lib /OUT:pngtest.exe /SUBSYSTEM:CONSOLE
+
+test: pngtest.exe
+	pngtest
+
+# End of makefile for libpng
+
diff --git a/scripts/pngdef.pas b/scripts/pngdef.pas
index 0739c42..d948aae 100644
--- a/scripts/pngdef.pas
+++ b/scripts/pngdef.pas
@@ -3,7 +3,7 @@
 interface
 
 const
-  PNG_LIBPNG_VER_STRING = '1.0.1e';
+  PNG_LIBPNG_VER_STRING = '1.0.2';
   PNG_LIBPNG_VER        =  10001;
 
 type