Imported from libpng-0.88.tar
diff --git a/ansi2knr.c b/ansi2knr.c
new file mode 100644
index 0000000..3924215
--- /dev/null
+++ b/ansi2knr.c
@@ -0,0 +1,488 @@
+/* Copyright (C) 1989, 1991, 1993 Aladdin Enterprises. All rights reserved. */
+
+/* ansi2knr.c */
+/* Convert ANSI function declarations to K&R syntax */
+
+/*
+ansi2knr is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
+to anyone for the consequences of using it or for whether it serves any
+particular purpose or works at all, unless he says so in writing.  Refer
+to the GNU General Public License for full details.
+
+Everyone is granted permission to copy, modify and redistribute
+ansi2knr, but only under the conditions described in the GNU
+General Public License.  A copy of this license is supposed to have been
+given to you along with ansi2knr so you can know your rights and
+responsibilities.  It should be in a file named COPYING.  Among other
+things, the copyright notice and this notice must be preserved on all
+copies.
+*/
+
+/*
+---------- Here is the GNU GPL file COPYING, referred to above ----------
+----- These terms do NOT apply to the JPEG software itself; see README ------
+
+		    GHOSTSCRIPT GENERAL PUBLIC LICENSE
+		    (Clarified 11 Feb 1988)
+
+ Copyright (C) 1988 Richard M. Stallman
+ Everyone is permitted to copy and distribute verbatim copies of this
+ license, but changing it is not allowed.  You can also use this wording
+ to make the terms for other programs.
+
+  The license agreements of most software companies keep you at the
+mercy of those companies.  By contrast, our general public license is
+intended to give everyone the right to share Ghostscript.  To make sure
+that you get the rights we want you to have, we need to make
+restrictions that forbid anyone to deny you these rights or to ask you
+to surrender the rights.  Hence this license agreement.
+
+  Specifically, we want to make sure that you have the right to give
+away copies of Ghostscript, that you receive source code or else can get
+it if you want it, that you can change Ghostscript or use pieces of it
+in new free programs, and that you know you can do these things.
+
+  To make sure that everyone has such rights, we have to forbid you to
+deprive anyone else of these rights.  For example, if you distribute
+copies of Ghostscript, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must tell them their rights.
+
+  Also, for our own protection, we must make certain that everyone finds
+out that there is no warranty for Ghostscript.  If Ghostscript is
+modified by someone else and passed on, we want its recipients to know
+that what they have is not what we distributed, so that any problems
+introduced by others will not reflect on our reputation.
+
+  Therefore we (Richard M. Stallman and the Free Software Foundation,
+Inc.) make the following terms which say what you must do to be allowed
+to distribute or change Ghostscript.
+
+
+			COPYING POLICIES
+
+  1. You may copy and distribute verbatim copies of Ghostscript source
+code as you receive it, in any medium, provided that you conspicuously
+and appropriately publish on each copy a valid copyright and license
+notice "Copyright (C) 1989 Aladdin Enterprises.  All rights reserved.
+Distributed by Free Software Foundation, Inc." (or with whatever year is
+appropriate); keep intact the notices on all files that refer to this
+License Agreement and to the absence of any warranty; and give any other
+recipients of the Ghostscript program a copy of this License Agreement
+along with the program.  You may charge a distribution fee for the
+physical act of transferring a copy.
+
+  2. You may modify your copy or copies of Ghostscript or any portion of
+it, and copy and distribute such modifications under the terms of
+Paragraph 1 above, provided that you also do the following:
+
+    a) cause the modified files to carry prominent notices stating
+    that you changed the files and the date of any change; and
+
+    b) cause the whole of any work that you distribute or publish,
+    that in whole or in part contains or is a derivative of Ghostscript
+    or any part thereof, to be licensed at no charge to all third
+    parties on terms identical to those contained in this License
+    Agreement (except that you may choose to grant more extensive
+    warranty protection to some or all third parties, at your option).
+
+    c) You may charge a distribution fee for the physical act of
+    transferring a copy, and you may at your option offer warranty
+    protection in exchange for a fee.
+
+Mere aggregation of another unrelated program with this program (or its
+derivative) on a volume of a storage or distribution medium does not bring
+the other program under the scope of these terms.
+
+  3. You may copy and distribute Ghostscript (or a portion or derivative
+of it, under Paragraph 2) in object code or executable form under the
+terms of Paragraphs 1 and 2 above provided that you also do one of the
+following:
+
+    a) accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of
+    Paragraphs 1 and 2 above; or,
+
+    b) accompany it with a written offer, valid for at least three
+    years, to give any third party free (except for a nominal
+    shipping charge) a complete machine-readable copy of the
+    corresponding source code, to be distributed under the terms of
+    Paragraphs 1 and 2 above; or,
+
+    c) accompany it with the information you received as to where the
+    corresponding source code may be obtained.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form alone.)
+
+For an executable file, complete source code means all the source code for
+all modules it contains; but, as a special exception, it need not include
+source code for modules which are standard libraries that accompany the
+operating system on which the executable file runs.
+
+  4. You may not copy, sublicense, distribute or transfer Ghostscript
+except as expressly provided under this License Agreement.  Any attempt
+otherwise to copy, sublicense, distribute or transfer Ghostscript is
+void and your rights to use the program under this License agreement
+shall be automatically terminated.  However, parties who have received
+computer software programs from you with this License Agreement will not
+have their licenses terminated so long as such parties remain in full
+compliance.
+
+  5. If you wish to incorporate parts of Ghostscript into other free
+programs whose distribution conditions are different, write to the Free
+Software Foundation at 675 Mass Ave, Cambridge, MA 02139.  We have not
+yet worked out a simple rule that can be stated here, but we will often
+permit this.  We will be guided by the two goals of preserving the free
+status of all derivatives of our free software and of promoting the
+sharing and reuse of software.
+
+Your comments and suggestions about our licensing policies and our
+software are welcome!  Please contact the Free Software Foundation,
+Inc., 675 Mass Ave, Cambridge, MA 02139, or call (617) 876-3296.
+
+		       NO WARRANTY
+
+  BECAUSE GHOSTSCRIPT IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY
+NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.  EXCEPT
+WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC, RICHARD
+M. STALLMAN, ALADDIN ENTERPRISES, L. PETER DEUTSCH, AND/OR OTHER PARTIES
+PROVIDE GHOSTSCRIPT "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
+EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE
+ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF GHOSTSCRIPT IS WITH
+YOU.  SHOULD GHOSTSCRIPT PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
+NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M.
+STALLMAN, THE FREE SOFTWARE FOUNDATION, INC., L. PETER DEUTSCH, ALADDIN
+ENTERPRISES, AND/OR ANY OTHER PARTY WHO MAY MODIFY AND REDISTRIBUTE
+GHOSTSCRIPT AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING
+ANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
+(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
+INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A FAILURE OF THE
+PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) GHOSTSCRIPT, EVEN IF YOU
+HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM
+BY ANY OTHER PARTY.
+
+-------------------- End of file COPYING ------------------------------
+*/
+
+
+#include <stdio.h>
+#include <ctype.h>
+
+#ifdef BSD
+#include <strings.h>
+#else
+#ifdef VMS
+	extern int strlen(), strncmp();
+#else
+#include <string.h>
+#endif
+#endif
+
+/* malloc and free should be declared in stdlib.h, */
+/* but if you've got a K&R compiler, they probably aren't. */
+#ifdef MSDOS
+#include <malloc.h>
+#else
+#ifdef VMS
+     extern char *malloc();
+     extern void free();
+#else
+     extern char *malloc();
+     extern int free();
+#endif
+#endif
+
+/* Usage:
+	ansi2knr input_file [output_file]
+ * If no output_file is supplied, output goes to stdout.
+ * There are no error messages.
+ *
+ * ansi2knr recognizes functions by seeing a non-keyword identifier
+ * at the left margin, followed by a left parenthesis,
+ * with a right parenthesis as the last character on the line.
+ * It will recognize a multi-line header provided that the last character
+ * of the last line of the header is a right parenthesis,
+ * and no intervening line ends with a left brace or a semicolon.
+ * These algorithms ignore whitespace and comments, except that
+ * the function name must be the first thing on the line.
+ * The following constructs will confuse it:
+ *	- Any other construct that starts at the left margin and
+ *	    follows the above syntax (such as a macro or function call).
+ *	- Macros that tinker with the syntax of the function header.
+ */
+
+/* Scanning macros */
+#define isidchar(ch) (isalnum(ch) || (ch) == '_')
+#define isidfirstchar(ch) (isalpha(ch) || (ch) == '_')
+
+/* Forward references */
+char *skipspace();
+int writeblanks();
+int test1();
+int convert1();
+
+/* The main program */
+main(argc, argv)
+    int argc;
+    char *argv[];
+{	FILE *in, *out;
+#define bufsize 5000			/* arbitrary size */
+	char *buf;
+	char *line;
+	switch ( argc )
+	   {
+	default:
+		printf("Usage: ansi2knr input_file [output_file]\n");
+		exit(0);
+	case 2:
+		out = stdout; break;
+	case 3:
+		out = fopen(argv[2], "w");
+		if ( out == NULL )
+		   {	fprintf(stderr, "Cannot open %s\n", argv[2]);
+			exit(1);
+		   }
+	   }
+	in = fopen(argv[1], "r");
+	if ( in == NULL )
+	   {	fprintf(stderr, "Cannot open %s\n", argv[1]);
+		exit(1);
+	   }
+	fprintf(out, "#line 1 \"%s\"\n", argv[1]);
+	buf = malloc(bufsize);
+	line = buf;
+	while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL )
+	   {	switch ( test1(buf) )
+		   {
+		case 1:			/* a function */
+			convert1(buf, out);
+			break;
+		case -1:		/* maybe the start of a function */
+			line = buf + strlen(buf);
+			if ( line != buf + (bufsize - 1) ) /* overflow check */
+				continue;
+			/* falls through */
+		default:		/* not a function */
+			fputs(buf, out);
+			break;
+		   }
+		line = buf;
+	   }
+	if ( line != buf ) fputs(buf, out);
+	free(buf);
+	fclose(out);
+	fclose(in);
+	return 0;
+}
+
+/* Skip over space and comments, in either direction. */
+char *
+skipspace(p, dir)
+    register char *p;
+    register int dir;			/* 1 for forward, -1 for backward */
+{	for ( ; ; )
+	   {	while ( isspace(*p) ) p += dir;
+		if ( !(*p == '/' && p[dir] == '*') ) break;
+		p += dir;  p += dir;
+		while ( !(*p == '*' && p[dir] == '/') )
+		   {	if ( *p == 0 ) return p;	/* multi-line comment?? */
+			p += dir;
+		   }
+		p += dir;  p += dir;
+	   }
+	return p;
+}
+
+/*
+ * Write blanks over part of a string.
+ */
+int
+writeblanks(start, end)
+    char *start;
+    char *end;
+{	char *p;
+	for ( p = start; p < end; p++ ) *p = ' ';
+	return 0;
+}
+
+/*
+ * Test whether the string in buf is a function definition.
+ * The string may contain and/or end with a newline.
+ * Return as follows:
+ *	0 - definitely not a function definition;
+ *	1 - definitely a function definition;
+ *	-1 - may be the beginning of a function definition,
+ *		append another line and look again.
+ */
+int
+test1(buf)
+    char *buf;
+{	register char *p = buf;
+	char *bend;
+	char *endfn;
+	int contin;
+	if ( !isidfirstchar(*p) )
+		return 0;		/* no name at left margin */
+	bend = skipspace(buf + strlen(buf) - 1, -1);
+	switch ( *bend )
+	   {
+	case ')': contin = 1; break;
+	case '{':
+	case ';': return 0;		/* not a function */
+	default: contin = -1;
+	   }
+	while ( isidchar(*p) ) p++;
+	endfn = p;
+	p = skipspace(p, 1);
+	if ( *p++ != '(' )
+		return 0;		/* not a function */
+	p = skipspace(p, 1);
+	if ( *p == ')' )
+		return 0;		/* no parameters */
+	/* Check that the apparent function name isn't a keyword. */
+	/* We only need to check for keywords that could be followed */
+	/* by a left parenthesis (which, unfortunately, is most of them). */
+	   {	static char *words[] =
+		   {	"asm", "auto", "case", "char", "const", "double",
+			"extern", "float", "for", "if", "int", "long",
+			"register", "return", "short", "signed", "sizeof",
+			"static", "switch", "typedef", "unsigned",
+			"void", "volatile", "while", 0
+		   };
+		char **key = words;
+		char *kp;
+		int len = endfn - buf;
+		while ( (kp = *key) != 0 )
+		   {	if ( strlen(kp) == len && !strncmp(kp, buf, len) )
+				return 0;	/* name is a keyword */
+			key++;
+		   }
+	   }
+	return contin;
+}
+
+int
+convert1(buf, out)
+    char *buf;
+    FILE *out;
+{	char *endfn;
+	register char *p;
+	char **breaks;
+	unsigned num_breaks = 2;	/* for testing */
+	char **btop;
+	char **bp;
+	char **ap;
+	/* Pre-ANSI implementations don't agree on whether strchr */
+	/* is called strchr or index, so we open-code it here. */
+	for ( endfn = buf; *(endfn++) != '('; ) ;
+top:	p = endfn;
+	breaks = (char **)malloc(sizeof(char *) * num_breaks * 2);
+	if ( breaks == 0 )
+	   {	/* Couldn't allocate break table, give up */
+		fprintf(stderr, "Unable to allocate break table!\n");
+		fputs(buf, out);
+		return -1;
+	   }
+	btop = breaks + num_breaks * 2 - 2;
+	bp = breaks;
+	/* Parse the argument list */
+	do
+	   {	int level = 0;
+		char *end = NULL;
+		if ( bp >= btop )
+		   {	/* Filled up break table. */
+			/* Allocate a bigger one and start over. */
+			free((char *)breaks);
+			num_breaks <<= 1;
+			goto top;
+		   }
+		*bp++ = p;
+		/* Find the end of the argument */
+		for ( ; end == NULL; p++ )
+		   {	switch(*p)
+			   {
+			case ',': if ( !level ) end = p; break;
+			case '(': level++; break;
+			case ')': if ( --level < 0 ) end = p; break;
+			case '/': p = skipspace(p, 1) - 1; break;
+			default: ;
+			   }
+		   }
+		p--;			/* back up over terminator */
+		/* Find the name being declared. */
+		/* This is complicated because of procedure and */
+		/* array modifiers. */
+		for ( ; ; )
+		   {	p = skipspace(p - 1, -1);
+			switch ( *p )
+			   {
+			case ']':	/* skip array dimension(s) */
+			case ')':	/* skip procedure args OR name */
+			   {	int level = 1;
+				while ( level )
+				 switch ( *--p )
+				   {
+				case ']': case ')': level++; break;
+				case '[': case '(': level--; break;
+				case '/': p = skipspace(p, -1) + 1; break;
+				default: ;
+				   }
+			   }
+				if ( *p == '(' && *skipspace(p + 1, 1) == '*' )
+				   {	/* We found the name being declared */
+					while ( !isidfirstchar(*p) )
+						p = skipspace(p, 1) + 1;
+					goto found;
+				   }
+				break;
+			default: goto found;
+			   }
+		   }
+found:		if ( *p == '.' && p[-1] == '.' && p[-2] == '.' )
+		   {	p++;
+			if ( bp == breaks + 1 )	/* sole argument */
+				writeblanks(breaks[0], p);
+			else
+				writeblanks(bp[-1] - 1, p);
+			bp--;
+		   }
+		else
+		   {	while ( isidchar(*p) ) p--;
+			*bp++ = p+1;
+		   }
+		p = end;
+	   }
+	while ( *p++ == ',' );
+	*bp = p;
+	/* Make a special check for 'void' arglist */
+	if ( bp == breaks+2 )
+	   {	p = skipspace(breaks[0], 1);
+		if ( !strncmp(p, "void", 4) )
+		   {	p = skipspace(p+4, 1);
+			if ( p == breaks[2] - 1 )
+			   {	bp = breaks;	/* yup, pretend arglist is empty */
+				writeblanks(breaks[0], p + 1);
+			   }
+		   }
+	   }
+	/* Put out the function name */
+	p = buf;
+	while ( p != endfn ) putc(*p, out), p++;
+	/* Put out the declaration */
+	for ( ap = breaks+1; ap < bp; ap += 2 )
+	   {	p = *ap;
+		while ( isidchar(*p) ) putc(*p, out), p++;
+		if ( ap < bp - 1 ) fputs(", ", out);
+	   }
+	fputs(")  ", out);
+	/* Put out the argument declarations */
+	for ( ap = breaks+2; ap <= bp; ap += 2 ) (*ap)[-1] = ';';
+	fputs(breaks[0], out);
+	free((char *)breaks);
+	return 0;
+}
diff --git a/build.bat b/build.bat
new file mode 100644
index 0000000..ec34b6f
--- /dev/null
+++ b/build.bat
@@ -0,0 +1,2 @@
+make -fmakefile.bor -B -DMODEL=m %1 %2 %3 libpng >buildm.out
+make -fmakefile.bor -B -DMODEL=l %1 %2 %3 libpng >buildl.out
diff --git a/descrip.mms b/descrip.mms
new file mode 100644
index 0000000..200d760
--- /dev/null
+++ b/descrip.mms
@@ -0,0 +1,50 @@
+
+cc_defs = /inc=$(ZLIBSRC)
+c_deb = 
+
+.ifdef __DECC__
+pref = /prefix=all
+.endif
+
+
+
+OBJS = png.obj, pngrcb.obj, pngrutil.obj, pngtrans.obj, pngwutil.obj,\
+	pngread.obj, pngmem.obj, pngwrite.obj, pngrtran.obj, pngwtran.obj,\
+	pngio.obj, pngerror.obj, pngpread.obj
+
+
+CFLAGS= $(C_DEB) $(CC_DEFS) $(PREF)
+
+all : pngtest.exe libpng.olb
+		@ write sys$output " pngtest available"
+
+libpng.olb : libpng.olb($(OBJS))
+	@ write sys$output " Libpng available"
+
+
+pngtest.exe : pngtest.obj libpng.olb
+              link pngtest,libpng.olb/lib,$(ZLIBSRC)libz.olb/lib
+
+test : pngtest.exe
+   run pngtest
+
+clean :
+	delete *.obj;*,*.exe;*
+
+
+# Other dependencies.
+png.obj : png.h, pngconf.h
+pngpread.obj : png.h, pngconf.h
+pngrcb.obj : png.h, pngconf.h
+pngread.obj : png.h, pngconf.h
+pngrtran.obj : png.h, pngconf.h
+pngrutil.obj : png.h, pngconf.h
+pngerror.obj : png.h, pngconf.h
+pngmem.obj : png.h, pngconf.h
+pngio.obj : png.h, pngconf.h
+pngtest.obj : png.h, pngconf.h
+pngtrans.obj : png.h, pngconf.h
+pngwrite.obj : png.h, pngconf.h
+pngwtran.obj : png.h, pngconf.h
+pngwutil.obj : png.h, pngconf.h
+
diff --git a/example.c b/example.c
index 97ac60b..63d7962 100644
--- a/example.c
+++ b/example.c
@@ -40,7 +40,7 @@
 void read_png(char *file_name)
 {
    FILE *fp;
-	png_structp png_ptr;
+   png_structp png_ptr;
    png_infop info_ptr;
 
    /* open the file */
@@ -82,18 +82,18 @@
    /* set up the input control if you are using standard C streams */
    png_init_io(png_ptr, fp);
 
-	/* if you are using replacement read functions, here you would call */
-	png_set_read_fn(png_ptr, (void *)io_ptr, user_read_fn);
-	/* where io_ptr is a structure you want available to the callbacks */
+   /* if you are using replacement read functions, here you would call */
+   png_set_read_fn(png_ptr, (void *)io_ptr, user_read_fn);
+   /* where io_ptr is a structure you want available to the callbacks */
 
-	/* if you are using replacement message functions, here you would call */
-	png_set_message_fn(png_ptr, (void *)msg_ptr, user_error_fn, user_warning_fn);
-	/* where msg_ptr is a structure you want available to the callbacks */
+   /* if you are using replacement message functions, here you would call */
+   png_set_message_fn(png_ptr, (void *)msg_ptr, user_error_fn, user_warning_fn);
+   /* where msg_ptr is a structure you want available to the callbacks */
 
-	/* read the file information */
-	png_read_info(png_ptr, info_ptr);
+   /* read the file information */
+   png_read_info(png_ptr, info_ptr);
 
-	/* set up the transformations you want.  Note that these are
+   /* set up the transformations you want.  Note that these are
       all optional.  Only call them if you want them */
 
    /* expand paletted colors into true rgb */
@@ -110,14 +110,14 @@
       png_set_expand(png_ptr);
 
    /* Set the background color to draw transparent and alpha
-		images over */
+      images over */
    png_color_16 my_background;
 
    if (info_ptr->valid & PNG_INFO_bKGD)
       png_set_background(png_ptr, &(info_ptr->background),
-			PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
-	else
-		png_set_background(png_ptr, &my_background,
+         PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
+   else
+      png_set_background(png_ptr, &my_background,
          PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
 
    /* tell libpng to handle the gamma conversion for you */
@@ -128,7 +128,7 @@
 
    /* tell libpng to strip 16 bit depth files down to 8 bits */
    if (info_ptr->bit_depth == 16)
-		png_set_strip_16(png_ptr);
+      png_set_strip_16(png_ptr);
 
    /* dither rgb files down to 8 bit palettes & reduce palettes
       to the number of colors available on your screen */
@@ -146,7 +146,7 @@
          png_set_dither(png_ptr, std_color_cube, MAX_SCREEN_COLORS,
             MAX_SCREEN_COLORS, NULL);
       }
-	}
+   }
 
    /* invert monocrome files */
    if (info_ptr->bit_depth == 1 &&
@@ -164,7 +164,7 @@
 
    /* flip the rgb pixels to bgr */
    if (info_ptr->color_type == PNG_COLOR_TYPE_RGB ||
-		info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+      info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
       png_set_bgr(png_ptr);
 
    /* swap bytes of 16 bit files to least significant bit first */
@@ -182,7 +182,7 @@
    else
       number_passes = 1;
 
-	/* optional call to update palette with transformations */
+   /* optional call to update palette with transformations */
    png_start_read_image(png_ptr);
 
    /* optional call to update the info structure */
@@ -200,7 +200,7 @@
    for (pass = 0; pass < number_passes; pass++)
    {
       /* Read the image using the "sparkle" effect. */
-		png_read_rows(png_ptr, row_pointers, NULL, number_of_rows);
+      png_read_rows(png_ptr, row_pointers, NULL, number_of_rows);
 
       /* If you are only reading on row at a time, this works */
       for (y = 0; y < height; y++)
@@ -218,7 +218,7 @@
 
    /* read the rest of the file, getting any additional chunks
       in info_ptr */
-	png_read_end(png_ptr, info_ptr);
+   png_read_end(png_ptr, info_ptr);
 
    /* clean up after the read, and free any memory allocated */
    png_read_destroy(png_ptr, info_ptr, (png_infop)0);
@@ -237,126 +237,126 @@
 /* progressively read a file */
 
 /* these will normally not be global unless you are only
-	reading in one image at a time */
+   reading in one image at a time */
 png_structp png_ptr;
 png_infop info_ptr;
 
 int
 initialize_png_reader()
 {
-	png_ptr = malloc(sizeof (png_struct));
-	if (!png_ptr)
-		return -1;
-	info_ptr = malloc(sizeof (png_info));
-	if (!info_ptr)
-	{
-		free(png_ptr);
-		return -1;
-	}
+   png_ptr = malloc(sizeof (png_struct));
+   if (!png_ptr)
+      return -1;
+   info_ptr = malloc(sizeof (png_info));
+   if (!info_ptr)
+   {
+      free(png_ptr);
+      return -1;
+   }
 
-	if (setjmp(png_ptr->jmpbuf))
-	{
-		png_read_destroy(png_ptr, info_ptr, (png_info *)0);
-		/* free pointers before returning, if necessary */
-		free(png_ptr);
-		free(info_ptr);
-		return -1;
-	}
+   if (setjmp(png_ptr->jmpbuf))
+   {
+      png_read_destroy(png_ptr, info_ptr, (png_info *)0);
+      /* free pointers before returning, if necessary */
+      free(png_ptr);
+      free(info_ptr);
+      return -1;
+   }
 
-	png_info_init(info_ptr);
-	png_read_init(png_ptr);
+   png_info_init(info_ptr);
+   png_read_init(png_ptr);
 
-	/* this one's new.  You will need to provide all three
-		function callbacks, even if you aren't using them all.
-		You can put a void pointer in place of the NULL, and
-		retrieve the pointer from inside the callbacks using
-		the function png_get_progressive_ptr(png_ptr); */
-	png_set_progressive_read_fn(png_ptr, NULL,
-		info_callback, row_callback, end_callback);
+   /* this one's new.  You will need to provide all three
+      function callbacks, even if you aren't using them all.
+      You can put a void pointer in place of the NULL, and
+      retrieve the pointer from inside the callbacks using
+      the function png_get_progressive_ptr(png_ptr); */
+   png_set_progressive_read_fn(png_ptr, NULL,
+      info_callback, row_callback, end_callback);
 
-	return 0;
+   return 0;
 }
 
 int
 process_data(png_bytep buffer, png_uint_32 length)
 {
-	if (setjmp(png_ptr->jmpbuf))
-	{
-		png_read_destroy(png_ptr, info_ptr, (png_info *)0);
-		free(png_ptr);
-		free(info_ptr);
-		return -1;
-	}
+   if (setjmp(png_ptr->jmpbuf))
+   {
+      png_read_destroy(png_ptr, info_ptr, (png_info *)0);
+      free(png_ptr);
+      free(info_ptr);
+      return -1;
+   }
 
-	/* this one's new also.  Simply give it a chunk of data
-		from the file stream (in order, of course).  On Segmented
-		machines, don't give it any more then 64K.  The library
-		seems to run fine with sizes of 4K, although you can give
-		it much less if necessary (I assume you can give it chunks
-		of 1 byte, but I haven't tried less then 256 bytes yet).
-		When this function returns, you may want to display any
-		rows that were generated in the row callback. */
-	png_process_data(png_ptr, info_ptr, buffer, length);
-	return 0;
+   /* this one's new also.  Simply give it a chunk of data
+      from the file stream (in order, of course).  On Segmented
+      machines, don't give it any more then 64K.  The library
+      seems to run fine with sizes of 4K, although you can give
+      it much less if necessary (I assume you can give it chunks
+      of 1 byte, but I haven't tried less then 256 bytes yet).
+      When this function returns, you may want to display any
+      rows that were generated in the row callback. */
+   png_process_data(png_ptr, info_ptr, buffer, length);
+   return 0;
 }
 
 info_callback(png_structp png_ptr, png_infop info)
 {
-/*	do any setup here, including setting any of the transformations
-	mentioned in the Reading PNG files section.  For now, you _must_
-	call either png_start_read_image() or png_read_update_info()
-	after all the transformations are set (even if you don't set
-	any).  You may start getting rows before png_process_data()
-	returns, so this is your last chance to prepare for that. */
+/* do any setup here, including setting any of the transformations
+   mentioned in the Reading PNG files section.  For now, you _must_
+   call either png_start_read_image() or png_read_update_info()
+   after all the transformations are set (even if you don't set
+   any).  You may start getting rows before png_process_data()
+   returns, so this is your last chance to prepare for that. */
 }
 
 row_callback(png_structp png_ptr, png_bytep new_row,
-	png_uint_32 row_num, int pass)
+   png_uint_32 row_num, int pass)
 {
-/*	this function is called for every row in the image.  If the
-	image is interlacing, and you turned on the interlace handler,
-	this function will be called for every row in every pass.
-	Some of these rows will not be changed from the previous pass.
-	When the row is not changed, the new_row variable will be NULL.
-	The rows and passes are called in order, so you don't really
-	need the row_num and pass, but I'm supplying them because it
-	may make your life easier.
+/* this function is called for every row in the image.  If the
+   image is interlacing, and you turned on the interlace handler,
+   this function will be called for every row in every pass.
+   Some of these rows will not be changed from the previous pass.
+   When the row is not changed, the new_row variable will be NULL.
+   The rows and passes are called in order, so you don't really
+   need the row_num and pass, but I'm supplying them because it
+   may make your life easier.
 
-	For the non-NULL rows of interlaced images, you must call
-	png_progressive_combine_row() passing in the row and the
-	old row.  You can call this function for NULL rows (it will
-	just return) and for non-interlaced images (it just does the
-	memcpy for you) if it will make the code easier.  Thus, you
-	can just do this for all cases: */
+   For the non-NULL rows of interlaced images, you must call
+   png_progressive_combine_row() passing in the row and the
+   old row.  You can call this function for NULL rows (it will
+   just return) and for non-interlaced images (it just does the
+   memcpy for you) if it will make the code easier.  Thus, you
+   can just do this for all cases: */
 
-	png_progressive_combine_row(png_ptr, old_row, new_row);
+   png_progressive_combine_row(png_ptr, old_row, new_row);
 
-/*	where old_row is what was displayed for previous rows.  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 the current row, and the function will combine the
-	old row and the new row. */
+/* where old_row is what was displayed for previous rows.  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 the current row, and the function will combine the
+   old row and the new row. */
 }
 
 end_callback(png_structp png_ptr, png_infop info)
 {
-/*	this function is called when the whole image has been read,
-	including any chunks after the image (up to and including
-	the IEND).  You will usually have the same info chunk as you
-	had in the header, although some data may have been added
-	to the comments and time fields.
+/* this function is called when the whole image has been read,
+   including any chunks after the image (up to and including
+   the IEND).  You will usually have the same info chunk as you
+   had in the header, although some data may have been added
+   to the comments and time fields.
 
-	Most people won't do much here, perhaps setting a flag that
-	marks the image as finished. */
+   Most people won't do much here, perhaps setting a flag that
+   marks the image as finished. */
 }
 
 /* write a png file */
 void write_png(char *file_name, ... other image information ...)
 {
    FILE *fp;
-	png_structp png_ptr;
-	png_infop info_ptr;
+   png_structp png_ptr;
+   png_infop info_ptr;
 
    /* open the file */
    fp = fopen(file_name, "wb");
@@ -380,7 +380,7 @@
    }
 
    /* set error handling */
-	if (setjmp(png_ptr->jmpbuf))
+   if (setjmp(png_ptr->jmpbuf))
    {
       png_write_destroy(png_ptr);
       fclose(fp);
@@ -397,15 +397,15 @@
    /* set up the output control if you are using standard C streams */
    png_init_io(png_ptr, fp);
 
-	/* if you are using replacement write functions, here you would call */
-	png_set_write_fn(png_ptr, (void *)io_ptr, user_write_fn, user_flush_fn);
-	/* where io_ptr is a structure you want available to the callbacks */
+   /* if you are using replacement write functions, here you would call */
+   png_set_write_fn(png_ptr, (void *)io_ptr, user_write_fn, user_flush_fn);
+   /* where io_ptr is a structure you want available to the callbacks */
 
-	/* if you are using replacement message functions, here you would call */
-	png_set_message_fn(png_ptr, (void *)msg_ptr, user_error_fn, user_warning_fn);
-	/* where msg_ptr is a structure you want available to the callbacks */
+   /* if you are using replacement message functions, here you would call */
+   png_set_message_fn(png_ptr, (void *)msg_ptr, user_error_fn, user_warning_fn);
+   /* where msg_ptr is a structure you want available to the callbacks */
 
-	/* set the file information here */
+   /* set the file information here */
    info_ptr->width = ;
    info_ptr->height = ;
    etc.
@@ -418,18 +418,18 @@
 
    /* optional significant bit chunk */
    info_ptr->valid |= PNG_INFO_sBIT;
-	/* if we are dealing with a grayscale image then */
-	info_ptr->sig_bit.gray = true_bit_depth;
-	/* otherwise, if we are dealing with a color image then */
-	info_ptr->sig_bit.red = true_red_bit_depth;
-	info_ptr->sig_bit.green = true_green_bit_depth;
-	info_ptr->sig_bit.blue = true_blue_bit_depth;
-	/* if the image has an alpha channel then */
+   /* if we are dealing with a grayscale image then */
+   info_ptr->sig_bit.gray = true_bit_depth;
+   /* otherwise, if we are dealing with a color image then */
+   info_ptr->sig_bit.red = true_red_bit_depth;
+   info_ptr->sig_bit.green = true_green_bit_depth;
+   info_ptr->sig_bit.blue = true_blue_bit_depth;
+   /* if the image has an alpha channel then */
    info_ptr->sig_bit.alpha = true_alpha_bit_depth;
   
-	/* optional gamma chunk is strongly suggested if you have any guess
-	   as to the correct gamma of the image */
-	info_ptr->valid |= PNG_INFO_gAMA;
+   /* optional gamma chunk is strongly suggested if you have any guess
+      as to the correct gamma of the image */
+   info_ptr->valid |= PNG_INFO_gAMA;
    info_ptr->gamma = gamma;
 
    /* other optional chunks */
diff --git a/libpng.txt b/libpng.txt
index 6e367c4..251795a 100644
--- a/libpng.txt
+++ b/libpng.txt
@@ -1,12 +1,12 @@
 libpng.txt - a description on how to use and modify libpng
 
-	libpng 1.0 beta 2 - version 0.87
-	For conditions of distribution and use, see copyright notice in png.h
-	Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
-	January 15, 1996
-	Updated/rewritten per request in the libpng FAQ
-	Copyright (c) 1995 Frank J. T. Wojcik
-	December 18, 1995
+    libpng 1.0 beta 2 - version 0.87
+    For conditions of distribution and use, see copyright notice in png.h
+    Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+    January 15, 1996
+    Updated/rewritten per request in the libpng FAQ
+    Copyright (c) 1995 Frank J. T. Wojcik
+    December 18, 1995 && January 20, 1996
 
 I. Introduction
 
@@ -18,13 +18,12 @@
 it is heavily commented and should include everything most people
 will need.
 
-Libpng was written as a companion to the PNG specification, as a
-way to reduce the amount of time and effort it takes to support
-the PNG file format in application programs.  Most users will not
-have to modify the library significantly; advanced users may want
-to modify it more.  The library was coded for both kinds of users.
-All attempts were made to make it as complete as possible, while
-keeping the code easy to understand.  Currently, this library
+Libpng was written as a companion to the PNG specification, as a way
+to reduce the amount of time and effort it takes to support the PNG
+file format in application programs.  Most users will not have to
+modify the library significantly; advanced users may want to modify it
+more.  All attempts were made to make it as complete as possible,
+while keeping the code easy to understand.  Currently, this library
 only supports C.  Support for other languages is being considered.
 
 Libpng has been designed to handle multiple sessions at one time,
@@ -32,7 +31,7 @@
 machines (ANSI, K&R, 16 bit, 32 bit) available, and to be easy to
 use.  The ultimate goal of libpng is to promote the acceptance of
 the PNG file format in whatever way possible.  While there is still
-work to be done (see the todo.txt file), libpng should cover the
+work to be done (see the pngtodo.txt file), libpng should cover the
 majority of the needs of it's users.
 
 Libpng uses zlib for its compression and decompression of PNG files.
@@ -40,7 +39,7 @@
 useful for more than PNG files, and can be used without libpng.
 See the documentation delivered with zlib for more details.
 
-Libpng is thread safe provided the threads are using different
+Libpng is thread safe, provided the threads are using different
 instances of the structures.  Each thread should have its own
 png_struct and png_info instances, and thus its own image.
 Libpng does not protect itself against two threads using the
@@ -68,18 +67,6 @@
 
 III. Reading
 
-Checking PNG files:
-
-Libpng provides a simple check to see if a file is a PNG file.  To
-use it, pass in the first 1 to 8 bytes of the file, and it will return
-true or false (1 or 0) depending on whether the bytes could be part
-of a PNG file.  Of course, the more bytes you pass in, the greater
-the accuracy of the prediction.  If you pass in more then eight bytes,
-libpng will only look at the first eight bytes.
-
-	fread(header, 1, number, fp);
-	is_png = png_check_sig(header, number);
-
 Reading PNG files:
 
 We'll now walk you through the possible functions to call when reading
@@ -88,38 +75,47 @@
 is covered in the next section, you will still need some of the
 functions discussed in this section to read a PNG file.
 
-The first thing you need to do while reading a PNG file, aside from
-the standard I/O initialization, is to allocate and initialize
-png_struct and png_info.  As these are both large, you may not want to
-store these on the stack, unless you have stack space to spare.  Of
-course, you will want to check if malloc returns NULL.
+You will want to do the I/O initialization(*) before you get into libpng,
+so if it doesn't work, you don't have much to undo.  Of course, you
+will also want to insure that you are, in fact, dealing with a PNG
+file.  Libpng provides a simple check to see if a file is a PNG file.
+To use it, pass in the first 1 to 8 bytes of the file, and it will
+return true or false (1 or 0) depending on whether the bytes could be
+part of a PNG file.  Of course, the more bytes you pass in, the
+greater the accuracy of the prediction.  If you pass in more then
+eight bytes, libpng will only look at the first eight bytes.
 
-	png_structp png_ptr = malloc(sizeof (png_struct));
-	if (!png_ptr)
-		return;
-	png_infop info_ptr = malloc(sizeof (png_info));
-	if (!info_ptr)
-	{
-		free(png_ptr);
-		return;
-	}
-
-You may also want to do any i/o initialization here, before
-you get into libpng, so if it doesn't work, you don't have
-much to undo.
-
-	FILE *fp = fopen(file_name, "rb");
-	if (!fp)
-	{
-		free(png_ptr);
-		free(info_ptr);
-		return;
-	}
-
-If you are not using the standard i/o functions, you will need
+(*): If you are not using the standard I/O functions, you will need
 to replace them with custom functions.  See the discussion under
 Customizing libpng.
 
+    FILE *fp = fopen(file_name, "rb");
+    if (!fp)
+    {
+        return;
+    }
+    fread(header, 1, number, fp);
+    is_png = png_check_sig(header, number);
+    if (!is_png)
+    {
+        return;
+    }
+
+Next, png_struct and png_info need to be allocated and initialized.
+As these are both large, you may not want to store these on the stack,
+unless you have stack space to spare.  Of course, you will want to
+check if malloc returns NULL.
+
+    png_structp png_ptr = malloc(sizeof (png_struct));
+    if (!png_ptr)
+        return;
+    png_infop info_ptr = malloc(sizeof (png_info));
+    if (!info_ptr)
+    {
+        free(png_ptr);
+        return;
+    }
+
 After you have these structures, you will need to set up the
 error handling.  When libpng encounters an error, it expects to
 longjmp back to your routine.  Therefore, you will need to call
@@ -133,35 +129,35 @@
 If an error occurs, and libpng longjmp's back to your setjmp,
 you will want to call png_read_destroy() to free any memory.
 
-	if (setjmp(png_ptr->jmpbuf))
-	{
-		png_read_destroy(png_ptr, info_ptr, (png_info *)0);
-		/* free pointers before returning, if necessary */
-		free(png_ptr);
-		free(info_ptr);
-		fclose(fp);
-		return;
-	}
+    if (setjmp(png_ptr->jmpbuf))
+    {
+        png_read_destroy(png_ptr, info_ptr, (png_info *)0);
+        /* free pointers before returning, if necessary */
+        free(png_ptr);
+        free(info_ptr);
+        fclose(fp);
+        return;
+    }
 
 Next, you will need to call png_info_init() and png_read_init().
 These functions make sure all the fields are initialized to useful
 values, and, in the case of png_read_init(), and allocate any memory
 needed for internal uses.  You must call png_info_init() first, as
-png_read_init() could do a longjmp, and if the info is not initialized,
-the png_read_destroy() could try to png_free() random addresses, which
+png_read_init() could do a longjmp, and, if the info is not initialized,
+then png_read_destroy() could try to png_free() random addresses, which
 would be bad.
 
-   png_info_init(info_ptr);
-	png_read_init(png_ptr);
+    png_info_init(info_ptr);
+    png_read_init(png_ptr);
 
-Now you need to set up the input code.  The default for libpng is
-to use the C function fread().  If you use this, you will need to
-pass a valid FILE * in the function png_init_io().  Be sure that
-the file is opened in binary mode.  If you wish to handle reading
-data in another way, see the discussion on png i/o handling in the
-Customizing Libpng section below.
+Now you need to set up the input code.  The default for libpng is to
+use the C function fread().  If you use this, you will need to pass a
+valid FILE * in the function png_init_io().  Be sure that the file is
+opened in binary mode.  Again, if you wish to handle reading data in
+another way, see the discussion on libpng I/O handling in the Customizing
+Libpng section below.
 
-	png_init_io(png_ptr, fp);
+    png_init_io(png_ptr, fp);
 
 You are now ready to read all the file information up to the actual
 image data.  You do this with a call to png_read_info().
@@ -171,37 +167,36 @@
 The png_info structure is now filled in with all the data necessary
 to read the file.  Some of the more important parts of the png_info are:
 
-	width          - holds the width of the file
-	height         - holds the height of the file
-	bit_depth      - holds the bit depth of one of the image channels
-	color_type     - describes the channels and what they mean
-						  (see the PNG_COLOR_TYPE_ macros for more information)
-	channels       - number of channels of info for the color type
-	pixel_depth    - bits per pixel, the result of multiplying the bit_depth
-						  times the channels
-	rowbytes       - number of bytes needed to hold a row
-	interlace_type - currently 0 for none, 1 for interlaced
-	valid          - this details which optional chunks were found in the
-						  file to see if a chunk was present, AND valid with the
-						  appropriate PNG_INFO_<chunk name> define.
+    width          - holds the width of the file
+    height         - holds the height of the file
+    bit_depth      - holds the bit depth of one of the image channels
+    color_type     - describes the channels and what they mean
+                     (see the PNG_COLOR_TYPE_ macros for more information)
+    channels       - number of channels of info for the color type
+    pixel_depth    - bits per pixel, the result of multiplying the 
+                     bit_depth times the channels
+    rowbytes       - number of bytes needed to hold a row
+    interlace_type - currently 0 for none, 1 for interlaced
+    valid          - this details which optional chunks were found in the
+                     file to see if a chunk was present, AND valid with
+                     the appropriate PNG_INFO_<chunk name> define.
 
 These are also important, but their validity depends on whether a
 corresponding chunk exists. Use valid (see above) to ensure that what
 you're doing with these values makes sense.
 
-	palette        - the palette for the file
-	num_palette    - number of entries in the palette
-	gamma          - the gamma the file is written at
-	sig_bit        - the number of significant bits
-						  for the gray, red, green, and blue channels, whichever are
-						  appropriate for the given color type.
-	sig_bit_number - number of channels
-	trans_values   - transparent pixel for non-paletted images
-	trans          - array of transparent entries for paletted images
-	number_trans   - number of transparent entries
-	hist           - histogram of palette
-	text           - text comments in the file.
-	num_text       - number of comments
+    palette        - the palette for the file
+    num_palette    - number of entries in the palette
+    gamma          - the gamma the file is written at
+    sig_bit        - the number of significant bits
+                     for the gray, red, green, and blue channels, whichever
+                     are appropriate for the given color type.
+    trans_values   - transparent pixel for non-paletted images
+    trans          - array of transparent entries for paletted images
+    num_trans      - number of transparent entries
+    hist           - histogram of palette
+    text           - text comments in the file.
+    num_text       - number of comments
 
 for more information, see the png_info definition in png.h and the
 PNG specification for chunk contents.  Be careful with trusting
@@ -210,13 +205,13 @@
 See png_update_info(), below.
 
 A quick word about text and num_text.  PNG stores comments in
-keyword/text pairs, one pair per chunk.  While there are
-suggested keywords, there is no requirement to restrict the use
-to these strings.  There is a requirement to have at least one
-character for a keyword.  It is strongly suggested that keywords
-be sensible to humans (that's the point), so don't use abbreviations.
-See the png specification for more details.  There is no requirement
-to have text after the keyword.
+keyword/text pairs, one pair per chunk.  While there are suggested
+keywords, there is no requirement to restrict the use to these
+strings.  There is a requirement to have at least one character for a
+keyword.  It is strongly suggested that keywords be sensible to humans
+(that's the point), so don't use abbreviations.  See the png
+specification for more details.  There is also no requirement to have
+text after the keyword.
 
 Keywords are restricted to 80 characters without leading or trailing
 spaces, but spaces are allowed within the keyword  It is possible to
@@ -225,7 +220,7 @@
 and a pointer to a text string.  Only the text string may be null.
 The keyword/text pairs are put into the array in the order that
 they are received.  However, some or all of the text chunks may be
-after the image, so to make sure you have read all the text chunks,
+after the image, so, to make sure you have read all the text chunks,
 don't mess with these until after you read the stuff after the image.
 This will be mentioned again below in the discussion that goes with
 png_read_end().
@@ -233,59 +228,59 @@
 After you've read the file information, you can set up the library to
 handle any special transformations of the image data.  The various
 ways to transform the data will be described in the order that they
-occur.  This is important, as some of these change the color type
-and bit depth of the data, and some others only work on certain
-color types and bit depths.  Even though each transformation should
-check to see if it has data that it can do somthing with, you should
-make sure to only enable a transformation if it will be valid for
-the data.  For example, don't swap red and blue on grayscale data.
+should occur.  This is important, as some of these change the color
+type and/or bit depth of the data, and some others only work on
+certain color types and bit depths.  Even though each transformation
+checks to see if it has data that it can do somthing with, you should
+make sure to only enable a transformation if it will be valid for the
+data.  For example, don't swap red and blue on grayscale data.
 
-This transforms bit depths of less than 8 to 8 bits, changes paletted
-images to rgb, and adds an alpha channel if there is transparency
-information in a tRNS chunk.  This is probably most useful on grayscale
-images with bit depths of 2 or 4 and tRNS chunks.
+The following code transforms bit depths of less than 8 to 8 bits,
+changes paletted images to rgb, and adds an alpha channel if there is
+transparency information in a tRNS chunk.  This is probably most
+useful on grayscale images with bit depths of 2 or 4 and tRNS chunks.
 
    if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
       info_ptr->bit_depth < 8)
-		png_set_expand(png_ptr);
+        png_set_expand(png_ptr);
 
-	if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY &&
+    if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY &&
       info_ptr->bit_depth < 8)
       png_set_expand(png_ptr);
 
    if (info_ptr->valid & PNG_INFO_tRNS)
       png_set_expand(png_ptr);
 
-This handles alpha and transparency by replacing it with a background
-value.  If there was a valid one in the file, you can use it if you
-want.  However, you can replace it with your own if you want also.  If
-there wasn't one in the file, you must supply a color.  If libpng is
-doing gamma correction, you will need to tell libpng where the
-background came from so it can do the appropriate gamma correction.
-If you are modifying the color data with png_set_expand(), you must
-indicate whether the background needs to be expanded.  See the
-function definition in png.h for more details.
+The following code handles alpha and transparency by replacing it with
+a background value.  If there was a valid one in the file, you can use
+it if you want.  However, you can replace it with your own if you want
+also.  If there wasn't one in the file, you must supply a color.  If
+libpng is doing gamma correction, you will need to tell libpng where
+the background came from so it can do the appropriate gamma
+correction.  If you are telling libpong to modify the color data with
+png_set_expand(), you must indicate whether the background needs to be
+expanded.  See the function definition in png.h for more details.
 
-	png_color_16 my_background;
+    png_color_16 my_background;
 
    if (info_ptr->valid & PNG_INFO_bKGD)
       png_set_backgrond(png_ptr, &(info_ptr->background),
-			PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
+            PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
    else
       png_set_background(png_ptr, &my_background,
          PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
 
-This handles gamma transformations of the data.  Pass both the file
-gamma and the desired screen gamma.  If the file does not have a
-gamma value, you can pass one anyway if you wish.  Note that file
-gammas are inverted from screen gammas.  See the discussions on
-gamma in the PNG specification for more information.  It is strongly
-recommended that viewers support gamma correction.
+The following code handles gamma transformations of the data.  Pass
+both the file gamma and the desired screen gamma.  If the file does
+not have a gamma value, you can pass one anyway if you wish.  Note
+that file gammas are inverted from screen gammas.  See the discussions
+on gamma in the PNG specification for more information.  It is
+strongly recommended that viewers support gamma correction.
 
    if (info_ptr->valid & PNG_INFO_gAMA)
       png_set_gamma(png_ptr, screen_gamma, info_ptr->gamma);
-	else
-		png_set_gamma(png_ptr, screen_gamma, 0.45);
+    else
+        png_set_gamma(png_ptr, screen_gamma, 0.45);
 
 PNG can have files with 16 bits per channel.  If you only can handle
 8 bits per channel, this will strip the pixels down to 8 bit.
@@ -293,42 +288,46 @@
    if (info_ptr->bit_depth == 16)
       png_set_strip_16(png_ptr);
 
-If you need to reduce an rgb file to a paletted file, or if a
-paletted file has more entries then will fit on your screen,
-png_set_dither() will do that.  Note that this is a simple match
-dither, that merely finds the closest color available.  This should
-work fairly well with optimized palettes, and fairly badly with linear
-color cubes.  If you pass a palette that is larger then
-maximum_colors, the file will reduce the number of colors in the
-palette so it will fit into maximum_colors.  If there is a histogram,
-it will use it to make intelligent choices when reducing the palette.
-If there is no histogram, it may not do as good a job.
+If you need to reduce an rgb file to a paletted file, or if a paletted
+file has more entries then will fit on your screen, png_set_dither()
+will do that.  Note that this is a simple match dither that merely
+finds the closest color available.  This should work fairly well with
+optimized palettes, and fairly badly with linear color cubes.  If you
+pass a palette that is larger then maximum_colors, the file will
+reduce the number of colors in the palette so it will fit into
+maximum_colors.  If there is a histogram, it will use it to make
+intelligent choices when reducing the palette.  If there is no
+histogram, it may not do as good a job.
 
-This function will be rewritten and/or replaced in libpng 0.9, which
-will have full two pass dithering with optimized palettes.
+It should be noted that this function will be rewritten and/or
+replaced in libpng 0.9, which will have full two pass dithering with
+optimized palettes.
 
-	if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)
+   if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)
    {
       if (info_ptr->valid & PNG_INFO_PLTE)
+      {
          png_set_dither(png_ptr, info_ptr->palette,
             info_ptr->num_palette, max_screen_colors,
-               info_ptr->histogram);
+            info_ptr->histogram, 1);
+      }
       else
       {
-			png_color std_color_cube[MAX_SCREEN_COLORS] =
+         png_color std_color_cube[MAX_SCREEN_COLORS] =
             { ... colors ... };
 
          png_set_dither(png_ptr, std_color_cube, MAX_SCREEN_COLORS,
-            MAX_SCREEN_COLORS, NULL);
+            MAX_SCREEN_COLORS, NULL,0);
       }
    }
 
-PNG files describe monocrome as black is zero and white is one.  The
-following code will reverse this (make black be one and white be zero):
+PNG files describe monochrome as black being zero and white being one.
+The following code will reverse this (make black be one and white be
+zero):
 
    if (info_ptr->bit_depth == 1 &&
       info_ptr->color_type == PNG_COLOR_GRAY)
-      png_set_invert(png_ptr);
+      png_set_invert_mono(png_ptr);
 
 PNG files have possible bit depths of 1, 2, 4, 8, and 16.  However,
 they also provide a way to describe the true bit depth of the image.
@@ -336,38 +335,38 @@
 depth used in the file.  See the PNG specification for details.  This
 code reduces the pixels back down to the true bit depth:
 
-	if (info_ptr->valid & PNG_INFO_sBIT)
-		png_set_shift(png_ptr, &(info_ptr->sig_bit));
+    if (info_ptr->valid & PNG_INFO_sBIT)
+        png_set_shift(png_ptr, &(info_ptr->sig_bit));
 
 PNG files pack pixels of bit depths 1, 2, and 4 into bytes as small as
 they can, resulting in, for example, 8 pixels per byte for 1 bit
 files.  This code expands to 1 pixel per byte without changing the
 values of the pixels:
 
-	if (info_ptr->bit_depth < 8)
-		png_set_packing(png_ptr);
+    if (info_ptr->bit_depth < 8)
+        png_set_packing(png_ptr);
 
 PNG files store 3 color pixels in red, green, blue order.  This code
 changes the storage of the pixels to blue, green, red:
 
-	if (info_ptr->color_type == PNG_COLOR_TYPE_RGB ||
-		info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
-		png_set_bgr(png_ptr);
+    if (info_ptr->color_type == PNG_COLOR_TYPE_RGB ||
+        info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+        png_set_bgr(png_ptr);
 
 For some uses, you may want a gray-scale image to be represented as
 rgb.  This code will do that conversion:
 
    if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY ||
       info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
-		png_set_gray_to_rgb(png_ptr);
+         png_set_gray_to_rgb(png_ptr);
 
 PNG files store 16 bit pixels in network byte order (big-endian,
 ie. most significant bits first).  This code chages the storage to the
 other way (little-endian, ie. least significant bits first, eg. the
 way PCs store them):
 
-	if (info_ptr->bit_depth == 16)
-		png_set_swap(png_ptr);
+    if (info_ptr->bit_depth == 16)
+        png_set_swap(png_ptr);
 
 PNG files store rgb pixels packed into 3 bytes. This code packs them
 into 4 bytes:
@@ -392,7 +391,7 @@
 don't call this function, the library will automatically call it
 before it reads the first row.
 
-	png_start_read_image(png_ptr);
+    png_start_read_image(png_ptr);
 
 libpng can update your png_info structure to reflect any
 transformations you've requested with this call.  This is most useful
@@ -400,7 +399,7 @@
 allocate your image memory.  This function calls
 png_start_read_image(), so you don't have to call both of them.
 
-	png_read_update_info(png_ptr, info_ptr);
+    png_read_update_info(png_ptr, info_ptr);
 
 After you call png_read_update_info(), you can allocate any
 memory you need to hold the image.  As the actual allocation
@@ -424,50 +423,50 @@
 
 where row_pointers is:
 
-	png_bytep row_pointers[height];
+    png_bytep row_pointers[height];
 
 You can point to void or char or whatever you use for pixels.
 
-If you don't want to read the whole image in at once, you can
+If you don't want to read int the whole image at once, you can
 use png_read_rows() instead.  If there is no interlacing (check
 info_ptr->interlace_type), this is simple:
 
-	png_read_rows(png_ptr, row_pointers, NULL, number_of_rows);
+    png_read_rows(png_ptr, row_pointers, NULL, number_of_rows);
 
-row_pointers is the same as in the png_read_image() call.
+where row_pointers is the same as in the png_read_image() call.
 
-If you are just calling one row at a time, you can do this for
+If you are doing this just one row at a time, you can do this with
 row_pointers:
 
-	png_bytep row_pointers = row;
-
-	png_read_rows(png_ptr, &row_pointers, NULL, 1);
+    png_bytep row_pointers = row;
+    png_read_rows(png_ptr, &row_pointers, NULL, 1);
 
 If the file is interlaced (info_ptr->interlace_type != 0), things get
-a good deal harder.  The only currently (as of 12/95) defined
-interlacing scheme for PNG files (info_ptr->interlace_type == 1) is a
-complicated interlace scheme, known as Adam7, that breaks down an
-image into seven smaller images of varying size.  libpng will fill out
-those images or it will give them to you "as is".  If you want to fill
-them out, there are two ways to do that.  The one mentioned in the PNG
-specification is to expand each pixel to cover those pixels that have
-not been read yet.  This results in a blocky image for the first pass,
-which gradually smoothes out as more pixels are read.  The other
-method is the "sparkle" method, where pixels are draw only in their
-final locations, with the rest of the image remaining whatever colors
-they were initialized to before the start of the read.  The first
-method usually looks better, but tends to be slower, as there are more
-pixels to put in the rows.
+a good deal harder.  The only currently (as of 1/96 -- PNG
+Specification version 0.92) defined interlacing scheme for PNG files
+(info_ptr->interlace_type == 1) is a complicated interlace scheme,
+known as Adam7, that breaks down an image into seven smaller images of
+varying size.  libpng will fill out those images or it will give them
+to you "as is".  If you want them filled out, there are two ways to
+do that.  The one mentioned in the PNG specification is to expand each
+pixel to cover those pixels that have not been read yet.  This results
+in a blocky image for the first pass, which gradually smoothes out as
+more pixels are read.  The other method is the "sparkle" method, where
+pixels are draw only in their final locations, with the rest of the
+image remaining whatever colors they were initialized to before the
+start of the read.  The first method usually looks better, but tends
+to be slower, as there are more pixels to put in the rows.
 
 If you don't want libpng to handle the interlacing details, just
 call png_read_rows() the correct number of times to read in all
 seven images.  See the PNG specification for more details on the
 interlacing scheme.
 
-If you want libpng to expand the images, call this above:
+If you want libpng to expand the images, call this before calling
+png_start_read_image() or png_read_update_info():
 
-	if (info_ptr->interlace_type)
-		number_passes = png_set_interlace_handling(png_ptr);
+    if (info_ptr->interlace_type)
+        number_passes = png_set_interlace_handling(png_ptr);
 
 This will return the number of passes needed.  Currently, this
 is seven, but may change if another interlace type is added.
@@ -488,13 +487,13 @@
 not the data.  Each pass only writes the pixels appropriate for that
 pass, and assumes the data from previous passes is still valid.
 
-	png_read_rows(png_ptr, row_pointers, NULL, number_of_rows);
+    png_read_rows(png_ptr, row_pointers, NULL, number_of_rows);
 
 If you only want the first effect (the rectangles), do the same as
 before except pass the row buffer in the third parameter, and leave
 the second parameter NULL.
 
-	png_read_rows(png_ptr, NULL, row_pointers, number_of_rows);
+    png_read_rows(png_ptr, NULL, row_pointers, number_of_rows);
 
 After you are finished reading the image, you can finish reading
 the file.  If you are interested in comments or time, you should
@@ -521,7 +520,7 @@
 set up these callbacks with png_set_progressive_read_fn().  You don't
 have to worry about the input/output functions of libpng, as you are
 giving the library the data directly in png_process_data().  I will
-assume that you have read the second on reading PNG files above,
+assume that you have read the section on reading PNG files above,
 so I will only highlight the differences (although I will show
 all of the code).
 
@@ -531,146 +530,157 @@
 int
 initialize_png_reader()
 {
-	png_ptr = malloc(sizeof (png_struct));
-	if (!png_ptr)
-		return -1;
-	info_ptr = malloc(sizeof (png_info));
-	if (!info_ptr)
-	{
-		free(png_ptr);
-		return -1;
-	}
+    png_ptr = malloc(sizeof (png_struct));
+    if (!png_ptr)
+        return -1;
+    info_ptr = malloc(sizeof (png_info));
+    if (!info_ptr)
+    {
+        free(png_ptr);
+        return -1;
+    }
 
-	if (setjmp(png_ptr->jmpbuf))
-	{
-		png_read_destroy(png_ptr, info_ptr, (png_info *)0);
-		/* free pointers before returning, if necessary */
-		free(png_ptr);
-		free(info_ptr);
-		return -1;
-	}
+    if (setjmp(png_ptr->jmpbuf))
+    {
+        png_read_destroy(png_ptr, info_ptr, (png_info *)0);
+        /* free pointers before returning, if necessary */
+        free(png_ptr);
+        free(info_ptr);
+        return -1;
+    }
 
-	png_info_init(info_ptr);
-	png_read_init(png_ptr);
+    png_info_init(info_ptr);
+    png_read_init(png_ptr);
 
-	/* this one's new.  You will need to provide all three
-		function callbacks, even if you aren't using them all.
-		You can use any void pointer as the user_ptr, and
-		retrieve the pointer from inside the callbacks using
-      the function png_get_progressive_ptr(png_ptr); */
-	png_set_progressive_read_fn(png_ptr, user_ptr,
-		info_callback, row_callback, end_callback);
+    /*
+        This one's new.  You will need to provide all three
+        function callbacks, even if you aren't using them all.
+        You can use any void pointer as the user_ptr, and
+        retrieve the pointer from inside the callbacks using
+        the function png_get_progressive_ptr(png_ptr);        
+    */
+     png_set_progressive_read_fn(png_ptr, user_ptr,
+        info_callback, row_callback, end_callback);
 
-	return 0;
+    return 0;
 }
 
 int
 process_data(png_bytep buffer, png_uint_32 length)
 {
-	if (setjmp(png_ptr->jmpbuf))
-	{
-		png_read_destroy(png_ptr, info_ptr, (png_info *)0);
-		free(png_ptr);
-		free(info_ptr);
-		return -1;
-	}
+    if (setjmp(png_ptr->jmpbuf))
+    {
+        png_read_destroy(png_ptr, info_ptr, (png_info *)0);
+        free(png_ptr);
+        free(info_ptr);
+        return -1;
+    }
 
-	/* this one's new also.  Simply give it a chunk of data
-		from the file stream (in order, of course).  On Segmented
-		machines, don't give it any more then 64K.  The library
-		seems to run fine with sizes of 4K, although you can give
-		it much less if necessary (I assume you can give it chunks
-		of 1 byte, but I haven't tried less then 256 bytes yet).
-		When this function returns, you may want to display any
-		rows that were generated in the row callback. */
-	png_process_data(png_ptr, info_ptr, buffer, length);
-	return 0;
+    /* 
+        This one's new also.  Simply give it a chunk of data
+        from the file stream (in order, of course).  On machines
+        with segmented memory models machines, don't give it any 
+        more than 64K.  The library seems to run fine with sizes 
+        of 4K. Although you can give it much less if necessary 
+        (I assume you can give it chunks of 1 byte, I haven't
+        tried less then 256 bytes yet).  When this function returns,
+        you may want to display any rows that were generated in the
+        row callback. 
+    */
+    png_process_data(png_ptr, info_ptr, buffer, length);
+    return 0;
 }
 
 info_callback(png_structp png_ptr, png_infop info)
 {
-	do any setup here, including setting any of the transformations
-	mentioned in the Reading PNG files section.  For now, you _must_
-	call either png_start_read_image() or png_read_update_info()
-	after all the transformations are set (even if you don't set
-	any).  You may start getting rows before png_process_data()
-	returns, so this is your last chance to prepare for that.
+    /*
+        Do any setup here, including setting any of the transformations
+        mentioned in the Reading PNG files section.  For now, you _must_
+        call either png_start_read_image() or png_read_update_info()
+        after all the transformations are set (even if you don't set
+        any).  You may start getting rows before png_process_data()
+        returns, so this is your last chance to prepare for that.
+    */
 }
 
 row_callback(png_structp png_ptr, png_bytep new_row,
-	png_uint_32 row_num, int pass)
+    png_uint_32 row_num, int pass)
 {
-	this function is called for every row in the image.  If the
-	image is interlacing, and you turned on the interlace handler,
-	this function will be called for every row in every pass.
-	Some of these rows will not be changed from the previous pass.
-	When the row is not changed, the new_row variable will be NULL.
-	The rows and passes are called in order, so you don't really
-	need the row_num and pass, but I'm supplying them because it
-	may make your life easier.
+    /* 
+        This function is called for every row in the image.  If the
+        image is interlaced, and you turned on the interlace handler,
+        this function will be called for every row in every pass.
+        Some of these rows will not be changed from the previous pass.
+        When the row is not changed, the new_row variable will be NULL.
+        The rows and passes are called in order, so you don't really
+        need the row_num and pass, but I'm supplying them because it
+        may make your life easier.
 
-	For the non-NULL rows of interlaced images, you must call
-	png_progressive_combine_row() passing in the row and the
-	old row.  You can call this function for NULL rows (it will
-	just return) and for non-interlaced images (it just does the
-	memcpy for you) if it will make the code easier.  Thus, you
-	can just do this for all cases:
+        For the non-NULL rows of interlaced images, you must call
+        png_progressive_combine_row() passing in the row and the
+        old row.  You can call this function for NULL rows (it will
+        just return) and for non-interlaced images (it just does the
+        memcpy for you) if it will make the code easier.  Thus, you
+        can just do this for all cases:
 
-	png_progressive_combine_row(png_ptr, old_row, new_row);
+        png_progressive_combine_row(png_ptr, old_row, new_row);
 
-	where old_row is what was displayed for previous rows.  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 the current row, and the function will combine the
-	old row and the new row.
+        where old_row is what was displayed for previous rows.  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 the current row, and the function will combine the
+        old row and the new row.
+    */  
 }
 
 end_callback(png_structp png_ptr, png_infop info)
 {
-	this function is called when the whole image has been read,
-	including any chunks after the image (up to and including
-	the IEND).  You will usually have the same info chunk as you
-	had in the header, although some data may have been added
-	to the comments and time fields.
+    /*  
+        This function is called after the whole image has been read,
+        including any chunks after the image (up to and including
+        the IEND).  You will usually have the same info chunk as you
+        had in the header, although some data may have been added
+        to the comments and time fields.
 
-	Most people won't do much here, perhaps setting a flag that
-	marks the image as finished.
+        Most people won't do much here, perhaps setting a flag that
+        marks the image as finished.
+    */
 }
 
 
+
 IV. Writing
 
 Much of this is very similar to reading.  However, everything of
-importance is repeated here, so you don't have to constantly look
+importance is repeated here, so you won't have to constantly look
 back up in the reading section to understand writing.
 
-The first thing you need to do while writing a PNG file is to allocate
-and initialize png_struct and png_info.  As these are both large, you
-may not want to store these on the stack, unless you have stack space
-to spare.
+You will want to do the I/O initialization before you get into libpng,
+so if it doesn't work, you don't have much to undo. If you are not
+using the standard I/O functions, you will need to replace them with
+custom functions.  See the discussion under Customizing libpng.
+    
+    FILE *fp = fopen(file_name, "wb");
+    if (!fp)
+    {
+        return;
+    }
 
-	png_structp png_ptr = malloc(sizeof (png_struct));
-	if (!png_ptr)
-		return;
-   png_infop info_ptr = malloc(sizeof (png_info));
-	if (!info_ptr)
-   {
-      free(png_ptr);
-      return;
-   }
+Next, png_struct and png_info need to be allocated and initialized.
+As these are both large, you may not want to store these on the stack,
+unless you have stack space to spare.  Of course, you will want to
+check if malloc returns NULL.
 
-You may also want to do any i/o initialization here, before
-you get into libpng, so if it doesn't work, you don't have
-much to undo.
-
-   FILE *fp = fopen(file_name, "wb");
-   if (!fp)
-   {
-      free(png_ptr);
-		free(info_ptr);
-      return;
-   }
+    png_structp png_ptr = malloc(sizeof (png_struct));
+    if (!png_ptr)
+        return;
+    png_infop info_ptr = malloc(sizeof (png_info));
+    if (!info_ptr)
+    {
+        free(png_ptr);
+        return;
+    }
 
 After you have these structures, you will need to set up the
 error handling.  When libpng encounters an error, it expects to
@@ -682,36 +692,36 @@
 for your compiler for more information on setjmp/longjmp.  See
 the discussion on libpng error handling in the Customizing Libpng
 section below for more information on the libpng error handling.
+    
+    if (setjmp(png_ptr->jmpbuf))
+    {    
+        png_write_destroy(png_ptr);
+        /* free pointers before returning.  Make sure you clean up
+           anything else you've done. */
+        free(png_ptr);
+        free(info_ptr);
+        fclose(fp);
+        return;
+    }
 
-   if (setjmp(png_ptr->jmpbuf))
-   {
-      png_write_destroy(png_ptr);
-		/* free pointers before returning.  Make sure you clean up
-         anything else you've done. */
-      free(png_ptr);
-      free(info_ptr);
-		fclose(fp);
-      return;
-   }
-
-Next, you will need to call png_info_init() and png_write_init().
+Then, you will need to call png_info_init() and png_write_init().
 These functions make sure all the fields are initialized to useful
 values, and, in the case of png_write_init(), allocate any memory
 needed for internal uses.  Do png_info_init() first, so if
 png_write_init() longjmps, you know info_ptr is valid, so you
 don't free random memory pointers, which would be bad.
 
-   png_info_init(info_ptr);
-	png_write_init(png_ptr);
+    png_info_init(info_ptr);
+    png_write_init(png_ptr);
 
-Now you need to set up the input code.  The default for libpng is
-to use the C function fwrite().  If you use this, you will need to
-pass a valid FILE * in the function png_init_io().  Be sure that
-the file is opened in binary mode.  If you wish to handle writing
-data in another way, see the discussion on png i/o handling in the
-Customizing Libpng section below.
+Now you need to set up the input code.  The default for libpng is to
+use the C function fwrite().  If you use this, you will need to pass a
+valid FILE * in the function png_init_io().  Be sure that the file is
+opened in binary mode.  Again, if you wish to handle writing data in
+another way, see the discussion on libpng I/O handling in the Customizing
+Libpng section below.
 
-   png_init_io(png_ptr, fp);
+    png_init_io(png_ptr, fp);
 
 You now have the option of modifying how the compression library
 will run.  The following functions are mainly for testing, but
@@ -722,21 +732,22 @@
 in this area, let the library do what it wants, as it has been
 carefully tuned to deliver the best speed/compression ratio.
 See the compression library for more details.
+    
+    /* turn on or off filtering (1 or 0) */
+    png_set_filtering(png_ptr, 1);
 
-   /* turn on or off filtering (1 or 0) */
-   png_set_filtering(png_ptr, 1);
+    /* compression level (0 - none, 6 - default, 9 - maximum) */
+    png_set_compression_level(png_ptr, Z_DEFAULT_COMPRESSION);
+    png_set_compression_mem_level(png_ptr, 8);
+    png_set_compression_strategy(png_ptr, Z_DEFAULT_STRATEGY);
+    png_set_compression_window_bits(png_ptr, 15);
+    png_set_compression_method(png_ptr, 8);
 
-   /* compression level (0 - none, 6 - default, 9 - maximum) */
-	png_set_compression_level(png_ptr, Z_DEFAULT_COMPRESSION);
-   png_set_compression_mem_level(png_ptr, 8);
-   png_set_compression_strategy(png_ptr, Z_DEFAULT_STRATEGY);
-   png_set_compression_window_bits(png_ptr, 15);
-   png_set_compression_method(png_ptr, 8);
-
-You now need to fill in the png_info structure with all the data
-you wish to write before the actual image.  Note that the only thing
-you are allowed to write after the image is the text chunks and the
-time chunk.  See png_write_end() for more information on that.  If you
+You now need to fill in the png_info structure with all the data you
+wish to write before the actual image.  Note that the only thing you
+are allowed to write after the image is the text chunks and the time
+chunk (as of PNG Specification 0.92, anyway).  See png_write_end() and
+the latest PNG specification for more information on that.  If you
 wish to write them before the image, fill them in now.  If you want to
 wait until after the data, don't fill them until png_write_end().  For
 all the fields in png_info, see png.h.  For explanations of what the
@@ -744,31 +755,30 @@
 
 Some of the more important parts of the png_info are:
 
-	width          - holds the width of the file
-	height         - holds the height of the file
-	bit_depth      - holds the bit depth of one of the image channels
-	color_type     - describes the channels and what they mean
-						  see the PNG_COLOR_TYPE_ defines for more information
-   interlace_type - currently 0 for none, 1 for interlaced
-	valid          - this describes which optional chunks to write to the
-						  file.  Note that if you are writing a
-						  PNG_COLOR_TYPE_PALETTE file, the PLTE chunk is not
-						  optional, but must still be marked for writing.  To
-						  mark chunks for writing, OR valid with the appropriate
-						  PNG_INFO_<chunk name> define.
-	palette        - the palette for the file
-	num_palette    - number of entries in the palette
-	gamma          - the gamma the file is written at
-	sig_bit        - the number of significant bits
-						  for the gray, red, green, and blue channels, whichever are
-						  appropriate for the given color type.
-   sig_bit_number - number of channels
-	trans_values   - transparent pixel for non-paletted images
-	trans          - array of transparent entries for paletted images
-	number_trans   - number of transparent entries
-	hist           - histogram of palette
-	text           - text comments in the file.
-	num_text       - number of comments
+    width          - holds the width of the file
+    height         - holds the height of the file
+    bit_depth      - holds the bit depth of one of the image channels
+    color_type     - describes the channels and what they mean
+                     see the PNG_COLOR_TYPE_ defines for more information
+    interlace_type - currently 0 for none, 1 for interlaced
+    valid          - this describes which optional chunks to write to the
+                     file.  Note that if you are writing a
+                     PNG_COLOR_TYPE_PALETTE file, the PLTE chunk is not
+                     optional, but must still be marked for writing.  To
+                     mark chunks for writing, OR valid with the 
+                     appropriate PNG_INFO_<chunk name> define.
+    palette        - the palette for the file
+    num_palette    - number of entries in the palette
+    gamma          - the gamma the file is written at
+    sig_bit        - the number of significant bits for the gray, red, 
+                     green, and blue channels, whichever are appropriate
+                     for the given color type.
+    trans_values   - transparent pixel for non-paletted images
+    trans          - array of transparent entries for paletted images
+    num_trans      - number of transparent entries
+    hist           - histogram of palette
+    text           - text comments in the file.
+    num_text       - number of comments
 
 A quick word about text and num_text.  text is an array of png_text
 structures.  num_text is the number of valid structures in the array.
@@ -811,12 +821,12 @@
 or automatically after a certain number of lines have been written.  To
 flush the output stream a single time call:
 
-	png_write_flush(png_ptr);
+    png_write_flush(png_ptr);
 
 and to have libpng flush the output stream periodically after a certain
 number of scanlines have been written, call:
 
-	png_set_flush(png_ptr, nrows);
+    png_set_flush(png_ptr, nrows);
 
 Note that the distance between rows is from the last time png_write_flush
 was called, or the first row of the image if it has never been called.
@@ -831,22 +841,22 @@
 You are now ready to write all the file information up to the actual
 image data.  You do this with a call to png_write_info().
 
-	png_write_info(png_ptr, info_ptr);
+    png_write_info(png_ptr, info_ptr);
 
 After you've read the file information, you can set up the library to
 handle any special transformations of the image data.  The various
 ways to transform the data will be described in the order that they
-occur.  This is important, as some of these change the color type
-and bit depth of the data, and some others only work on certain
-color types and bit depths.  Even though each transformation should
-check to see if it has data that it can do somthing with, you should
-make sure to only enable a transformation if it will be valid for
-the data.  For example, don't swap red and blue on grayscale data.
+should occur.  This is important, as some of these change the color
+type and/or bit depth of the data, and some others only work on
+certain color types and bit depths.  Even though each transformation
+checks to see if it has data that it can do somthing with, you should
+make sure to only enable a transformation if it will be valid for the
+data.  For example, don't swap red and blue on grayscale data.
 
 PNG files store rgb pixels packed into 3 bytes.  This code tells
 the library to use 4 bytes per pixel
 
-	png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
+    png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
 
 where the 0 is not used for writing, and the location is either
 PNG_FILLER_BEFORE or PNG_FILLER_AFTER, depending upon whether you
@@ -857,54 +867,54 @@
 If the data is supplied at 1 pixel per byte, use this code, which will
 correctly pack the values:
 
-	png_set_packing(png_ptr);
+    png_set_packing(png_ptr);
 
 PNG files reduce possible bit depths to 1, 2, 4, 8, and 16.  If your
 data is of another bit depth, but is packed into the bytes correctly,
 this will scale the values to appear to be the correct bit depth.
 Make sure you write a sBIT chunk when you do this, so others, if
 they want, can reduce the values down to their true depth.
+    
+    /* Do this before png_write_info() */
+    info_ptr->valid |= PNG_INFO_sBIT;
 
-	/* do this before png_write_info() */
-	info_ptr->valid |= PNG_INFO_sBIT;
+    /* Note that you can cheat and set all the values of
+       sig_bit to true_bit_depth if you want */
+    if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)
+    {
+        info_ptr->sig_bit.red = true_bit_depth;
+        info_ptr->sig_bit.green = true_bit_depth;
+        info_ptr->sig_bit.blue = true_bit_depth;
+    }
+    else
+    {
+        info_ptr->sig_bit.gray = true_bit_depth;
+    }
 
-	/* note that you can cheat and set all the values of
-		sig_bit to true_bit_depth if you want */
-	if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)
-	{
-      info_ptr->sig_bit.red = true_bit_depth;
-      info_ptr->sig_bit.green = true_bit_depth;
-      info_ptr->sig_bit.blue = true_bit_depth;
-   }
-   else
-   {
-      info_ptr->sig_bit.gray = true_bit_depth;
-   }
+    if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
+    {
+        info_ptr->sig_bit.alpha = true_bit_depth;
+    }
 
-   if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
-   {
-      info_ptr->sig_bit.alpha = true_bit_depth;
-   }
-
-   png_set_shift(png_ptr, &(info_ptr->sig_bit));
+    png_set_shift(png_ptr, &(info_ptr->sig_bit));
 
 PNG files store 16 bit pixels in network byte order (big-endian,
-ie. most significant bits first).  This code would be used to supply
-them the other way (little-endian, ie. least significant bits first,
-eg. the way PCs store them):
+ie. most significant bits first).  This code would be used if they are
+supplied the other way (little-endian, ie. least significant bits
+first, eg. the way PCs store them):
 
-   png_set_swap(png_ptr);
+    png_set_swap(png_ptr);
 
 PNG files store 3 color pixels in red, green, blue order.  This code
-would be used to supply the pixels as blue, green, red:
+would be used if they are supplied as blue, green, red:
 
-   png_set_bgr(png_ptr);
+    png_set_bgr(png_ptr);
 
 PNG files describe monochrome as black being zero and white being
-one. This code would be used to supply the pixels with this reversed
+one. This code would be used if the pixels are supplied with this reversed
 (black being one and white being zero):
 
-	png_set_invert(png_ptr);
+    png_set_invert(png_ptr);
 
 That's it for the transformations.  Now you can write the image data.
 The simplest way to do this is in one function call.  If have the
@@ -914,11 +924,11 @@
 need to call png_set_interlace_handling() or call this function multiple
 times, or any of that other stuff necessary with png_write_rows().
 
-   png_write_image(png_ptr, row_pointers);
+    png_write_image(png_ptr, row_pointers);
 
 where row_pointers is:
 
-   png_bytef *row_pointers[height];
+    png_bytef *row_pointers[height];
 
 You can point to void or char or whatever you use for pixels.
 
@@ -926,24 +936,25 @@
 use png_write_rows() instead.  If the file is not interlaced,
 this is simple:
 
-   png_write_rows(png_ptr, row_pointers, number_of_rows);
+    png_write_rows(png_ptr, row_pointers, number_of_rows);
 
 row_pointers is the same as in the png_write_image() call.
 
-If you are just calling one row at a time, you can do this for
+If you are just writing one row at a time, you can do this with
 row_pointers:
 
-	png_bytep row_pointers = row;
+    png_bytep row_pointers = row;
 
-   png_write_rows(png_ptr, &row_pointers, 1);
+    png_write_rows(png_ptr, &row_pointers, 1);
 
 When the file is interlaced, things can get a good deal more
-complicated.  The only currently (as of 12/95) defined interlacing
-scheme for PNG files is a compilcated interlace scheme, known as
-Adam7, that breaks down an image into seven smaller images of varying
-size.  libpng will build these images for you, or you can do them
-yourself.  If you want to build them yourself, see the PNG
-specification for details of which pixels to write when.
+complicated.  The only currently (as of 1/96 -- PNG Specification
+version 0.92) defined interlacing scheme for PNG files is a
+compilcated interlace scheme, known as Adam7, that breaks down an
+image into seven smaller images of varying size.  libpng will build
+these images for you, or you can do them yourself.  If you want to
+build them yourself, see the PNG specification for details of which
+pixels to write when.
 
 If you don't want libpng to handle the interlacing details, just
 call png_write_rows() the correct number of times to write all
@@ -952,14 +963,14 @@
 If you want libpng to build the sub-images, call this before you start
 writing any rows:
 
-	number_passes = png_set_interlace_handling(png_ptr);
+    number_passes = png_set_interlace_handling(png_ptr);
 
 This will return the number of passes needed.  Currently, this
 is seven, but may change if another interlace type is added.
 
 Then write the image number_passes times.
 
-	png_write_rows(png_ptr, row_pointers, number_of_rows);
+    png_write_rows(png_ptr, row_pointers, number_of_rows);
 
 As some of these rows are not used, and thus return immediately,
 you may want to read about interlacing in the PNG specification,
@@ -971,7 +982,7 @@
 are not interested, you can pass NULL.  Be careful that you don't
 write the same text or time chunks here as you did in png_write_info().
 
-	png_write_end(png_ptr, info_ptr);
+    png_write_end(png_ptr, info_ptr);
 
 When you are done, you can free all memory used by libpng like this:
 
@@ -991,10 +1002,10 @@
 The second deals with more complicated things like adding new chunks,
 adding new transformations, and generally changing how libpng works.
 
-All of the memory allocation, input/output, and error handling in libpng
-goes through callbacks which are user setable.  The default routines
-are in pngerror.c, pngmem.c, and pngio.c.  To change these functions,
-call the approprate _fn function.
+All of the memory allocation, input/output, and error handling in
+libpng goes through callbacks which are user setable.  The default
+routines are in pngmem.c, pngio.c, and pngerror.c respectively.  To
+change these functions, call the approprate _fn function.
 
 Memory allocation is done through the functions png_large_malloc(),
 png_malloc(), png_realloc(), png_large_free(), and png_free().
@@ -1014,21 +1025,21 @@
 functions also provide a void pointer that can be retrieved via the function
 png_get_io_ptr().  For example:
 
-	png_set_read_fn(png_structp png_ptr, voidp io_ptr,
-		png_rw_ptr read_data_fn)
+    png_set_read_fn(png_structp png_ptr, voidp io_ptr,
+        png_rw_ptr read_data_fn)
 
-	png_set_write_fn(png_structp png_ptr, voidp io_ptr,
-		png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn);
+    png_set_write_fn(png_structp png_ptr, voidp io_ptr,
+        png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn);
 
-	voidp io_ptr = png_get_io_ptr(png_ptr);
+    voidp io_ptr = png_get_io_ptr(png_ptr);
 
 The replacement I/O functions should have prototypes as follows:
 
-	void user_read_data(png_structp png_ptr, png_bytep data,
-		png_uint_32 length);
-	void user_write_data(png_structp png_ptr, png_bytep data,
-		png_uint_32 length);
-	void user_flush_data(png_structp png_ptr);
+    void user_read_data(png_structp png_ptr, png_bytep data,
+        png_uint_32 length);
+    void user_write_data(png_structp png_ptr, png_bytep data,
+        png_uint_32 length);
+    void user_flush_data(png_structp png_ptr);
 
 Supplying NULL for the read, write, or flush functions sets them back
 to using the default C stream functions.  It is an error to read from
@@ -1044,15 +1055,15 @@
 you wish to change the behavior of the error functions, you will need to
 set up your own message callbacks.  You do this like the I/O callbacks above.
 
-	  png_set_message_fn(png_structp png_ptr, png_voidp msg_ptr,
-		  png_msg_ptr error_fn, png_msg_ptr warning_fn);
+    png_set_message_fn(png_structp png_ptr, png_voidp msg_ptr,
+        png_msg_ptr error_fn, png_msg_ptr warning_fn);
 
-	  png_voidp msg_ptr = png_get_msg_ptr(png_ptr);
+    png_voidp msg_ptr = png_get_msg_ptr(png_ptr);
 
 The replacement message functions should have parameters as follows:
 
-	void user_error_fn(png_struct png_ptr, png_const_charp error_msg);
-	void user_warning_fn(png_struct png_ptr, png_const_charp warning_msg);
+    void user_error_fn(png_struct png_ptr, png_const_charp error_msg);
+    void user_warning_fn(png_struct png_ptr, png_const_charp warning_msg);
 
 The motivation behind using setjmp() and longjmp() is the C++ throw and
 catch exception handling methods.  This makes the code much easier to write,
@@ -1066,16 +1077,16 @@
 into the libpng code.  First, read the PNG specification, and have
 a first level of understanding of how it works.  Pay particular
 attention to the sections that describe chunk names, and look
-at how other chunks were designed, so you can do things similar.
+at how other chunks were designed, so you can do things similarly.
 Second, check out the sections of libpng that read and write chunks.
-Try to find a chunk that is similar to yours, and copy off of it.
+Try to find a chunk that is similar to yours and copy off of it.
 More details can be found in the comments inside the code.
 
 If you wish to write your own transformation for the data, look
 through the part of the code that does the transformations, and check
-out some of the more simple ones to get an idea of how they work.  Try
-to find a similar transformation to the one you want to add, and copy
-off of it.  More details can be found in the comments inside the code
+out some of the simpler ones to get an idea of how they work.  Try to
+find a similar transformation to the one you want to add and copy off
+of it.  More details can be found in the comments inside the code
 itself.
 
 Configuring for 16 bit platforms:
@@ -1128,27 +1139,27 @@
 compression (9) or maximum speed (1), you may desire to change the
 level.  You do this by calling:
 
-	png_set_compression_mem_level(png_ptr, level);
+    png_set_compression_mem_level(png_ptr, level);
 
 Another useful one is to reduce the memory level used by the library.
 The memory level defaults to 8, but it can be lowered if you are
 short on memory (running DOS, for example, where you only have 640K).
 
-	png_set_compression_mem_level(png_ptr, level);
+    png_set_compression_mem_level(png_ptr, level);
 
 If you want to control whether libpng uses filtering or not, you
 can call this function.  I recommend not changing the default unless
 you are experimenting with compression ratios.
 
-	png_set_filtering(png_ptr, use_filter);
+    png_set_filtering(png_ptr, use_filter);
 
 The other functions are for configuring zlib.  They are not recommended
 for normal use and may result in writing an invalid png file.  See
 zlib.h for more information on what these mean.
 
-	png_set_compression_strategy(png_ptr, strategy);
-	png_set_compression_window_bits(png_ptr, window_bits);
-	png_set_compression_method(png_ptr, method);
+    png_set_compression_strategy(png_ptr, strategy);
+    png_set_compression_window_bits(png_ptr, window_bits);
+    png_set_compression_method(png_ptr, method);
 
 Except for png_set_filtering(), all of these are just controlling
 zlib, so see the zlib documentation (zlib.h and zconf.h) for more
diff --git a/makefile.sun b/makefile
similarity index 86%
rename from makefile.sun
rename to makefile
index ad3a9ff..ae3a0be 100644
--- a/makefile.sun
+++ b/makefile
@@ -2,15 +2,15 @@
 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
 # For conditions of distribution and use, see copyright notice in png.h
 
-CC=gcc
-CFLAGS=-I../zlib -O2 -Wall
+CC=cc
+CFLAGS=-I../zlib -O
 LDFLAGS=-L. -L../zlib/ -lpng -lz -lm
 
-RANLIB=ranlib
-#RANLIB=echo
+#RANLIB=ranlib
+RANLIB=echo
 
 # where make install puts libpng.a and png.h
-prefix=/home/munet-d2/sun/local
+prefix=/usr/local
 
 OBJS = png.o pngrcb.o pngrutil.o pngtrans.o pngwutil.o \
 	pngread.o pngio.o pngwrite.o pngrtran.o pngwtran.o \
@@ -31,12 +31,11 @@
 install: libpng.a
 	-@mkdir $(prefix)/include
 	-@mkdir $(prefix)/lib
-	cp png.h pngconf.h $(prefix)/include
-	rcp png.h pngconf.h vlsi:bin/include
+	cp png.h $(prefix)/include
+	cp pngconf.h $(prefix)/include
 	chmod 644 $(prefix)/include/png.h
 	chmod 644 $(prefix)/include/pngconf.h
 	cp libpng.a $(prefix)/lib
-	rcp libpng.a vlsi:bin/lib
 	chmod 644 $(prefix)/lib/libpng.a
 
 clean:
diff --git a/makefile.ama b/makefile.ama
new file mode 100644
index 0000000..367431c
--- /dev/null
+++ b/makefile.ama
@@ -0,0 +1,42 @@
+# Commodore Amiga Makefile
+# makefile for libpng and SAS C V6.55 compiler
+# Copyright (C) 1995 Wolf Faust
+
+#compiler
+CC=sc
+#compiler flags
+# WARNING: a bug in V6.51 causes bad code with OPTGO
+#          So use V6.55 or set NOOPTGO!!!!!!!!!
+CFLAGS= NOSTKCHK PARMS=REG OPTIMIZE OPTGO OPTPEEP OPTINLOCAL OPTINL\
+        OPTLOOP OPTRDEP=4 OPTDEP=4 OPTCOMP=4 DEFINE=PNG_INTERNAL
+#linker flags
+LDFLAGS= SD ND BATCH
+#link libs
+LDLIBS= libpng.lib libgz.lib LIB:scm.lib LIB:sc.lib Lib:amiga.lib
+# linker
+LN= slink
+# file deletion command
+RM= delete quiet
+# library (.lib) file creation command
+AR= oml
+# make directory command
+MKDIR= makedir
+
+OBJS = png.o pngrcb.o pngrutil.o pngtrans.o pngwutil.o pngpread.o \
+pngread.o pngerror.o pngwrite.o pngrtran.o pngwtran.o pngio.o pngmem.o
+
+all: libpng.lib pngtest
+
+libpng.lib: $(OBJS)
+-$(RM) libpng.lib
+$(AR) libpng.lib r $(OBJS)
+
+pngtest: pngtest.o libpng.lib
+$(LN) <WITH <
+$(LDFLAGS)
+TO pngtest
+FROM LIB:c.o pngtest.o
+LIB $(LDLIBS)
+<
+
+
diff --git a/makefile.atr b/makefile.atr
new file mode 100644
index 0000000..88ba163
--- /dev/null
+++ b/makefile.atr
@@ -0,0 +1,31 @@
+# makefile for libpng
+# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
+# For conditions of distribution and use, see copyright notice in png.h
+# modified for LC56/ATARI assumes libz.lib is in same dir and uses default
+# rules for library management
+#
+CFLAGS=-I..\zlib -O
+LBR = png.lib
+LDFLAGS=-lpng -lz -lm
+
+# where make install puts libpng.a and png.h
+
+OBJS = $(LBR)(png.o) $(LBR)(pngrcb.o) $(LBR)(pngrutil.o)\
+	$(LBR)(pngtrans.o) $(LBR)(pngwutil.o)\
+	$(LBR)(pngread.o) $(LBR)(pngerror.o) $(LBR)(pngwrite.o)\
+	$(LBR)(pngrtran.o) $(LBR)(pngwtran.o)\
+   $(LBR)(pngmem.o) $(LBR)(pngio.o) $(LBR)(pngpread.o)
+
+all: $(LBR) pngtest.ttp
+
+$(LBR): $(OBJS)
+
+pngtest.ttp: pngtest.o $(LBR)
+	$(CC) $(CFLAGS) $(LDFLAGS) -o$@ pngtest.o
+
+install: libpng.a
+	-@mkdir $(prefix)/include
+	-@mkdir $(prefix)/lib
+	cp png.h $(prefix)/include
+	cp pngconf.h $(prefix)/include
+	chmod 644 $(prefix)/include/p
diff --git a/makefile.bor b/makefile.bor
new file mode 100644
index 0000000..1716099
--- /dev/null
+++ b/makefile.bor
@@ -0,0 +1,165 @@
+# Makefile for libpng
+# Borland C++ 4.5 (Note: All modules are compiled in C mode)
+# Will work with C++ 4.02 also
+# To build the library, do: 
+#       "make -fmakefile.bor -DMODEL=m"
+# or:   "make -fmakefile.bor -DMODEL=l"
+#
+# ------------- Borland C++ 4.5 -------------
+
+### Absolutely necessary for this makefile to work
+.AUTODEPEND
+
+## Useful user options
+
+# Usually defined in builtins.mak or the environment
+# Currently unused.
+!ifndef BCROOT
+BCROOT=N:\BC45
+!endif
+
+# Where zlib.h and zconf.h and zlib.lib are
+ZLIB_PATH=..\zlib
+
+!ifndef MODEL
+MODEL=l
+!endif
+
+#TARGET_CPU=3
+# 2 = 286, 3 = 386, etc.
+!ifndef TARGET_CPU
+TARGET_CPU=2
+!endif
+
+
+# Use this if you don't want Borland's fancy exception handling.
+NOEHLIB=noeh$(MODEL).lib
+
+!ifdef DEBUG
+CDEBUG=-v
+LDEBUG=-v
+!else
+CDEBUG=
+LDEBUG=
+!endif
+
+# STACKOFLOW=1
+!ifdef STACKOFLOW
+CDEBUG=$(CDEBUG) -N
+LDEBUG=$(LDEBUG) -N
+!endif
+
+
+## Compiler, linker, and lib stuff
+CC=bcc
+LD=bcc
+LIB=tlib
+
+MODELARG=-m$(MODEL)
+
+# -X- turns on dependency generation in the object file
+# -w  sets all warnings on
+# -O2 optimize for speed
+# -Z  global optimization
+CFLAGS=-O2 -Z -X- -w -I$(ZLIB_PATH) -$(TARGET_CPU) $(MODELARG) $(CDEBUG)
+
+# -M  generate map file
+LDFLAGS=-M $(LDEBUG)
+
+O=obj
+
+## variables
+OBJS = \
+ png.$(O) \
+ pngrcb.$(O) \
+ pngrutil.$(O) \
+ pngtrans.$(O) \
+ pngwutil.$(O) \
+ pngmem.$(O) \
+ pngread.$(O) \
+ pngpread.$(O) \
+ pngerror.$(O) \
+ pngwrite.$(O) \
+ pngrtran.$(O) \
+ pngwtran.$(O) \
+ pngzlib.$(O) \
+ pngio.$(O)
+
+LIBOBJS = \
+ +png.$(O) \
+ +pngrcb.$(O) \
+ +pngrutil.$(O) \
+ +pngtrans.$(O) \
+ +pngwutil.$(O) \
+ +pngmem.$(O) \
+ +pngpread.$(O) \
+ +pngread.$(O) \
+ +pngerror.$(O) \
+ +pngwrite.$(O) \
+ +pngrtran.$(O) \
+ +pngwtran.$(O) \
+ +pngzlib.$(O) \
+ +pngio.$(O)
+
+LIBNAME=libpng$(MODEL).lib
+
+
+## Implicit rules
+# Braces let make "batch" calls to the compiler,
+# 2 calls instead of 12; space is important.
+.c.obj:
+	$(CC) $(CFLAGS) -c {$*.c }
+
+.c.exe:
+	$(CC) $(CFLAGS) $(LDFLAGS) $*.c
+
+
+## Major targets
+libpng: $(LIBNAME)
+
+pngtest: pngtest$(MODEL).exe
+
+test:
+	pngtest$(MODEL)
+
+
+## Minor Targets
+
+png.obj: png.c
+pngrcb.obj: pngrcb.c
+pngread.obj: pngread.c
+pngpread.obj: pngpread.c
+pngrtran.obj: pngrtran.c
+pngrutil.obj: pngrutil.c
+pngerror.obj: pngerror.c
+pngmem.obj: pngmem.c
+pngio.obj: pngio.c
+pngtrans.obj: pngtrans.c
+pngwrite.obj: pngwrite.c
+pngwtran.obj: pngwtran.c
+pngwutil.obj: pngwutil.c
+pngzlib.obj: pngzlib.c
+
+
+$(LIBNAME): $(OBJS)
+	-del $(LIBNAME)
+        $(LIB) $(LIBNAME) @&&|
+$(LIBOBJS), libpng$(MODEL)
+|
+
+
+pngtest$(MODEL).obj: pngtest.c
+	$(CC) $(CFLAGS) -opngtest$(MODEL) -c pngtest.c
+
+pngtest$(MODEL).exe: pngtest$(MODEL).obj
+	$(CC) $(MODELARG) $(LDFLAGS) -L$(ZLIB_PATH) pngtest$(MODEL).obj $(LIBNAME) zlib$(MODEL).lib $(NOEHLIB)
+
+
+# Clean up anything else you want
+clean:
+	-del *.obj
+	-del *.lib
+	-del *.lst
+
+
+# End of makefile for libpng
diff --git a/makefile.elf b/makefile.elf
index 1533f5b..b9ad070 100644
--- a/makefile.elf
+++ b/makefile.elf
@@ -9,7 +9,7 @@
 RANLIB=ranlib
 #RANLIB=echo
 
-PNGVER = 0.87
+PNGVER = 0.86
 
 # where make install puts libpng.a, libpng.so*, and png.h
 prefix=/usr/local
diff --git a/makefile.sun b/makefile.gcc
similarity index 69%
copy from makefile.sun
copy to makefile.gcc
index ad3a9ff..999a34b 100644
--- a/makefile.sun
+++ b/makefile.gcc
@@ -1,20 +1,20 @@
-# makefile for libpng
+# gcc/DOS makefile for libpng
 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
 # For conditions of distribution and use, see copyright notice in png.h
 
 CC=gcc
-CFLAGS=-I../zlib -O2 -Wall
+CFLAGS=-I../zlib -O
 LDFLAGS=-L. -L../zlib/ -lpng -lz -lm
 
 RANLIB=ranlib
-#RANLIB=echo
 
 # where make install puts libpng.a and png.h
-prefix=/home/munet-d2/sun/local
+#prefix=/usr/local
+prefix=.
 
 OBJS = png.o pngrcb.o pngrutil.o pngtrans.o pngwutil.o \
 	pngread.o pngio.o pngwrite.o pngrtran.o pngwtran.o \
-   pngmem.o pngerror.o pngpread.o
+	pngmem.o pngerror.o pngpread.o
 
 all: libpng.a pngtest
 
@@ -24,21 +24,10 @@
 
 pngtest: pngtest.o libpng.a
 	$(CC) -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS)
+	coff2exe pngtest
 
 test: pngtest
 	./pngtest
-
-install: libpng.a
-	-@mkdir $(prefix)/include
-	-@mkdir $(prefix)/lib
-	cp png.h pngconf.h $(prefix)/include
-	rcp png.h pngconf.h vlsi:bin/include
-	chmod 644 $(prefix)/include/png.h
-	chmod 644 $(prefix)/include/pngconf.h
-	cp libpng.a $(prefix)/lib
-	rcp libpng.a vlsi:bin/lib
-	chmod 644 $(prefix)/lib/libpng.a
-
 clean:
 	rm -f *.o libpng.a pngtest pngout.png
 
@@ -50,6 +39,7 @@
 pngmem.o: png.h pngconf.h
 pngrcb.o: png.h pngconf.h
 pngread.o: png.h pngconf.h
+pngpread.o: png.h pngconf.h
 pngrtran.o: png.h pngconf.h
 pngrutil.o: png.h pngconf.h
 pngtest.o: png.h pngconf.h
@@ -57,5 +47,4 @@
 pngwrite.o: png.h pngconf.h
 pngwtran.o: png.h pngconf.h
 pngwutil.o: png.h pngconf.h
-pngpread.o: png.h pngconf.h
 
diff --git a/makefile.sun b/makefile.knr
similarity index 67%
copy from makefile.sun
copy to makefile.knr
index ad3a9ff..7d74212 100644
--- a/makefile.sun
+++ b/makefile.knr
@@ -2,28 +2,40 @@
 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
 # For conditions of distribution and use, see copyright notice in png.h
 
-CC=gcc
-CFLAGS=-I../zlib -O2 -Wall
+CC=cc
+CFLAGS=-I../zlib -O
 LDFLAGS=-L. -L../zlib/ -lpng -lz -lm
+# flags for ansi2knr
+ANSI2KNRFLAGS=
 
 RANLIB=ranlib
 #RANLIB=echo
 
 # where make install puts libpng.a and png.h
-prefix=/home/munet-d2/sun/local
+prefix=/usr/local
 
 OBJS = png.o pngrcb.o pngrutil.o pngtrans.o pngwutil.o \
 	pngread.o pngio.o pngwrite.o pngrtran.o pngwtran.o \
    pngmem.o pngerror.o pngpread.o
 
-all: libpng.a pngtest
+all: ansi2knr libpng.a pngtest
 
-libpng.a: $(OBJS)
+# general rule to allow ansi2knr to work
+.c.o:
+	./ansi2knr $*.c T$*.c
+	$(CC) $(CFLAGS) -c T$*.c
+	rm -f T$*.c $*.o
+	mv T$*.o $*.o
+
+ansi2knr: ansi2knr.c
+	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
+
+libpng.a: ansi2knr $(OBJS)
 	ar rc $@  $(OBJS)
 	$(RANLIB) $@
 
-pngtest: pngtest.o libpng.a
-	$(CC) -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS)
+pngtest: pngtest.o libpng.a ansi2knr
+	cc -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS)
 
 test: pngtest
 	./pngtest
@@ -31,16 +43,15 @@
 install: libpng.a
 	-@mkdir $(prefix)/include
 	-@mkdir $(prefix)/lib
-	cp png.h pngconf.h $(prefix)/include
-	rcp png.h pngconf.h vlsi:bin/include
+	cp png.h $(prefix)/include
+	cp pngconf.h $(prefix)/include
 	chmod 644 $(prefix)/include/png.h
 	chmod 644 $(prefix)/include/pngconf.h
 	cp libpng.a $(prefix)/lib
-	rcp libpng.a vlsi:bin/lib
 	chmod 644 $(prefix)/lib/libpng.a
 
 clean:
-	rm -f *.o libpng.a pngtest pngout.png
+	rm -f *.o libpng.a pngtest pngout.png ansi2knr
 
 # DO NOT DELETE THIS LINE -- make depend depends on it.
 
@@ -50,6 +61,7 @@
 pngmem.o: png.h pngconf.h
 pngrcb.o: png.h pngconf.h
 pngread.o: png.h pngconf.h
+pngpread.o: png.h pngconf.h
 pngrtran.o: png.h pngconf.h
 pngrutil.o: png.h pngconf.h
 pngtest.o: png.h pngconf.h
@@ -57,5 +69,3 @@
 pngwrite.o: png.h pngconf.h
 pngwtran.o: png.h pngconf.h
 pngwutil.o: png.h pngconf.h
-pngpread.o: png.h pngconf.h
-
diff --git a/makefile.sun b/makefile.mip
similarity index 82%
copy from makefile.sun
copy to makefile.mip
index ad3a9ff..76e0a0e 100644
--- a/makefile.sun
+++ b/makefile.mip
@@ -2,15 +2,16 @@
 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
 # For conditions of distribution and use, see copyright notice in png.h
 
-CC=gcc
-CFLAGS=-I../zlib -O2 -Wall
+CC=cc
+CFLAGS=-I../zlib -O -systype sysv -DSYSV -w -Dmips
+#CFLAGS=-O
 LDFLAGS=-L. -L../zlib/ -lpng -lz -lm
 
-RANLIB=ranlib
-#RANLIB=echo
+#RANLIB=ranlib
+RANLIB=echo
 
 # where make install puts libpng.a and png.h
-prefix=/home/munet-d2/sun/local
+prefix=/usr/local
 
 OBJS = png.o pngrcb.o pngrutil.o pngtrans.o pngwutil.o \
 	pngread.o pngio.o pngwrite.o pngrtran.o pngwtran.o \
@@ -23,7 +24,7 @@
 	$(RANLIB) $@
 
 pngtest: pngtest.o libpng.a
-	$(CC) -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS)
+	cc -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS)
 
 test: pngtest
 	./pngtest
@@ -31,12 +32,11 @@
 install: libpng.a
 	-@mkdir $(prefix)/include
 	-@mkdir $(prefix)/lib
-	cp png.h pngconf.h $(prefix)/include
-	rcp png.h pngconf.h vlsi:bin/include
+	cp png.h $(prefix)/include
+	cp pngconf.h $(prefix)/include
 	chmod 644 $(prefix)/include/png.h
 	chmod 644 $(prefix)/include/pngconf.h
 	cp libpng.a $(prefix)/lib
-	rcp libpng.a vlsi:bin/lib
 	chmod 644 $(prefix)/lib/libpng.a
 
 clean:
@@ -50,6 +50,7 @@
 pngmem.o: png.h pngconf.h
 pngrcb.o: png.h pngconf.h
 pngread.o: png.h pngconf.h
+pngpread.o: png.h pngconf.h
 pngrtran.o: png.h pngconf.h
 pngrutil.o: png.h pngconf.h
 pngtest.o: png.h pngconf.h
@@ -57,5 +58,3 @@
 pngwrite.o: png.h pngconf.h
 pngwtran.o: png.h pngconf.h
 pngwutil.o: png.h pngconf.h
-pngpread.o: png.h pngconf.h
-
diff --git a/makefile.msc b/makefile.msc
new file mode 100644
index 0000000..d48d9ef
--- /dev/null
+++ b/makefile.msc
@@ -0,0 +1,78 @@
+# makefile for libpng
+# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
+# 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
+
+# ------------- Microsoft C 5.1 and later -------------
+MODEL=-AL
+CFLAGS=-Oait -Gs -nologo -W2 $(MODEL) -I..\zlib
+#-Ox generates bad code with MSC 5.1
+CC=cl
+LD=link
+LDFLAGS=/e/st:0x1500/noe 
+O=.obj
+
+#uncomment next to put error messages in a file
+ERRFILE= >> pngerrs
+
+# variables
+OBJS1 = png$(O) pngrcb$(O) pngrutil$(O) pngtrans$(O) pngwutil$(O) pngmem$(O) pngpread$(O)
+OBJS2 = pngread$(O) pngerror$(O) pngwrite$(O) pngrtran$(O) pngwtran$(O) pngio$(O)
+
+all: libpng.lib
+
+png$(O): png.h pngconf.h
+		  $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
+
+pngrcb$(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)
+
+pngio$(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)
+        del libpng.lib
+	lib libpng $(OBJS1);
+	lib libpng $(OBJS2);
+
+pngtest.exe: pngtest.obj libpng.lib 
+	$(LD) $(LDFLAGS) pngtest.obj,,,libpng.lib ..\zlib\zlib.lib ;
+
+test: pngtest.exe
+	pngtest
+
+# End of makefile for libpng
+
diff --git a/makefile.sun b/makefile.std
similarity index 86%
copy from makefile.sun
copy to makefile.std
index ad3a9ff..ae3a0be 100644
--- a/makefile.sun
+++ b/makefile.std
@@ -2,15 +2,15 @@
 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
 # For conditions of distribution and use, see copyright notice in png.h
 
-CC=gcc
-CFLAGS=-I../zlib -O2 -Wall
+CC=cc
+CFLAGS=-I../zlib -O
 LDFLAGS=-L. -L../zlib/ -lpng -lz -lm
 
-RANLIB=ranlib
-#RANLIB=echo
+#RANLIB=ranlib
+RANLIB=echo
 
 # where make install puts libpng.a and png.h
-prefix=/home/munet-d2/sun/local
+prefix=/usr/local
 
 OBJS = png.o pngrcb.o pngrutil.o pngtrans.o pngwutil.o \
 	pngread.o pngio.o pngwrite.o pngrtran.o pngwtran.o \
@@ -31,12 +31,11 @@
 install: libpng.a
 	-@mkdir $(prefix)/include
 	-@mkdir $(prefix)/lib
-	cp png.h pngconf.h $(prefix)/include
-	rcp png.h pngconf.h vlsi:bin/include
+	cp png.h $(prefix)/include
+	cp pngconf.h $(prefix)/include
 	chmod 644 $(prefix)/include/png.h
 	chmod 644 $(prefix)/include/pngconf.h
 	cp libpng.a $(prefix)/lib
-	rcp libpng.a vlsi:bin/lib
 	chmod 644 $(prefix)/lib/libpng.a
 
 clean:
diff --git a/makefile.tc b/makefile.tc
new file mode 100644
index 0000000..3fb5e42
--- /dev/null
+++ b/makefile.tc
@@ -0,0 +1,69 @@
+# Makefile for libpng
+# TurboC++ 3.0 (Note: All modules are compiled in C mode)
+
+# To use, do "make -fmakefile.tc"
+
+# ------------- Turbo C++ 3.0 -------------
+MODEL=-ml
+CFLAGS=-O2 -Z $(MODEL) -I..\zlib
+CC=tcc
+LD=tcc
+LIB=tlib
+LDFLAGS=$(MODEL)
+O=.obj
+
+# variables
+OBJS1 = png$(O) pngrcb$(O) pngrutil$(O) pngtrans$(O) pngwutil$(O) pngmem$(O) pngpread$(O)
+OBJS2 = pngread$(O) pngerror$(O) pngwrite$(O) pngrtran$(O) pngwtran$(O) pngio$(O)
+OBJSL1 = +png$(O) +pngrcb$(O) +pngrutil$(O) +pngtrans$(O) +pngwutil$(O) +pngmem$(O) +pngpread$(O)
+OBJSL2 = +pngread$(O) +pngerror$(O) +pngwrite$(O) +pngrtran$(O) +pngwtran$(O) pngio$(O)
+
+all: libpng.lib
+
+png$(O): png.h pngconf.h
+		  $(CC) -c $(CFLAGS) $*.c
+
+pngrcb$(O): png.h pngconf.h
+		  $(CC) -c $(CFLAGS) $*.c
+
+pngread$(O): png.h pngconf.h
+		  $(CC) -c $(CFLAGS) $*.c
+
+pngpread$(O): png.h pngconf.h
+		  $(CC) -c $(CFLAGS) $*.c
+
+pngrtran$(O): png.h pngconf.h
+		  $(CC) -c $(CFLAGS) $*.c
+
+pngrutil$(O): png.h pngconf.h
+		  $(CC) -c $(CFLAGS) $*.c
+
+pngerror$(O): png.h pngconf.h
+        $(CC) -c $(CFLAGS) $*.c
+
+pngmem$(O): png.h pngconf.h
+        $(CC) -c $(CFLAGS) $*.c
+
+pngio$(O): png.h pngconf.h
+        $(CC) -c $(CFLAGS) $*.c
+
+pngtest$(O): png.h pngconf.h
+        $(CC) -c $(CFLAGS) $*.c
+
+pngtrans$(O): png.h pngconf.h
+        $(CC) -c $(CFLAGS) $*.c
+
+pngwrite$(O): png.h pngconf.h
+        $(CC) -c $(CFLAGS) $*.c
+
+pngwtran$(O): png.h pngconf.h
+        $(CC) -c $(CFLAGS) $*.c
+
+pngwutil$(O): png.h pngconf.h
+        $(CC) -c $(CFLAGS) $*.c
+
+libpng.lib: $(OBJS1) $(OBJS2)
+        $(LIB) libpng +$(OBJSL1)
+        $(LIB) libpng +$(OBJSL2)
+
+# End of makefile for libpng
diff --git a/makevms.com b/makevms.com
new file mode 100644
index 0000000..aa112b1
--- /dev/null
+++ b/makevms.com
@@ -0,0 +1,121 @@
+$! make libpng under VMS
+$!
+$!
+$! Look for the compiler used
+$!
+$ zlibsrc = "[-.zlib]"
+$ ccopt="/include=''zlibsrc'"
+$ if f$getsyi("HW_MODEL").ge.1024
+$ then
+$  ccopt = "/prefix=all"+ccopt
+$  comp  = "__decc__=1"
+$  if f$trnlnm("SYS").eqs."" then define sys sys$library:
+$ else
+$  if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").eqs.""
+$   then
+$    if f$trnlnm("SYS").eqs."" then define sys sys$library:
+$    if f$search("SYS$SYSTEM:VAXC.EXE").eqs.""
+$     then
+$      comp  = "__gcc__=1"
+$      CC :== GCC
+$     else
+$      comp = "__vaxc__=1"
+$     endif
+$   else
+$    if f$trnlnm("SYS").eqs."" then define sys decc$library_include:
+$    ccopt = "/decc/prefix=all"+ccopt
+$    comp  = "__decc__=1"
+$  endif
+$ endif
+$!
+$! Build the thing plain or with mms
+$!
+$ write sys$output "Compiling Libpng sources ..."
+$ if f$search("SYS$SYSTEM:MMS.EXE").eqs.""
+$  then
+$   dele pngtest.obj;*
+$   CALL MAKE png.OBJ "cc ''CCOPT' png" -
+                png.c png.h pngconf.h   
+$   CALL MAKE pngpread.OBJ "cc ''CCOPT' pngpread" -
+					 pngpread.c png.h pngconf.h
+$   CALL MAKE pngrcb.OBJ "cc ''CCOPT' pngrcb" -
+                pngrcb.c png.h pngconf.h
+$   CALL MAKE pngread.OBJ "cc ''CCOPT' pngread" -
+                pngread.c png.h pngconf.h
+$   CALL MAKE pngpread.OBJ "cc ''CCOPT' pngpread" -
+					 pngpread.c png.h pngconf.h
+$   CALL MAKE pngrtran.OBJ "cc ''CCOPT' pngrtran" -
+                pngrtran.c png.h pngconf.h
+$   CALL MAKE pngrutil.OBJ "cc ''CCOPT' pngrutil" -
+                pngrutil.c png.h pngconf.h
+$   CALL MAKE pngerror.OBJ "cc ''CCOPT' pngerror" -
+                pngerror.c png.h pngconf.h
+$   CALL MAKE pngmem.OBJ "cc ''CCOPT' pngmem" -
+                pngmem.c png.h pngconf.h
+$   CALL MAKE pngio.OBJ "cc ''CCOPT' pngio" -
+                pngio.c png.h pngconf.h
+$   CALL MAKE pngtrans.OBJ "cc ''CCOPT' pngtrans" -
+                pngtrans.c png.h pngconf.h
+$   CALL MAKE pngwrite.OBJ "cc ''CCOPT' pngwrite" -
+                pngwrite.c png.h pngconf.h
+$   CALL MAKE pngwtran.OBJ "cc ''CCOPT' pngwtran" -
+                pngwtran.c png.h pngconf.h
+$   CALL MAKE pngwutil.OBJ "cc ''CCOPT' pngwutil" -
+                pngwutil.c png.h pngconf.h
+$   write sys$output "Building Libpng ..."
+$   CALL MAKE libpng.OLB "lib/crea libpng.olb *.obj" *.OBJ
+$   write sys$output "Building pngtest..."
+$   CALL MAKE pngtest.OBJ "cc ''CCOPT' pngtest" -
+                pngtest.c png.h pngconf.h
+$   call make pngtest.exe - 
+                "LINK pngtest,libpng.olb/lib,''zlibsrc'libgz.olb/lib" - 
+                pngtest.obj libpng.olb
+$   write sys$output "Testing Libpng..."
+$   run pngtest
+$  else
+$   mms/macro=('comp',zlibsrc='zlibsrc')
+$  endif
+$ write sys$output "Libpng build completed"
+$ exit
+$!
+$!
+$MAKE: SUBROUTINE   !SUBROUTINE TO CHECK DEPENDENCIES
+$ V = 'F$Verify(0)
+$! P1 = What we are trying to make
+$! P2 = Command to make it
+$! P3 - P8  What it depends on
+$
+$ If F$Search(P1) .Eqs. "" Then Goto Makeit
+$ Time = F$CvTime(F$File(P1,"RDT"))
+$arg=3
+$Loop:
+$       Argument = P'arg
+$       If Argument .Eqs. "" Then Goto Exit
+$       El=0
+$Loop2:
+$       File = F$Element(El," ",Argument)
+$       If File .Eqs. " " Then Goto Endl
+$       AFile = ""
+$Loop3:
+$       OFile = AFile
+$       AFile = F$Search(File)
+$       If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
+$       If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
+$       Goto Loop3
+$NextEL:
+$       El = El + 1
+$       Goto Loop2
+$EndL:
+$ arg=arg+1
+$ If arg .Le. 8 Then Goto Loop
+$ Goto Exit
+$
+$Makeit:
+$ VV=F$VERIFY(0)
+$ write sys$output P2
+$ 'P2
+$ VV='F$Verify(VV)
+$Exit:
+$ If V Then Set Verify
+$ENDSUBROUTINE
+
diff --git a/png.c b/png.c
index 4663e1a..facd04c 100644
--- a/png.c
+++ b/png.c
@@ -1,10 +1,10 @@
 
 /* png.c - location for general purpose png functions
 
-	libpng 1.0 beta 2 - version 0.87
+   libpng 1.0 beta 2 - version 0.88
    For conditions of distribution and use, see copyright notice in png.h
-	Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
-   January 15, 1996
+   Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+   January 25, 1996
    */
 
 #define PNG_INTERNAL
@@ -13,7 +13,7 @@
 
 /* version information for c files.  This better match the version
    string defined in png.h */
-char png_libpng_ver[] = "0.87";
+char png_libpng_ver[] = "0.88";
 
 /* place to hold the signiture string for a png file. */
 png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};
@@ -95,7 +95,7 @@
 int
 png_check_sig(png_bytep sig, int num)
 {
-	if (num > 8)
+   if (num > 8)
       num = 8;
    if (num < 1)
       return 0;
@@ -107,22 +107,22 @@
 voidpf
 png_zalloc(voidpf png_ptr, uInt items, uInt size)
 {
-	png_voidp ptr;
-	png_uint_32 num_bytes;
+   png_voidp ptr;
+   png_uint_32 num_bytes;
 
-	ptr = png_large_malloc((png_structp)png_ptr,
-		(png_uint_32)items * (png_uint_32)size);
-	num_bytes = (png_uint_32)items * (png_uint_32)size;
-	if (num_bytes > (png_uint_32)0x7fff)
-	{
-		png_memset(ptr, 0, (png_size_t)0x8000L);
-		png_memset((png_bytep)ptr + (png_size_t)0x8000L, 0,
-			(png_size_t)(num_bytes - (png_uint_32)0x8000L));
-	}
-	else
-	{
-		png_memset(ptr, 0, (png_size_t)num_bytes);
-	}
+   ptr = png_large_malloc((png_structp)png_ptr,
+      (png_uint_32)items * (png_uint_32)size);
+   num_bytes = (png_uint_32)items * (png_uint_32)size;
+   if (num_bytes > (png_uint_32)0x7fff)
+   {
+      png_memset(ptr, 0, (png_size_t)0x8000L);
+      png_memset((png_bytep)ptr + (png_size_t)0x8000L, 0,
+         (png_size_t)(num_bytes - (png_uint_32)0x8000L));
+   }
+   else
+   {
+      png_memset(ptr, 0, (png_size_t)num_bytes);
+   }
    return (voidpf)(ptr);
 }
 
@@ -130,7 +130,7 @@
 void
 png_zfree(voidpf png_ptr, voidpf ptr)
 {
-	png_large_free((png_structp)png_ptr, (png_voidp)ptr);
+   png_large_free((png_structp)png_ptr, (png_voidp)ptr);
 }
 
 /* reset the crc variable to 32 bits of 1's.  Care must be taken
@@ -143,8 +143,8 @@
 }
 
 /* Note: the crc code below was copied from the sample code in the
-	PNG spec, with appropriate modifications made to ensure the
-	variables are large enough */
+   PNG spec, with appropriate modifications made to ensure the
+   variables are large enough */
 
 /* table of crc's of all 8-bit messages.  If you wish to png_malloc this
    table, turn this into a pointer, and png_malloc it in make_crc_table().
@@ -193,7 +193,7 @@
 
   if (n > 0) do
   {
-	c = crc_table[(png_byte)((c ^ (*p++)) & 0xff)] ^ (c >> 8);
+   c = crc_table[(png_byte)((c ^ (*p++)) & 0xff)] ^ (c >> 8);
   } while (--n);
 
   return c;
@@ -213,6 +213,6 @@
 png_info_init(png_infop info)
 {
    /* set everything to 0 */
-	png_memset(info, 0, sizeof (png_info));
+   png_memset(info, 0, sizeof (png_info));
 }
 
diff --git a/png.h b/png.h
index 112bbd8..1fe369f 100644
--- a/png.h
+++ b/png.h
@@ -1,8 +1,8 @@
 
 /* png.h - header file for png reference library
 
-   libpng 1.0 beta 2 - version 0.87
-   Jan 15, 1996
+   libpng 1.0 beta 2 - version 0.88
+   Jan 25, 1996
 
    Note: This is a beta version.  It reads and writes valid files
    on the platforms I have, but it has had limited portability
@@ -27,7 +27,7 @@
    with testing, bug fixes, and patience.  You know who you are.  This
    wouldn't have been possible without all of you.
 
-   Thanks to Frank J. T. Wojcik for reviewing the documentation
+   Thanks to Frank J. T. Wojcik for helping with the documentation
 
    The PNG Reference Library is supplied "AS IS". The Contributing Authors
    and Group 42, Inc. disclaim all warranties, expressed or implied,
@@ -41,9 +41,9 @@
    to the following restrictions:
    1. The origin of this source code must not be misrepresented.
    2. Altered versions must be plainly marked as such and must not be
-      misrepresented as being the original source.
+     misrepresented as being the original source.
    3. This Copyright notice may not be removed or altered from any source or
-      altered source distribution.
+     altered source distribution.
 
    The Contributing Authors and Group 42, Inc. specifically permit, without
    fee, and encourage the use of this source code as a component to
@@ -74,10 +74,10 @@
 
 /* version information for png.h - this should match the version
    number in png.c */
-#define PNG_LIBPNG_VER_STRING "0.87"
-/* careful here.  I wanted to use 087, but that would be octal.  Version
+#define PNG_LIBPNG_VER_STRING "0.88"
+/* careful here.  I wanted to use 088, but that would be octal.  Version
    1.0 will be 100 here, etc. */
-#define PNG_LIBPNG_VER 87
+#define PNG_LIBPNG_VER 88
 
 /* variables defined in png.c - only it needs to define PNG_NO_EXTERN */
 #ifndef PNG_NO_EXTERN
@@ -99,7 +99,7 @@
    png_byte green;
    png_byte blue;
 } png_color;
-typedef png_color       FAR *      png_colorp;
+typedef png_color       FAR *    png_colorp;
 typedef png_color       FAR * FAR * png_colorpp;
 
 typedef struct png_color_16_struct
@@ -110,7 +110,7 @@
    png_uint_16 blue;
    png_uint_16 gray; /* for use in grayscale files */
 } png_color_16;
-typedef png_color_16    FAR *      png_color_16p;
+typedef png_color_16    FAR *    png_color_16p;
 typedef png_color_16    FAR * FAR * png_color_16pp;
 
 typedef struct png_color_8_struct
@@ -121,7 +121,7 @@
    png_byte gray; /* for use in grayscale files */
    png_byte alpha; /* for alpha channel files */
 } png_color_8;
-typedef png_color_8     FAR *      png_color_8p;
+typedef png_color_8     FAR *    png_color_8p;
 typedef png_color_8     FAR * FAR * png_color_8pp;
 
 /* png_text holds the text in a png file, and whether they are compressed
@@ -133,7 +133,7 @@
    png_charp text; /* comment */
    png_uint_32 text_length; /* length of text field */
 } png_text;
-typedef png_text        FAR *      png_textp;
+typedef png_text        FAR *    png_textp;
 typedef png_text        FAR * FAR * png_textpp;
 
 /* png_time is a way to hold the time in an machine independent way.
@@ -150,7 +150,7 @@
    png_byte minute; /* minute of hour, 0 - 59 */
    png_byte second; /* second of minute, 0 - 60 (for leap seconds) */
 } png_time;
-typedef png_time        FAR *      png_timep;
+typedef png_time        FAR *    png_timep;
 typedef png_time        FAR * FAR * png_timepp;
 
 /* png_info is a structure that holds the information in a png file.
@@ -231,7 +231,7 @@
    png_textp text; /* array of comments */
 #endif
 } png_info;
-typedef png_info        FAR *      png_infop;
+typedef png_info        FAR *    png_infop;
 typedef png_info        FAR * FAR * png_infopp;
 
 #define PNG_RESOLUTION_UNKNOWN 0
@@ -287,7 +287,7 @@
    png_byte pixel_depth; /* bits per pixel (depth * channels) */
 } png_row_info;
 
-typedef png_row_info    FAR *      png_row_infop;
+typedef png_row_info    FAR *    png_row_infop;
 typedef png_row_info    FAR * FAR * png_row_infopp;
 
 /* These are the function types for the I/O functions, and the functions which
diff --git a/pngchang.txt b/pngchang.txt
index c0ef5a5..5424513 100644
--- a/pngchang.txt
+++ b/pngchang.txt
@@ -1,31 +1,31 @@
 pngchange.txt - changes for libpng
 
 version 0.2
-	added reader into png.h
-	fixed small problems in stub file
+   added reader into png.h
+   fixed small problems in stub file
 version 0.3
-	added pull reader
-	split up pngwrite.c to several files
-	added pnglib.txt
-	added example.c
-	cleaned up writer, adding a few new tranformations
-	fixed some bugs in writer
-	interfaced with zlib 0.5
-	added K&R support
-	added check for 64 KB blocks for 16 bit machines
+   added pull reader
+   split up pngwrite.c to several files
+   added pnglib.txt
+   added example.c
+   cleaned up writer, adding a few new tranformations
+   fixed some bugs in writer
+   interfaced with zlib 0.5
+   added K&R support
+   added check for 64 KB blocks for 16 bit machines
 version 0.4
-	cleaned up code and commented code
-	simplified time handling into png_time
-	created png_color_16 and png_color_8 to handle color needs
-	cleaned up color type defines
-	fixed various bugs
-	made various names more consistant
-	interfaced with zlib 0.71
-	cleaned up zTXt reader and writer (using zlib's Reset functions)
-	split transformations into pngrtran.c and pngwtran.c
+   cleaned up code and commented code
+   simplified time handling into png_time
+   created png_color_16 and png_color_8 to handle color needs
+   cleaned up color type defines
+   fixed various bugs
+   made various names more consistant
+   interfaced with zlib 0.71
+   cleaned up zTXt reader and writer (using zlib's Reset functions)
+   split transformations into pngrtran.c and pngwtran.c
 version 0.5
-	interfaced with zlib 0.8
-	fixed many reading and writing bugs
+   interfaced with zlib 0.8
+   fixed many reading and writing bugs
    saved using 3 spaces instead of tabs
 version 0.6
    added png_large_malloc() and png_large_free()
@@ -54,7 +54,8 @@
    changed external functions passing floats to doubles (k&r problems?)
    put all the configurable stuff in pngconf.h
    enabled png_set_shift to work with paletted images on read
-   added png_read_update_info() - updates info structure with transformations
+   added png_read_update_info() - updates info structure with
+      transformations
 version 0.81
    incorporated Tim Wegner's medium model code (thanks, Tim)
 version 0.85
@@ -66,7 +67,10 @@
    fixed bugs
    improved documentation
 version 0.87
-	fixed medium model bugs
-	fixed other bugs introduced in 0.85 and 0.86
+   fixed medium model bugs
+   fixed other bugs introduced in 0.85 and 0.86
    added some minor documentation
-
+version 0.88
+   fixed progressive bugs
+   replaced tabs with spaces
+   cleaned up documentation
diff --git a/pngconf.h b/pngconf.h
index 99c21cd..60bad86 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -1,10 +1,10 @@
 
 /* pngconf.c - machine configurable file for libpng
 
-	libpng 1.0 beta 2 - version 0.87
+   libpng 1.0 beta 2 - version 0.88
    For conditions of distribution and use, see copyright notice in png.h
-	Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
-   January 15, 1996
+   Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+   January 25, 1996
    */
 
 /* Any machine specific code is near the front of this file, so if you
@@ -27,7 +27,7 @@
    Unless this gets smaller then the size of a row (compressed),
    it should not make much difference how big this is.  */
 
-#define PNG_ZBUF_SIZE 32768
+#define PNG_ZBUF_SIZE 8192
 
 /* While libpng currently uses zlib for it's compression, it has been designed
    to stand on it's own.  Towards this end, there are two defines that are
@@ -49,10 +49,10 @@
 #endif
 
 /* this protects us against compilers which run on a windowing system
-	and thus don't have or would rather us not use the stdio types:
-	stdin, stdout, and stderr.  The only one currently used is stderr
-	in png_error() and png_warning().  #defining PNG_NO_STDIO will
-	prevent these from being compiled and used. */
+   and thus don't have or would rather us not use the stdio types:
+   stdin, stdout, and stderr.  The only one currently used is stderr
+   in png_error() and png_warning().  #defining PNG_NO_STDIO will
+   prevent these from being compiled and used. */
 
 /* #define PNG_NO_STDIO */
 
@@ -138,11 +138,11 @@
 #endif /* PNG_INTERNAL */
 
 /* the following uses const char * instead of char * for error
-	and warning message functions, so some compilers won't complain.
-	If you want to use const, define PNG_USE_CONST here.  It is not
-	normally defined to make configuration easier, as it is not a
+   and warning message functions, so some compilers won't complain.
+   If you want to use const, define PNG_USE_CONST here.  It is not
+   normally defined to make configuration easier, as it is not a
    critical part of the code.
-	*/
+   */
 
 #ifdef PNG_USE_CONST
 #  define PNG_CONST const
@@ -260,7 +260,7 @@
 #define FAR __far
 #endif
 #define USE_FAR_KEYWORD
-#endif	/* LDATA != 1 */
+#endif   /* LDATA != 1 */
 
 /* SJT:  Possibly useful for moving data out of default segment.
    Uncomment it if you want. Could also define FARDATA as const
@@ -269,7 +269,7 @@
 */
 #endif  /* __WIN32__, __FLAT__ */
 
-#endif	/* __BORLANDC__ */
+#endif   /* __BORLANDC__ */
 
 
 /* SJT:  Suggest testing for specific compiler first before
@@ -303,7 +303,7 @@
 /* End medium model changes to be in zconf.h */
 
 /* SJT: More typedefs */
-typedef void FAR *	png_voidp;
+typedef void FAR *   png_voidp;
 
 
 /* SJT: Add typedefs for pointers */
@@ -341,7 +341,7 @@
 #   define png_strcat _fstrcat
 #   define png_strlen _fstrlen
 #   define png_strcmp _fstrcmp
-#   define png_memcmp _fmemcmp		/* SJT: added */
+#   define png_memcmp _fmemcmp      /* SJT: added */
 #   define png_memcpy _fmemcpy
 #   define png_memset _fmemset
 #else /* use the usual functions */
@@ -349,7 +349,7 @@
 #   define png_strcat strcat
 #   define png_strlen strlen
 #   define png_strcmp strcmp
-#   define png_memcmp memcmp		/* SJT: added */
+#   define png_memcmp memcmp     /* SJT: added */
 #   define png_memcpy memcpy
 #   define png_memset memset
 #endif
diff --git a/pngerror.c b/pngerror.c
index 522cbb7..bc3f324 100644
--- a/pngerror.c
+++ b/pngerror.c
@@ -1,107 +1,107 @@
 
 /* pngerror.c - stub functions for i/o and memory allocation
 
-	libpng 1.0 beta 2 - version 0.87
+   libpng 1.0 beta 2 - version 0.88
    For conditions of distribution and use, see copyright notice in png.h
-	Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
-   January 15, 1996
+   Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+   January 25, 1996
 
-	This file provides a location for all error handling.  Users which
+   This file provides a location for all error handling.  Users which
    need special error handling are expected to write replacement functions
-	and use png_set_message_fn() to use those functions.  See the instructions
-	at each function. */
+   and use png_set_message_fn() to use those functions.  See the instructions
+   at each function. */
 
 #define PNG_INTERNAL
 #include "png.h"
 
 /* This function is called whenever there is a fatal error.  This function
-	should not be changed.  If there is a need to handle errors differently,
-	you should supply a replacement error function and use png_set_message_fn()
+   should not be changed.  If there is a need to handle errors differently,
+   you should supply a replacement error function and use png_set_message_fn()
    to replace the error function at run-time. */
 void
 png_error(png_structp png_ptr, png_const_charp message)
 {
-	if (png_ptr->error_fn)
-		(*(png_ptr->error_fn))(png_ptr, message);
+   if (png_ptr->error_fn)
+      (*(png_ptr->error_fn))(png_ptr, message);
 
-	/* if the following returns or doesn't exist, use the default function,
-	   which will not return */
-	png_default_error(png_ptr, message);
+   /* if the following returns or doesn't exist, use the default function,
+      which will not return */
+   png_default_error(png_ptr, message);
 }
 
 /* This function is called whenever there is a non-fatal error.  This function
-	should not be changed.  If there is a need to handle warnings differently,
-	you should supply a replacement warning function and use
-	png_set_message_fn() to replace the warning function at run-time. */
+   should not be changed.  If there is a need to handle warnings differently,
+   you should supply a replacement warning function and use
+   png_set_message_fn() to replace the warning function at run-time. */
 void
 png_warning(png_structp png_ptr, png_const_charp message)
 {
-	if (png_ptr->warning_fn)
-		(*(png_ptr->warning_fn))(png_ptr, message);
-	else
-		png_default_warning(png_ptr, message);
+   if (png_ptr->warning_fn)
+      (*(png_ptr->warning_fn))(png_ptr, message);
+   else
+      png_default_warning(png_ptr, message);
 }
 
 /* This is the default error handling function.  Note that replacements for
-	this function MUST NOT RETURN, or the program will likely crash.  This
-	function is used by default, or if the program supplies NULL for the
-	error function pointer in png_set_message_fn(). */
+   this function MUST NOT RETURN, or the program will likely crash.  This
+   function is used by default, or if the program supplies NULL for the
+   error function pointer in png_set_message_fn(). */
 void
 png_default_error(png_structp png_ptr, png_const_charp message)
 {
 #ifndef PNG_NO_STDIO
-	fprintf(stderr, "libpng error: %s\n", message);
+   fprintf(stderr, "libpng error: %s\n", message);
 #endif
 
 #ifdef USE_FAR_KEYWORD
-	{
-		jmp_buf jmpbuf;
-		png_memcpy(jmpbuf,png_ptr->jmpbuf,sizeof(jmp_buf));
-		longjmp(jmpbuf, 1);
-	}
+   {
+      jmp_buf jmpbuf;
+      png_memcpy(jmpbuf,png_ptr->jmpbuf,sizeof(jmp_buf));
+      longjmp(jmpbuf, 1);
+   }
 #else
-	longjmp(png_ptr->jmpbuf, 1);
+   longjmp(png_ptr->jmpbuf, 1);
 #endif
 }
 
 /* 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
+   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
    not used, but it is passed in case it may be useful. */
 void
 png_default_warning(png_structp png_ptr, png_const_charp message)
 {
-	if (!png_ptr)
-		return;
+   if (!png_ptr)
+      return;
 
 #ifndef PNG_NO_STDIO
-	fprintf(stderr, "libpng warning: %s\n", message);
+   fprintf(stderr, "libpng warning: %s\n", message);
 #endif
 }
 
 /* This function is called when the application wants to use another method
-	of handling errors and warnings.  Note that the error function MUST NOT
-	return to the calling routine or serious problems will occur. The error
-	return method used in the default routine calls
-	longjmp(png_ptr->jmpbuf, 1) */
+   of handling errors and warnings.  Note that the error function MUST NOT
+   return to the calling routine or serious problems will occur. The error
+   return method used in the default routine calls
+   longjmp(png_ptr->jmpbuf, 1) */
 void
 png_set_message_fn(png_structp png_ptr, png_voidp msg_ptr, png_msg_ptr error_fn,
-	png_msg_ptr warning_fn)
+   png_msg_ptr warning_fn)
 {
-	png_ptr->msg_ptr = msg_ptr;
+   png_ptr->msg_ptr = msg_ptr;
 
-	png_ptr->error_fn = error_fn;
-	png_ptr->warning_fn = warning_fn;
+   png_ptr->error_fn = error_fn;
+   png_ptr->warning_fn = warning_fn;
 }
 
 
 /* This function returns a pointer to the msg_ptr associated with the user
-	functions.  The application should free any memory associated with this
-	pointer before png_write_destroy and png_read_destroy are called. */
+   functions.  The application should free any memory associated with this
+   pointer before png_write_destroy and png_read_destroy are called. */
 png_voidp
 png_get_msg_ptr(png_structp png_ptr)
 {
-	return png_ptr->msg_ptr;
+   return png_ptr->msg_ptr;
 }
 
 
diff --git a/pngio.c b/pngio.c
index b399a92..3dc4451 100644
--- a/pngio.c
+++ b/pngio.c
@@ -1,41 +1,41 @@
 
 /* pngio.c - stub functions for i/o and memory allocation
 
-	libpng 1.0 beta 2 - version 0.87
+   libpng 1.0 beta 2 - version 0.88
    For conditions of distribution and use, see copyright notice in png.h
-	Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
-   January 15, 1996
+   Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+   January 25, 1996
 
    This file provides a location for all input/output.  Users which need
-	special handling are expected to write functions which have the same
-	arguments as these, and perform similar functions, but possibly have
-	different I/O methods.  Note that you shouldn't change these functions,
-	but rather write replacement functions and then change them at run
-	time with png_set_write_fn(...) or png_set_read_fn(...), etc */
+   special handling are expected to write functions which have the same
+   arguments as these, and perform similar functions, but possibly have
+   different I/O methods.  Note that you shouldn't change these functions,
+   but rather write replacement functions and then change them at run
+   time with png_set_write_fn(...) or png_set_read_fn(...), etc */
 
 #define PNG_INTERNAL
 #include "png.h"
 
 /* Write the data to whatever output you are using.  The default routine
-	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.  The cast to png_size_t is
-	there to quiet warnings of certain compilers. */
+   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.  The cast to png_size_t is
+   there to quiet warnings of certain compilers. */
 
 void
 png_write_data(png_structp png_ptr, png_bytep data, png_uint_32 length)
 {
-	if (png_ptr->write_data_fn)
-		(*(png_ptr->write_data_fn))(png_ptr, data, length);
-	else
-		png_error(png_ptr, "Call to NULL write function");
+   if (png_ptr->write_data_fn)
+      (*(png_ptr->write_data_fn))(png_ptr, data, length);
+   else
+      png_error(png_ptr, "Call to NULL write function");
 }
 
 /* This is the function which does the actual writing of data.  If you are
-	not writing to a standard C stream, you should create a replacement
-	write_data function and use it at run time with png_set_write_fn(), rather
-	than changing the library. */
+   not writing to a standard C stream, you should create a replacement
+   write_data function and use it at run time with png_set_write_fn(), rather
+   than changing the library. */
 #ifndef USE_FAR_KEYWORD
 void
 png_default_write_data(png_structp png_ptr, png_bytep data, png_uint_32 length)
@@ -51,7 +51,7 @@
 #else
 /* this is the model-independent version. Since the standard I/O library
    can't handle far buffers in the medium and small models, we have to copy
-	the data.
+   the data.
 */
 
 #define NEAR_BUF_SIZE 1024
@@ -70,73 +70,73 @@
 
    /* Check if data really is near. If so, use usual code. */
 #ifdef _MSC_VER
-	/* do it this way just to quiet warning */
+   /* do it this way just to quiet warning */
    FP_OFF(n_data) = FP_OFF(data);
-	if (FP_SEG(n_data) == FP_SEG(data))
+   if (FP_SEG(n_data) == FP_SEG(data))
 #else
-	/* this works in MSC also but with lost segment warning */
+   /* this works in MSC also but with lost segment warning */
    n_data = (png_byte *)data;
-	if ((png_bytep)n_data == data)
+   if ((png_bytep)n_data == data)
 #endif
    {
       check = fwrite(n_data, 1, (png_size_t)length, png_ptr->fp);
    }
-	else
+   else
    {
       png_byte buf[NEAR_BUF_SIZE];
       png_size_t written, remaining, err;
       check = 0;
       remaining = (png_size_t)length;
-		do
-		{
-			written = MIN(NEAR_BUF_SIZE, remaining);
-			png_memcpy(buf, data, written); /* copy far buffer to near buffer */
+      do
+      {
+         written = MIN(NEAR_BUF_SIZE, remaining);
+         png_memcpy(buf, data, written); /* copy far buffer to near buffer */
          err = fwrite(buf, 1, written, png_ptr->fp);
-			if (err != written)
+         if (err != written)
             break;
-			else
+         else
             check += err;
          data += written;
          remaining -= written;
       }
-		while (remaining != 0);
-	}
-	if (check != length)
-	{
-		png_error(png_ptr, "Write Error");
-	}
+      while (remaining != 0);
+   }
+   if (check != length)
+   {
+      png_error(png_ptr, "Write Error");
+   }
 }
 
 #endif
 
 /* Read the data from whatever input you are using.  The default routine
-	reads from 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 reads.  This should never be asked
-	to read more then 64K on a 16 bit machine.  The cast to png_size_t is
-	there to quiet some compilers */
+   reads from 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 reads.  This should never be asked
+   to read more then 64K on a 16 bit machine.  The cast to png_size_t is
+   there to quiet some compilers */
 void
 png_read_data(png_structp png_ptr, png_bytep data, png_uint_32 length)
 {
 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
-	if (png_ptr->read_mode == PNG_READ_PUSH_MODE)
-	{
-   	png_push_fill_buffer(png_ptr, data, length);
-	}
+   if (png_ptr->read_mode == PNG_READ_PUSH_MODE)
+   {
+      png_push_fill_buffer(png_ptr, data, length);
+   }
    else
 #endif
-	{
-		if (png_ptr->read_data_fn)
-			(*(png_ptr->read_data_fn))(png_ptr, data, length);
-		else
-			png_error(png_ptr, "Call to NULL read function");
-	}
+   {
+      if (png_ptr->read_data_fn)
+         (*(png_ptr->read_data_fn))(png_ptr, data, length);
+      else
+         png_error(png_ptr, "Call to NULL read function");
+   }
 }
 
 /* This is the function which does the actual reading of data.  If you are
-	not reading from a standard C stream, you should create a replacement
-	read_data function and use it at run time with png_set_read_fn(), rather
-	than changing the library. */
+   not reading from a standard C stream, you should create a replacement
+   read_data function and use it at run time with png_set_read_fn(), rather
+   than changing the library. */
 #ifndef USE_FAR_KEYWORD
 void
 png_default_read_data(png_structp png_ptr, png_bytep data, png_uint_32 length)
@@ -160,7 +160,7 @@
 #ifdef _MSC_VER
    /* do it this way just to quiet warning */
    FP_OFF(n_data) = FP_OFF(data);
-	if (FP_SEG(n_data) == FP_SEG(data))
+   if (FP_SEG(n_data) == FP_SEG(data))
 #else
    /* this works in MSC also but with lost segment warning */
    n_data = (png_byte *)data;
@@ -168,7 +168,7 @@
 #endif
    {
       check = fread(n_data, 1, (size_t)length, png_ptr->fp);
-	}
+   }
    else
    {
       png_byte buf[NEAR_BUF_SIZE];
@@ -177,142 +177,142 @@
       remaining = (png_size_t)length;
       do
       {
-			read = MIN(NEAR_BUF_SIZE, remaining);
+         read = MIN(NEAR_BUF_SIZE, remaining);
          err = fread(buf, 1, read, png_ptr->fp);
-			png_memcpy(data, buf, read); /* copy far buffer to near buffer */
+         png_memcpy(data, buf, read); /* copy far buffer to near buffer */
          if(err != read)
             break;
          else
             check += err;
          data += read;
-			remaining -= read;
-		}
-		while (remaining != 0);
-	}
-	if (check != length)
-	{
-		png_error(png_ptr, "read Error");
-	}
+         remaining -= read;
+      }
+      while (remaining != 0);
+   }
+   if (check != length)
+   {
+      png_error(png_ptr, "read Error");
+   }
 }
 #endif
 
 /* This function is called to output any data pending writing (normally
-	to disk.  After png_flush is called, there should be no data pending
-	writing in any buffers. */
+   to disk.  After png_flush is called, there should be no data pending
+   writing in any buffers. */
 #if defined(PNG_WRITE_FLUSH_SUPPORTED)
 void
 png_flush(png_structp png_ptr)
 {
-	if (png_ptr->output_flush_fn)
-		(*(png_ptr->output_flush_fn))(png_ptr);
+   if (png_ptr->output_flush_fn)
+      (*(png_ptr->output_flush_fn))(png_ptr);
 }
 
 void
 png_default_flush(png_structp png_ptr)
 {
-	if (png_ptr->fp)
-		fflush(png_ptr->fp);
+   if (png_ptr->fp)
+      fflush(png_ptr->fp);
 }
 #endif
 
 /* This function allows the application to supply new output functions for
-	libpng if standard C streams aren't being used.
+   libpng if standard C streams aren't being used.
 
-	This function takes as its arguments:
-	png_ptr       - pointer to a png output data structure
-	io_ptr        - pointer to user supplied structure containing info about
-						 the output functions.  May be NULL.
-	write_data_fn - pointer to a new output function which takes as its
-						 arguments a pointer to a png_struct, a pointer to
-						 data to be written, and a 32-bit unsigned int which is
-						 the number of bytes to be written.  The new write
-						 function should call png_error(png_ptr, "Error msg")
-						 to exit and output any fatal error messages.
-	flush_data_fn - pointer to a new flush function which takes as its
-						 arguments a pointer to a png_struct.  After a call to
-						 the flush function, there should be no data in any buffers
-						 or pending transmission.  If the output method doesn't do
-						 any buffering of ouput, a function prototype must still be
-						 supplied although it doesn't have to do anything.  If
-						 PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile
-						 time, output_flush_fn will be ignored, although it must be
-						 supplied for compatibility. */
+   This function takes as its arguments:
+   png_ptr       - pointer to a png output data structure
+   io_ptr        - pointer to user supplied structure containing info about
+                   the output functions.  May be NULL.
+   write_data_fn - pointer to a new output function which takes as its
+                   arguments a pointer to a png_struct, a pointer to
+                   data to be written, and a 32-bit unsigned int which is
+                   the number of bytes to be written.  The new write
+                   function should call png_error(png_ptr, "Error msg")
+                   to exit and output any fatal error messages.
+   flush_data_fn - pointer to a new flush function which takes as its
+                   arguments a pointer to a png_struct.  After a call to
+                   the flush function, there should be no data in any buffers
+                   or pending transmission.  If the output method doesn't do
+                   any buffering of ouput, a function prototype must still be
+                   supplied although it doesn't have to do anything.  If
+                   PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile
+                   time, output_flush_fn will be ignored, although it must be
+                   supplied for compatibility. */
 void
 png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
-	png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
+   png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
 {
-	png_ptr->io_ptr = io_ptr;
+   png_ptr->io_ptr = io_ptr;
 
-	if (write_data_fn)
-		png_ptr->write_data_fn = write_data_fn;
-	else
-		png_ptr->write_data_fn = png_default_write_data;
+   if (write_data_fn)
+      png_ptr->write_data_fn = write_data_fn;
+   else
+      png_ptr->write_data_fn = png_default_write_data;
 
 #if defined(PNG_WRITE_FLUSH_SUPPORTED)
-	if (output_flush_fn)
-		png_ptr->output_flush_fn = output_flush_fn;
-	else
-		png_ptr->output_flush_fn = png_default_flush;
+   if (output_flush_fn)
+      png_ptr->output_flush_fn = output_flush_fn;
+   else
+      png_ptr->output_flush_fn = png_default_flush;
 #endif /* PNG_WRITE_FLUSH_SUPPORTED */
 
-	/* It is an error to read while writing a png file */
-	png_ptr->read_data_fn = NULL;
+   /* It is an error to read while writing a png file */
+   png_ptr->read_data_fn = NULL;
 }
 
 
 /* This function allows the application to supply a new input function
-	for libpng if standard C streams aren't being used.
+   for libpng if standard C streams aren't being used.
 
-	This function takes as its arguments:
-	png_ptr      - pointer to a png input data structure
-	io_ptr       - pointer to user supplied structure containing info about
-						the input functions.  May be NULL.
-	read_data_fn - pointer to a new input function which takes as it's
-						arguments a pointer to a png_struct, a pointer to
-						a location where input data can be stored, and a 32-bit
-						unsigned int which is the number of bytes to be read.
-						To exit and output any fatal error messages the new write
+   This function takes as its arguments:
+   png_ptr      - pointer to a png input data structure
+   io_ptr       - pointer to user supplied structure containing info about
+                  the input functions.  May be NULL.
+   read_data_fn - pointer to a new input function which takes as it's
+                  arguments a pointer to a png_struct, a pointer to
+                  a location where input data can be stored, and a 32-bit
+                  unsigned int which is the number of bytes to be read.
+                  To exit and output any fatal error messages the new write
                   function should call png_error(png_ptr, "Error msg"). */
 void
 png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
-	png_rw_ptr read_data_fn)
+   png_rw_ptr read_data_fn)
 {
-	png_ptr->io_ptr = io_ptr;
+   png_ptr->io_ptr = io_ptr;
 
-	if (read_data_fn)
-		png_ptr->read_data_fn = read_data_fn;
-	else
-		png_ptr->read_data_fn = png_default_read_data;
+   if (read_data_fn)
+      png_ptr->read_data_fn = read_data_fn;
+   else
+      png_ptr->read_data_fn = png_default_read_data;
 
-	/* It is an error to write to a read device */
-	png_ptr->write_data_fn = NULL;
+   /* It is an error to write to a read device */
+   png_ptr->write_data_fn = NULL;
 
 #if defined(PNG_WRITE_FLUSH_SUPPORTED)
-	png_ptr->output_flush_fn = NULL;
+   png_ptr->output_flush_fn = NULL;
 #endif /* PNG_WRITE_FLUSH_SUPPORTED */
 }
 
 
 /* This function returns a pointer to the io_ptr associated with the user
-	functions.  The application should free any memory associated with this
-	pointer before png_write_destroy and png_read_destroy are called. */
+   functions.  The application should free any memory associated with this
+   pointer before png_write_destroy and png_read_destroy are called. */
 png_voidp
 png_get_io_ptr(png_structp png_ptr)
 {
-	return png_ptr->io_ptr;
+   return png_ptr->io_ptr;
 }
 
 /* Initialize the default input/output functions for the png file.  If you
-	change the read, or write routines, you can call either png_set_read_fn()
+   change the read, or write routines, you can call either png_set_read_fn()
    or png_set_write_fn() instead of png_init_io(). */
 void
 png_init_io(png_structp png_ptr, FILE *fp)
 {
-	png_ptr->fp = fp;
-	png_ptr->read_data_fn = png_default_read_data;
-	png_ptr->write_data_fn = png_default_write_data;
+   png_ptr->fp = fp;
+   png_ptr->read_data_fn = png_default_read_data;
+   png_ptr->write_data_fn = png_default_write_data;
 #ifdef PNG_WRITE_FLUSH_SUPPORTED
-	png_ptr->output_flush_fn = png_default_flush;
+   png_ptr->output_flush_fn = png_default_flush;
 #endif
 }
 
diff --git a/pngmem.c b/pngmem.c
index 83b8528..63200fd 100644
--- a/pngmem.c
+++ b/pngmem.c
@@ -1,14 +1,14 @@
 
 /* pngmem.c - stub functions for memory allocation
 
-	libpng 1.0 beta 2 - version 0.87
+   libpng 1.0 beta 2 - version 0.88
    For conditions of distribution and use, see copyright notice in png.h
-	Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
-   January 15, 1996
+   Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+   January 25, 1996
 
    This file provides a location for all memory allocation.  Users which
-	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 modify the code in this file
+   to meet their needs.  See the instructions at each function. */
 
 #define PNG_INTERNAL
 #include "png.h"
@@ -18,190 +18,113 @@
 /* if you change this, be sure to change the one in png.h also */
 
 /* Allocate memory.  For reasonable files, size should never exceed
-	64K.  However, zlib may allocate more then 64K if you don't tell
-	it not to.  See zconf.h and png.h for more information. zlib does
-	need to allocate exactly 64K, so whatever you call here must
-	have the ability to do that. */
+   64K.  However, zlib may allocate more then 64K if you don't tell
+   it not to.  See zconf.h and png.h for more information. zlib does
+   need to allocate exactly 64K, so whatever you call here must
+   have the ability to do that. */
 
 /* Borland seems to have a problem in DOS mode for exactly 64K.
-	It gives you a segment with an offset of 8 (perhaps to store it's
-	memory stuff).  zlib doesn't like this at all, so we have to
-	detect and deal with it.  This code should not be needed in
+   It gives you a segment with an offset of 8 (perhaps to store it's
+   memory stuff).  zlib doesn't like this at all, so we have to
+   detect and deal with it.  This code should not be needed in
    Windows or OS/2 modes, and only in 16 bit mode.
 */
 
 png_voidp
 png_large_malloc(png_structp png_ptr, png_uint_32 size)
 {
-	png_voidp ret;
-	if (!png_ptr || !size)
-		return ((voidp)0);
+   png_voidp ret;
+   if (!png_ptr || !size)
+      return ((voidp)0);
 
 #ifdef PNG_MAX_MALLOC_64K
-	if (size > (png_uint_32)65536L)
-		png_error(png_ptr, "Cannot Allocate > 64K");
+   if (size > (png_uint_32)65536L)
+      png_error(png_ptr, "Cannot Allocate > 64K");
 #endif
 
-	if (size == (png_uint_32)(65536L))
-	{
-		if (!png_ptr->offset_table)
-		{
-			/* try to see if we need to do any of this fancy stuff */
-			ret = farmalloc(size);
-			if (!ret || ((long)ret & 0xffff))
-			{
-				int num_blocks;
-				png_uint_32 total_size;
-				png_bytep table;
-				int i;
+   if (size == (png_uint_32)(65536L))
+   {
+      if (!png_ptr->offset_table)
+      {
+         /* try to see if we need to do any of this fancy stuff */
+         ret = farmalloc(size);
+         if (!ret || ((long)ret & 0xffff))
+         {
+            int num_blocks;
+            png_uint_32 total_size;
+            png_bytep table;
+            int i;
             png_byte huge * hptr;
 
-				if (ret)
-					farfree(ret);
-				ret = 0;
+            if (ret)
+               farfree(ret);
+            ret = 0;
 
-				num_blocks = (int)(1 << (png_ptr->zlib_window_bits - 14));
-				if (num_blocks < 1)
-					num_blocks = 1;
-				if (png_ptr->zlib_mem_level >= 7)
-					num_blocks += (int)(1 << (png_ptr->zlib_mem_level - 7));
-				else
-            	num_blocks++;
+            num_blocks = (int)(1 << (png_ptr->zlib_window_bits - 14));
+            if (num_blocks < 1)
+               num_blocks = 1;
+            if (png_ptr->zlib_mem_level >= 7)
+               num_blocks += (int)(1 << (png_ptr->zlib_mem_level - 7));
+            else
+               num_blocks++;
 
-				total_size = ((png_uint_32)65536L) * (png_uint_32)num_blocks;
+            total_size = ((png_uint_32)65536L) * (png_uint_32)num_blocks;
 
-				table = farmalloc(total_size);
+            table = farmalloc(total_size);
 
-				if (!table)
-				{
-					png_error(png_ptr, "Out of Memory");
-				}
+            if (!table)
+            {
+               png_error(png_ptr, "Out of Memory");
+            }
 
-				if ((long)table & 0xffff)
-				{
-					farfree(table);
-					total_size += (png_uint_32)65536L;
-				}
+            if ((long)table & 0xffff)
+            {
+               farfree(table);
+               total_size += (png_uint_32)65536L;
+            }
 
-				table = farmalloc(total_size);
+            table = farmalloc(total_size);
 
-				if (!table)
-				{
-					png_error(png_ptr, "Out of Memory");
-				}
+            if (!table)
+            {
+               png_error(png_ptr, "Out of Memory");
+            }
 
-				png_ptr->offset_table = table;
-				png_ptr->offset_table_ptr = farmalloc(
-					num_blocks * sizeof (png_bytep));
-				hptr = (png_byte huge *)table;
-				if ((long)hptr & 0xffff)
-				{
-					hptr = (png_byte huge *)((long)(hptr) & 0xffff0000L);
-					hptr += 65536L;
-				}
-				for (i = 0; i < num_blocks; i++)
-				{
-					png_ptr->offset_table_ptr[i] = (png_bytep)hptr;
-					hptr += 65536L;
-				}
+            png_ptr->offset_table = table;
+            png_ptr->offset_table_ptr = farmalloc(
+               num_blocks * sizeof (png_bytep));
+            hptr = (png_byte huge *)table;
+            if ((long)hptr & 0xffff)
+            {
+               hptr = (png_byte huge *)((long)(hptr) & 0xffff0000L);
+               hptr += 65536L;
+            }
+            for (i = 0; i < num_blocks; i++)
+            {
+               png_ptr->offset_table_ptr[i] = (png_bytep)hptr;
+               hptr += 65536L;
+            }
 
-				png_ptr->offset_table_number = num_blocks;
-				png_ptr->offset_table_count = 0;
-				png_ptr->offset_table_count_free = 0;
-			}
+            png_ptr->offset_table_number = num_blocks;
+            png_ptr->offset_table_count = 0;
+            png_ptr->offset_table_count_free = 0;
+         }
 
-			if (png_ptr->offset_table_count >= png_ptr->offset_table_number)
-				png_error(png_ptr, "Out of Memory");
+         if (png_ptr->offset_table_count >= png_ptr->offset_table_number)
+            png_error(png_ptr, "Out of Memory");
 
          ret = png_ptr->offset_table_ptr[png_ptr->offset_table_count++];
-		}
-	}
-	else
-		ret = farmalloc(size);
-
-	if (ret == NULL)
-	{
-		png_error(png_ptr, "Out of Memory");
-	}
-
-	return ret;
-}
-
-/* free a pointer allocated by png_large_malloc().  In the default
-  configuration, png_ptr is not used, but is passed in case it
-  is needed.  If ptr is NULL, return without taking any action. */
-void
-png_large_free(png_structp png_ptr, png_voidp ptr)
-{
-	if (!png_ptr)
-		return;
-
-	if (ptr != NULL)
-	{
-		if (png_ptr->offset_table)
-		{
-			int i;
-
-			for (i = 0; i < png_ptr->offset_table_count; i++)
-			{
-				if (ptr == png_ptr->offset_table_ptr[i])
-            {
-					ptr = 0;
-               png_ptr->offset_table_count_free++;
-					break;
-				}
-			}
-			if (png_ptr->offset_table_count_free == png_ptr->offset_table_count)
-			{
-				farfree(png_ptr->offset_table);
-				farfree(png_ptr->offset_table_ptr);
-				png_ptr->offset_table = 0;
-				png_ptr->offset_table_ptr = 0;
-         }
-		}
-
-		if (ptr)
-			farfree(ptr);
-	}
-}
-
-#else /* Not the Borland DOS special memory handler */
-
-/* Allocate memory.  For reasonable files, size should never exceed
-	64K.  However, zlib may allocate more then 64K if you don't tell
-	it not to.  See zconf.h and png.h for more information. zlib does
-	need to allocate exactly 64K, so whatever you call here must
-	have the ability to do that. */
-
-
-png_voidp
-png_large_malloc(png_structp png_ptr, png_uint_32 size)
-{
-	png_voidp ret;
-	if (!png_ptr || !size)
-		return ((voidp)0);
-
-#ifdef PNG_MAX_MALLOC_64K
-	if (size > (png_uint_32)65536L)
-		png_error(png_ptr, "Cannot Allocate > 64K");
-#endif
-
-#if defined(__TURBOC__) && !defined(__FLAT__)
-	ret = farmalloc(size);
-#else
-# if defined(_MSC_VER) && defined(MAXSEG_64K)
-	ret = halloc(size, 1);
-# else
-	ret = malloc(size);
-# endif
-#endif
+      }
+   }
+   else
+      ret = farmalloc(size);
 
    if (ret == NULL)
    {
       png_error(png_ptr, "Out of Memory");
    }
 
-	return ret;
+   return ret;
 }
 
 /* free a pointer allocated by png_large_malloc().  In the default
@@ -211,29 +134,106 @@
 png_large_free(png_structp png_ptr, png_voidp ptr)
 {
    if (!png_ptr)
-		return;
+      return;
+
+   if (ptr != NULL)
+   {
+      if (png_ptr->offset_table)
+      {
+         int i;
+
+         for (i = 0; i < png_ptr->offset_table_count; i++)
+         {
+            if (ptr == png_ptr->offset_table_ptr[i])
+            {
+               ptr = 0;
+               png_ptr->offset_table_count_free++;
+               break;
+            }
+         }
+         if (png_ptr->offset_table_count_free == png_ptr->offset_table_count)
+         {
+            farfree(png_ptr->offset_table);
+            farfree(png_ptr->offset_table_ptr);
+            png_ptr->offset_table = 0;
+            png_ptr->offset_table_ptr = 0;
+         }
+      }
+
+      if (ptr)
+         farfree(ptr);
+   }
+}
+
+#else /* Not the Borland DOS special memory handler */
+
+/* Allocate memory.  For reasonable files, size should never exceed
+   64K.  However, zlib may allocate more then 64K if you don't tell
+   it not to.  See zconf.h and png.h for more information. zlib does
+   need to allocate exactly 64K, so whatever you call here must
+   have the ability to do that. */
+
+
+png_voidp
+png_large_malloc(png_structp png_ptr, png_uint_32 size)
+{
+   png_voidp ret;
+   if (!png_ptr || !size)
+      return ((voidp)0);
+
+#ifdef PNG_MAX_MALLOC_64K
+   if (size > (png_uint_32)65536L)
+      png_error(png_ptr, "Cannot Allocate > 64K");
+#endif
+
+#if defined(__TURBOC__) && !defined(__FLAT__)
+   ret = farmalloc(size);
+#else
+# if defined(_MSC_VER) && defined(MAXSEG_64K)
+   ret = halloc(size, 1);
+# else
+   ret = malloc(size);
+# endif
+#endif
+
+   if (ret == NULL)
+   {
+      png_error(png_ptr, "Out of Memory");
+   }
+
+   return ret;
+}
+
+/* free a pointer allocated by png_large_malloc().  In the default
+  configuration, png_ptr is not used, but is passed in case it
+  is needed.  If ptr is NULL, return without taking any action. */
+void
+png_large_free(png_structp png_ptr, png_voidp ptr)
+{
+   if (!png_ptr)
+      return;
 
    if (ptr != NULL)
    {
 #if defined(__TURBOC__) && !defined(__FLAT__)
-		farfree(ptr);
+      farfree(ptr);
 #else
 # if defined(_MSC_VER) && defined(MAXSEG_64K)
-		hfree(ptr);
+      hfree(ptr);
 # else
-		free(ptr);
+      free(ptr);
 # endif
 #endif
-	}
+   }
 }
 
 #endif /* Not Borland DOS special memory handler */
 
 /* Allocate memory.  This is called for smallish blocks only  It
-	should not get anywhere near 64K.  On segmented machines, this
-	must come from the local heap (for zlib).  Currently, zlib is
-	the only one that uses this, so you should only get one call
-	to this, and that a small block. */
+   should not get anywhere near 64K.  On segmented machines, this
+   must come from the local heap (for zlib).  Currently, zlib is
+   the only one that uses this, so you should only get one call
+   to this, and that a small block. */
 void *
 png_malloc(png_structp png_ptr, png_uint_32 size)
 {
@@ -252,39 +252,39 @@
 
    ret = malloc((png_size_t)size);
 
-	if (!ret)
+   if (!ret)
    {
-		png_error(png_ptr, "Out of Memory");
+      png_error(png_ptr, "Out of Memory");
    }
 
    return ret;
 }
 
 /* Reallocate memory.  This will not get near 64K on a
-	even marginally reasonable file.  This is not used in
-	the current version of the library. */
+   even marginally reasonable file.  This is not used in
+   the current version of the library. */
 void *
 png_realloc(png_structp png_ptr, void * ptr, png_uint_32 size,
-	png_uint_32 old_size)
+   png_uint_32 old_size)
 {
-	void *ret;
+   void *ret;
 
-	if (!png_ptr || !old_size || !ptr || !size)
-		return ((void *)0);
+   if (!png_ptr || !old_size || !ptr || !size)
+      return ((void *)0);
 
 #ifdef PNG_MAX_MALLOC_64K
-	if (size > (png_uint_32)65536L)
-		png_error(png_ptr, "Cannot Allocate > 64K");
+   if (size > (png_uint_32)65536L)
+      png_error(png_ptr, "Cannot Allocate > 64K");
 #endif
 
-	ret = realloc(ptr, (png_size_t)size);
+   ret = realloc(ptr, (png_size_t)size);
 
-	if (!ret)
-	{
-		png_error(png_ptr, "Out of Memory 7");
-	}
+   if (!ret)
+   {
+      png_error(png_ptr, "Out of Memory 7");
+   }
 
-	return ret;
+   return ret;
 }
 
 /* free a pointer allocated by png_malloc().  In the default
@@ -293,11 +293,11 @@
 void
 png_free(png_structp png_ptr, void * ptr)
 {
-	if (!png_ptr)
-		return;
+   if (!png_ptr)
+      return;
 
-	if (ptr != (void *)0)
-		free(ptr);
+   if (ptr != (void *)0)
+      free(ptr);
 }
 
 
diff --git a/pngpread.c b/pngpread.c
index f23f326..facea6c 100644
--- a/pngpread.c
+++ b/pngpread.c
@@ -1,10 +1,10 @@
 
 /* pngpread.c - read a png file in push mode
 
-	libpng 1.0 beta 2 - version 0.87
+   libpng 1.0 beta 2 - version 0.88
    For conditions of distribution and use, see copyright notice in png.h
-	Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
-   January 15, 1996
+   Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+   January 25, 1996
    */
 
 #define PNG_INTERNAL
@@ -14,605 +14,623 @@
 
 void
 png_process_data(png_structp png_ptr, png_infop info,
-	png_bytep buffer, png_uint_32 buffer_size)
+   png_bytep buffer, png_uint_32 buffer_size)
 {
-	png_push_restore_buffer(png_ptr, buffer, buffer_size);
+   png_push_restore_buffer(png_ptr, buffer, buffer_size);
 
-	while (png_ptr->buffer_size)
-	{
-		png_process_some_data(png_ptr, info);
-	}
+   while (png_ptr->buffer_size)
+   {
+      png_process_some_data(png_ptr, info);
+   }
 }
 
 void
 png_process_some_data(png_structp png_ptr, png_infop info)
 {
-	switch (png_ptr->process_mode)
-	{
-		case PNG_READ_SIG_MODE:
-		{
-			png_push_read_sig(png_ptr);
-			break;
-		}
-		case PNG_READ_CHUNK_MODE:
-		{
-			png_push_read_chunk(png_ptr, info);
-			break;
-		}
-		case PNG_READ_IDAT_MODE:
-		{
-			png_push_read_idat(png_ptr);
-			break;
-		}
-		case PNG_READ_PLTE_MODE:
-		{
-			png_push_read_plte(png_ptr, info);
-			break;
-		}
+   switch (png_ptr->process_mode)
+   {
+      case PNG_READ_SIG_MODE:
+      {
+         png_push_read_sig(png_ptr);
+         break;
+      }
+      case PNG_READ_CHUNK_MODE:
+      {
+         png_push_read_chunk(png_ptr, info);
+         break;
+      }
+      case PNG_READ_IDAT_MODE:
+      {
+         png_push_read_idat(png_ptr);
+         break;
+      }
+      case PNG_READ_PLTE_MODE:
+      {
+         png_push_read_plte(png_ptr, info);
+         break;
+      }
 #if defined(PNG_READ_tEXt_SUPPORTED)
-		case PNG_READ_tEXt_MODE:
-		{
-			png_push_read_text(png_ptr, info);
-			break;
-		}
+      case PNG_READ_tEXt_MODE:
+      {
+         png_push_read_text(png_ptr, info);
+         break;
+      }
 #endif
-		case PNG_READ_END_MODE:
-		{
-			png_push_read_end(png_ptr, info);
-			break;
-		}
-		case PNG_SKIP_MODE:
-		{
-			png_push_skip(png_ptr);
-			break;
-		}
-		default:
-		{
-			png_ptr->buffer_size = 0;
-			break;
-		}
-	}
+#if defined(PNG_READ_zTXt_SUPPORTED)
+      case PNG_READ_zTXt_MODE:
+      {
+         png_push_read_ztxt(png_ptr, info);
+         break;
+      }
+#endif
+      case PNG_READ_END_MODE:
+      {
+         png_push_read_end(png_ptr, info);
+         break;
+      }
+      case PNG_SKIP_MODE:
+      {
+         png_push_skip(png_ptr);
+         break;
+      }
+      default:
+      {
+         png_ptr->buffer_size = 0;
+         break;
+      }
+   }
 }
 
 void
 png_push_read_sig(png_structp png_ptr)
 {
-	png_byte sig[8];
+   png_byte sig[8];
 
-	if (png_ptr->buffer_size < 8)
-	{
-		png_push_save_buffer(png_ptr);
-		return;
-	}
+   if (png_ptr->buffer_size < 8)
+   {
+      png_push_save_buffer(png_ptr);
+      return;
+   }
 
-	png_push_fill_buffer(png_ptr, sig, 8);
+   png_push_fill_buffer(png_ptr, sig, 8);
 
-	if (png_check_sig(sig, 8))
-	{
-		png_ptr->process_mode = PNG_READ_CHUNK_MODE;
-	}
-	else
-	{
-   	png_error(png_ptr, "Not a PNG file");
-	}
+   if (png_check_sig(sig, 8))
+   {
+      png_ptr->process_mode = PNG_READ_CHUNK_MODE;
+   }
+   else
+   {
+      png_error(png_ptr, "Not a PNG file");
+   }
 }
 
 void
 png_push_read_chunk(png_structp png_ptr, png_infop info)
 {
-	if (!png_ptr->have_chunk_header)
-	{
-		png_byte chunk_start[8];
+   if (!png_ptr->have_chunk_header)
+   {
+      png_byte chunk_start[8];
 
-		if (png_ptr->buffer_size < 8)
-		{
-			png_push_save_buffer(png_ptr);
-			return;
-		}
+      if (png_ptr->buffer_size < 8)
+      {
+         png_push_save_buffer(png_ptr);
+         return;
+      }
 
-		png_push_fill_buffer(png_ptr, chunk_start, 8);
-		png_ptr->push_length = png_get_uint_32(chunk_start);
-		png_memcpy(png_ptr->push_chunk_name, (png_voidp)(chunk_start + 4), 4);
-		png_ptr->have_chunk_header = 1;
-		png_reset_crc(png_ptr);
-		png_calculate_crc(png_ptr, chunk_start + 4, 4);
-	}
+      png_push_fill_buffer(png_ptr, chunk_start, 8);
+      png_ptr->push_length = png_get_uint_32(chunk_start);
+      png_memcpy(png_ptr->push_chunk_name, (png_voidp)(chunk_start + 4), 4);
+      png_ptr->have_chunk_header = 1;
+      png_reset_crc(png_ptr);
+      png_calculate_crc(png_ptr, chunk_start + 4, 4);
+   }
 
-	if (!png_memcmp(png_ptr->push_chunk_name, png_IHDR, 4))
-	{
-		if (png_ptr->mode != PNG_BEFORE_IHDR)
-			png_error(png_ptr, "Out of Place IHDR");
+   if (!png_memcmp(png_ptr->push_chunk_name, png_IHDR, 4))
+   {
+      if (png_ptr->mode != PNG_BEFORE_IHDR)
+         png_error(png_ptr, "Out of Place IHDR");
 
-		if (png_ptr->push_length + 4 > png_ptr->buffer_size)
-		{
-			png_push_save_buffer(png_ptr);
-			return;
-		}
+      if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+      {
+         png_push_save_buffer(png_ptr);
+         return;
+      }
 
-		png_handle_IHDR(png_ptr, info, png_ptr->push_length);
-		png_push_check_crc(png_ptr);
-		png_ptr->mode = PNG_HAVE_IHDR;
-	}
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_PLTE, 4))
-	{
-		if (png_ptr->mode != PNG_HAVE_IHDR)
-			png_error(png_ptr, "Missing IHDR");
+      png_handle_IHDR(png_ptr, info, png_ptr->push_length);
+      png_push_check_crc(png_ptr);
+      png_ptr->mode = PNG_HAVE_IHDR;
+   }
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_PLTE, 4))
+   {
+      if (png_ptr->mode != PNG_HAVE_IHDR)
+         png_error(png_ptr, "Missing IHDR");
 
 #if !defined(PNG_READ_OPT_PLTE_SUPPORTED)
-		if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE)
-			png_push_crc_skip(png_ptr, length);
-		else
+      if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE)
+         png_push_crc_skip(png_ptr, length);
+      else
 #else
-		{
-			png_push_handle_PLTE(png_ptr, png_ptr->push_length);
-		}
+      {
+         png_push_handle_PLTE(png_ptr, png_ptr->push_length);
+      }
 #endif
-		png_ptr->mode = PNG_HAVE_PLTE;
-	}
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_IDAT, 4))
-	{
-		png_ptr->idat_size = png_ptr->push_length;
-		png_ptr->mode = PNG_HAVE_IDAT;
-		png_ptr->process_mode = PNG_READ_IDAT_MODE;
-		png_push_have_info(png_ptr, info);
-		png_ptr->zstream->avail_out = (uInt)png_ptr->irowbytes;
-		png_ptr->zstream->next_out = png_ptr->row_buf;
-		return;
-	}
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_IEND, 4))
-	{
-		png_error(png_ptr, "No Image in File");
-	}
+      png_ptr->mode = PNG_HAVE_PLTE;
+   }
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_IDAT, 4))
+   {
+      png_ptr->idat_size = png_ptr->push_length;
+      png_ptr->mode = PNG_HAVE_IDAT;
+      png_ptr->process_mode = PNG_READ_IDAT_MODE;
+      png_push_have_info(png_ptr, info);
+      png_ptr->zstream->avail_out = (uInt)png_ptr->irowbytes;
+      png_ptr->zstream->next_out = png_ptr->row_buf;
+      return;
+   }
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_IEND, 4))
+   {
+      png_error(png_ptr, "No Image in File");
+   }
 #if defined(PNG_READ_gAMA_SUPPORTED)
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_gAMA, 4))
-	{
-		if (png_ptr->push_length + 4 > png_ptr->buffer_size)
-		{
-			png_push_save_buffer(png_ptr);
-			return;
-		}
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_gAMA, 4))
+   {
+      if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+      {
+         png_push_save_buffer(png_ptr);
+         return;
+      }
 
-		if (png_ptr->mode != PNG_HAVE_IHDR)
-			png_error(png_ptr, "Out of Place PLTE");
+      if (png_ptr->mode != PNG_HAVE_IHDR)
+         png_error(png_ptr, "Out of Place gAMA");
 
-		png_handle_gAMA(png_ptr, info, png_ptr->push_length);
-		png_push_check_crc(png_ptr);
-	}
+      png_handle_gAMA(png_ptr, info, png_ptr->push_length);
+      png_push_check_crc(png_ptr);
+   }
 #endif
 #if defined(PNG_READ_sBIT_SUPPORTED)
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_sBIT, 4))
-	{
-		if (png_ptr->push_length + 4 > png_ptr->buffer_size)
-		{
-			png_push_save_buffer(png_ptr);
-			return;
-		}
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_sBIT, 4))
+   {
+      if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+      {
+         png_push_save_buffer(png_ptr);
+         return;
+      }
 
-		if (png_ptr->mode != PNG_HAVE_IHDR)
-			png_error(png_ptr, "Out of Place sBIT");
+      if (png_ptr->mode != PNG_HAVE_IHDR)
+         png_error(png_ptr, "Out of Place sBIT");
 
-		png_handle_sBIT(png_ptr, info, png_ptr->push_length);
-		png_push_check_crc(png_ptr);
-	}
+      png_handle_sBIT(png_ptr, info, png_ptr->push_length);
+      png_push_check_crc(png_ptr);
+   }
 #endif
 #if defined(PNG_READ_cHRM_SUPPORTED)
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_cHRM, 4))
-	{
-		if (png_ptr->push_length + 4 > png_ptr->buffer_size)
-		{
-			png_push_save_buffer(png_ptr);
-			return;
-		}
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_cHRM, 4))
+   {
+      if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+      {
+         png_push_save_buffer(png_ptr);
+         return;
+      }
 
-		if (png_ptr->mode != PNG_HAVE_IHDR)
-			png_error(png_ptr, "Out of Place cHRM");
+      if (png_ptr->mode != PNG_HAVE_IHDR)
+         png_error(png_ptr, "Out of Place cHRM");
 
-		png_handle_cHRM(png_ptr, info, png_ptr->push_length);
-		png_push_check_crc(png_ptr);
-	}
+      png_handle_cHRM(png_ptr, info, png_ptr->push_length);
+      png_push_check_crc(png_ptr);
+   }
 #endif
 #if defined(PNG_READ_tRNS_SUPPORTED)
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_tRNS, 4))
-	{
-		if (png_ptr->push_length + 4 > png_ptr->buffer_size)
-		{
-			png_push_save_buffer(png_ptr);
-			return;
-		}
-		if (png_ptr->mode != PNG_HAVE_IHDR &&
-			png_ptr->mode != PNG_HAVE_PLTE)
-			png_error(png_ptr, "Out of Place tRNS");
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_tRNS, 4))
+   {
+      if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+      {
+         png_push_save_buffer(png_ptr);
+         return;
+      }
+      if (png_ptr->mode != PNG_HAVE_IHDR &&
+         png_ptr->mode != PNG_HAVE_PLTE)
+         png_error(png_ptr, "Out of Place tRNS");
 
-		png_handle_tRNS(png_ptr, info, png_ptr->push_length);
-		png_push_check_crc(png_ptr);
-	}
+      png_handle_tRNS(png_ptr, info, png_ptr->push_length);
+      png_push_check_crc(png_ptr);
+   }
 #endif
 #if defined(PNG_READ_bKGD_SUPPORTED)
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_bKGD, 4))
-	{
-		if (png_ptr->push_length + 4 > png_ptr->buffer_size)
-		{
-			png_push_save_buffer(png_ptr);
-			return;
-		}
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_bKGD, 4))
+   {
+      if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+      {
+         png_push_save_buffer(png_ptr);
+         return;
+      }
 
-		if (png_ptr->mode != PNG_HAVE_IHDR &&
-			png_ptr->mode != PNG_HAVE_PLTE)
-			png_error(png_ptr, "Out of Place bKGD");
+      if (png_ptr->mode != PNG_HAVE_IHDR &&
+         png_ptr->mode != PNG_HAVE_PLTE)
+         png_error(png_ptr, "Out of Place bKGD");
 
-		png_handle_bKGD(png_ptr, info, png_ptr->push_length);
-		png_push_check_crc(png_ptr);
-	}
+      png_handle_bKGD(png_ptr, info, png_ptr->push_length);
+      png_push_check_crc(png_ptr);
+   }
 #endif
 #if defined(PNG_READ_hIST_SUPPORTED)
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_hIST, 4))
-	{
-		if (png_ptr->push_length + 4 > png_ptr->buffer_size)
-		{
-			png_push_save_buffer(png_ptr);
-			return;
-		}
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_hIST, 4))
+   {
+      if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+      {
+         png_push_save_buffer(png_ptr);
+         return;
+      }
 
-		if (png_ptr->mode != PNG_HAVE_PLTE)
-			png_error(png_ptr, "Out of Place hIST");
+      if (png_ptr->mode != PNG_HAVE_PLTE)
+         png_error(png_ptr, "Out of Place hIST");
 
-		png_handle_hIST(png_ptr, info, png_ptr->push_length);
-		png_push_check_crc(png_ptr);
-	}
+      png_handle_hIST(png_ptr, info, png_ptr->push_length);
+      png_push_check_crc(png_ptr);
+   }
 #endif
 #if defined(PNG_READ_pHYs_SUPPORTED)
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_pHYs, 4))
-	{
-		if (png_ptr->push_length + 4 > png_ptr->buffer_size)
-		{
-			png_push_save_buffer(png_ptr);
-			return;
-		}
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_pHYs, 4))
+   {
+      if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+      {
+         png_push_save_buffer(png_ptr);
+         return;
+      }
 
-		if (png_ptr->mode != PNG_HAVE_IHDR &&
-			png_ptr->mode != PNG_HAVE_PLTE)
-			png_error(png_ptr, "Out of Place pHYs");
+      if (png_ptr->mode != PNG_HAVE_IHDR &&
+         png_ptr->mode != PNG_HAVE_PLTE)
+         png_error(png_ptr, "Out of Place pHYs");
 
-		png_handle_pHYs(png_ptr, info, png_ptr->push_length);
-		png_push_check_crc(png_ptr);
-	}
+      png_handle_pHYs(png_ptr, info, png_ptr->push_length);
+      png_push_check_crc(png_ptr);
+   }
 #endif
 #if defined(PNG_READ_oFFs_SUPPORTED)
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_oFFs, 4))
-	{
-		if (png_ptr->push_length + 4 > png_ptr->buffer_size)
-		{
-			png_push_save_buffer(png_ptr);
-			return;
-		}
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_oFFs, 4))
+   {
+      if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+      {
+         png_push_save_buffer(png_ptr);
+         return;
+      }
 
-		if (png_ptr->mode != PNG_HAVE_IHDR &&
-			png_ptr->mode != PNG_HAVE_PLTE)
-			png_error(png_ptr, "Out of Place oFFs");
+      if (png_ptr->mode != PNG_HAVE_IHDR &&
+         png_ptr->mode != PNG_HAVE_PLTE)
+         png_error(png_ptr, "Out of Place oFFs");
 
-		png_handle_oFFs(png_ptr, info, png_ptr->push_length);
-		png_push_check_crc(png_ptr);
-	}
+      png_handle_oFFs(png_ptr, info, png_ptr->push_length);
+      png_push_check_crc(png_ptr);
+   }
 #endif
 #if defined(PNG_READ_tIME_SUPPORTED)
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_tIME, 4))
-	{
-		if (png_ptr->push_length + 4 > png_ptr->buffer_size)
-		{
-			png_push_save_buffer(png_ptr);
-			return;
-		}
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_tIME, 4))
+   {
+      if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+      {
+         png_push_save_buffer(png_ptr);
+         return;
+      }
 
-		if (png_ptr->mode == PNG_BEFORE_IHDR ||
-			png_ptr->mode == PNG_AFTER_IEND)
-			png_error(png_ptr, "Out of Place tIME");
+      if (png_ptr->mode == PNG_BEFORE_IHDR ||
+         png_ptr->mode == PNG_AFTER_IEND)
+         png_error(png_ptr, "Out of Place tIME");
 
-		png_handle_tIME(png_ptr, info, png_ptr->push_length);
-		png_push_check_crc(png_ptr);
-	}
+      png_handle_tIME(png_ptr, info, png_ptr->push_length);
+      png_push_check_crc(png_ptr);
+   }
 #endif
 #if defined(PNG_READ_tEXt_SUPPORTED)
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_tEXt, 4))
-	{
-		if (png_ptr->mode == PNG_BEFORE_IHDR ||
-			png_ptr->mode == PNG_AFTER_IEND)
-			png_error(png_ptr, "Out of Place tEXt");
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_tEXt, 4))
+   {
+      if (png_ptr->mode == PNG_BEFORE_IHDR ||
+         png_ptr->mode == PNG_AFTER_IEND)
+         png_error(png_ptr, "Out of Place tEXt");
 
-		png_push_handle_tEXt(png_ptr, png_ptr->push_length);
-	}
+      png_push_handle_tEXt(png_ptr, png_ptr->push_length);
+   }
 #endif
 #if defined(PNG_READ_zTXt_SUPPORTED)
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_zTXt, 4))
-	{
-		if (png_ptr->mode == PNG_BEFORE_IHDR ||
-			png_ptr->mode == PNG_AFTER_IEND)
-			png_error(png_ptr, "Out of Place zTXt");
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_zTXt, 4))
+   {
+      if (png_ptr->mode == PNG_BEFORE_IHDR ||
+         png_ptr->mode == PNG_AFTER_IEND)
+         png_error(png_ptr, "Out of Place zTXt");
 
-		png_push_handle_zTXt(png_ptr, png_ptr->push_length);
-	}
+      png_push_handle_zTXt(png_ptr, png_ptr->push_length);
+   }
 #endif
-	else
-	{
-		if ((png_ptr->push_chunk_name[0] & 0x20) == 0)
-			png_error(png_ptr, "Unknown Critical Chunk");
+   else
+   {
+      if ((png_ptr->push_chunk_name[0] & 0x20) == 0)
+         png_error(png_ptr, "Unknown Critical Chunk");
 
-		png_push_crc_skip(png_ptr, png_ptr->push_length);
-	}
-	png_ptr->have_chunk_header = 0;
+      png_push_crc_skip(png_ptr, png_ptr->push_length);
+   }
+   png_ptr->have_chunk_header = 0;
 }
 
 void
 png_push_check_crc(png_structp png_ptr)
 {
-	png_byte crc_buf[4];
-	png_uint_32 crc;
+   png_byte crc_buf[4];
+   png_uint_32 crc;
 
-	png_push_fill_buffer(png_ptr, crc_buf, 4);
-	crc = png_get_uint_32(crc_buf);
-	if (((crc ^ 0xffffffffL) & 0xffffffffL) !=
-		(png_ptr->crc & 0xffffffffL))
-		png_error(png_ptr, "Bad CRC value");
+   png_push_fill_buffer(png_ptr, crc_buf, 4);
+   crc = png_get_uint_32(crc_buf);
+   if (((crc ^ 0xffffffffL) & 0xffffffffL) !=
+      (png_ptr->crc & 0xffffffffL))
+      png_error(png_ptr, "Bad CRC value");
 }
 
 void
 png_push_crc_skip(png_structp png_ptr, png_uint_32 length)
 {
-	png_ptr->process_mode = PNG_SKIP_MODE;
-	png_ptr->skip_length = length;
+   png_ptr->process_mode = PNG_SKIP_MODE;
+   png_ptr->skip_length = length;
 }
 
 void
 png_push_skip(png_structp png_ptr)
 {
-	if (png_ptr->skip_length && png_ptr->save_buffer_size)
-	{
-		png_uint_32 save_size;
+   if (png_ptr->skip_length && png_ptr->save_buffer_size)
+   {
+      png_uint_32 save_size;
 
-		if (png_ptr->skip_length < png_ptr->save_buffer_size)
-			save_size = png_ptr->skip_length;
-		else
-			save_size = png_ptr->save_buffer_size;
+      if (png_ptr->skip_length < png_ptr->save_buffer_size)
+         save_size = png_ptr->skip_length;
+      else
+         save_size = png_ptr->save_buffer_size;
 
-		png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size);
+      png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size);
 
-		png_ptr->skip_length -= save_size;
-		png_ptr->buffer_size -= save_size;
-		png_ptr->save_buffer_size -= save_size;
-		png_ptr->save_buffer_ptr += (png_size_t)save_size;
-	}
-	if (png_ptr->skip_length && png_ptr->current_buffer_size)
-	{
-		png_uint_32 save_size;
+      png_ptr->skip_length -= save_size;
+      png_ptr->buffer_size -= save_size;
+      png_ptr->save_buffer_size -= save_size;
+      png_ptr->save_buffer_ptr += (png_size_t)save_size;
+   }
+   if (png_ptr->skip_length && png_ptr->current_buffer_size)
+   {
+      png_uint_32 save_size;
 
-		if (png_ptr->skip_length < png_ptr->current_buffer_size)
-			save_size = png_ptr->skip_length;
-		else
-			save_size = png_ptr->current_buffer_size;
+      if (png_ptr->skip_length < png_ptr->current_buffer_size)
+         save_size = png_ptr->skip_length;
+      else
+         save_size = png_ptr->current_buffer_size;
 
-		png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size);
+      png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size);
 
-		png_ptr->skip_length -= save_size;
-		png_ptr->buffer_size -= save_size;
-		png_ptr->current_buffer_size -= save_size;
-		png_ptr->current_buffer_ptr += (png_size_t)save_size;
-	}
-	if (!png_ptr->skip_length && png_ptr->buffer_size >= 4)
-	{
-		png_push_check_crc(png_ptr);
-		png_ptr->process_mode = PNG_READ_CHUNK_MODE;
-	}
+      png_ptr->skip_length -= save_size;
+      png_ptr->buffer_size -= save_size;
+      png_ptr->current_buffer_size -= save_size;
+      png_ptr->current_buffer_ptr += (png_size_t)save_size;
+   }
+   if (!png_ptr->skip_length)
+   {
+      if (png_ptr->buffer_size < 4)
+      {
+         png_push_save_buffer(png_ptr);
+         return;
+      }
+      png_push_check_crc(png_ptr);
+      png_ptr->process_mode = PNG_READ_CHUNK_MODE;
+   }
 }
 
 void
 png_push_fill_buffer(png_structp png_ptr, png_bytep buffer,
-	png_uint_32 length)
+   png_uint_32 length)
 {
-	png_bytep ptr;
+   png_bytep ptr;
 
-	ptr = buffer;
-	if (png_ptr->save_buffer_size)
-	{
-		png_uint_32 save_size;
+   ptr = buffer;
+   if (png_ptr->save_buffer_size)
+   {
+      png_uint_32 save_size;
 
-		if (length < png_ptr->save_buffer_size)
-			save_size = length;
-		else
-			save_size = png_ptr->save_buffer_size;
+      if (length < png_ptr->save_buffer_size)
+         save_size = length;
+      else
+         save_size = png_ptr->save_buffer_size;
 
-		png_memcpy(ptr, png_ptr->save_buffer_ptr, (png_size_t)save_size);
-		length -= save_size;
-		ptr += (png_size_t)save_size;
-		png_ptr->buffer_size -= save_size;
-		png_ptr->save_buffer_size -= save_size;
-		png_ptr->save_buffer_ptr += (png_size_t)save_size;
-	}
-	if (length && png_ptr->current_buffer_size)
-	{
-		png_uint_32 save_size;
+      png_memcpy(ptr, png_ptr->save_buffer_ptr, (png_size_t)save_size);
+      length -= save_size;
+      ptr += (png_size_t)save_size;
+      png_ptr->buffer_size -= save_size;
+      png_ptr->save_buffer_size -= save_size;
+      png_ptr->save_buffer_ptr += (png_size_t)save_size;
+   }
+   if (length && png_ptr->current_buffer_size)
+   {
+      png_uint_32 save_size;
 
-		if (length < png_ptr->current_buffer_size)
-			save_size = length;
-		else
-			save_size = png_ptr->current_buffer_size;
+      if (length < png_ptr->current_buffer_size)
+         save_size = length;
+      else
+         save_size = png_ptr->current_buffer_size;
 
-		png_memcpy(ptr, png_ptr->current_buffer_ptr, (png_size_t)save_size);
-		png_ptr->buffer_size -= save_size;
-		png_ptr->current_buffer_size -= save_size;
-		png_ptr->current_buffer_ptr += (png_size_t)save_size;
-	}
+      png_memcpy(ptr, png_ptr->current_buffer_ptr, (png_size_t)save_size);
+      png_ptr->buffer_size -= save_size;
+      png_ptr->current_buffer_size -= save_size;
+      png_ptr->current_buffer_ptr += (png_size_t)save_size;
+   }
 }
 
 void
 png_push_save_buffer(png_structp png_ptr)
 {
-	if (png_ptr->save_buffer_size)
-	{
-		if (png_ptr->save_buffer_ptr != png_ptr->save_buffer)
-		{
-			int i;
-			png_bytep sp;
-			png_bytep dp;
+   if (png_ptr->save_buffer_size)
+   {
+      if (png_ptr->save_buffer_ptr != png_ptr->save_buffer)
+      {
+         int i;
+         png_bytep sp;
+         png_bytep dp;
 
-			for (i = 0, sp = png_ptr->save_buffer_ptr, dp = png_ptr->save_buffer;
-				i < png_ptr->save_buffer_size;
-				i++, sp++, dp++)
-			{
-         	*dp = *sp;
-			}
-		}
-	}
-	if (png_ptr->save_buffer_size + png_ptr->current_buffer_size >
-		png_ptr->save_buffer_max)
-	{
-		int new_max;
-		png_bytep old_buffer;
+         for (i = 0, sp = png_ptr->save_buffer_ptr, dp = png_ptr->save_buffer;
+            i < png_ptr->save_buffer_size;
+            i++, sp++, dp++)
+         {
+            *dp = *sp;
+         }
+      }
+   }
+   if (png_ptr->save_buffer_size + png_ptr->current_buffer_size >
+      png_ptr->save_buffer_max)
+   {
+      int new_max;
+      png_bytep old_buffer;
 
-		new_max = (int)(png_ptr->save_buffer_size +
-			png_ptr->current_buffer_size + 256);
-		old_buffer = png_ptr->save_buffer;
-		png_ptr->save_buffer = (png_bytep)
-			png_large_malloc(png_ptr, new_max);
-		png_memcpy(png_ptr->save_buffer, old_buffer,
-			(png_size_t)png_ptr->save_buffer_size);
-		png_large_free(png_ptr, old_buffer);
-		  png_ptr->save_buffer_max = new_max;
-	}
-	if (png_ptr->current_buffer_size)
-	{
-		png_memcpy(png_ptr->save_buffer +
-			(png_size_t)png_ptr->save_buffer_size,
-			png_ptr->current_buffer_ptr,
-			(png_size_t)png_ptr->current_buffer_size);
-		png_ptr->save_buffer_size += png_ptr->current_buffer_size;
-		png_ptr->current_buffer_size = 0;
-	}
-	png_ptr->save_buffer_ptr = png_ptr->save_buffer;
-	png_ptr->buffer_size = 0;
+      new_max = (int)(png_ptr->save_buffer_size +
+         png_ptr->current_buffer_size + 256);
+      old_buffer = png_ptr->save_buffer;
+      png_ptr->save_buffer = (png_bytep)
+         png_large_malloc(png_ptr, new_max);
+      png_memcpy(png_ptr->save_buffer, old_buffer,
+         (png_size_t)png_ptr->save_buffer_size);
+      png_large_free(png_ptr, old_buffer);
+        png_ptr->save_buffer_max = new_max;
+   }
+   if (png_ptr->current_buffer_size)
+   {
+      png_memcpy(png_ptr->save_buffer +
+         (png_size_t)png_ptr->save_buffer_size,
+         png_ptr->current_buffer_ptr,
+         (png_size_t)png_ptr->current_buffer_size);
+      png_ptr->save_buffer_size += png_ptr->current_buffer_size;
+      png_ptr->current_buffer_size = 0;
+   }
+   png_ptr->save_buffer_ptr = png_ptr->save_buffer;
+   png_ptr->buffer_size = 0;
 }
 
 void
 png_push_restore_buffer(png_structp png_ptr, png_bytep buffer,
-	png_uint_32 buffer_length)
+   png_uint_32 buffer_length)
 {
-	png_ptr->current_buffer = buffer;
-	png_ptr->current_buffer_size = buffer_length;
-	png_ptr->buffer_size = buffer_length + png_ptr->save_buffer_size;
-	png_ptr->current_buffer_ptr = png_ptr->current_buffer;
+   png_ptr->current_buffer = buffer;
+   png_ptr->current_buffer_size = buffer_length;
+   png_ptr->buffer_size = buffer_length + png_ptr->save_buffer_size;
+   png_ptr->current_buffer_ptr = png_ptr->current_buffer;
 }
 
 void
 png_push_read_idat(png_structp png_ptr)
 {
-	if (!png_ptr->have_chunk_header)
-	{
-		png_byte chunk_start[8];
+   if (!png_ptr->have_chunk_header)
+   {
+      png_byte chunk_start[8];
 
-		if (png_ptr->buffer_size < 8)
-		{
-			png_push_save_buffer(png_ptr);
-			return;
-		}
+      if (png_ptr->buffer_size < 8)
+      {
+         png_push_save_buffer(png_ptr);
+         return;
+      }
 
-		png_push_fill_buffer(png_ptr, chunk_start, 8);
-		png_ptr->push_length = png_get_uint_32(chunk_start);
-		png_memcpy(png_ptr->push_chunk_name,
-			(png_voidp)(chunk_start + 4), 4);
-		png_ptr->have_chunk_header = 1;
-		png_reset_crc(png_ptr);
-		png_calculate_crc(png_ptr, chunk_start + 4, 4);
-		if (png_memcmp(png_ptr->push_chunk_name, png_IDAT, 4))
-		{
-			png_ptr->process_mode = PNG_READ_END_MODE;
-			if (!png_ptr->zlib_finished)
-				png_error(png_ptr, "Not enough compressed data");
-			return;
-		}
+      png_push_fill_buffer(png_ptr, chunk_start, 8);
+      png_ptr->push_length = png_get_uint_32(chunk_start);
+      png_memcpy(png_ptr->push_chunk_name,
+         (png_voidp)(chunk_start + 4), 4);
+      png_ptr->have_chunk_header = 1;
+      png_reset_crc(png_ptr);
+      png_calculate_crc(png_ptr, chunk_start + 4, 4);
+      if (png_memcmp(png_ptr->push_chunk_name, png_IDAT, 4))
+      {
+         png_ptr->process_mode = PNG_READ_END_MODE;
+         if (!png_ptr->zlib_finished)
+            png_error(png_ptr, "Not enough compressed data");
+         return;
+      }
 
-		png_ptr->idat_size = png_ptr->push_length;
-	}
-	if (png_ptr->idat_size && png_ptr->save_buffer_size)
-	{
-		png_uint_32 save_size;
+      png_ptr->idat_size = png_ptr->push_length;
+   }
+   if (png_ptr->idat_size && png_ptr->save_buffer_size)
+   {
+      png_uint_32 save_size;
 
-		if (png_ptr->idat_size < png_ptr->save_buffer_size)
-			save_size = png_ptr->idat_size;
-		else
-			save_size = png_ptr->save_buffer_size;
+      if (png_ptr->idat_size < png_ptr->save_buffer_size)
+         save_size = png_ptr->idat_size;
+      else
+         save_size = png_ptr->save_buffer_size;
 
-		png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size);
-		png_process_IDAT_data(png_ptr, png_ptr->save_buffer_ptr, save_size);
+      png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size);
+      png_process_IDAT_data(png_ptr, png_ptr->save_buffer_ptr, save_size);
 
-		png_ptr->idat_size -= save_size;
-		png_ptr->buffer_size -= save_size;
-		png_ptr->save_buffer_size -= save_size;
-		png_ptr->save_buffer_ptr += (png_size_t)save_size;
-	}
-	if (png_ptr->idat_size && png_ptr->current_buffer_size)
-	{
-		png_uint_32 save_size;
+      png_ptr->idat_size -= save_size;
+      png_ptr->buffer_size -= save_size;
+      png_ptr->save_buffer_size -= save_size;
+      png_ptr->save_buffer_ptr += (png_size_t)save_size;
+   }
+   if (png_ptr->idat_size && png_ptr->current_buffer_size)
+   {
+      png_uint_32 save_size;
 
-		if (png_ptr->idat_size < png_ptr->current_buffer_size)
-			save_size = png_ptr->idat_size;
-		else
-			save_size = png_ptr->current_buffer_size;
+      if (png_ptr->idat_size < png_ptr->current_buffer_size)
+         save_size = png_ptr->idat_size;
+      else
+         save_size = png_ptr->current_buffer_size;
 
-		png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size);
-		png_process_IDAT_data(png_ptr, png_ptr->current_buffer_ptr, save_size);
+      png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size);
+      png_process_IDAT_data(png_ptr, png_ptr->current_buffer_ptr, save_size);
 
-		png_ptr->idat_size -= save_size;
-		png_ptr->buffer_size -= save_size;
-		png_ptr->current_buffer_size -= save_size;
-		png_ptr->current_buffer_ptr += (png_size_t)save_size;
-	}
-	if (!png_ptr->idat_size && png_ptr->buffer_size >= 4)
-	{
-		png_push_check_crc(png_ptr);
-		png_ptr->have_chunk_header = 0;
-	}
+      png_ptr->idat_size -= save_size;
+      png_ptr->buffer_size -= save_size;
+      png_ptr->current_buffer_size -= save_size;
+      png_ptr->current_buffer_ptr += (png_size_t)save_size;
+   }
+   if (!png_ptr->idat_size)
+   {
+      if (png_ptr->buffer_size < 4)
+      {
+         png_push_save_buffer(png_ptr);
+         return;
+      }
+
+      png_push_check_crc(png_ptr);
+      png_ptr->have_chunk_header = 0;
+   }
 }
 
 void
 png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
-	png_uint_32 buffer_length)
+   png_uint_32 buffer_length)
 {
-	int ret;
+   int ret;
 
-	if (png_ptr->zlib_finished && buffer_length)
-   	png_error(png_ptr, "Extra compression data");
+   if (png_ptr->zlib_finished && buffer_length)
+      png_error(png_ptr, "Extra compression data");
 
-	png_ptr->zstream->next_in = buffer;
-	png_ptr->zstream->avail_in = (uInt)buffer_length;
-	do
-	{
-		ret = inflate(png_ptr->zstream, Z_PARTIAL_FLUSH);
-		if (ret == Z_STREAM_END)
-		{
-			if (png_ptr->zstream->avail_in)
-				png_error(png_ptr, "Extra compressed data");
-			if (!png_ptr->zstream->avail_out)
-			{
-				png_push_process_row(png_ptr);
-			}
-			png_ptr->mode = PNG_AT_LAST_IDAT;
-			png_ptr->zlib_finished = 1;
-			break;
-		}
-		if (ret != Z_OK)
-			png_error(png_ptr, "Compression Error");
-		if (!(png_ptr->zstream->avail_out))
-		{
-			png_push_process_row(png_ptr);
-			png_ptr->zstream->avail_out = (uInt)png_ptr->irowbytes;
-			png_ptr->zstream->next_out = png_ptr->row_buf;
-		}
+   png_ptr->zstream->next_in = buffer;
+   png_ptr->zstream->avail_in = (uInt)buffer_length;
+   do
+   {
+      ret = inflate(png_ptr->zstream, Z_PARTIAL_FLUSH);
+      if (ret == Z_STREAM_END)
+      {
+         if (png_ptr->zstream->avail_in)
+            png_error(png_ptr, "Extra compressed data");
+         if (!png_ptr->zstream->avail_out)
+         {
+            png_push_process_row(png_ptr);
+         }
+         png_ptr->mode = PNG_AT_LAST_IDAT;
+         png_ptr->zlib_finished = 1;
+         break;
+      }
+      if (ret != Z_OK)
+         png_error(png_ptr, "Compression Error");
+      if (!(png_ptr->zstream->avail_out))
+      {
+         png_push_process_row(png_ptr);
+         png_ptr->zstream->avail_out = (uInt)png_ptr->irowbytes;
+         png_ptr->zstream->next_out = png_ptr->row_buf;
+      }
 
-	} while (png_ptr->zstream->avail_in);
+   } while (png_ptr->zstream->avail_in);
 }
 
 void
 png_push_process_row(png_structp png_ptr)
 {
-	png_ptr->row_info.color_type = png_ptr->color_type;
+   png_ptr->row_info.color_type = png_ptr->color_type;
    png_ptr->row_info.width = png_ptr->iwidth;
    png_ptr->row_info.channels = png_ptr->channels;
    png_ptr->row_info.bit_depth = png_ptr->bit_depth;
@@ -620,10 +638,10 @@
    png_ptr->row_info.rowbytes = ((png_ptr->row_info.width *
       (png_uint_32)png_ptr->row_info.pixel_depth + 7) >> 3);
 
-	if (png_ptr->row_buf[0])
+   if (png_ptr->row_buf[0])
       png_read_filter_row(&(png_ptr->row_info),
          png_ptr->row_buf + 1, png_ptr->prev_row + 1,
-			(int)(png_ptr->row_buf[0]));
+         (int)(png_ptr->row_buf[0]));
 
    png_memcpy(png_ptr->prev_row, png_ptr->row_buf, (png_size_t)png_ptr->rowbytes + 1);
 
@@ -631,124 +649,124 @@
       png_do_read_transformations(png_ptr);
 
 #if defined(PNG_READ_INTERLACING_SUPPORTED)
-	/* blow up interlaced rows to full size */
-	if (png_ptr->interlaced &&
-		(png_ptr->transformations & PNG_INTERLACE))
-	{
-		if (png_ptr->pass < 6)
-			png_do_read_interlace(&(png_ptr->row_info),
-				png_ptr->row_buf + 1, png_ptr->pass);
+   /* blow up interlaced rows to full size */
+   if (png_ptr->interlaced &&
+      (png_ptr->transformations & PNG_INTERLACE))
+   {
+      if (png_ptr->pass < 6)
+         png_do_read_interlace(&(png_ptr->row_info),
+            png_ptr->row_buf + 1, png_ptr->pass);
 
-		switch (png_ptr->pass)
-		{
-			case 0:
-			{
-				int i;
-				for (i = 0; i < 8 && png_ptr->pass == 0; i++)
-				{
-					png_push_have_row(png_ptr, png_ptr->row_buf + 1);
-					png_read_push_finish_row(png_ptr);
-				}
-				break;
-			}
-			case 1:
-			{
-				int i;
-				for (i = 0; i < 8 && png_ptr->pass == 1; i++)
-				{
-					png_push_have_row(png_ptr, png_ptr->row_buf + 1);
-					png_read_push_finish_row(png_ptr);
-				}
-				if (png_ptr->pass == 2)
-				{
-					for (i = 0; i < 4 && png_ptr->pass == 2; i++)
-					{
-						png_push_have_row(png_ptr, NULL);
-						png_read_push_finish_row(png_ptr);
-					}
-				}
-				break;
-			}
-			case 2:
-			{
-				int i;
-				for (i = 0; i < 4 && png_ptr->pass == 2; i++)
-				{
-					png_push_have_row(png_ptr, png_ptr->row_buf + 1);
-					png_read_push_finish_row(png_ptr);
-				}
-				for (i = 0; i < 4 && png_ptr->pass == 2; i++)
-				{
-					png_push_have_row(png_ptr, NULL);
-					png_read_push_finish_row(png_ptr);
-				}
-				break;
-			}
-			case 3:
-			{
-				int i;
-				for (i = 0; i < 4 && png_ptr->pass == 3; i++)
-				{
-					png_push_have_row(png_ptr, png_ptr->row_buf + 1);
-					png_read_push_finish_row(png_ptr);
-				}
-				if (png_ptr->pass == 4)
-				{
-					for (i = 0; i < 2 && png_ptr->pass == 4; i++)
-					{
-						png_push_have_row(png_ptr, NULL);
-						png_read_push_finish_row(png_ptr);
-					}
-				}
-				break;
-			}
-			case 4:
-			{
-				int i;
-				for (i = 0; i < 2 && png_ptr->pass == 4; i++)
-				{
-					png_push_have_row(png_ptr, png_ptr->row_buf + 1);
-					png_read_push_finish_row(png_ptr);
-				}
-				for (i = 0; i < 2 && png_ptr->pass == 4; i++)
-				{
-					png_push_have_row(png_ptr, NULL);
-					png_read_push_finish_row(png_ptr);
-				}
-				break;
-			}
-			case 5:
-			{
-				int i;
-				for (i = 0; i < 2 && png_ptr->pass == 5; i++)
-				{
-					png_push_have_row(png_ptr, png_ptr->row_buf + 1);
-					png_read_push_finish_row(png_ptr);
-				}
-				if (png_ptr->pass == 6)
-				{
-					png_push_have_row(png_ptr, NULL);
-					png_read_push_finish_row(png_ptr);
-				}
-				break;
-			}
-			case 6:
-			{
-				png_push_have_row(png_ptr, png_ptr->row_buf + 1);
-				png_read_push_finish_row(png_ptr);
-				if (png_ptr->pass != 6)
-					break;
-				png_push_have_row(png_ptr, NULL);
-				png_read_push_finish_row(png_ptr);
-			}
-		}
-	}
-	else
+      switch (png_ptr->pass)
+      {
+         case 0:
+         {
+            int i;
+            for (i = 0; i < 8 && png_ptr->pass == 0; i++)
+            {
+               png_push_have_row(png_ptr, png_ptr->row_buf + 1);
+               png_read_push_finish_row(png_ptr);
+            }
+            break;
+         }
+         case 1:
+         {
+            int i;
+            for (i = 0; i < 8 && png_ptr->pass == 1; i++)
+            {
+               png_push_have_row(png_ptr, png_ptr->row_buf + 1);
+               png_read_push_finish_row(png_ptr);
+            }
+            if (png_ptr->pass == 2)
+            {
+               for (i = 0; i < 4 && png_ptr->pass == 2; i++)
+               {
+                  png_push_have_row(png_ptr, NULL);
+                  png_read_push_finish_row(png_ptr);
+               }
+            }
+            break;
+         }
+         case 2:
+         {
+            int i;
+            for (i = 0; i < 4 && png_ptr->pass == 2; i++)
+            {
+               png_push_have_row(png_ptr, png_ptr->row_buf + 1);
+               png_read_push_finish_row(png_ptr);
+            }
+            for (i = 0; i < 4 && png_ptr->pass == 2; i++)
+            {
+               png_push_have_row(png_ptr, NULL);
+               png_read_push_finish_row(png_ptr);
+            }
+            break;
+         }
+         case 3:
+         {
+            int i;
+            for (i = 0; i < 4 && png_ptr->pass == 3; i++)
+            {
+               png_push_have_row(png_ptr, png_ptr->row_buf + 1);
+               png_read_push_finish_row(png_ptr);
+            }
+            if (png_ptr->pass == 4)
+            {
+               for (i = 0; i < 2 && png_ptr->pass == 4; i++)
+               {
+                  png_push_have_row(png_ptr, NULL);
+                  png_read_push_finish_row(png_ptr);
+               }
+            }
+            break;
+         }
+         case 4:
+         {
+            int i;
+            for (i = 0; i < 2 && png_ptr->pass == 4; i++)
+            {
+               png_push_have_row(png_ptr, png_ptr->row_buf + 1);
+               png_read_push_finish_row(png_ptr);
+            }
+            for (i = 0; i < 2 && png_ptr->pass == 4; i++)
+            {
+               png_push_have_row(png_ptr, NULL);
+               png_read_push_finish_row(png_ptr);
+            }
+            break;
+         }
+         case 5:
+         {
+            int i;
+            for (i = 0; i < 2 && png_ptr->pass == 5; i++)
+            {
+               png_push_have_row(png_ptr, png_ptr->row_buf + 1);
+               png_read_push_finish_row(png_ptr);
+            }
+            if (png_ptr->pass == 6)
+            {
+               png_push_have_row(png_ptr, NULL);
+               png_read_push_finish_row(png_ptr);
+            }
+            break;
+         }
+         case 6:
+         {
+            png_push_have_row(png_ptr, png_ptr->row_buf + 1);
+            png_read_push_finish_row(png_ptr);
+            if (png_ptr->pass != 6)
+               break;
+            png_push_have_row(png_ptr, NULL);
+            png_read_push_finish_row(png_ptr);
+         }
+      }
+   }
+   else
 #endif
-	{
-		png_push_have_row(png_ptr, png_ptr->row_buf + 1);
-		png_read_push_finish_row(png_ptr);
-	}
+   {
+      png_push_have_row(png_ptr, png_ptr->row_buf + 1);
+      png_read_push_finish_row(png_ptr);
+   }
 }
 
 void
@@ -756,7 +774,7 @@
 {
    png_ptr->row_number++;
    if (png_ptr->row_number < png_ptr->num_rows)
-		return;
+      return;
 
    if (png_ptr->interlaced)
    {
@@ -774,7 +792,7 @@
          png_ptr->irowbytes = ((png_ptr->iwidth *
             png_ptr->pixel_depth + 7) >> 3) + 1;
          if (!(png_ptr->transformations & PNG_INTERLACE))
-			{
+         {
             png_ptr->num_rows = (png_ptr->height +
                png_pass_yinc[png_ptr->pass] - 1 -
                png_pass_ystart[png_ptr->pass]) /
@@ -792,432 +810,467 @@
 void
 png_push_handle_PLTE(png_structp png_ptr, png_uint_32 length)
 {
-	if (length % 3)
-		png_error(png_ptr, "Invalid Palette Chunk");
+   if (length % 3)
+      png_error(png_ptr, "Invalid Palette Chunk");
 
-	png_ptr->num_palette = (png_uint_16)(length / 3);
-	png_ptr->cur_palette = 0;
-	png_ptr->palette = (png_colorp)png_large_malloc(png_ptr,
-		png_ptr->num_palette * sizeof (png_color));
-	png_ptr->process_mode = PNG_READ_PLTE_MODE;
+   png_ptr->num_palette = (png_uint_16)(length / 3);
+   png_ptr->cur_palette = 0;
+   png_ptr->palette = (png_colorp)png_large_malloc(png_ptr,
+      png_ptr->num_palette * sizeof (png_color));
+   png_ptr->process_mode = PNG_READ_PLTE_MODE;
 }
 
 void
 png_push_read_plte(png_structp png_ptr, png_infop info)
 {
-	while (png_ptr->cur_palette < png_ptr->num_palette &&
-		png_ptr->buffer_size >= 3)
-	{
-		png_byte buf[3];
-		png_push_fill_buffer(png_ptr, buf, 3);
-		png_calculate_crc(png_ptr, buf, 3);
+   while (png_ptr->cur_palette < png_ptr->num_palette &&
+      png_ptr->buffer_size >= 3)
+   {
+      png_byte buf[3];
+      png_push_fill_buffer(png_ptr, buf, 3);
+      png_calculate_crc(png_ptr, buf, 3);
 
-		/* don't depend upon png_color being any order */
-		png_ptr->palette[png_ptr->cur_palette].red = buf[0];
-		png_ptr->palette[png_ptr->cur_palette].green = buf[1];
-		png_ptr->palette[png_ptr->cur_palette].blue = buf[2];
-		png_ptr->cur_palette++;
-	}
-	if (png_ptr->cur_palette == png_ptr->num_palette &&
-		png_ptr->buffer_size >= 4)
-	{
-		png_push_check_crc(png_ptr);
-		png_read_PLTE(png_ptr, info, png_ptr->palette, png_ptr->num_palette);
-		png_ptr->process_mode = PNG_READ_CHUNK_MODE;
-	}
-	else
-	{
-		png_push_save_buffer(png_ptr);
-	}
+      /* don't depend upon png_color being any order */
+      png_ptr->palette[png_ptr->cur_palette].red = buf[0];
+      png_ptr->palette[png_ptr->cur_palette].green = buf[1];
+      png_ptr->palette[png_ptr->cur_palette].blue = buf[2];
+      png_ptr->cur_palette++;
+   }
+   if (png_ptr->cur_palette == png_ptr->num_palette &&
+      png_ptr->buffer_size >= 4)
+   {
+      png_push_check_crc(png_ptr);
+      png_read_PLTE(png_ptr, info, png_ptr->palette, png_ptr->num_palette);
+      png_ptr->process_mode = PNG_READ_CHUNK_MODE;
+   }
+   else
+   {
+      png_push_save_buffer(png_ptr);
+   }
 }
 
 #if defined(PNG_READ_tEXt_SUPPORTED)
 void
 png_push_handle_tEXt(png_structp png_ptr, png_uint_32 length)
 {
-	png_ptr->current_text = (png_charp)png_large_malloc(png_ptr, length + 1);
-	png_ptr->current_text[(png_size_t)length] = '\0';
-	png_ptr->current_text_ptr = png_ptr->current_text;
-	png_ptr->current_text_size = length;
-	png_ptr->current_text_left = length;
-	png_ptr->process_mode = PNG_READ_tEXt_MODE;
+   png_ptr->current_text = (png_charp)png_large_malloc(png_ptr, length + 1);
+   png_ptr->current_text[(png_size_t)length] = '\0';
+   png_ptr->current_text_ptr = png_ptr->current_text;
+   png_ptr->current_text_size = length;
+   png_ptr->current_text_left = length;
+   png_ptr->process_mode = PNG_READ_tEXt_MODE;
 }
 
 void
 png_push_read_text(png_structp png_ptr, png_infop info)
 {
-	if (png_ptr->buffer_size && png_ptr->current_text_left)
-	{
-		png_uint_32 text_size;
+   if (png_ptr->buffer_size && png_ptr->current_text_left)
+   {
+      png_uint_32 text_size;
 
-		if (png_ptr->buffer_size < png_ptr->current_text_left)
-			text_size = png_ptr->buffer_size;
-		else
-			text_size = png_ptr->current_text_left;
-		png_push_fill_buffer(png_ptr, (png_bytep)png_ptr->current_text_ptr,
-			text_size);
-		png_calculate_crc(png_ptr, (png_bytep)png_ptr->current_text_ptr,
-			text_size);
-		png_ptr->current_text_left -= text_size;
-		png_ptr->current_text_ptr += (png_size_t)text_size;
-	}
-	if (!(png_ptr->current_text_left) && png_ptr->buffer_size >= 4)
-	{
-		png_charp text;
-		png_charp key;
+      if (png_ptr->buffer_size < png_ptr->current_text_left)
+         text_size = png_ptr->buffer_size;
+      else
+         text_size = png_ptr->current_text_left;
+      png_push_fill_buffer(png_ptr, (png_bytep)png_ptr->current_text_ptr,
+         text_size);
+      png_calculate_crc(png_ptr, (png_bytep)png_ptr->current_text_ptr,
+         text_size);
+      png_ptr->current_text_left -= text_size;
+      png_ptr->current_text_ptr += (png_size_t)text_size;
+   }
+   if (!(png_ptr->current_text_left))
+   {
+      png_charp text;
+      png_charp key;
 
-		png_push_check_crc(png_ptr);
+      if (png_ptr->buffer_size < 4)
+      {
+         png_push_save_buffer(png_ptr);
+         return;
+      }
 
-		key = png_ptr->current_text;
-		png_ptr->current_text = 0;
+      png_push_check_crc(png_ptr);
 
-		for (text = key; *text; text++)
-			/* empty loop */ ;
+      key = png_ptr->current_text;
+      png_ptr->current_text = 0;
 
-		if (text != key + (png_size_t)png_ptr->current_text_size)
-			text++;
+      for (text = key; *text; text++)
+         /* empty loop */ ;
 
-		png_read_tEXt(png_ptr, info, key, text,
-			png_ptr->current_text_size - (text - key));
-		png_ptr->process_mode = PNG_READ_CHUNK_MODE;
-	}
+      if (text != key + (png_size_t)png_ptr->current_text_size)
+         text++;
+
+      png_read_tEXt(png_ptr, info, key, text,
+         png_ptr->current_text_size - (text - key));
+
+      if (png_ptr->mode == PNG_AT_LAST_IDAT ||
+         png_ptr->mode == PNG_AFTER_IDAT)
+      {
+         png_ptr->process_mode = PNG_READ_END_MODE;
+      }
+      else
+      {
+         png_ptr->process_mode = PNG_READ_CHUNK_MODE;
+      }
+   }
 }
 #endif
 
 #if defined(PNG_READ_zTXt_SUPPORTED)
 void
 png_push_handle_zTXt(png_structp png_ptr,
-	png_uint_32 length)
+   png_uint_32 length)
 {
-	png_ptr->current_text = (png_charp)png_large_malloc(png_ptr, length + 1);
-	png_ptr->current_text[(png_size_t)length] = '\0';
-	png_ptr->current_text_ptr = png_ptr->current_text;
-	png_ptr->current_text_size = length;
-	png_ptr->current_text_left = length;
-	png_ptr->process_mode = PNG_READ_zTXt_MODE;
+   png_ptr->current_text = (png_charp)png_large_malloc(png_ptr, length + 1);
+   png_ptr->current_text[(png_size_t)length] = '\0';
+   png_ptr->current_text_ptr = png_ptr->current_text;
+   png_ptr->current_text_size = length;
+   png_ptr->current_text_left = length;
+   png_ptr->process_mode = PNG_READ_zTXt_MODE;
 }
 
 void
 png_push_read_ztxt(png_structp png_ptr, png_infop info)
 {
-	if (png_ptr->buffer_size && png_ptr->current_text_left)
-	{
-		png_uint_32 text_size;
+   if (png_ptr->buffer_size && png_ptr->current_text_left)
+   {
+      png_uint_32 text_size;
 
-		if (png_ptr->buffer_size < png_ptr->current_text_left)
-			text_size = png_ptr->buffer_size;
-		else
-			text_size = png_ptr->current_text_left;
-		png_push_fill_buffer(png_ptr, (png_bytep)png_ptr->current_text_ptr,
-			text_size);
-		png_calculate_crc(png_ptr, (png_bytep)png_ptr->current_text_ptr,
-			text_size);
-		png_ptr->current_text_left -= text_size;
-		png_ptr->current_text_ptr += (png_size_t)text_size;
-	}
-	if (!(png_ptr->current_text_left) && png_ptr->buffer_size >= 4)
-	{
-		png_charp text;
-		png_charp key;
-		int ret;
-		png_uint_32 text_size, key_size;
+      if (png_ptr->buffer_size < png_ptr->current_text_left)
+         text_size = png_ptr->buffer_size;
+      else
+         text_size = png_ptr->current_text_left;
+      png_push_fill_buffer(png_ptr, (png_bytep)png_ptr->current_text_ptr,
+         text_size);
+      png_calculate_crc(png_ptr, (png_bytep)png_ptr->current_text_ptr,
+         text_size);
+      png_ptr->current_text_left -= text_size;
+      png_ptr->current_text_ptr += (png_size_t)text_size;
+   }
+   if (!(png_ptr->current_text_left))
+   {
+      png_charp text;
+      png_charp key;
+      int ret;
+      png_uint_32 text_size, key_size;
 
-		png_push_check_crc(png_ptr);
+      if (png_ptr->buffer_size < 4)
+      {
+         png_push_save_buffer(png_ptr);
+         return;
+      }
 
-		key = png_ptr->current_text;
-		png_ptr->current_text = 0;
+      png_push_check_crc(png_ptr);
 
-		for (text = key; *text; text++)
-			/* empty loop */ ;
+      key = png_ptr->current_text;
+      png_ptr->current_text = 0;
 
-		/* zTXt can't have zero text */
-		if (text == key + (png_size_t)png_ptr->current_text_size)
-		{
-			png_large_free(png_ptr, key);
-			return;
-		}
+      for (text = key; *text; text++)
+         /* empty loop */ ;
 
-		text++;
+      /* zTXt can't have zero text */
+      if (text == key + (png_size_t)png_ptr->current_text_size)
+      {
+         png_large_free(png_ptr, key);
+         return;
+      }
 
-		if (*text) /* check compression byte */
-		{
-			png_large_free(png_ptr, key);
-			return;
-		}
+      text++;
 
-		text++;
+      if (*text) /* check compression byte */
+      {
+         png_large_free(png_ptr, key);
+         return;
+      }
 
-		png_ptr->zstream->next_in = (png_bytep )text;
-		png_ptr->zstream->avail_in = (uInt)(png_ptr->current_text_size -
-			(text - key));
-		png_ptr->zstream->next_out = png_ptr->zbuf;
-		png_ptr->zstream->avail_out = (png_size_t)png_ptr->zbuf_size;
+      text++;
 
-		key_size = text - key;
-		text_size = 0;
-		text = NULL;
-		ret = Z_STREAM_END;
+      png_ptr->zstream->next_in = (png_bytep )text;
+      png_ptr->zstream->avail_in = (uInt)(png_ptr->current_text_size -
+         (text - key));
+      png_ptr->zstream->next_out = png_ptr->zbuf;
+      png_ptr->zstream->avail_out = (png_size_t)png_ptr->zbuf_size;
 
-		while (png_ptr->zstream->avail_in)
-		{
-			ret = inflate(png_ptr->zstream, Z_PARTIAL_FLUSH);
-			if (ret != Z_OK && ret != Z_STREAM_END)
-			{
-				inflateReset(png_ptr->zstream);
-				png_ptr->zstream->avail_in = 0;
-				png_large_free(png_ptr, key);
-				png_large_free(png_ptr, text);
-				return;
-			}
-			if (!png_ptr->zstream->avail_out || ret == Z_STREAM_END)
-			{
-				if (!text)
-				{
-					text = (png_charp)png_large_malloc(png_ptr,
-						png_ptr->zbuf_size - png_ptr->zstream->avail_out +
-							key_size + 1);
-					png_memcpy(text + (png_size_t)key_size, png_ptr->zbuf,
-						(png_size_t)(png_ptr->zbuf_size - png_ptr->zstream->avail_out));
-					png_memcpy(text, key, (png_size_t)key_size);
-					text_size = key_size + (png_size_t)png_ptr->zbuf_size -
-						png_ptr->zstream->avail_out;
-					*(text + (png_size_t)text_size) = '\0';
-				}
-				else
-				{
-					png_charp tmp;
+      key_size = text - key;
+      text_size = 0;
+      text = NULL;
+      ret = Z_STREAM_END;
 
-					tmp = text;
-					text = png_large_malloc(png_ptr, text_size +
-						png_ptr->zbuf_size - png_ptr->zstream->avail_out + 1);
-					png_memcpy(text, tmp, (png_size_t)text_size);
-					png_large_free(png_ptr, tmp);
-					png_memcpy(text + (png_size_t)text_size, png_ptr->zbuf,
-						(png_size_t)(png_ptr->zbuf_size - png_ptr->zstream->avail_out));
-					text_size += png_ptr->zbuf_size - png_ptr->zstream->avail_out;
-					*(text + (png_size_t)text_size) = '\0';
-				}
-				if (ret != Z_STREAM_END)
-				{
-					png_ptr->zstream->next_out = png_ptr->zbuf;
-					png_ptr->zstream->avail_out = (uInt)png_ptr->zbuf_size;
-				}
-			}
-			else
-			{
-				break;
-			}
+      while (png_ptr->zstream->avail_in)
+      {
+         ret = inflate(png_ptr->zstream, Z_PARTIAL_FLUSH);
+         if (ret != Z_OK && ret != Z_STREAM_END)
+         {
+            inflateReset(png_ptr->zstream);
+            png_ptr->zstream->avail_in = 0;
+            png_large_free(png_ptr, key);
+            png_large_free(png_ptr, text);
+            return;
+         }
+         if (!png_ptr->zstream->avail_out || ret == Z_STREAM_END)
+         {
+            if (!text)
+            {
+               text = (png_charp)png_large_malloc(png_ptr,
+                  png_ptr->zbuf_size - png_ptr->zstream->avail_out +
+                     key_size + 1);
+               png_memcpy(text + (png_size_t)key_size, png_ptr->zbuf,
+                  (png_size_t)(png_ptr->zbuf_size - png_ptr->zstream->avail_out));
+               png_memcpy(text, key, (png_size_t)key_size);
+               text_size = key_size + (png_size_t)png_ptr->zbuf_size -
+                  png_ptr->zstream->avail_out;
+               *(text + (png_size_t)text_size) = '\0';
+            }
+            else
+            {
+               png_charp tmp;
 
-			if (ret == Z_STREAM_END)
-				break;
-		}
+               tmp = text;
+               text = png_large_malloc(png_ptr, text_size +
+                  png_ptr->zbuf_size - png_ptr->zstream->avail_out + 1);
+               png_memcpy(text, tmp, (png_size_t)text_size);
+               png_large_free(png_ptr, tmp);
+               png_memcpy(text + (png_size_t)text_size, png_ptr->zbuf,
+                  (png_size_t)(png_ptr->zbuf_size - png_ptr->zstream->avail_out));
+               text_size += png_ptr->zbuf_size - png_ptr->zstream->avail_out;
+               *(text + (png_size_t)text_size) = '\0';
+            }
+            if (ret != Z_STREAM_END)
+            {
+               png_ptr->zstream->next_out = png_ptr->zbuf;
+               png_ptr->zstream->avail_out = (uInt)png_ptr->zbuf_size;
+            }
+         }
+         else
+         {
+            break;
+         }
 
-		inflateReset(png_ptr->zstream);
-		png_ptr->zstream->avail_in = 0;
+         if (ret == Z_STREAM_END)
+            break;
+      }
 
-		if (ret != Z_STREAM_END)
-		{
-			png_large_free(png_ptr, key);
-			png_large_free(png_ptr, text);
-			return;
-		}
+      inflateReset(png_ptr->zstream);
+      png_ptr->zstream->avail_in = 0;
 
-		png_large_free(png_ptr, key);
-		key = text;
-		text += (png_size_t)key_size;
-		text_size -= key_size;
+      if (ret != Z_STREAM_END)
+      {
+         png_large_free(png_ptr, key);
+         png_large_free(png_ptr, text);
+         return;
+      }
 
-		png_read_zTXt(png_ptr, info, key, text, text_size, 0);
-	}
+      png_large_free(png_ptr, key);
+      key = text;
+      text += (png_size_t)key_size;
+      text_size -= key_size;
+
+      png_read_zTXt(png_ptr, info, key, text, text_size, 0);
+      if (png_ptr->mode == PNG_AT_LAST_IDAT ||
+         png_ptr->mode == PNG_AFTER_IDAT)
+      {
+         png_ptr->process_mode = PNG_READ_END_MODE;
+      }
+      else
+      {
+         png_ptr->process_mode = PNG_READ_CHUNK_MODE;
+      }
+   }
 }
 #endif
 
 void
 png_push_have_info(png_structp png_ptr, png_infop info)
 {
-	if (png_ptr->info_fn)
-		(*(png_ptr->info_fn))(png_ptr, info);
+   if (png_ptr->info_fn)
+      (*(png_ptr->info_fn))(png_ptr, info);
 }
 
 void
 png_push_have_end(png_structp png_ptr, png_infop info)
 {
-	if (png_ptr->end_fn)
-		(*(png_ptr->end_fn))(png_ptr, info);
+   if (png_ptr->end_fn)
+      (*(png_ptr->end_fn))(png_ptr, info);
 }
 
 void
 png_push_have_row(png_structp png_ptr, png_bytep row)
 {
-	if (png_ptr->row_fn)
-		(*(png_ptr->row_fn))(png_ptr, row, png_ptr->row_number,
-			(int)png_ptr->pass);
+   if (png_ptr->row_fn)
+      (*(png_ptr->row_fn))(png_ptr, row, png_ptr->row_number,
+         (int)png_ptr->pass);
 }
 
 png_voidp
 png_get_progressive_ptr(png_structp png_ptr)
 {
-	return png_ptr->push_ptr;
+   return png_ptr->push_ptr;
 }
 
 void
 png_push_read_end(png_structp png_ptr, png_infop info)
 {
-	if (!png_ptr->have_chunk_header)
-	{
-		png_byte chunk_start[8];
+   if (!png_ptr->have_chunk_header)
+   {
+      png_byte chunk_start[8];
 
-		if (png_ptr->buffer_size < 8)
-		{
-			png_push_save_buffer(png_ptr);
-			return;
-		}
+      if (png_ptr->buffer_size < 8)
+      {
+         png_push_save_buffer(png_ptr);
+         return;
+      }
 
-		png_push_fill_buffer(png_ptr, chunk_start, 8);
-		png_ptr->push_length = png_get_uint_32(chunk_start);
-		png_memcpy(png_ptr->push_chunk_name, (png_voidp)(chunk_start + 4), 4);
-		png_ptr->have_chunk_header = 1;
-		png_reset_crc(png_ptr);
-		png_calculate_crc(png_ptr, chunk_start + 4, 4);
-	}
+      png_push_fill_buffer(png_ptr, chunk_start, 8);
+      png_ptr->push_length = png_get_uint_32(chunk_start);
+      png_memcpy(png_ptr->push_chunk_name, (png_voidp)(chunk_start + 4), 4);
+      png_ptr->have_chunk_header = 1;
+      png_reset_crc(png_ptr);
+      png_calculate_crc(png_ptr, chunk_start + 4, 4);
+   }
 
-	if (!png_memcmp(png_ptr->push_chunk_name, png_IHDR, 4))
-	{
-		png_error(png_ptr, "invalid chunk after IDAT");
-	}
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_PLTE, 4))
-	{
-		png_error(png_ptr, "invalid chunk after IDAT");
-	}
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_IDAT, 4))
-	{
-		if (png_ptr->push_length > 0 || png_ptr->mode != PNG_AT_LAST_IDAT)
-			png_error(png_ptr, "too many IDAT's found");
-	}
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_IEND, 4))
-	{
-		if (png_ptr->push_length)
-      	png_error(png_ptr, "Invalid IEND chunk");
-		png_push_check_crc(png_ptr);
-		png_ptr->mode = PNG_AFTER_IEND;
-		png_ptr->process_mode = PNG_READ_DONE_MODE;
-		png_push_have_end(png_ptr, info);
-	}
+   if (!png_memcmp(png_ptr->push_chunk_name, png_IHDR, 4))
+   {
+      png_error(png_ptr, "invalid chunk after IDAT");
+   }
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_PLTE, 4))
+   {
+      png_error(png_ptr, "invalid chunk after IDAT");
+   }
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_IDAT, 4))
+   {
+      if (png_ptr->push_length > 0 || png_ptr->mode != PNG_AT_LAST_IDAT)
+         png_error(png_ptr, "too many IDAT's found");
+   }
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_IEND, 4))
+   {
+      if (png_ptr->push_length)
+         png_error(png_ptr, "Invalid IEND chunk");
+      if (png_ptr->buffer_size < 4)
+      {
+         png_push_save_buffer(png_ptr);
+         return;
+      }
+      png_push_check_crc(png_ptr);
+      png_ptr->mode = PNG_AFTER_IEND;
+      png_ptr->process_mode = PNG_READ_DONE_MODE;
+      png_push_have_end(png_ptr, info);
+   }
 #if defined(PNG_READ_gAMA_SUPPORTED)
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_gAMA, 4))
-	{
-		png_error(png_ptr, "invalid chunk after IDAT");
-	}
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_gAMA, 4))
+   {
+      png_error(png_ptr, "invalid chunk after IDAT");
+   }
 #endif
 #if defined(PNG_READ_sBIT_SUPPORTED)
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_sBIT, 4))
-	{
-		png_error(png_ptr, "invalid chunk after IDAT");
-	}
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_sBIT, 4))
+   {
+      png_error(png_ptr, "invalid chunk after IDAT");
+   }
 #endif
 #if defined(PNG_READ_cHRM_SUPPORTED)
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_cHRM, 4))
-	{
-		png_error(png_ptr, "invalid chunk after IDAT");
-	}
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_cHRM, 4))
+   {
+      png_error(png_ptr, "invalid chunk after IDAT");
+   }
 #endif
 #if defined(PNG_READ_tRNS_SUPPORTED)
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_tRNS, 4))
-	{
-		png_error(png_ptr, "invalid chunk after IDAT");
-	}
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_tRNS, 4))
+   {
+      png_error(png_ptr, "invalid chunk after IDAT");
+   }
 #endif
 #if defined(PNG_READ_bKGD_SUPPORTED)
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_bKGD, 4))
-	{
-		png_error(png_ptr, "invalid chunk after IDAT");
-	}
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_bKGD, 4))
+   {
+      png_error(png_ptr, "invalid chunk after IDAT");
+   }
 #endif
 #if defined(PNG_READ_hIST_SUPPORTED)
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_hIST, 4))
-	{
-		png_error(png_ptr, "invalid chunk after IDAT");
-	}
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_hIST, 4))
+   {
+      png_error(png_ptr, "invalid chunk after IDAT");
+   }
 #endif
 #if defined(PNG_READ_pHYs_SUPPORTED)
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_pHYs, 4))
-	{
-		png_error(png_ptr, "invalid chunk after IDAT");
-	}
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_pHYs, 4))
+   {
+      png_error(png_ptr, "invalid chunk after IDAT");
+   }
 #endif
 #if defined(PNG_READ_oFFs_SUPPORTED)
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_oFFs, 4))
-	{
-		png_error(png_ptr, "invalid chunk after IDAT");
-	}
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_oFFs, 4))
+   {
+      png_error(png_ptr, "invalid chunk after IDAT");
+   }
 #endif
 #if defined(PNG_READ_tIME_SUPPORTED)
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_tIME, 4))
-	{
-		if (png_ptr->push_length + 4 > png_ptr->buffer_size)
-		{
-			png_push_save_buffer(png_ptr);
-			return;
-		}
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_tIME, 4))
+   {
+      if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+      {
+         png_push_save_buffer(png_ptr);
+         return;
+      }
 
-		if (png_ptr->mode == PNG_BEFORE_IHDR ||
-			png_ptr->mode == PNG_AFTER_IEND)
-			png_error(png_ptr, "Out of Place tIME");
+      if (png_ptr->mode == PNG_BEFORE_IHDR ||
+         png_ptr->mode == PNG_AFTER_IEND)
+         png_error(png_ptr, "Out of Place tIME");
 
-		png_handle_tIME(png_ptr, info, png_ptr->push_length);
-		png_push_check_crc(png_ptr);
-	}
+      png_handle_tIME(png_ptr, info, png_ptr->push_length);
+      png_push_check_crc(png_ptr);
+   }
 #endif
 #if defined(PNG_READ_tEXt_SUPPORTED)
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_tEXt, 4))
-	{
-		if (png_ptr->mode == PNG_BEFORE_IHDR ||
-			png_ptr->mode == PNG_AFTER_IEND)
-			png_error(png_ptr, "Out of Place tEXt");
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_tEXt, 4))
+   {
+      if (png_ptr->mode == PNG_BEFORE_IHDR ||
+         png_ptr->mode == PNG_AFTER_IEND)
+         png_error(png_ptr, "Out of Place tEXt");
 
-		png_push_handle_tEXt(png_ptr, png_ptr->push_length);
-	}
+      png_push_handle_tEXt(png_ptr, png_ptr->push_length);
+   }
 #endif
 #if defined(PNG_READ_zTXt_SUPPORTED)
-	else if (!png_memcmp(png_ptr->push_chunk_name, png_zTXt, 4))
-	{
-		if (png_ptr->mode == PNG_BEFORE_IHDR ||
-			png_ptr->mode == PNG_AFTER_IEND)
-			png_error(png_ptr, "Out of Place zTXt");
+   else if (!png_memcmp(png_ptr->push_chunk_name, png_zTXt, 4))
+   {
+      if (png_ptr->mode == PNG_BEFORE_IHDR ||
+         png_ptr->mode == PNG_AFTER_IEND)
+         png_error(png_ptr, "Out of Place zTXt");
 
-		png_push_handle_zTXt(png_ptr, png_ptr->push_length);
-	}
+      png_push_handle_zTXt(png_ptr, png_ptr->push_length);
+   }
 #endif
-	else
-	{
-		if ((png_ptr->push_chunk_name[0] & 0x20) == 0)
-			png_error(png_ptr, "Unknown Critical Chunk");
+   else
+   {
+      if ((png_ptr->push_chunk_name[0] & 0x20) == 0)
+         png_error(png_ptr, "Unknown Critical Chunk");
 
-		png_push_crc_skip(png_ptr, png_ptr->push_length);
-	}
-	if (png_ptr->mode == PNG_AT_LAST_IDAT)
-		png_ptr->mode = PNG_AFTER_IDAT;
-	png_ptr->have_chunk_header = 0;
+      png_push_crc_skip(png_ptr, png_ptr->push_length);
+   }
+   if (png_ptr->mode == PNG_AT_LAST_IDAT)
+      png_ptr->mode = PNG_AFTER_IDAT;
+   png_ptr->have_chunk_header = 0;
 }
 
 void
 png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr,
-	png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
-	png_progressive_end_ptr end_fn)
+   png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
+   png_progressive_end_ptr end_fn)
 {
-	png_ptr->info_fn = info_fn;
-	png_ptr->row_fn = row_fn;
-	png_ptr->push_ptr = progressive_ptr;
+   png_ptr->info_fn = info_fn;
+   png_ptr->row_fn = row_fn;
+   png_ptr->push_ptr = progressive_ptr;
    png_ptr->end_fn = end_fn;
-	png_ptr->read_mode = PNG_READ_PUSH_MODE;
+   png_ptr->read_mode = PNG_READ_PUSH_MODE;
 }
 
 void
 png_progressive_combine_row (png_structp png_ptr,
-	png_bytep old_row, png_bytep new_row)
+   png_bytep old_row, png_bytep new_row)
 {
-	if (new_row)
-		png_combine_row(png_ptr, old_row, png_pass_dsp_mask[png_ptr->pass]);
+   if (new_row)
+      png_combine_row(png_ptr, old_row, png_pass_dsp_mask[png_ptr->pass]);
 }
 
 #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
diff --git a/pngrcb.c b/pngrcb.c
index c85e138..f2824e4 100644
--- a/pngrcb.c
+++ b/pngrcb.c
@@ -1,9 +1,9 @@
 /* pngrcb.c - callbacks while reading a png file
 
-	libpng 1.0 beta 2 - version 0.87
+   libpng 1.0 beta 2 - version 0.88
    For conditions of distribution and use, see copyright notice in png.h
-	Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
-   January 15, 1996
+   Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+   January 25, 1996
    */
 
 #define PNG_INTERNAL
@@ -20,11 +20,11 @@
 
    info->width = width;
    info->height = height;
-	info->bit_depth = (png_byte)bit_depth;
-	info->color_type =(png_byte) color_type;
-	info->compression_type = (png_byte)compression_type;
-	info->filter_type = (png_byte)filter_type;
-	info->interlace_type = (png_byte)interlace_type;
+   info->bit_depth = (png_byte)bit_depth;
+   info->color_type =(png_byte) color_type;
+   info->compression_type = (png_byte)compression_type;
+   info->filter_type = (png_byte)filter_type;
+   info->interlace_type = (png_byte)interlace_type;
    if (info->color_type == PNG_COLOR_TYPE_PALETTE)
       info->channels = 1;
    else if (info->color_type & PNG_COLOR_MASK_COLOR)
@@ -33,7 +33,7 @@
       info->channels = 1;
    if (info->color_type & PNG_COLOR_MASK_ALPHA)
       info->channels++;
-	info->pixel_depth = (png_byte)(info->channels * info->bit_depth);
+   info->pixel_depth = (png_byte)(info->channels * info->bit_depth);
    info->rowbytes = ((info->width * info->pixel_depth + 7) >> 3);
 }
 
@@ -45,7 +45,7 @@
       return;
 
    info->palette = palette;
-	info->num_palette = (png_uint_16)num;
+   info->num_palette = (png_uint_16)num;
    info->valid |= PNG_INFO_PLTE;
 }
 
@@ -69,7 +69,7 @@
    if (!png_ptr || !info)
       return;
 
-	png_memcpy(&(info->sig_bit), sig_bit, sizeof (png_color_8));
+   png_memcpy(&(info->sig_bit), sig_bit, sizeof (png_color_8));
    info->valid |= PNG_INFO_sBIT;
 }
 #endif
@@ -77,8 +77,8 @@
 #if defined(PNG_READ_cHRM_SUPPORTED)
 void
 png_read_cHRM(png_structp png_ptr, png_infop info,
-	double white_x, double white_y, double red_x, double red_y,
-	double green_x, double green_y, double blue_x, double blue_y)
+   double white_x, double white_y, double red_x, double red_y,
+   double green_x, double green_y, double blue_x, double blue_y)
 {
    if (!png_ptr || !info)
       return;
@@ -112,7 +112,7 @@
       png_memcpy(&(info->trans_values), trans_values,
          sizeof(png_color_16));
    }
-	info->num_trans = (png_uint_16)num_trans;
+   info->num_trans = (png_uint_16)num_trans;
    info->valid |= PNG_INFO_tRNS;
 }
 #endif
@@ -152,7 +152,7 @@
 
    info->x_pixels_per_unit = res_x;
    info->y_pixels_per_unit = res_y;
-	info->phys_unit_type = (png_byte)unit_type;
+   info->phys_unit_type = (png_byte)unit_type;
    info->valid |= PNG_INFO_pHYs;
 }
 #endif
@@ -175,7 +175,7 @@
 #if defined(PNG_READ_tIME_SUPPORTED)
 void
 png_read_tIME(png_structp png_ptr, png_infop info,
-	png_timep mod_time)
+   png_timep mod_time)
 {
    if (!png_ptr || !info)
       return;
@@ -193,24 +193,24 @@
    if (!png_ptr || !info)
       return;
 
-	if (info->max_text <= info->num_text)
+   if (info->max_text <= info->num_text)
    {
       if (info->text)
       {
          png_uint_32 old_max;
 
          old_max = info->max_text;
-			info->max_text = info->num_text + 16;
-			{
-				png_textp old_text;
+         info->max_text = info->num_text + 16;
+         {
+            png_textp old_text;
 
-				old_text = info->text;
-				info->text = (png_textp)png_large_malloc(png_ptr,
-					info->max_text * sizeof (png_text));
-				png_memcpy(info->text, old_text,
-					(png_size_t)(old_max * sizeof (png_text)));
-				png_large_free(png_ptr, old_text);
-			}
+            old_text = info->text;
+            info->text = (png_textp)png_large_malloc(png_ptr,
+               info->max_text * sizeof (png_text));
+            png_memcpy(info->text, old_text,
+               (png_size_t)(old_max * sizeof (png_text)));
+            png_large_free(png_ptr, old_text);
+         }
       }
       else
       {
@@ -237,7 +237,7 @@
    if (!png_ptr || !info)
       return;
 
-	png_read_zTXt(png_ptr, info, key, text, text_len, -1);
+   png_read_zTXt(png_ptr, info, key, text, text_len, -1);
 }
 #endif
 
diff --git a/pngread.c b/pngread.c
index 9e00833..fc618b2 100644
--- a/pngread.c
+++ b/pngread.c
@@ -1,10 +1,10 @@
 
 /* pngread.c - read a png file
 
-   libpng 1.0 beta 2 - version 0.87
+   libpng 1.0 beta 2 - version 0.88
    For conditions of distribution and use, see copyright notice in png.h
    Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
-   January 15, 1996
+   January 25, 1996
    */
 
 #define PNG_INTERNAL
diff --git a/pngrtran.c b/pngrtran.c
index 93913a0..e829dc3 100644
--- a/pngrtran.c
+++ b/pngrtran.c
@@ -1,10 +1,10 @@
 
 /* pngrtran.c - transforms the data in a row for png readers
 
-	libpng 1.0 beta 2 - version 0.87
+   libpng 1.0 beta 2 - version 0.88
    For conditions of distribution and use, see copyright notice in png.h
-	Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
-   January 15, 1996
+   Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+   January 25, 1996
    */
 
 #define PNG_INTERNAL
@@ -21,8 +21,8 @@
    png_memcpy(&(png_ptr->background), background_color,
       sizeof(png_color_16));
    png_ptr->background_gamma = (float)background_gamma;
-	png_ptr->background_gamma_type = (png_byte)(background_gamma_code);
-	png_ptr->background_expand = (png_byte)need_expand;
+   png_ptr->background_gamma_type = (png_byte)(background_gamma_code);
+   png_ptr->background_expand = (png_byte)need_expand;
 }
 #endif
 
@@ -59,14 +59,14 @@
 {
    png_ptr->transformations |= PNG_DITHER;
 
-	if (!full_dither)
+   if (!full_dither)
    {
       int i;
 
       png_ptr->dither_index = (png_bytep)png_large_malloc(png_ptr,
          num_palette * sizeof (png_byte));
       for (i = 0; i < num_palette; i++)
-			png_ptr->dither_index[i] = (png_byte)i;
+         png_ptr->dither_index[i] = (png_byte)i;
    }
 
    if (num_palette > maximum_colors)
@@ -77,14 +77,14 @@
             perhaps not the best solution, but good enough */
 
          int i;
-			png_bytep sort;
+         png_bytep sort;
 
          /* initialize an array to sort colors */
          sort = (png_bytep)png_large_malloc(png_ptr, num_palette * sizeof (png_byte));
 
          /* initialize the sort array */
          for (i = 0; i < num_palette; i++)
-				sort[i] = (png_byte)i;
+            sort[i] = (png_byte)i;
 
          /* find the least used palette entries by starting a
             bubble sort, and running it until we have sorted
@@ -95,7 +95,7 @@
          for (i = num_palette - 1; i >= maximum_colors; i--)
          {
             int done; /* to stop early if the list is pre-sorted */
-				int j;
+            int j;
 
             done = 1;
             for (j = 0; j < i; j++)
@@ -131,13 +131,13 @@
                   while (sort[j] >= maximum_colors);
                   palette[i] = palette[j];
                }
-				}
+            }
          }
          else
          {
             int j;
 
-				/* move all the used colors inside the max limit, and
+            /* move all the used colors inside the max limit, and
                develop a translation table */
             j = num_palette;
             for (i = 0; i < maximum_colors; i++)
@@ -149,14 +149,14 @@
 
                   do
                      j--;
-						while (sort[j] >= maximum_colors);
+                  while (sort[j] >= maximum_colors);
 
                   tmp_color = palette[j];
                   palette[j] = palette[i];
                   palette[i] = tmp_color;
                   /* indicate where the color went */
-						png_ptr->dither_index[j] = (png_byte)i;
-						png_ptr->dither_index[i] = (png_byte)j;
+                  png_ptr->dither_index[j] = (png_byte)i;
+                  png_ptr->dither_index[i] = (png_byte)j;
                }
             }
             /* find closest color for those colors we are not
@@ -167,7 +167,7 @@
                {
                   int min_d, j, min_j, index;
 
-						/* find the closest color to one we threw out */
+                  /* find the closest color to one we threw out */
                   index = png_ptr->dither_index[i];
                   min_d = PNG_COLOR_DIST(palette[index],
                         palette[0]);
@@ -185,8 +185,8 @@
                         min_j = j;
                      }
                   }
-						/* point to closest color */
-						png_ptr->dither_index[i] = (png_byte)min_j;
+                  /* point to closest color */
+                  png_ptr->dither_index[i] = (png_byte)min_j;
                }
             }
          }
@@ -203,8 +203,8 @@
          int i;
          int max_d;
          int num_new_palette;
-			png_dsortpp hash;
-			png_bytep index_to_palette;
+         png_dsortpp hash;
+         png_bytep index_to_palette;
             /* where the original index currently is in the palette */
          png_bytep palette_to_index;
             /* which original index points to this palette color */
@@ -218,8 +218,8 @@
          /* initialize the sort array */
          for (i = 0; i < num_palette; i++)
          {
-				index_to_palette[i] = (png_byte)i;
-				palette_to_index[i] = (png_byte)i;
+            index_to_palette[i] = (png_byte)i;
+            palette_to_index[i] = (png_byte)i;
          }
 
          hash = (png_dsortpp)png_large_malloc(png_ptr, 769 * sizeof (png_dsortp));
@@ -239,7 +239,7 @@
             */
          max_d = 96;
 
-			while (num_new_palette > maximum_colors)
+         while (num_new_palette > maximum_colors)
          {
             for (i = 0; i < num_new_palette - 1; i++)
             {
@@ -249,7 +249,7 @@
                {
                   int d;
 
-						d = PNG_COLOR_DIST(palette[i], palette[j]);
+                  d = PNG_COLOR_DIST(palette[i], palette[j]);
 
                   if (d <= max_d)
                   {
@@ -257,8 +257,8 @@
 
                      t = png_large_malloc(png_ptr, sizeof (png_dsort));
                      t->next = hash[d];
-							t->left = (png_byte)i;
-							t->right = (png_byte)j;
+                     t->left = (png_byte)i;
+                     t->right = (png_byte)j;
                      hash[d] = t;
                   }
                }
@@ -313,8 +313,8 @@
                         palette_to_index[index_to_palette[j]] =
                            palette_to_index[num_new_palette];
 
-								index_to_palette[j] = (png_byte)num_new_palette;
-								palette_to_index[num_new_palette] = (png_byte)j;
+                        index_to_palette[j] = (png_byte)num_new_palette;
+                        palette_to_index[num_new_palette] = (png_byte)j;
                      }
                      if (num_new_palette <= maximum_colors)
                         break;
@@ -333,7 +333,7 @@
                   p = hash[i];
                   while (p)
                   {
-							png_dsortp t;
+                     png_dsortp t;
 
                      t = p->next;
                      png_large_free(png_ptr, p);
@@ -351,11 +351,11 @@
       num_palette = maximum_colors;
    }
    if (!(png_ptr->palette))
-	{
+   {
       png_ptr->palette = palette;
       png_ptr->user_palette = 1;
    }
-	png_ptr->num_palette = (png_uint_16)num_palette;
+   png_ptr->num_palette = (png_uint_16)num_palette;
 
    if (full_dither)
    {
@@ -365,11 +365,11 @@
       png_bytep distance;
 
       total_bits = PNG_DITHER_RED_BITS + PNG_DITHER_GREEN_BITS +
-			PNG_DITHER_BLUE_BITS;
+         PNG_DITHER_BLUE_BITS;
 
       num_red = (1 << PNG_DITHER_RED_BITS);
       num_green = (1 << PNG_DITHER_GREEN_BITS);
-		num_blue = (1 << PNG_DITHER_BLUE_BITS);
+      num_blue = (1 << PNG_DITHER_BLUE_BITS);
       num_entries = ((png_uint_32)1 << total_bits);
 
       png_ptr->palette_lookup = (png_bytep )png_large_malloc(png_ptr,
@@ -387,7 +387,7 @@
          int r, g, b, ir, ig, ib;
 
          r = (palette[i].red >> (8 - PNG_DITHER_RED_BITS));
-			g = (palette[i].green >> (8 - PNG_DITHER_GREEN_BITS));
+         g = (palette[i].green >> (8 - PNG_DITHER_GREEN_BITS));
          b = (palette[i].blue >> (8 - PNG_DITHER_BLUE_BITS));
 
          for (ir = 0; ir < num_red; ir++)
@@ -397,7 +397,7 @@
             dr = abs(ir - r);
             index_r = (ir << (PNG_DITHER_BLUE_BITS + PNG_DITHER_GREEN_BITS));
             for (ig = 0; ig < num_green; ig++)
-				{
+            {
                int dg, dt, dm, index_g;
 
                dg = abs(ig - g);
@@ -405,7 +405,7 @@
                dm = ((dr > dg) ? dr : dg);
                index_g = index_r | (ig << PNG_DITHER_BLUE_BITS);
                for (ib = 0; ib < num_blue; ib++)
-					{
+               {
                   int index, db, dmax, d;
 
                   index = index_g | ib;
@@ -415,15 +415,15 @@
 
                   if (d < distance[index])
                   {
-							distance[index] = (png_byte)d;
-							png_ptr->palette_lookup[index] = (png_byte)i;
+                     distance[index] = (png_byte)d;
+                     png_ptr->palette_lookup[index] = (png_byte)i;
                   }
                }
             }
          }
       }
 
-		png_large_free(png_ptr, distance);
+      png_large_free(png_ptr, distance);
    }
 }
 #endif
@@ -477,7 +477,7 @@
          (png_ptr->transformations & PNG_BACKGROUND) &&
          png_ptr->background_expand)
 /*         (!(png_ptr->transformations & PNG_BACKGROUND) ||
-			png_ptr->background_expand)) */
+         png_ptr->background_expand)) */
       {
          /* expand background chunk.  While this may not be
             the fastest way to do this, it only happens once
@@ -485,17 +485,17 @@
          switch (png_ptr->bit_depth)
          {
             case 1:
-					png_ptr->background.gray *= (png_byte)0xff;
+               png_ptr->background.gray *= (png_byte)0xff;
                break;
             case 2:
-					png_ptr->background.gray *= (png_byte)0x55;
+               png_ptr->background.gray *= (png_byte)0x55;
                break;
             case 4:
-					png_ptr->background.gray *= (png_byte)0x11;
+               png_ptr->background.gray *= (png_byte)0x11;
                break;
          }
       }
-		if (color_type == PNG_COLOR_TYPE_PALETTE &&
+      if (color_type == PNG_COLOR_TYPE_PALETTE &&
          (png_ptr->transformations & PNG_BACKGROUND) &&
          png_ptr->background_expand)
       {
@@ -531,7 +531,7 @@
             gs = 1.0;
 
             switch (png_ptr->background_gamma_type)
-				{
+            {
                case PNG_BACKGROUND_GAMMA_SCREEN:
                   g = (png_ptr->display_gamma);
                   gs = 1.0;
@@ -547,9 +547,9 @@
                   break;
             }
 
-				if (color_type & PNG_COLOR_MASK_COLOR)
+            if (color_type & PNG_COLOR_MASK_COLOR)
             {
-					png_ptr->background_1.red = (png_uint_16)(pow(
+               png_ptr->background_1.red = (png_uint_16)(pow(
                   (double)png_ptr->background.red / m, g) * m + .5);
                png_ptr->background_1.green = (png_uint_16)(pow(
                   (double)png_ptr->background.green / m, g) * m + .5);
@@ -565,9 +565,9 @@
             else
             {
                png_ptr->background_1.gray = (png_uint_16)(pow(
-						(double)png_ptr->background.gray / m, g) * m + .5);
+                  (double)png_ptr->background.gray / m, g) * m + .5);
                png_ptr->background.gray = (png_uint_16)(pow(
-						(double)png_ptr->background.gray / m, gs) * m + .5);
+                  (double)png_ptr->background.gray / m, gs) * m + .5);
             }
          }
       }
@@ -585,7 +585,7 @@
       sr = 8 - png_ptr->sig_bit.red;
       if (sr < 0 || sr > 8)
          sr = 0;
-		sg = 8 - png_ptr->sig_bit.green;
+      sg = 8 - png_ptr->sig_bit.green;
       if (sg < 0 || sg > 8)
          sg = 0;
       sb = 8 - png_ptr->sig_bit.blue;
@@ -603,7 +603,7 @@
 
 /* modify the info structure to reflect the transformations.  The
    info should be updated so a png file could be written with it,
-	assuming the transformations result in valid png data */
+   assuming the transformations result in valid png data */
 void
 png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
 {
@@ -621,7 +621,7 @@
    else if (png_ptr->transformations & PNG_EXPAND)
    {
       if (png_ptr->num_trans)
-			info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
+         info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
       if (info_ptr->bit_depth < 8)
          info_ptr->bit_depth = 8;
       info_ptr->num_trans = 0;
@@ -639,7 +639,7 @@
 
 #if defined(PNG_READ_16_TO_8_SUPPORTED)
    if ((png_ptr->transformations & PNG_16_TO_8) && info_ptr->bit_depth == 16)
-		info_ptr->bit_depth = 8;
+      info_ptr->bit_depth = 8;
 #endif
 
 #if defined(PNG_READ_DITHER_SUPPORTED)
@@ -664,7 +664,7 @@
       !(info_ptr->color_type & PNG_COLOR_MASK_COLOR))
       info_ptr->color_type |= PNG_COLOR_MASK_COLOR;
 #endif
-	if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
+   if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
       info_ptr->channels = 1;
    else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)
       info_ptr->channels = 3;
@@ -672,8 +672,8 @@
       info_ptr->channels = 1;
    if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
       info_ptr->channels++;
-	info_ptr->pixel_depth = (png_byte)(info_ptr->channels *
-		info_ptr->bit_depth);
+   info_ptr->pixel_depth = (png_byte)(info_ptr->channels *
+      info_ptr->bit_depth);
    info_ptr->rowbytes = ((info_ptr->width * info_ptr->pixel_depth + 7) >> 3);
 }
 
@@ -694,7 +694,7 @@
    {
       if (png_ptr->num_trans)
          png_do_expand(&(png_ptr->row_info), png_ptr->row_buf + 1,
-				&(png_ptr->trans_values));
+            &(png_ptr->trans_values));
       else
          png_do_expand(&(png_ptr->row_info), png_ptr->row_buf + 1,
             NULL);
@@ -730,14 +730,14 @@
    {
       png_do_dither((png_row_infop)&(png_ptr->row_info), 
          png_ptr->row_buf + 1,
-			png_ptr->palette_lookup,
+         png_ptr->palette_lookup,
          png_ptr->dither_index);
    }      
 #endif
 
 #if defined(PNG_READ_INVERT_SUPPORTED)
    if (png_ptr->transformations & PNG_INVERT_MONO)
-		png_do_invert(&(png_ptr->row_info), png_ptr->row_buf + 1);
+      png_do_invert(&(png_ptr->row_info), png_ptr->row_buf + 1);
 #endif
 
 #if defined(PNG_READ_SHIFT_SUPPORTED)
@@ -748,7 +748,7 @@
 
 #if defined(PNG_READ_PACK_SUPPORTED)
    if (png_ptr->transformations & PNG_PACK)
-		png_do_unpack(&(png_ptr->row_info), png_ptr->row_buf + 1);
+      png_do_unpack(&(png_ptr->row_info), png_ptr->row_buf + 1);
 #endif
 
 #if defined(PNG_READ_BGR_SUPPORTED)
@@ -784,7 +784,7 @@
 {
    int shift;
    png_bytep sp, dp;
-	png_uint_32 i;
+   png_uint_32 i;
    
    if (row && row_info && row_info->bit_depth < 8)
    {
@@ -797,12 +797,12 @@
             shift = 7 - (int)((row_info->width + 7) & 7);
             for (i = 0; i < row_info->width; i++)
             {
-					*dp = (png_byte)((*sp >> shift) & 0x1);
+               *dp = (png_byte)((*sp >> shift) & 0x1);
                if (shift == 7)
                {
                   shift = 0;
                   sp--;
-					}
+               }
                else
                   shift++;
 
@@ -818,7 +818,7 @@
             shift = (int)((3 - ((row_info->width + 3) & 3)) << 1);
             for (i = 0; i < row_info->width; i++)
             {
-					*dp = (png_byte)((*sp >> shift) & 0x3);
+               *dp = (png_byte)((*sp >> shift) & 0x3);
                if (shift == 6)
                {
                   shift = 0;
@@ -838,7 +838,7 @@
             shift = (int)((1 - ((row_info->width + 1) & 1)) << 2);
             for (i = 0; i < row_info->width; i++)
             {
-					*dp = (png_byte)((*sp >> shift) & 0xf);
+               *dp = (png_byte)((*sp >> shift) & 0xf);
                if (shift == 4)
                {
                   shift = 0;
@@ -853,7 +853,7 @@
          }
       }
       row_info->bit_depth = 8;
-		row_info->pixel_depth = (png_byte)(8 * row_info->channels);
+      row_info->pixel_depth = (png_byte)(8 * row_info->channels);
       row_info->rowbytes = row_info->width * row_info->channels;
    }
 }
@@ -891,22 +891,22 @@
       if (row_info->color_type & PNG_COLOR_MASK_ALPHA)
       {
          shift[channels++] = row_info->bit_depth - sig_bits->alpha;
-		}
+      }
 
-		value = 0;
+      value = 0;
 
-		for (i = 0; i < channels; i++)
-		{
-			if (shift[(png_size_t)i] <= 0)
-				shift[(png_size_t)i] = 0;
-			else
-				value = 1;
-		}
+      for (i = 0; i < channels; i++)
+      {
+         if (shift[(png_size_t)i] <= 0)
+            shift[(png_size_t)i] = 0;
+         else
+            value = 1;
+      }
 
-		if (!value)
-      	return;
+      if (!value)
+         return;
 
-		switch (row_info->bit_depth)
+      switch (row_info->bit_depth)
       {
          case 2:
          {
@@ -922,8 +922,8 @@
          case 4:
          {
             png_byte  mask;
-				mask = (png_byte)(((int)0xf0 >> shift[0]) & (int)0xf0) |
-					(png_byte)((int)0xf >> shift[0]);
+            mask = (png_byte)(((int)0xf0 >> shift[0]) & (int)0xf0) |
+               (png_byte)((int)0xf >> shift[0]);
             for (bp = row, i = 0;
                i < row_info->rowbytes;
                i++, bp++)
@@ -940,7 +940,7 @@
             {
                int c;
 
-					for (c = 0; c < row_info->channels; c++, bp++)
+               for (c = 0; c < row_info->channels; c++, bp++)
                {
                   *bp >>= shift[c];
                }
@@ -956,9 +956,9 @@
 
                for (c = 0; c < row_info->channels; c++, bp += 2)
                {
-						value = (png_uint_16)((*bp << 8) + *(bp + 1));
+                  value = (png_uint_16)((*bp << 8) + *(bp + 1));
                   value >>= shift[c];
-						*bp = (png_byte)(value >> 8);
+                  *bp = (png_byte)(value >> 8);
                   *(bp + 1) = (png_byte)(value & 0xff);
                }
             }
@@ -976,23 +976,23 @@
 {
    png_bytep sp, dp;
    png_uint_32 i;
-	if (row && row_info && row_info->bit_depth == 16)
+   if (row && row_info && row_info->bit_depth == 16)
    {
-		sp = row;
-		dp = row;
+      sp = row;
+      dp = row;
       for (i = 0; i < row_info->width * row_info->channels; i++)
       {
-			*dp = *sp;
+         *dp = *sp;
 /* not yet, as I'm afraid of overflow here
-			*dp = ((((((png_uint_16)(*sp) << 8)) |
-				(png_uint_16)((*(sp + 1) - *sp) & 0xff) +
-				0x7f) >> 8) & 0xff);
+         *dp = ((((((png_uint_16)(*sp) << 8)) |
+            (png_uint_16)((*(sp + 1) - *sp) & 0xff) +
+            0x7f) >> 8) & 0xff);
 */
          sp += 2;
          dp++;
       }
       row_info->bit_depth = 8;
-		row_info->pixel_depth = (png_byte)(8 * row_info->channels);
+      row_info->pixel_depth = (png_byte)(8 * row_info->channels);
       row_info->rowbytes = row_info->width * row_info->channels;
    }
 }
@@ -1126,10 +1126,10 @@
             }
          }
       }
-		row_info->channels += (png_byte)2;
+      row_info->channels += (png_byte)2;
       row_info->color_type |= PNG_COLOR_MASK_COLOR;
-		row_info->pixel_depth = (png_byte)(row_info->channels *
-			row_info->bit_depth);
+      row_info->pixel_depth = (png_byte)(row_info->channels *
+         row_info->bit_depth);
       row_info->rowbytes = ((row_info->width *
          row_info->pixel_depth + 7) >> 3);
    }
@@ -1170,16 +1170,16 @@
          color_inc = 1;
          break;
       default:
-			num_palette = 0;
+         num_palette = 0;
          color_inc = 0;
          break;
    }
 
    for (i = 0, v = 0; i < num_palette; i++, v += color_inc)
    {
-		palette[i].red = (png_byte)v;
-		palette[i].green = (png_byte)v;
-		palette[i].blue = (png_byte)v;
+      palette[i].red = (png_byte)v;
+      palette[i].green = (png_byte)v;
+      palette[i].blue = (png_byte)v;
    }
 }
 
@@ -1264,9 +1264,9 @@
          {
             if (palette[i].red == png_ptr->trans_values.gray)
             {
-					palette[i].red = (png_byte)back;
-					palette[i].green = (png_byte)back;
-					palette[i].blue = (png_byte)back;
+               palette[i].red = (png_byte)back;
+               palette[i].green = (png_byte)back;
+               palette[i].blue = (png_byte)back;
             }
             else
             {
@@ -1359,8 +1359,8 @@
    png_color_16p trans_values, png_color_16p background,
    png_color_16p background_1,
    png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
-	png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
-	png_uint_16pp gamma_16_to_1, int gamma_shift)
+   png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
+   png_uint_16pp gamma_16_to_1, int gamma_shift)
 {
    png_bytep sp, dp;
    png_uint_32 i;
@@ -1386,8 +1386,8 @@
                      if (((*sp >> shift) & 0x1) ==
                         trans_values->gray)
                      {
-								*sp &= (png_byte)((0x7f7f >> (7 - shift)) & 0xff);
-								*sp |= (png_byte)(background->gray << shift);
+                        *sp &= (png_byte)((0x7f7f >> (7 - shift)) & 0xff);
+                        *sp |= (png_byte)(background->gray << shift);
                      }
                      if (!shift)
                      {
@@ -1408,8 +1408,8 @@
                      if (((*sp >> shift) & 0x3) ==
                         trans_values->gray)
                      {
-								*sp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff);
-								*sp |= (png_byte)(background->gray << shift);
+                        *sp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff);
+                        *sp |= (png_byte)(background->gray << shift);
                      }
                      if (!shift)
                      {
@@ -1430,8 +1430,8 @@
                      if (((*sp >> shift) & 0xf) ==
                         trans_values->gray)
                      {
-								*sp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff);
-								*sp |= (png_byte)(background->gray << shift);
+                        *sp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff);
+                        *sp |= (png_byte)(background->gray << shift);
                      }
                      if (!shift)
                      {
@@ -1486,21 +1486,21 @@
                      {
                         png_uint_16 v;
 
-								v = (png_uint_16)(((png_uint_16)(*sp) << 8) +
-									(png_uint_16)(*(sp + 1)));
+                        v = (png_uint_16)(((png_uint_16)(*sp) << 8) +
+                           (png_uint_16)(*(sp + 1)));
                         if (v == trans_values->gray)
                         {
-									*sp = (png_byte)((background->gray >> 8) & 0xff);
-									*(sp + 1) = (png_byte)(background->gray & 0xff);
+                           *sp = (png_byte)((background->gray >> 8) & 0xff);
+                           *(sp + 1) = (png_byte)(background->gray & 0xff);
                         }
                         else
                         {
                            v = gamma_16[
-										*(sp + 1) >> gamma_shift][*sp];
-									*sp = (png_byte)((v >> 8) & 0xff);
+                              *(sp + 1) >> gamma_shift][*sp];
+                           *sp = (png_byte)((v >> 8) & 0xff);
                            *(sp + 1) = (png_byte)(v & 0xff);
                         }
-							}
+                     }
                   }
                   else
 #endif
@@ -1510,12 +1510,12 @@
                      {
                         png_uint_16 v;
 
-								v = (png_uint_16)(((png_uint_16)(*sp) << 8) +
-									(png_uint_16)(*(sp + 1)));
+                        v = (png_uint_16)(((png_uint_16)(*sp) << 8) +
+                           (png_uint_16)(*(sp + 1)));
                         if (v == trans_values->gray)
                         {
-									*sp = (png_byte)((background->gray >> 8) & 0xff);
-									*(sp + 1) = (png_byte)(background->gray & 0xff);
+                           *sp = (png_byte)((background->gray >> 8) & 0xff);
+                           *(sp + 1) = (png_byte)(background->gray & 0xff);
                         }
                      }
                   }
@@ -1573,42 +1573,42 @@
                if (gamma_16)
                {
                   for (i = 0, sp = row;
-							i < row_info->width; i++, sp += 6)
-						{
-							png_uint_16 r, g, b;
+                     i < row_info->width; i++, sp += 6)
+                  {
+                     png_uint_16 r, g, b;
 
-							r = (png_uint_16)(((png_uint_16)(*sp) << 8) +
-								(png_uint_16)(*(sp + 1)));
-							g = (png_uint_16)(((png_uint_16)(*(sp + 2)) << 8) +
-								(png_uint_16)(*(sp + 3)));
-							b = (png_uint_16)(((png_uint_16)(*(sp + 4)) << 8) +
-								(png_uint_16)(*(sp + 5)));
+                     r = (png_uint_16)(((png_uint_16)(*sp) << 8) +
+                        (png_uint_16)(*(sp + 1)));
+                     g = (png_uint_16)(((png_uint_16)(*(sp + 2)) << 8) +
+                        (png_uint_16)(*(sp + 3)));
+                     b = (png_uint_16)(((png_uint_16)(*(sp + 4)) << 8) +
+                        (png_uint_16)(*(sp + 5)));
                      if (r == trans_values->red &&
                         g == trans_values->green &&
                         b == trans_values->blue)
                      {
-								*sp = (png_byte)((background->red >> 8) & 0xff);
-								*(sp + 1) = (png_byte)(background->red & 0xff);
-								*(sp + 2) = (png_byte)((background->green >> 8) & 0xff);
-								*(sp + 3) = (png_byte)(background->green & 0xff);
-								*(sp + 4) = (png_byte)((background->blue >> 8) & 0xff);
-								*(sp + 5) = (png_byte)(background->blue & 0xff);
+                        *sp = (png_byte)((background->red >> 8) & 0xff);
+                        *(sp + 1) = (png_byte)(background->red & 0xff);
+                        *(sp + 2) = (png_byte)((background->green >> 8) & 0xff);
+                        *(sp + 3) = (png_byte)(background->green & 0xff);
+                        *(sp + 4) = (png_byte)((background->blue >> 8) & 0xff);
+                        *(sp + 5) = (png_byte)(background->blue & 0xff);
                      }
                      else
                      {
                         png_uint_16 v;
                         v = gamma_16[
                            *(sp + 1) >> gamma_shift][*sp];
-								*sp = (png_byte)((v >> 8) & 0xff);
+                        *sp = (png_byte)((v >> 8) & 0xff);
                         *(sp + 1) = (png_byte)(v & 0xff);
                         v = gamma_16[
                            *(sp + 3) >> gamma_shift][*(sp + 2)];
-								*(sp + 2) = (png_byte)((v >> 8) & 0xff);
-								*(sp + 3) = (png_byte)(v & 0xff);
-								v = gamma_16[
+                        *(sp + 2) = (png_byte)((v >> 8) & 0xff);
+                        *(sp + 3) = (png_byte)(v & 0xff);
+                        v = gamma_16[
                            *(sp + 5) >> gamma_shift][*(sp + 4)];
-								*(sp + 4) = (png_byte)((v >> 8) & 0xff);
-								*(sp + 5) = (png_byte)(v & 0xff);
+                        *(sp + 4) = (png_byte)((v >> 8) & 0xff);
+                        *(sp + 5) = (png_byte)(v & 0xff);
                      }
                   }
                }
@@ -1620,29 +1620,29 @@
                   {
                      png_uint_16 r, g, b;
 
-							r = (png_uint_16)(((png_uint_16)(*sp) << 8) +
-								(png_uint_16)(*(sp + 1)));
-							g = (png_uint_16)(((png_uint_16)(*(sp + 2)) << 8) +
-								(png_uint_16)(*(sp + 3)));
-							b = (png_uint_16)(((png_uint_16)(*(sp + 4)) << 8) +
-								(png_uint_16)(*(sp + 5)));
+                     r = (png_uint_16)(((png_uint_16)(*sp) << 8) +
+                        (png_uint_16)(*(sp + 1)));
+                     g = (png_uint_16)(((png_uint_16)(*(sp + 2)) << 8) +
+                        (png_uint_16)(*(sp + 3)));
+                     b = (png_uint_16)(((png_uint_16)(*(sp + 4)) << 8) +
+                        (png_uint_16)(*(sp + 5)));
                      if (r == trans_values->red &&
                         g == trans_values->green &&
                         b == trans_values->blue)
-							{
-								*sp = (png_byte)((background->red >> 8) & 0xff);
-								*(sp + 1) = (png_byte)(background->red & 0xff);
-								*(sp + 2) = (png_byte)((background->green >> 8) & 0xff);
-								*(sp + 3) = (png_byte)(background->green & 0xff);
-								*(sp + 4) = (png_byte)((background->blue >> 8) & 0xff);
-								*(sp + 5) = (png_byte)(background->blue & 0xff);
-							}
-						}
-					}
-				}
-				break;
-			}
-			case PNG_COLOR_TYPE_GRAY_ALPHA:
+                     {
+                        *sp = (png_byte)((background->red >> 8) & 0xff);
+                        *(sp + 1) = (png_byte)(background->red & 0xff);
+                        *(sp + 2) = (png_byte)((background->green >> 8) & 0xff);
+                        *(sp + 3) = (png_byte)(background->green & 0xff);
+                        *(sp + 4) = (png_byte)((background->blue >> 8) & 0xff);
+                        *(sp + 5) = (png_byte)(background->blue & 0xff);
+                     }
+                  }
+               }
+            }
+            break;
+         }
+         case PNG_COLOR_TYPE_GRAY_ALPHA:
          {
             switch (row_info->bit_depth)
             {
@@ -1671,8 +1671,8 @@
                            png_uint_16 v;
 
                            v = gamma_to_1[*sp];
-									v = (png_uint_16)(((png_uint_16)(v) * a +
-										(png_uint_16)background_1->gray *
+                           v = (png_uint_16)(((png_uint_16)(v) * a +
+                              (png_uint_16)background_1->gray *
                               (255 - a) + 127) / 255);
                            *dp = gamma_from_1[v];
                         }
@@ -1698,9 +1698,9 @@
                         }
                         else
                         {
-									*dp = (png_byte)(((png_uint_16)(*sp) * a +
-										(png_uint_16)background_1->gray *
-										(255 - a) + 127) / 255);
+                           *dp = (png_byte)(((png_uint_16)(*sp) * a +
+                              (png_uint_16)background_1->gray *
+                              (255 - a) + 127) / 255);
                         }
                      }
                   }
@@ -1717,8 +1717,8 @@
                      {
                         png_uint_16 a;
 
-								a = (png_uint_16)(((png_uint_16)(*(sp + 2)) << 8) +
-									(png_uint_16)(*(sp + 3)));
+                        a = (png_uint_16)(((png_uint_16)(*(sp + 2)) << 8) +
+                           (png_uint_16)(*(sp + 3)));
                         if (a == (png_uint_16)0xffff)
                         {
                            png_uint_32 v;
@@ -1759,18 +1759,18 @@
                      {
                         png_uint_16 a;
 
-								a = (png_uint_16)(((png_uint_16)(*(sp + 2)) << 8) +
-									(png_uint_16)(*(sp + 3)));
+                        a = (png_uint_16)(((png_uint_16)(*(sp + 2)) << 8) +
+                           (png_uint_16)(*(sp + 3)));
                         if (a == (png_uint_16)0xffff)
                         {
                            png_memcpy(dp, sp, 2);
                         }
                         else if (a == 0)
                         {
-									*dp = (png_byte)((background->gray >> 8) & 0xff);
-									*(dp + 1) = (png_byte)(background->gray & 0xff);
-								}
-								else
+                           *dp = (png_byte)((background->gray >> 8) & 0xff);
+                           *(dp + 1) = (png_byte)(background->gray & 0xff);
+                        }
+                        else
                         {
                            png_uint_32 g, v;
 
@@ -1821,19 +1821,19 @@
                         png_uint_16 v;
 
                         v = gamma_to_1[*sp];
-								v = (png_uint_16)(((png_uint_16)(v) * a +
-									(png_uint_16)background_1->red *
-									(255 - a) + 127) / 255);
+                        v = (png_uint_16)(((png_uint_16)(v) * a +
+                           (png_uint_16)background_1->red *
+                           (255 - a) + 127) / 255);
                         *dp = gamma_from_1[v];
                         v = gamma_to_1[*(sp + 1)];
-								v = (png_uint_16)(((png_uint_16)(v) * a +
-									(png_uint_16)background_1->green *
-									(255 - a) + 127) / 255);
+                        v = (png_uint_16)(((png_uint_16)(v) * a +
+                           (png_uint_16)background_1->green *
+                           (255 - a) + 127) / 255);
                         *(dp + 1) = gamma_from_1[v];
                         v = gamma_to_1[*(sp + 2)];
-								v = (png_uint_16)(((png_uint_16)(v) * a +
-									(png_uint_16)background_1->blue *
-									(255 - a) + 127) / 255);
+                        v = (png_uint_16)(((png_uint_16)(v) * a +
+                           (png_uint_16)background_1->blue *
+                           (255 - a) + 127) / 255);
                         *(dp + 2) = gamma_from_1[v];
                      }
                   }
@@ -1862,15 +1862,15 @@
                      }
                      else
                      {
-								*dp = (png_byte)(((png_uint_16)(*sp) * a +
-									(png_uint_16)background->red *
-									(255 - a) + 127) / 255);
-								*(dp + 1) = (png_byte)(((png_uint_16)(*(sp + 1)) * a +
-									(png_uint_16)background->green *
-									(255 - a) + 127) / 255);
-								*(dp + 2) = (png_byte)(((png_uint_16)(*(sp + 2)) * a +
-									(png_uint_16)background->blue *
-									(255 - a) + 127) / 255);
+                        *dp = (png_byte)(((png_uint_16)(*sp) * a +
+                           (png_uint_16)background->red *
+                           (255 - a) + 127) / 255);
+                        *(dp + 1) = (png_byte)(((png_uint_16)(*(sp + 1)) * a +
+                           (png_uint_16)background->green *
+                           (255 - a) + 127) / 255);
+                        *(dp + 2) = (png_byte)(((png_uint_16)(*(sp + 2)) * a +
+                           (png_uint_16)background->blue *
+                           (255 - a) + 127) / 255);
                      }
                   }
                }
@@ -1886,33 +1886,33 @@
                   {
                      png_uint_16 a;
 
-							a = (png_uint_16)(((png_uint_16)(*(sp + 6)) << 8) +
-								(png_uint_16)(*(sp + 7)));
+                     a = (png_uint_16)(((png_uint_16)(*(sp + 6)) << 8) +
+                        (png_uint_16)(*(sp + 7)));
                      if (a == (png_uint_16)0xffff)
                      {
                         png_uint_16 v;
 
                         v = gamma_16[
                            *(sp + 1) >> gamma_shift][*sp];
-								*dp = (png_byte)((v >> 8) & 0xff);
-								*(dp + 1) = (png_byte)(v & 0xff);
+                        *dp = (png_byte)((v >> 8) & 0xff);
+                        *(dp + 1) = (png_byte)(v & 0xff);
                         v = gamma_16[
                            *(sp + 3) >> gamma_shift][*(sp + 2)];
-								*(dp + 2) = (png_byte)((v >> 8) & 0xff);
-								*(dp + 3) = (png_byte)(v & 0xff);
-								v = gamma_16[
-									*(sp + 5) >> gamma_shift][*(sp + 4)];
-								*(dp + 4) = (png_byte)((v >> 8) & 0xff);
-								*(dp + 5) = (png_byte)(v & 0xff);
+                        *(dp + 2) = (png_byte)((v >> 8) & 0xff);
+                        *(dp + 3) = (png_byte)(v & 0xff);
+                        v = gamma_16[
+                           *(sp + 5) >> gamma_shift][*(sp + 4)];
+                        *(dp + 4) = (png_byte)((v >> 8) & 0xff);
+                        *(dp + 5) = (png_byte)(v & 0xff);
                      }
                      else if (a == 0)
                      {
-								*dp = (png_byte)((background->red >> 8) & 0xff);
-								*(dp + 1) = (png_byte)(background->red & 0xff);
-								*(dp + 2) = (png_byte)((background->green >> 8) & 0xff);
-								*(dp + 3) = (png_byte)(background->green & 0xff);
-								*(dp + 4) = (png_byte)((background->blue >> 8) & 0xff);
-								*(dp + 5) = (png_byte)(background->blue & 0xff);
+                        *dp = (png_byte)((background->red >> 8) & 0xff);
+                        *(dp + 1) = (png_byte)(background->red & 0xff);
+                        *(dp + 2) = (png_byte)((background->green >> 8) & 0xff);
+                        *(dp + 3) = (png_byte)(background->green & 0xff);
+                        *(dp + 4) = (png_byte)((background->blue >> 8) & 0xff);
+                        *(dp + 5) = (png_byte)(background->blue & 0xff);
                      }
                      else
                      {
@@ -1960,22 +1960,22 @@
                   {
                      png_uint_16 a;
 
-							a = (png_uint_16)(((png_uint_16)(*(sp + 6)) << 8) +
-								(png_uint_16)(*(sp + 7)));
+                     a = (png_uint_16)(((png_uint_16)(*(sp + 6)) << 8) +
+                        (png_uint_16)(*(sp + 7)));
                      if (a == (png_uint_16)0xffff)
                      {
                         png_memcpy(dp, sp, 6);
                      }
                      else if (a == 0)
                      {
-								*dp = (png_byte)((background->red >> 8) & 0xff);
-								*(dp + 1) = (png_byte)(background->red & 0xff);
-								*(dp + 2) = (png_byte)((background->green >> 8) & 0xff);
-								*(dp + 3) = (png_byte)(background->green & 0xff);
-								*(dp + 4) = (png_byte)((background->blue >> 8) & 0xff);
-								*(dp + 5) = (png_byte)(background->blue & 0xff);
-							}
-							else
+                        *dp = (png_byte)((background->red >> 8) & 0xff);
+                        *(dp + 1) = (png_byte)(background->red & 0xff);
+                        *(dp + 2) = (png_byte)((background->green >> 8) & 0xff);
+                        *(dp + 3) = (png_byte)(background->green & 0xff);
+                        *(dp + 4) = (png_byte)((background->blue >> 8) & 0xff);
+                        *(dp + 5) = (png_byte)(background->blue & 0xff);
+                     }
+                     else
                      {
                         png_uint_32 r, g, b, v;
 
@@ -2013,9 +2013,9 @@
       if (row_info->color_type & PNG_COLOR_MASK_ALPHA)
       {
          row_info->color_type &= ~PNG_COLOR_MASK_ALPHA;
-			row_info->channels -= (png_byte)1;
-			row_info->pixel_depth = (png_byte)(row_info->channels *
-				row_info->bit_depth);
+         row_info->channels -= (png_byte)1;
+         row_info->pixel_depth = (png_byte)(row_info->channels *
+            row_info->bit_depth);
          row_info->rowbytes = ((row_info->width *
             row_info->pixel_depth + 7) >> 3);
       }
@@ -2067,30 +2067,30 @@
 
                   v = gamma_16_table[*(sp + 1) >>
                      gamma_shift][*sp];
-						*sp = (png_byte)((v >> 8) & 0xff);
-						*(sp + 1) = (png_byte)(v & 0xff);
-						sp += 2;
-						v = gamma_16_table[*(sp + 1) >>
-							gamma_shift][*sp];
-						*sp = (png_byte)((v >> 8) & 0xff);
-						*(sp + 1) = (png_byte)(v & 0xff);
+                  *sp = (png_byte)((v >> 8) & 0xff);
+                  *(sp + 1) = (png_byte)(v & 0xff);
                   sp += 2;
                   v = gamma_16_table[*(sp + 1) >>
                      gamma_shift][*sp];
-						*sp = (png_byte)((v >> 8) & 0xff);
-						*(sp + 1) = (png_byte)(v & 0xff);
-						sp += 2;
-					}
-				}
-				break;
-			}
-			case PNG_COLOR_TYPE_RGB_ALPHA:
-			{
-				if (row_info->bit_depth == 8)
-				{
-					for (i = 0, sp = row;
-						i < row_info->width; i++)
-					{
+                  *sp = (png_byte)((v >> 8) & 0xff);
+                  *(sp + 1) = (png_byte)(v & 0xff);
+                  sp += 2;
+                  v = gamma_16_table[*(sp + 1) >>
+                     gamma_shift][*sp];
+                  *sp = (png_byte)((v >> 8) & 0xff);
+                  *(sp + 1) = (png_byte)(v & 0xff);
+                  sp += 2;
+               }
+            }
+            break;
+         }
+         case PNG_COLOR_TYPE_RGB_ALPHA:
+         {
+            if (row_info->bit_depth == 8)
+            {
+               for (i = 0, sp = row;
+                  i < row_info->width; i++)
+               {
                   *sp = gamma_table[*sp];
                   sp++;
                   *sp = gamma_table[*sp];
@@ -2109,21 +2109,21 @@
 
                   v = gamma_16_table[*(sp + 1) >>
                      gamma_shift][*sp];
-						*sp = (png_byte)((v >> 8) & 0xff);
-						*(sp + 1) = (png_byte)(v & 0xff);
+                  *sp = (png_byte)((v >> 8) & 0xff);
+                  *(sp + 1) = (png_byte)(v & 0xff);
                   sp += 2;
                   v = gamma_16_table[*(sp + 1) >>
                      gamma_shift][*sp];
-						*sp = (png_byte)((v >> 8) & 0xff);
-						*(sp + 1) = (png_byte)(v & 0xff);
-						sp += 2;
-						v = gamma_16_table[*(sp + 1) >>
-							gamma_shift][*sp];
-						*sp = (png_byte)((v >> 8) & 0xff);
-						*(sp + 1) = (png_byte)(v & 0xff);
-						sp += 4;
-					}
-				}
+                  *sp = (png_byte)((v >> 8) & 0xff);
+                  *(sp + 1) = (png_byte)(v & 0xff);
+                  sp += 2;
+                  v = gamma_16_table[*(sp + 1) >>
+                     gamma_shift][*sp];
+                  *sp = (png_byte)((v >> 8) & 0xff);
+                  *(sp + 1) = (png_byte)(v & 0xff);
+                  sp += 4;
+               }
+            }
             break;
          }
          case PNG_COLOR_TYPE_GRAY_ALPHA:
@@ -2147,8 +2147,8 @@
 
                   v = gamma_16_table[*(sp + 1) >>
                      gamma_shift][*sp];
-						*sp = (png_byte)((v >> 8) & 0xff);
-						*(sp + 1) = (png_byte)(v & 0xff);
+                  *sp = (png_byte)((v >> 8) & 0xff);
+                  *(sp + 1) = (png_byte)(v & 0xff);
                   sp += 4;
                }
             }
@@ -2174,8 +2174,8 @@
 
                   v = gamma_16_table[*(sp + 1) >>
                      gamma_shift][*sp];
-						*sp = (png_byte)((v >> 8) & 0xff);
-						*(sp + 1) = (png_byte)(v & 0xff);
+                  *sp = (png_byte)((v >> 8) & 0xff);
+                  *(sp + 1) = (png_byte)(v & 0xff);
                   sp += 2;
                }
             }
@@ -2191,7 +2191,7 @@
    upon whether you supply trans and num_trans */
 void
 png_do_expand_palette(png_row_infop row_info, png_bytep row,
-	png_colorp palette,
+   png_colorp palette,
    png_bytep trans, int num_trans)
 {
    int shift, value;
@@ -2235,7 +2235,7 @@
                for (i = 0; i < row_info->width; i++)
                {
                   value = (*sp >> shift) & 0x3;
-						*dp = (png_byte)value;
+                  *dp = (png_byte)value;
                   if (shift == 6)
                   {
                      shift = 0;
@@ -2256,7 +2256,7 @@
                for (i = 0; i < row_info->width; i++)
                {
                   value = (*sp >> shift) & 0xf;
-						*dp = (png_byte)value;
+                  *dp = (png_byte)value;
                   if (shift == 4)
                   {
                      shift = 0;
@@ -2325,10 +2325,10 @@
 }
 
 /* if the bit depth < 8, it is expanded to 8.  Also, if the
-	transparency value is supplied, an alpha channel is built. */
+   transparency value is supplied, an alpha channel is built. */
 void
 png_do_expand(png_row_infop row_info, png_bytep row,
-	png_color_16p trans_value)
+   png_color_16p trans_value)
 {
    int shift, value;
    png_bytep sp, dp;
@@ -2372,8 +2372,8 @@
                for (i = 0; i < row_info->width; i++)
                {
                   value = (*sp >> shift) & 0x3;
-						*dp = (png_byte)(value | (value << 2) | (value << 4) |
-							(value << 6));
+                  *dp = (png_byte)(value | (value << 2) | (value << 4) |
+                     (value << 6));
                   if (shift == 6)
                   {
                      shift = 0;
@@ -2394,7 +2394,7 @@
                for (i = 0; i < row_info->width; i++)
                {
                   value = (*sp >> shift) & 0xf;
-						*dp = (png_byte)(value | (value << 4));
+                  *dp = (png_byte)(value | (value << 4));
                   if (shift == 4)
                   {
                      shift = 0;
@@ -2426,7 +2426,7 @@
                   *dp-- = 0xff;
                *dp-- = *sp--;
             }
-			}
+         }
          else if (row_info->bit_depth == 16)
          {
             sp = row + (png_size_t)row_info->rowbytes - 1;
@@ -2444,13 +2444,13 @@
                   *dp-- = 0xff;
                   *dp-- = 0xff;
                }
-					*dp-- = *sp--;
+               *dp-- = *sp--;
                *dp-- = *sp--;
             }
          }
          row_info->color_type = PNG_COLOR_TYPE_GRAY_ALPHA;
          row_info->channels = 2;
-			row_info->pixel_depth = (png_byte)(row_info->bit_depth << 1);
+         row_info->pixel_depth = (png_byte)(row_info->bit_depth << 1);
          row_info->rowbytes =
             ((row_info->width * row_info->pixel_depth) >> 3);
       }
@@ -2462,7 +2462,7 @@
             dp = row + (png_size_t)(row_info->width << 2) - 1;
             for (i = 0; i < row_info->width; i++)
             {
-					if (*(sp - 2) == trans_value->red &&
+               if (*(sp - 2) == trans_value->red &&
                   *(sp - 1) == trans_value->green &&
                   *(sp - 0) == trans_value->blue)
                   *dp-- = 0;
@@ -2480,7 +2480,7 @@
             for (i = 0; i < row_info->width; i++)
             {
                if ((((png_uint_16)*(sp - 4) |
-						((png_uint_16)*(sp - 5) << 8)) == trans_value->red) &&
+                  ((png_uint_16)*(sp - 5) << 8)) == trans_value->red) &&
                   (((png_uint_16)*(sp - 2) |
                   ((png_uint_16)*(sp - 3) << 8)) == trans_value->green) &&
                   (((png_uint_16)*(sp - 0) |
@@ -2498,13 +2498,13 @@
                *dp-- = *sp--;
                *dp-- = *sp--;
                *dp-- = *sp--;
-					*dp-- = *sp--;
+               *dp-- = *sp--;
                *dp-- = *sp--;
             }
          }
          row_info->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
          row_info->channels = 4;
-			row_info->pixel_depth = (png_byte)(row_info->bit_depth << 2);
+         row_info->pixel_depth = (png_byte)(row_info->bit_depth << 2);
          row_info->rowbytes =
             ((row_info->width * row_info->pixel_depth) >> 3);
       }
@@ -2515,7 +2515,7 @@
 #if defined(PNG_READ_DITHER_SUPPORTED)
 void
 png_do_dither(png_row_infop row_info, png_bytep row,
-	 png_bytep palette_lookup, png_bytep dither_lookup)
+    png_bytep palette_lookup, png_bytep dither_lookup)
 {
    png_bytep sp, dp;
    png_uint_32 i;
@@ -2545,7 +2545,7 @@
                ((1 << PNG_DITHER_RED_BITS) - 1)) <<
                (PNG_DITHER_GREEN_BITS + PNG_DITHER_BLUE_BITS)) |
                (((g >> (8 - PNG_DITHER_GREEN_BITS)) &
-					((1 << PNG_DITHER_GREEN_BITS) - 1)) <<
+               ((1 << PNG_DITHER_GREEN_BITS) - 1)) <<
                (PNG_DITHER_BLUE_BITS)) |
                ((b >> (8 - PNG_DITHER_BLUE_BITS)) &
                ((1 << PNG_DITHER_BLUE_BITS) - 1));
@@ -2572,7 +2572,7 @@
             sp++;
 
             p = (((r >> (8 - PNG_DITHER_RED_BITS)) &
-					((1 << PNG_DITHER_RED_BITS) - 1)) <<
+               ((1 << PNG_DITHER_RED_BITS) - 1)) <<
                (PNG_DITHER_GREEN_BITS + PNG_DITHER_BLUE_BITS)) |
                (((g >> (8 - PNG_DITHER_GREEN_BITS)) &
                ((1 << PNG_DITHER_GREEN_BITS) - 1)) <<
@@ -2590,7 +2590,7 @@
       }
       else if (row_info->color_type == PNG_COLOR_TYPE_PALETTE &&
          dither_lookup && row_info->bit_depth == 8)
-		{
+      {
          sp = row;
          for (i = 0; i < row_info->width; i++, sp++)
          {
@@ -2639,7 +2639,7 @@
 
          g = 1.0 / (png_ptr->display_gamma);
 
-			png_ptr->gamma_from_1 = (png_bytep)png_large_malloc(png_ptr,
+         png_ptr->gamma_from_1 = (png_bytep)png_large_malloc(png_ptr,
             (png_uint_32)256);
 
          for (i = 0; i < 256; i++)
@@ -2649,30 +2649,30 @@
          }
       }
    }
-	else
+   else
    {
       double g;
-		int i, j, shift, num;
-		int sig_bit;
-		png_uint_32 ig;
+      int i, j, shift, num;
+      int sig_bit;
+      png_uint_32 ig;
 
       if (png_ptr->color_type & PNG_COLOR_MASK_COLOR)
-		{
+      {
          sig_bit = (int)png_ptr->sig_bit.red;
          if ((int)png_ptr->sig_bit.green > sig_bit)
             sig_bit = png_ptr->sig_bit.green;
          if ((int)png_ptr->sig_bit.blue > sig_bit)
-				sig_bit = png_ptr->sig_bit.blue;
+            sig_bit = png_ptr->sig_bit.blue;
       }
       else
       {
          sig_bit = (int)png_ptr->sig_bit.gray;
-		}
+      }
 
       if (sig_bit > 0)
          shift = 16 - sig_bit;
       else
-			shift = 0;
+         shift = 0;
 
       if (png_ptr->transformations & PNG_16_TO_8)
       {
@@ -2680,65 +2680,65 @@
             shift = (16 - PNG_MAX_GAMMA_8);
       }
 
-		if (shift > 8)
+      if (shift > 8)
          shift = 8;
       if (shift < 0)
          shift = 0;
 
-		png_ptr->gamma_shift = (png_byte)shift;
+      png_ptr->gamma_shift = (png_byte)shift;
 
-		num = (1 << (8 - shift));
+      num = (1 << (8 - shift));
 
       g = 1.0 / (png_ptr->gamma * png_ptr->display_gamma);
 
       png_ptr->gamma_16_table = (png_uint_16pp)png_large_malloc(png_ptr,
          num * sizeof (png_uint_16p ));
 
-		if ((png_ptr->transformations & PNG_16_TO_8) &&
-			!(png_ptr->transformations & PNG_BACKGROUND))
-		{
-			double fin, fout;
-			png_uint_32 last, max;
+      if ((png_ptr->transformations & PNG_16_TO_8) &&
+         !(png_ptr->transformations & PNG_BACKGROUND))
+      {
+         double fin, fout;
+         png_uint_32 last, max;
 
-			for (i = 0; i < num; i++)
-			{
-				png_ptr->gamma_16_table[i] = (png_uint_16p)png_large_malloc(png_ptr,
-					256 * sizeof (png_uint_16));
-			}
+         for (i = 0; i < num; i++)
+         {
+            png_ptr->gamma_16_table[i] = (png_uint_16p)png_large_malloc(png_ptr,
+               256 * sizeof (png_uint_16));
+         }
 
-			g = 1.0 / g;
-			last = 0;
-			for (i = 0; i < 256; i++)
-			{
-				fout = ((double)i + 0.5) / 256.0;
-				fin = pow(fout, g);
-				max = (png_uint_32)(fin * (double)((png_uint_32)num << 8));
-				while (last <= max)
-				{
-					png_ptr->gamma_16_table[(int)(last & (0xff >> shift))]
-						[(int)(last >> (8 - shift))] = (png_uint_16)(
-						(png_uint_16)i | ((png_uint_16)i << 8));
-					last++;
-				}
-			}
-			while (last < ((png_uint_32)num << 8))
-			{
-				png_ptr->gamma_16_table[(int)(last & (0xff >> shift))]
-					[(int)(last >> (8 - shift))] =
-					(png_uint_16)65535L;
-				last++;
+         g = 1.0 / g;
+         last = 0;
+         for (i = 0; i < 256; i++)
+         {
+            fout = ((double)i + 0.5) / 256.0;
+            fin = pow(fout, g);
+            max = (png_uint_32)(fin * (double)((png_uint_32)num << 8));
+            while (last <= max)
+            {
+               png_ptr->gamma_16_table[(int)(last & (0xff >> shift))]
+                  [(int)(last >> (8 - shift))] = (png_uint_16)(
+                  (png_uint_16)i | ((png_uint_16)i << 8));
+               last++;
+            }
+         }
+         while (last < ((png_uint_32)num << 8))
+         {
+            png_ptr->gamma_16_table[(int)(last & (0xff >> shift))]
+               [(int)(last >> (8 - shift))] =
+               (png_uint_16)65535L;
+            last++;
          }
       }
-		else
-		{
-			for (i = 0; i < num; i++)
-			{
-				png_ptr->gamma_16_table[i] = (png_uint_16p)png_large_malloc(png_ptr,
-					256 * sizeof (png_uint_16));
+      else
+      {
+         for (i = 0; i < num; i++)
+         {
+            png_ptr->gamma_16_table[i] = (png_uint_16p)png_large_malloc(png_ptr,
+               256 * sizeof (png_uint_16));
 
-				ig = (((png_uint_32)i *
-					(png_uint_32)png_gamma_shift[shift]) >> 4);
-				for (j = 0; j < 256; j++)
+            ig = (((png_uint_32)i *
+               (png_uint_32)png_gamma_shift[shift]) >> 4);
+            for (j = 0; j < 256; j++)
             {
                png_ptr->gamma_16_table[i][j] =
                   (png_uint_16)(pow((double)(ig + ((png_uint_32)j << 8)) /
@@ -2751,7 +2751,7 @@
       {
          g = 1.0 / (png_ptr->gamma);
 
-			png_ptr->gamma_16_to_1 = (png_uint_16pp)png_large_malloc(png_ptr,
+         png_ptr->gamma_16_to_1 = (png_uint_16pp)png_large_malloc(png_ptr,
             num * sizeof (png_uint_16p ));
 
          for (i = 0; i < num; i++)
@@ -2775,7 +2775,7 @@
 
          for (i = 0; i < num; i++)
          {
-				png_ptr->gamma_16_from_1[i] = (png_uint_16p)png_large_malloc(png_ptr,
+            png_ptr->gamma_16_from_1[i] = (png_uint_16p)png_large_malloc(png_ptr,
                256 * sizeof (png_uint_16));
 
             ig = (((png_uint_32)i *
diff --git a/pngrutil.c b/pngrutil.c
index 523d8bf..41d50b9 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -1,10 +1,10 @@
 
 /* pngrutil.c - utilities to read a png file
 
-	libpng 1.0 beta 2 - version 0.87
+   libpng 1.0 beta 2 - version 0.88
    For conditions of distribution and use, see copyright notice in png.h
-	Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
-   January 15, 1996
+   Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+   January 25, 1996
    */
 
 #define PNG_INTERNAL
@@ -30,8 +30,8 @@
 {
    png_uint_16 i;
 
-	i = (png_uint_16)(((png_uint_16)(*buf) << 8) +
-		(png_uint_16)(*(buf + 1)));
+   i = (png_uint_16)(((png_uint_16)(*buf) << 8) +
+      (png_uint_16)(*(buf + 1)));
 
    return i;
 }
@@ -99,7 +99,7 @@
       color_type == 5 || color_type > 6)
       png_error(png_ptr, "Invalid Color Type Found");
 
-	if (color_type == PNG_COLOR_TYPE_PALETTE &&
+   if (color_type == PNG_COLOR_TYPE_PALETTE &&
       bit_depth == 16)
       png_error(png_ptr, "Found Invalid Color Type and Bit Depth Combination");
 
@@ -121,9 +121,9 @@
    /* set internal variables */
    png_ptr->width = width;
    png_ptr->height = height;
-	png_ptr->bit_depth = (png_byte)bit_depth;
-	png_ptr->interlaced = (png_byte)interlace_type;
-	png_ptr->color_type = (png_byte)color_type;
+   png_ptr->bit_depth = (png_byte)bit_depth;
+   png_ptr->interlaced = (png_byte)interlace_type;
+   png_ptr->color_type = (png_byte)color_type;
 
    /* find number of channels */
    switch (png_ptr->color_type)
@@ -143,8 +143,8 @@
          break;
    }
    /* set up other useful info */
-	png_ptr->pixel_depth = (png_byte)(png_ptr->bit_depth *
-		png_ptr->channels);
+   png_ptr->pixel_depth = (png_byte)(png_ptr->bit_depth *
+      png_ptr->channels);
    png_ptr->rowbytes = ((png_ptr->width *
       (png_uint_32)png_ptr->pixel_depth + 7) >> 3);
    /* call the IHDR callback (which should just set up info) */
@@ -165,7 +165,7 @@
    num = (int)length / 3;
    palette = (png_colorp)png_large_malloc(png_ptr, num * sizeof (png_color));
    png_ptr->do_free |= PNG_FREE_PALETTE;
-	for (i = 0; i < num; i++)
+   for (i = 0; i < num; i++)
    {
       png_byte buf[3];
 
@@ -176,7 +176,7 @@
       palette[i].blue = buf[2];
    }
    png_ptr->palette = palette;
-	png_ptr->num_palette = (png_uint_16)num;
+   png_ptr->num_palette = (png_uint_16)num;
    png_read_PLTE(png_ptr, info, palette, num);
 }
 
@@ -191,7 +191,7 @@
    if (length != 4)
    {
       png_warning(png_ptr, "Incorrect gAMA chunk length");
-		png_crc_skip(png_ptr, length);
+      png_crc_skip(png_ptr, length);
       return;
    }
 
@@ -199,7 +199,7 @@
    igamma = png_get_uint_32(buf);
    /* check for zero gamma */
    if (!igamma)
-		return;
+      return;
 
    gamma = (float)igamma / (float)100000.0;
    png_read_gAMA(png_ptr, info, gamma);
@@ -212,20 +212,20 @@
 png_handle_sBIT(png_structp png_ptr, png_infop info, png_uint_32 length)
 {
    int slen;
-	png_byte buf[4];
+   png_byte buf[4];
 
    buf[0] = buf[1] = buf[2] = buf[3] = 0;
 
    if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
       slen = 3;
    else
-		slen = png_ptr->channels;
+      slen = png_ptr->channels;
 
    if (length != (png_uint_32)slen)
    {
       png_warning(png_ptr, "Incorrect sBIT chunk length");
-		png_crc_skip(png_ptr, length);
-		return;
+      png_crc_skip(png_ptr, length);
+      return;
    }
 
    png_crc_read(png_ptr, buf, length);
@@ -238,7 +238,7 @@
    }
    else
    {
-		png_ptr->sig_bit.gray = buf[0];
+      png_ptr->sig_bit.gray = buf[0];
       png_ptr->sig_bit.alpha = buf[1];
    }
    png_read_sBIT(png_ptr, info, &(png_ptr->sig_bit));
@@ -256,8 +256,8 @@
    if (length != 32)
    {
       png_warning(png_ptr, "Incorrect cHRM chunk length");
-		png_crc_skip(png_ptr, length);
-		return;
+      png_crc_skip(png_ptr, length);
+      return;
    }
 
    png_crc_read(png_ptr, buf, 4);
@@ -293,7 +293,7 @@
    blue_y = (float)v / (float)100000.0;
 
    png_read_cHRM(png_ptr, info,
-		white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y);
+      white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y);
 }
 #endif
 
@@ -306,14 +306,14 @@
       if (length > png_ptr->num_palette)
       {
          png_warning(png_ptr, "Incorrect tRNS chunk length");
-			png_crc_skip(png_ptr, length);
+         png_crc_skip(png_ptr, length);
          return;
       }
 
       png_ptr->trans = (png_bytep)png_large_malloc(png_ptr, length);
       png_ptr->do_free |= PNG_FREE_TRANS;
-		png_crc_read(png_ptr, png_ptr->trans, length);
-		png_ptr->num_trans = (png_uint_16)length;
+      png_crc_read(png_ptr, png_ptr->trans, length);
+      png_ptr->num_trans = (png_uint_16)length;
    }
    else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB)
    {
@@ -322,7 +322,7 @@
       if (length != 6)
       {
          png_warning(png_ptr, "Incorrect tRNS chunk length");
-			png_crc_skip(png_ptr, length);
+         png_crc_skip(png_ptr, length);
          return;
       }
 
@@ -339,15 +339,15 @@
       if (length != 2)
       {
          png_warning(png_ptr, "Incorrect tRNS chunk length");
-			png_crc_skip(png_ptr, length);
-			return;
-		}
+         png_crc_skip(png_ptr, length);
+         return;
+      }
 
-		png_crc_read(png_ptr, buf, 2);
-		png_ptr->num_trans = 1;
-		png_ptr->trans_values.gray = png_get_uint_16(buf);
-	}
-	else
+      png_crc_read(png_ptr, buf, 2);
+      png_ptr->num_trans = 1;
+      png_ptr->trans_values.gray = png_get_uint_16(buf);
+   }
+   else
       png_warning(png_ptr, "Invalid tRNS chunk");
 
    png_read_tRNS(png_ptr, info, png_ptr->trans, png_ptr->num_trans,
@@ -371,8 +371,8 @@
 
    if (length != (png_uint_32)truelen)
    {
-		png_warning(png_ptr, "Incorrect bKGD chunk length");
-		png_crc_skip(png_ptr, length);
+      png_warning(png_ptr, "Incorrect bKGD chunk length");
+      png_crc_skip(png_ptr, length);
       return;
    }
 
@@ -396,20 +396,20 @@
 void
 png_handle_hIST(png_structp png_ptr, png_infop info, png_uint_32 length)
 {
-	int num, i;
+   int num, i;
 
-	if (length != 2 * png_ptr->num_palette)
-	{
-		png_warning(png_ptr, "Incorrect hIST chunk length");
-		png_crc_skip(png_ptr, length);
-		return;
-	}
+   if (length != 2 * png_ptr->num_palette)
+   {
+      png_warning(png_ptr, "Incorrect hIST chunk length");
+      png_crc_skip(png_ptr, length);
+      return;
+   }
 
    num = (int)length / 2;
-	png_ptr->hist = (png_uint_16p)png_large_malloc(png_ptr,
-		num * sizeof (png_uint_16));
+   png_ptr->hist = (png_uint_16p)png_large_malloc(png_ptr,
+      num * sizeof (png_uint_16));
    png_ptr->do_free |= PNG_FREE_HIST;
-	for (i = 0; i < num; i++)
+   for (i = 0; i < num; i++)
    {
       png_byte buf[2];
 
@@ -430,10 +430,10 @@
 
    if (length != 9)
    {
-		png_warning(png_ptr, "Incorrect pHYs chunk length");
-		png_crc_skip(png_ptr, length);
+      png_warning(png_ptr, "Incorrect pHYs chunk length");
+      png_crc_skip(png_ptr, length);
       return;
-	}
+   }
 
    png_crc_read(png_ptr, buf, 9);
 
@@ -454,12 +454,12 @@
 
    if (length != 9)
    {
-		png_warning(png_ptr, "Incorrect oFFs chunk length");
-		png_crc_skip(png_ptr, length);
+      png_warning(png_ptr, "Incorrect oFFs chunk length");
+      png_crc_skip(png_ptr, length);
       return;
    }
 
-	png_crc_read(png_ptr, buf, 9);
+   png_crc_read(png_ptr, buf, 9);
 
    offset_x = png_get_uint_32(buf);
    offset_y = png_get_uint_32(buf + 4);
@@ -477,8 +477,8 @@
 
    if (length != 7)
    {
-		png_warning(png_ptr, "Incorrect tIME chunk length");
-		png_crc_skip(png_ptr, length);
+      png_warning(png_ptr, "Incorrect tIME chunk length");
+      png_crc_skip(png_ptr, length);
       return;
    }
 
@@ -489,7 +489,7 @@
    mod_time.hour = buf[4];
    mod_time.day = buf[3];
    mod_time.month = buf[2];
-	mod_time.year = png_get_uint_16(buf);
+   mod_time.year = png_get_uint_16(buf);
 
    png_read_tIME(png_ptr, info, &mod_time);
 }
@@ -500,12 +500,12 @@
 void
 png_handle_tEXt(png_structp png_ptr, png_infop info, png_uint_32 length)
 {
-	png_charp key;
+   png_charp key;
    png_charp text;
 
-	key = (png_charp )png_large_malloc(png_ptr, length + 1);
+   key = (png_charp )png_large_malloc(png_ptr, length + 1);
    png_crc_read(png_ptr, (png_bytep )key, length);
-	key[(png_size_t)length] = '\0';
+   key[(png_size_t)length] = '\0';
 
    for (text = key; *text; text++)
       /* empty loop */ ;
@@ -527,8 +527,8 @@
    int ret;
    png_uint_32 text_size, key_size;
 
-	key = png_large_malloc(png_ptr, length + 1);
-	png_crc_read(png_ptr, (png_bytep )key, length);
+   key = png_large_malloc(png_ptr, length + 1);
+   png_crc_read(png_ptr, (png_bytep )key, length);
    key[(png_size_t)length] = '\0';
 
    for (text = key; *text; text++)
@@ -538,7 +538,7 @@
    if (text == key + (png_size_t)length)
    {
       png_warning(png_ptr, "Zero length zTXt chunk");
-		png_large_free(png_ptr, key);
+      png_large_free(png_ptr, key);
       return;
    }
 
@@ -559,19 +559,19 @@
 
    key_size = text - key;
    text_size = 0;
-	text = NULL;
+   text = NULL;
    ret = Z_STREAM_END;
 
    while (png_ptr->zstream->avail_in)
    {
-		ret = inflate(png_ptr->zstream, Z_PARTIAL_FLUSH);
+      ret = inflate(png_ptr->zstream, Z_PARTIAL_FLUSH);
       if (ret != Z_OK && ret != Z_STREAM_END)
       {
-			if (png_ptr->zstream->msg)
-				png_warning(png_ptr, png_ptr->zstream->msg);
+         if (png_ptr->zstream->msg)
+            png_warning(png_ptr, png_ptr->zstream->msg);
          else
-				png_warning(png_ptr, "zTXt decompression error");
-			inflateReset(png_ptr->zstream);
+            png_warning(png_ptr, "zTXt decompression error");
+         inflateReset(png_ptr->zstream);
          png_ptr->zstream->avail_in = 0;
          png_large_free(png_ptr, key);
          png_large_free(png_ptr, text);
@@ -593,7 +593,7 @@
          }
          else
          {
-				png_charp tmp;
+            png_charp tmp;
 
             tmp = text;
             text = png_large_malloc(png_ptr, text_size +
@@ -620,7 +620,7 @@
          break;
    }
 
-	inflateReset(png_ptr->zstream);
+   inflateReset(png_ptr->zstream);
    png_ptr->zstream->avail_in = 0;
 
    if (ret != Z_STREAM_END)
@@ -683,7 +683,7 @@
                {
                   value = (*sp >> shift) & 0x1;
                   *dp &= (png_byte)((0x7f7f >> (7 - shift)) & 0xff);
-						*dp |= (png_byte)(value << shift);
+                  *dp |= (png_byte)(value << shift);
                }
 
                if (shift == 0)
@@ -721,7 +721,7 @@
                {
                   value = (*sp >> shift) & 0x3;
                   *dp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff);
-						*dp |= (png_byte)(value << shift);
+                  *dp |= (png_byte)(value << shift);
                }
 
                if (shift == 0)
@@ -758,7 +758,7 @@
                {
                   value = (*sp >> shift) & 0xf;
                   *dp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff);
-						*dp |= (png_byte)(value << shift);
+                  *dp |= (png_byte)(value << shift);
                }
 
                if (shift == 0)
@@ -835,7 +835,7 @@
             dshift = 7 - (int)((final_width + 7) & 7);
             for (i = row_info->width; i; i--)
             {
-					v = (png_byte)((*sp >> sshift) & 0x1);
+               v = (png_byte)((*sp >> sshift) & 0x1);
                for (j = 0; j < png_pass_inc[pass]; j++)
                {
                   *dp &= (png_byte)((0x7f7f >> (7 - dshift)) & 0xff);
@@ -871,11 +871,11 @@
             dshift = (png_size_t)((3 - ((final_width + 3) & 3)) << 1);
             for (i = row_info->width; i; i--)
             {
-					v = (png_byte)((*sp >> sshift) & 0x3);
+               v = (png_byte)((*sp >> sshift) & 0x3);
                for (j = 0; j < png_pass_inc[pass]; j++)
                {
                   *dp &= (png_byte)((0x3f3f >> (6 - dshift)) & 0xff);
-						*dp |= (png_byte)(v << dshift);
+                  *dp |= (png_byte)(v << dshift);
                   if (dshift == 6)
                   {
                      dshift = 0;
@@ -908,7 +908,7 @@
             dshift = (png_size_t)((1 - ((final_width + 1) & 1)) << 2);
             for (i = row_info->width; i; i--)
             {
-					v = (png_byte)((*sp >> sshift) & 0xf);
+               v = (png_byte)((*sp >> sshift) & 0xf);
                for (j = 0; j < png_pass_inc[pass]; j++)
                {
                   *dp &= (png_byte)((0xf0f >> (4 - dshift)) & 0xff);
@@ -1145,7 +1145,7 @@
             png_crc_read(png_ptr, png_ptr->zbuf, png_ptr->zstream->avail_in);
             png_ptr->idat_size -= png_ptr->zstream->avail_in;
          }
-			ret = inflate(png_ptr->zstream, Z_PARTIAL_FLUSH);
+         ret = inflate(png_ptr->zstream, Z_PARTIAL_FLUSH);
          if (ret == Z_STREAM_END)
          {
             if (!(png_ptr->zstream->avail_out) || png_ptr->zstream->avail_in ||
@@ -1279,11 +1279,11 @@
    if (rowbytes > 65536L)
       png_error(png_ptr, "This image requires a row greater then 64KB");
 #endif
-	png_ptr->row_buf = (png_bytep )png_large_malloc(png_ptr, rowbytes);
+   png_ptr->row_buf = (png_bytep )png_large_malloc(png_ptr, rowbytes);
 
 #ifdef PNG_MAX_MALLOC_64K
    if (png_ptr->rowbytes + 1 > 65536L)
-		png_error(png_ptr, "This image requires a row greater then 64KB");
+      png_error(png_ptr, "This image requires a row greater then 64KB");
 #endif
    png_ptr->prev_row = png_large_malloc(png_ptr,
       png_ptr->rowbytes + 1);
diff --git a/pngtest.c b/pngtest.c
index 92f501e..5b6715c 100644
--- a/pngtest.c
+++ b/pngtest.c
@@ -1,8 +1,8 @@
 /* pngtest.c - a simple test program to test libpng
 
-	libpng 1.0 beta 2 - version 0.87
+   libpng 1.0 beta 2 - version 0.87
    For conditions of distribution and use, see copyright notice in png.h
-	Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+   Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
    January 15, 1996
 */
 
@@ -16,7 +16,7 @@
 
 /* defined so I can write to a file on gui/windowing platforms */
 /*  #define STDERR stderr  */
-#define STDERR stdout	/* for DOS */
+#define STDERR stdout   /* for DOS */
 
 /* input and output filenames */
 char inname[] = "pngtest.png";
@@ -32,13 +32,13 @@
 int main()
 {
    FILE *fpin, *fpout;
-	png_bytep row_buf;
+   png_bytep row_buf;
    png_byte * near_row_buf;
    png_uint_32 rowbytes;
    png_uint_32 y;
    int channels, num_pass, pass;
 
-	row_buf = (png_bytep)0;
+   row_buf = (png_bytep)0;
    near_row_buf = (png_byte *)0;
 
    fprintf(STDERR, "Testing libpng version %s\n", PNG_LIBPNG_VER_STRING);
@@ -75,7 +75,7 @@
    }
 
    if (setjmp(write_ptr.jmpbuf))
-	{
+   {
       fprintf(STDERR, "libpng write error\n");
       fclose(fpin);
       fclose(fpout);
@@ -93,7 +93,7 @@
    png_read_info(&read_ptr, &info_ptr);
    png_write_info(&write_ptr, &info_ptr);
 
-	if ((info_ptr.color_type & 3) == 2)
+   if ((info_ptr.color_type & 3) == 2)
       channels = 3;
    else
       channels = 1;
@@ -101,7 +101,7 @@
       channels++;
 
    rowbytes = ((info_ptr.width * info_ptr.bit_depth * channels + 7) >> 3);
-	near_row_buf = (png_byte *)malloc((size_t)rowbytes);
+   near_row_buf = (png_byte *)malloc((size_t)rowbytes);
    row_buf = (png_bytep)near_row_buf;
    if (!row_buf)
    {
@@ -130,8 +130,8 @@
 #ifdef TESTING
          fprintf(STDERR, "Processing line #%ld\n", y);
 #endif
-			png_read_rows(&read_ptr, (png_bytepp)&row_buf, (png_bytepp)0, 1);
-			png_write_rows(&write_ptr, (png_bytepp)&row_buf, 1);
+         png_read_rows(&read_ptr, (png_bytepp)&row_buf, (png_bytepp)0, 1);
+         png_write_rows(&write_ptr, (png_bytepp)&row_buf, 1);
       }
    }
 
diff --git a/pngtodo.txt b/pngtodo.txt
index 4ab649c..8b8089b 100644
--- a/pngtodo.txt
+++ b/pngtodo.txt
@@ -3,14 +3,14 @@
 for 0.9
    improved dithering
    final bug fixes
-	cHRM transformation
+   cHRM transformation
    better documentation
 
 after 1.0
    overlaying one image on top of another
-	optional palette creation
-	histogram creation
-	text conversion between different code types
+   optional palette creation
+   histogram creation
+   text conversion between different code types
    support for other chunks being defined (sCAl, the gIF series,
       and others that people come up with).
    pull writer
diff --git a/pngtrans.c b/pngtrans.c
index db1cbf9..bbab350 100644
--- a/pngtrans.c
+++ b/pngtrans.c
@@ -2,10 +2,10 @@
 /* pngtrans.c - transforms the data in a row
    routines used by both readers and writers
 
-	libpng 1.0 beta 2 - version 0.87
+   libpng 1.0 beta 2 - version 0.88
    For conditions of distribution and use, see copyright notice in png.h
-	Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
-   January 15, 1996
+   Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+   January 25, 1996
    */
 
 #define PNG_INTERNAL
@@ -199,7 +199,7 @@
       }
       else if (row_info->color_type == 6 && row_info->bit_depth == 16)
       {
-			png_bytep rp;
+         png_bytep rp;
          png_byte t[2];
          png_uint_32 i;
 
diff --git a/pngwrite.c b/pngwrite.c
index e6d590f..58070b6 100644
--- a/pngwrite.c
+++ b/pngwrite.c
@@ -1,10 +1,10 @@
 
 /* pngwrite.c - general routines to write a png file
 
-	libpng 1.0 beta 2 - version 0.87
+   libpng 1.0 beta 2 - version 0.88
    For conditions of distribution and use, see copyright notice in png.h
-	Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
-   January 15, 1996
+   Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+   January 25, 1996
    */
 
 /* get internal access to png.h */
@@ -16,7 +16,7 @@
    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 you to supply a PNG_INFO_ flag, and check
-	info->valid before writing the chunk, as that will keep the code
+   info->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 them in png_write_end(),
    and compressing them. */
@@ -88,7 +88,7 @@
          if (info->text[i].compression >= 0)
          {
 #if defined(PNG_WRITE_zTXt_SUPPORTED)
-				/* write compressed chunk */
+            /* write compressed chunk */
             png_write_zTXt(png_ptr, info->text[i].key,
                info->text[i].text, info->text[i].text_length,
                info->text[i].compression);
@@ -99,7 +99,7 @@
 #if defined(PNG_WRITE_tEXt_SUPPORTED)
             /* write uncompressed chunk */
             png_write_tEXt(png_ptr, info->text[i].key,
-					info->text[i].text, info->text[i].text_length);
+               info->text[i].text, info->text[i].text_length);
 #endif
          }
       }
@@ -114,7 +114,7 @@
 void
 png_write_end(png_structp png_ptr, png_infop info)
 {
-	/* see if user wants us to write information chunks */
+   /* see if user wants us to write information chunks */
    if (info)
    {
 #if defined(PNG_WRITE_tIME_SUPPORTED)
@@ -130,7 +130,7 @@
 
          /* loop through comment chunks */
          for (i = 0; i < info->num_text; i++)
-			{
+         {
             /* check to see if comment is to be compressed */
             if (info->text[i].compression >= 0)
             {
@@ -148,7 +148,7 @@
                png_write_tEXt(png_ptr, info->text[i].key,
                   info->text[i].text, info->text[i].text_length);
 #endif
-				}
+            }
          }
       }
 #endif
@@ -161,12 +161,12 @@
 void
 png_convert_from_struct_tm(png_timep ptime, struct tm FAR * ttime)
 {
-	ptime->year = (png_uint_16)(1900 + ttime->tm_year);
-	ptime->month = (png_byte)(ttime->tm_mon + 1);
-	ptime->day = (png_byte)ttime->tm_mday;
-	ptime->hour = (png_byte)ttime->tm_hour;
-	ptime->minute = (png_byte)ttime->tm_min;
-	ptime->second = (png_byte)ttime->tm_sec;
+   ptime->year = (png_uint_16)(1900 + ttime->tm_year);
+   ptime->month = (png_byte)(ttime->tm_mon + 1);
+   ptime->day = (png_byte)ttime->tm_mday;
+   ptime->hour = (png_byte)ttime->tm_hour;
+   ptime->minute = (png_byte)ttime->tm_min;
+   ptime->second = (png_byte)ttime->tm_sec;
 }
 
 void
@@ -184,23 +184,23 @@
 png_write_init(png_structp png_ptr)
 {
    jmp_buf tmp_jmp; /* to save current jump buffer */
-	png_msg_ptr error_fn;
-	png_msg_ptr warning_fn;
-	png_voidp msg_ptr;
+   png_msg_ptr error_fn;
+   png_msg_ptr warning_fn;
+   png_voidp msg_ptr;
 
-	/* save jump buffer and error functions */
-	png_memcpy(tmp_jmp, png_ptr->jmpbuf, sizeof (jmp_buf));
-	error_fn = png_ptr->error_fn;
-	warning_fn = png_ptr->warning_fn;
-	msg_ptr = png_ptr->msg_ptr;
+   /* save jump buffer and error functions */
+   png_memcpy(tmp_jmp, png_ptr->jmpbuf, sizeof (jmp_buf));
+   error_fn = png_ptr->error_fn;
+   warning_fn = png_ptr->warning_fn;
+   msg_ptr = png_ptr->msg_ptr;
 
-	/* reset all variables to 0 */
-	png_memset(png_ptr, 0, sizeof (png_struct));
-	/* restore jump buffer and error functions */
+   /* reset all variables to 0 */
+   png_memset(png_ptr, 0, sizeof (png_struct));
+   /* restore jump buffer and error functions */
    png_memcpy(png_ptr->jmpbuf, tmp_jmp, sizeof (jmp_buf));
-	png_ptr->error_fn = error_fn;
-	png_ptr->warning_fn = warning_fn;
-	png_ptr->msg_ptr = msg_ptr;
+   png_ptr->error_fn = error_fn;
+   png_ptr->warning_fn = warning_fn;
+   png_ptr->msg_ptr = msg_ptr;
 
    /* initialize zbuf - compression buffer */
    png_ptr->zbuf_size = PNG_ZBUF_SIZE;
@@ -210,7 +210,7 @@
 /* write a few rows of image data.  If the image is interlaced,
    either you will have to write the 7 sub images, or, if you
    have called png_set_interlace_handling(), you will have to
-	"write" the image seven times */
+   "write" the image seven times */
 void
 png_write_rows(png_structp png_ptr, png_bytepp row,
    png_uint_32 num_rows)
@@ -264,7 +264,7 @@
    {
       switch (png_ptr->pass)
       {
-			case 0:
+         case 0:
             if (png_ptr->row_number & 7)
             {
                png_write_finish_row(png_ptr);
@@ -282,7 +282,7 @@
             if ((png_ptr->row_number & 7) != 4)
             {
                png_write_finish_row(png_ptr);
-					return;
+               return;
             }
             break;
          case 3:
@@ -300,7 +300,7 @@
             }
             break;
          case 5:
-				if ((png_ptr->row_number & 1) || png_ptr->width < 2)
+            if ((png_ptr->row_number & 1) || png_ptr->width < 2)
             {
                png_write_finish_row(png_ptr);
                return;
@@ -318,12 +318,12 @@
 #endif
 
    /* set up row info for transformations */
-	png_ptr->row_info.color_type = png_ptr->color_type;
+   png_ptr->row_info.color_type = png_ptr->color_type;
    png_ptr->row_info.width = png_ptr->usr_width;
    png_ptr->row_info.channels = png_ptr->usr_channels;
    png_ptr->row_info.bit_depth = png_ptr->usr_bit_depth;
-	png_ptr->row_info.pixel_depth = (png_byte)(png_ptr->row_info.bit_depth *
-		png_ptr->row_info.channels);
+   png_ptr->row_info.pixel_depth = (png_byte)(png_ptr->row_info.bit_depth *
+      png_ptr->row_info.channels);
    png_ptr->row_info.rowbytes = ((png_ptr->row_info.width *
       (png_uint_32)png_ptr->row_info.pixel_depth + 7) >> 3);
 
@@ -336,7 +336,7 @@
       (png_ptr->transformations & PNG_INTERLACE))
    {
       png_do_write_interlace(&(png_ptr->row_info),
-			png_ptr->row_buf + 1, png_ptr->pass);
+         png_ptr->row_buf + 1, png_ptr->pass);
       /* this should always get caught above, but still ... */
       if (!(png_ptr->row_info.width))
       {
@@ -354,7 +354,7 @@
    if (png_ptr->do_filter)
    {
       /* save row to previous row */
-		png_memcpy(png_ptr->save_row, png_ptr->row_buf,
+      png_memcpy(png_ptr->save_row, png_ptr->row_buf,
          (png_size_t)png_ptr->row_info.rowbytes + 1);
 
       /* filter row */
@@ -363,7 +363,7 @@
 
       /* trade saved pointer and prev pointer so next row references are correctly */
       { /* scope limiter */
-			png_bytep tptr;
+         png_bytep tptr;
 
          tptr = png_ptr->prev_row;
          png_ptr->prev_row = png_ptr->save_row;
@@ -372,7 +372,7 @@
    }
    else
       /* set filter row to "none" */
-		png_ptr->row_buf[0] = 0;
+      png_ptr->row_buf[0] = 0;
 
    /* set up the zlib input buffer */
    png_ptr->zstream->next_in = png_ptr->row_buf;
@@ -389,8 +389,8 @@
       {
          if (png_ptr->zstream->msg)
             png_error(png_ptr, png_ptr->zstream->msg);
-			else
-				png_error(png_ptr, "zlib error");
+         else
+            png_error(png_ptr, "zlib error");
       }
 
       /* see if it is time to write another IDAT */
@@ -404,17 +404,17 @@
    /* repeat until all data has been compressed */
    } while (png_ptr->zstream->avail_in);
 
-	/* finish row - updates counters and flushes zlib if last row */
-	png_write_finish_row(png_ptr);
+   /* finish row - updates counters and flushes zlib if last row */
+   png_write_finish_row(png_ptr);
 
 #if defined(PNG_WRITE_FLUSH_SUPPORTED)
-	png_ptr->flush_rows++;
+   png_ptr->flush_rows++;
 
-	if (png_ptr->flush_dist > 0 &&
-		 png_ptr->flush_rows >= png_ptr->flush_dist)
-	{
-		png_write_flush(png_ptr);
-	}
+   if (png_ptr->flush_dist > 0 &&
+       png_ptr->flush_rows >= png_ptr->flush_dist)
+   {
+      png_write_flush(png_ptr);
+   }
 #endif /* PNG_WRITE_FLUSH_SUPPORTED */
 }
 
@@ -423,57 +423,57 @@
 void
 png_set_flush(png_structp png_ptr, int nrows)
 {
-	png_ptr->flush_dist = (nrows < 0 ? 0 : nrows);
+   png_ptr->flush_dist = (nrows < 0 ? 0 : nrows);
 }
 
 /* flush the current output buffers now */
 void
 png_write_flush(png_structp png_ptr)
 {
-	int wrote_IDAT;
+   int wrote_IDAT;
 
-	if (png_ptr->mode != PNG_HAVE_IDAT)
-	  return;
+   if (png_ptr->mode != PNG_HAVE_IDAT)
+     return;
 
-	do
-	{
-		int ret;
+   do
+   {
+      int ret;
 
-		/* compress the data */
-		ret = deflate(png_ptr->zstream, Z_SYNC_FLUSH);
-		wrote_IDAT = 0;
+      /* compress the data */
+      ret = deflate(png_ptr->zstream, Z_SYNC_FLUSH);
+      wrote_IDAT = 0;
 
-		/* check for compression errors */
-		if (ret != Z_OK)
-		{
-			if (png_ptr->zstream->msg)
-				png_error(png_ptr, png_ptr->zstream->msg);
-			else
-				png_error(png_ptr, "zlib error");
-		}
+      /* check for compression errors */
+      if (ret != Z_OK)
+      {
+         if (png_ptr->zstream->msg)
+            png_error(png_ptr, png_ptr->zstream->msg);
+         else
+            png_error(png_ptr, "zlib error");
+      }
 
-		if (!png_ptr->zstream->avail_out)
-		{
-			/* write the IDAT and reset the zlib output buffer */
-			png_write_IDAT(png_ptr, png_ptr->zbuf,
-								png_ptr->zbuf_size);
-			png_ptr->zstream->next_out = png_ptr->zbuf;
-			png_ptr->zstream->avail_out = (uInt)png_ptr->zbuf_size;
-			wrote_IDAT = 1;
-		}
-	} while(wrote_IDAT == 1);
+      if (!png_ptr->zstream->avail_out)
+      {
+         /* write the IDAT and reset the zlib output buffer */
+         png_write_IDAT(png_ptr, png_ptr->zbuf,
+                        png_ptr->zbuf_size);
+         png_ptr->zstream->next_out = png_ptr->zbuf;
+         png_ptr->zstream->avail_out = (uInt)png_ptr->zbuf_size;
+         wrote_IDAT = 1;
+      }
+   } while(wrote_IDAT == 1);
 
-	/* If there is any data left to be output, write it into a new IDAT */
-	if (png_ptr->zbuf_size != png_ptr->zstream->avail_out)
-	{
-		/* write the IDAT and reset the zlib output buffer */
-		png_write_IDAT(png_ptr, png_ptr->zbuf,
-							png_ptr->zbuf_size - png_ptr->zstream->avail_out);
-		png_ptr->zstream->next_out = png_ptr->zbuf;
-		png_ptr->zstream->avail_out = (uInt)png_ptr->zbuf_size;
-	}
-	png_ptr->flush_rows = 0;
-	png_flush(png_ptr);
+   /* If there is any data left to be output, write it into a new IDAT */
+   if (png_ptr->zbuf_size != png_ptr->zstream->avail_out)
+   {
+      /* write the IDAT and reset the zlib output buffer */
+      png_write_IDAT(png_ptr, png_ptr->zbuf,
+                     png_ptr->zbuf_size - png_ptr->zstream->avail_out);
+      png_ptr->zstream->next_out = png_ptr->zbuf;
+      png_ptr->zstream->avail_out = (uInt)png_ptr->zbuf_size;
+   }
+   png_ptr->flush_rows = 0;
+   png_flush(png_ptr);
 }
 #endif /* PNG_WRITE_FLUSH_SUPPORTED */
 
@@ -482,10 +482,10 @@
 void
 png_write_destroy(png_structp png_ptr)
 {
-	jmp_buf tmp_jmp; /* save jump buffer */
+   jmp_buf tmp_jmp; /* save jump buffer */
 
    /* free any memory zlib uses */
-	deflateEnd(png_ptr->zstream);
+   deflateEnd(png_ptr->zstream);
    png_free(png_ptr, png_ptr->zstream);
    /* free our memory.  png_free checks NULL for us. */
    png_large_free(png_ptr, png_ptr->zbuf);
@@ -515,7 +515,7 @@
 png_set_compression_mem_level(png_structp png_ptr, int mem_level)
 {
    png_ptr->zlib_custom_mem_level = 1;
-	png_ptr->zlib_mem_level = mem_level;
+   png_ptr->zlib_mem_level = mem_level;
 }
 
 void
diff --git a/pngwtran.c b/pngwtran.c
index 3638761..757af61 100644
--- a/pngwtran.c
+++ b/pngwtran.c
@@ -1,10 +1,10 @@
 
 /* pngwtran.c - transforms the data in a row for png writers
 
-	libpng 1.0 beta 2 - version 0.87
+   libpng 1.0 beta 2 - version 0.88
    For conditions of distribution and use, see copyright notice in png.h
-	Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
-   January 15, 1996
+   Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+   January 25, 1996
    */
 
 #define PNG_INTERNAL
@@ -60,8 +60,8 @@
          {
             png_bytep sp;
             png_bytep dp;
-				int mask;
-				png_int_32 i;
+            int mask;
+            png_int_32 i;
             int v;
 
             sp = row;
@@ -78,13 +78,13 @@
                else
                {
                   mask = 0x80;
-						*dp = (png_byte)v;
-						dp++;
+                  *dp = (png_byte)v;
+                  dp++;
                   v = 0;
                }
             }
             if (mask != 0x80)
-					*dp = (png_byte)v;
+               *dp = (png_byte)v;
             break;
          }
          case 2:
@@ -94,7 +94,7 @@
             int shift;
             png_int_32 i;
             int v;
-				png_byte value;
+            png_byte value;
 
             sp = row;
             dp = row;
@@ -102,12 +102,12 @@
             v = 0;
             for (i = 0; i < row_info->width; i++)
             {
-					value = (png_byte)(*sp & 0x3);
+               value = (png_byte)(*sp & 0x3);
                v |= (value << shift);
                if (shift == 0)
                {
                   shift = 6;
-						*dp = (png_byte)v;
+                  *dp = (png_byte)v;
                   dp++;
                   v = 0;
                }
@@ -116,7 +116,7 @@
                sp++;
             }
             if (shift != 6)
-					*dp = (png_byte)v;
+               *dp = (png_byte)v;
             break;
          }
          case 4:
@@ -134,13 +134,13 @@
             v = 0;
             for (i = 0; i < row_info->width; i++)
             {
-					value = (png_byte)(*sp & 0xf);
+               value = (png_byte)(*sp & 0xf);
                v |= (value << shift);
 
                if (shift == 0)
                {
                   shift = 4;
-						*dp = (png_byte)v;
+                  *dp = (png_byte)v;
                   dp++;
                   v = 0;
                }
@@ -150,12 +150,12 @@
                sp++;
             }
             if (shift != 4)
-					*dp = (png_byte)v;
+               *dp = (png_byte)v;
             break;
          }
       }
       row_info->bit_depth = bit_depth;
-		row_info->pixel_depth = (png_uint_16)(bit_depth * row_info->channels);
+      row_info->pixel_depth = (png_uint_16)(bit_depth * row_info->channels);
       row_info->rowbytes =
          ((row_info->width * row_info->pixel_depth + 7) >> 3);
    }
@@ -276,8 +276,8 @@
             {
                png_uint_16 value, v;
 
-					v = (png_uint_16)(((png_uint_16)(*bp) << 8) +
-						(png_uint_16)(*(bp + 1)));
+               v = (png_uint_16)(((png_uint_16)(*bp) << 8) +
+                  (png_uint_16)(*(bp + 1)));
                value = 0;
                for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
                {
@@ -286,7 +286,7 @@
                   else
                      value |= (png_uint_16)((v >> (-j)) & (png_uint_16)0xffff);
                }
-					*bp = (png_byte)(value >> 8);
+               *bp = (png_byte)(value >> 8);
                *(bp + 1) = (png_byte)(value & 0xff);
             }
          }
@@ -325,7 +325,7 @@
       }
       else
       {
-			png_bytep sp, dp;
+         png_bytep sp, dp;
          png_uint_32 i;
 
          for (i = 0, sp = row, dp = row;
diff --git a/pngwutil.c b/pngwutil.c
index 39a950d..cde6ab5 100644
--- a/pngwutil.c
+++ b/pngwutil.c
@@ -1,10 +1,10 @@
 
 /* pngwutil.c - utilities to write a png file
 
-	libpng 1.0 beta 2 - version 0.87
+   libpng 1.0 beta 2 - version 0.88
    For conditions of distribution and use, see copyright notice in png.h
-	Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
-   January 15, 1996
+   Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+   January 25, 1996
    */
 #define PNG_INTERNAL
 #include "png.h"
@@ -142,15 +142,15 @@
    /* pack the header information into the buffer */
    png_save_uint_32(buf, width);
    png_save_uint_32(buf + 4, height);
-	buf[8] = (png_byte)bit_depth;
-	buf[9] = (png_byte)color_type;
-	buf[10] = (png_byte)compression_type;
-	buf[11] = (png_byte)filter_type;
-	buf[12] = (png_byte)interlace_type;
-	/* save off the relevent information */
-	png_ptr->bit_depth = (png_byte)bit_depth;
-	png_ptr->color_type = (png_byte)color_type;
-	png_ptr->interlaced = (png_byte)interlace_type;
+   buf[8] = (png_byte)bit_depth;
+   buf[9] = (png_byte)color_type;
+   buf[10] = (png_byte)compression_type;
+   buf[11] = (png_byte)filter_type;
+   buf[12] = (png_byte)interlace_type;
+   /* save off the relevent information */
+   png_ptr->bit_depth = (png_byte)bit_depth;
+   png_ptr->color_type = (png_byte)color_type;
+   png_ptr->interlaced = (png_byte)interlace_type;
    png_ptr->width = width;
    png_ptr->height = height;
 
@@ -170,7 +170,7 @@
          png_ptr->channels = 4;
          break;
    }
-	png_ptr->pixel_depth = (png_byte)(bit_depth * png_ptr->channels);
+   png_ptr->pixel_depth = (png_byte)(bit_depth * png_ptr->channels);
    png_ptr->rowbytes = ((width * (png_uint_32)png_ptr->pixel_depth + 7) >> 3);
    /* set the usr info, so any transformations can modify it */
    png_ptr->usr_width = png_ptr->width;
@@ -224,7 +224,7 @@
 png_write_PLTE(png_structp png_ptr, png_colorp palette, int number)
 {
    int i;
-	png_colorp pal_ptr;
+   png_colorp pal_ptr;
    png_byte buf[3];
 
    png_write_chunk_start(png_ptr, png_PLTE, number * 3);
@@ -304,8 +304,8 @@
 /* write the cHRM chunk */
 void
 png_write_cHRM ( png_structp png_ptr, double white_x, double white_y,
-	double red_x, double red_y, double green_x, double green_y,
-	double blue_x, double blue_y)
+   double red_x, double red_y, double green_x, double green_y,
+   double blue_x, double blue_y)
 {
    png_uint_32 itemp;
    png_byte buf[32];
@@ -381,7 +381,7 @@
       png_write_chunk(png_ptr, png_bKGD, buf, (png_uint_32)6);
    }
    else
-	{
+   {
       png_save_uint_16(buf, back->gray);
       png_write_chunk(png_ptr, png_bKGD, buf, (png_uint_32)2);
    }
@@ -399,7 +399,7 @@
    png_write_chunk_start(png_ptr, png_hIST, (png_uint_32)(number * 2));
    for (i = 0; i < number; i++)
    {
-		png_save_uint_16(buf, hist[i]);
+      png_save_uint_16(buf, hist[i]);
       png_write_chunk_data(png_ptr, buf, (png_uint_32)2);
    }
    png_write_chunk_end(png_ptr);
@@ -417,7 +417,7 @@
    key_len = png_strlen(key);
    /* make sure we count the 0 after the key */
    png_write_chunk_start(png_ptr, png_tEXt,
-		(png_uint_32)(key_len + text_len + 1));
+      (png_uint_32)(key_len + text_len + 1));
    /* key has an 0 at the end.  How nice */
    png_write_chunk_data(png_ptr, (png_bytep )key, (png_uint_32)(key_len + 1));
    if (text && text_len)
@@ -435,7 +435,7 @@
    int key_len;
    char buf[1];
    int i, ret;
-	png_charpp output_ptr = NULL; /* array of pointers to output */
+   png_charpp output_ptr = NULL; /* array of pointers to output */
    int num_output_ptr = 0; /* number of output pointers used */
    int max_output_ptr = 0; /* size of output_ptr */
 
@@ -453,11 +453,11 @@
    png_ptr->zstream->avail_out = (uInt)png_ptr->zbuf_size;
    png_ptr->zstream->next_out = (Bytef *)png_ptr->zbuf;
 
-	/* this is the same compression loop as in png_write_row() */
+   /* this is the same compression loop as in png_write_row() */
    do
    {
       /* compress the data */
-		ret = deflate(png_ptr->zstream, Z_NO_FLUSH);
+      ret = deflate(png_ptr->zstream, Z_NO_FLUSH);
       if (ret != Z_OK)
       {
          /* error */
@@ -471,25 +471,25 @@
       {
          /* make sure the output array has room */
          if (num_output_ptr >= max_output_ptr)
-			{
+         {
             png_uint_32 old_max;
 
             old_max = max_output_ptr;
             max_output_ptr = num_output_ptr + 4;
-				if (output_ptr)
-				{
-					png_charpp old_ptr;
+            if (output_ptr)
+            {
+               png_charpp old_ptr;
 
-					old_ptr = output_ptr;
-					output_ptr = (png_charpp)png_large_malloc(png_ptr,
-						max_output_ptr * sizeof (png_charpp));
-					png_memcpy(output_ptr, old_ptr,
-						(png_size_t)(old_max * sizeof (png_charp)));
-					png_large_free(png_ptr, old_ptr);
-				}
-				else
-					output_ptr = (png_charpp)png_large_malloc(png_ptr,
-						max_output_ptr * sizeof (png_charp));
+               old_ptr = output_ptr;
+               output_ptr = (png_charpp)png_large_malloc(png_ptr,
+                  max_output_ptr * sizeof (png_charpp));
+               png_memcpy(output_ptr, old_ptr,
+                  (png_size_t)(old_max * sizeof (png_charp)));
+               png_large_free(png_ptr, old_ptr);
+            }
+            else
+               output_ptr = (png_charpp)png_large_malloc(png_ptr,
+                  max_output_ptr * sizeof (png_charp));
          }
 
          /* save the data */
@@ -506,11 +506,11 @@
    /* continue until we don't have anymore to compress */
    } while (png_ptr->zstream->avail_in);
 
-	/* finish the compression */
+   /* finish the compression */
    do
    {
       /* tell zlib we are finished */
-		ret = deflate(png_ptr->zstream, Z_FINISH);
+      ret = deflate(png_ptr->zstream, Z_FINISH);
       if (ret != Z_OK && ret != Z_STREAM_END)
       {
          /* we got an error */
@@ -523,33 +523,33 @@
       /* check to see if we need more room */
       if (!png_ptr->zstream->avail_out && ret == Z_OK)
       {
-			/* check to make sure our output array has room */
-			if (num_output_ptr >= max_output_ptr)
+         /* check to make sure our output array has room */
+         if (num_output_ptr >= max_output_ptr)
          {
             png_uint_32 old_max;
 
             old_max = max_output_ptr;
             max_output_ptr = num_output_ptr + 4;
             if (output_ptr)
-				{
-					png_charpp old_ptr;
+            {
+               png_charpp old_ptr;
 
-					old_ptr = output_ptr;
-					output_ptr = (png_charpp)png_large_malloc(png_ptr,
-						max_output_ptr * sizeof (png_charpp));
-					png_memcpy(output_ptr, old_ptr,
-						(png_size_t)(old_max * sizeof (png_charp)));
-					png_large_free(png_ptr, old_ptr);
-				}
-				else
-					output_ptr = (png_charpp)png_large_malloc(png_ptr,
-						max_output_ptr * sizeof (png_charp));
-			}
+               old_ptr = output_ptr;
+               output_ptr = (png_charpp)png_large_malloc(png_ptr,
+                  max_output_ptr * sizeof (png_charpp));
+               png_memcpy(output_ptr, old_ptr,
+                  (png_size_t)(old_max * sizeof (png_charp)));
+               png_large_free(png_ptr, old_ptr);
+            }
+            else
+               output_ptr = (png_charpp)png_large_malloc(png_ptr,
+                  max_output_ptr * sizeof (png_charp));
+         }
 
-			/* save off the data */
-			output_ptr[num_output_ptr] = png_large_malloc(png_ptr,
-				png_ptr->zbuf_size);
-			png_memcpy(output_ptr[num_output_ptr], png_ptr->zbuf,
+         /* save off the data */
+         output_ptr[num_output_ptr] = png_large_malloc(png_ptr,
+            png_ptr->zbuf_size);
+         png_memcpy(output_ptr[num_output_ptr], png_ptr->zbuf,
             (png_size_t)png_ptr->zbuf_size);
          num_output_ptr++;
 
@@ -560,7 +560,7 @@
    } while (ret != Z_STREAM_END);
 
    /* text length is number of buffers plus last buffer */
-	text_len = png_ptr->zbuf_size * num_output_ptr;
+   text_len = png_ptr->zbuf_size * num_output_ptr;
    if (png_ptr->zstream->avail_out < png_ptr->zbuf_size)
       text_len += (png_uint_32)(png_ptr->zbuf_size -
          png_ptr->zstream->avail_out);
@@ -570,7 +570,7 @@
       (png_uint_32)(key_len + text_len + 2));
    /* write key */
    png_write_chunk_data(png_ptr, (png_bytep )key, (png_uint_32)(key_len + 1));
-	buf[0] = (png_byte)compression;
+   buf[0] = (png_byte)compression;
    /* write compression */
    png_write_chunk_data(png_ptr, (png_bytep )buf, (png_uint_32)1);
 
@@ -578,7 +578,7 @@
    for (i = 0; i < num_output_ptr; i++)
    {
       png_write_chunk_data(png_ptr, (png_bytep )output_ptr[i], png_ptr->zbuf_size);
-		png_large_free(png_ptr, output_ptr[i]);
+      png_large_free(png_ptr, output_ptr[i]);
    }
    if (max_output_ptr)
       png_large_free(png_ptr, output_ptr);
@@ -590,7 +590,7 @@
    png_write_chunk_end(png_ptr);
 
    /* reset zlib for another zTXt or the image data */
-	deflateReset(png_ptr->zstream);
+   deflateReset(png_ptr->zstream);
 }
 #endif
 
@@ -605,7 +605,7 @@
 
    png_save_uint_32(buf, x_pixels_per_unit);
    png_save_uint_32(buf + 4, y_pixels_per_unit);
-	buf[8] = (png_byte)unit_type;
+   buf[8] = (png_byte)unit_type;
 
    png_write_chunk(png_ptr, png_pHYs, buf, (png_uint_32)9);
 }
@@ -622,7 +622,7 @@
 
    png_save_uint_32(buf, x_offset);
    png_save_uint_32(buf + 4, y_offset);
-	buf[8] = (png_byte)unit_type;
+   buf[8] = (png_byte)unit_type;
 
    png_write_chunk(png_ptr, png_oFFs, buf, (png_uint_32)9);
 }
@@ -668,7 +668,7 @@
    }
 
    /* if interlaced, we need to set up width and height of pass */
-	if (png_ptr->interlaced)
+   if (png_ptr->interlaced)
    {
       if (!(png_ptr->transformations & PNG_INTERLACE))
       {
@@ -686,7 +686,7 @@
       }
    }
    else
-	{
+   {
       png_ptr->num_rows = png_ptr->height;
       png_ptr->usr_width = png_ptr->width;
    }
@@ -704,7 +704,7 @@
    png_ptr->row_number++;
    /* see if we are done */
    if (png_ptr->row_number < png_ptr->num_rows)
-		return;
+      return;
 
    /* if interlaced, go to next pass */
    if (png_ptr->interlaced)
@@ -722,7 +722,7 @@
             png_ptr->pass++;
             if (png_ptr->pass >= 7)
                break;
-				png_ptr->usr_width = (png_ptr->width +
+            png_ptr->usr_width = (png_ptr->width +
                png_pass_inc[png_ptr->pass] - 1 -
                png_pass_start[png_ptr->pass]) /
                png_pass_inc[png_ptr->pass];
@@ -740,7 +740,7 @@
       if (png_ptr->prev_row)
          png_memset(png_ptr->prev_row, 0, (png_size_t)png_ptr->rowbytes + 1);
       /* if we have more data to get, go get it */
-		if (png_ptr->pass < 7)
+      if (png_ptr->pass < 7)
          return;
    }
 
@@ -749,7 +749,7 @@
    do
    {
       /* tell the compressor we are done */
-		ret = deflate(png_ptr->zstream, Z_FINISH);
+      ret = deflate(png_ptr->zstream, Z_FINISH);
       /* check for an error */
       if (ret != Z_OK && ret != Z_STREAM_END)
       {
@@ -758,7 +758,7 @@
          else
             png_error(png_ptr, "zlib error");
       }
-		/* check to see if we need more room */
+      /* check to see if we need more room */
       if (!png_ptr->zstream->avail_out && ret == Z_OK)
       {
          png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size);
@@ -794,7 +794,7 @@
    {
       /* each pixel depth is handled seperately */
       switch (row_info->pixel_depth)
-		{
+      {
          case 1:
          {
             png_bytep sp;
@@ -812,13 +812,13 @@
                i += png_pass_inc[pass])
             {
                sp = row + (png_size_t)(i >> 3);
-					value = (int)(*sp >> (7 - (int)(i & 7))) & 0x1;
+               value = (int)(*sp >> (7 - (int)(i & 7))) & 0x1;
                d |= (value << shift);
 
                if (shift == 0)
                {
                   shift = 7;
-						*dp++ = (png_byte)d;
+                  *dp++ = (png_byte)d;
                   d = 0;
                }
                else
@@ -826,11 +826,11 @@
 
             }
             if (shift != 7)
-					*dp = (png_byte)d;
+               *dp = (png_byte)d;
             break;
          }
          case 2:
-			{
+         {
             png_bytep sp;
             png_bytep dp;
             int shift;
@@ -852,21 +852,21 @@
                if (shift == 0)
                {
                   shift = 6;
-						*dp++ = (png_byte)d;
+                  *dp++ = (png_byte)d;
                   d = 0;
                }
                else
                   shift -= 2;
             }
             if (shift != 6)
-						 *dp = (png_byte)d;
+                   *dp = (png_byte)d;
             break;
          }
          case 4:
          {
             png_bytep sp;
             png_bytep dp;
-				int shift;
+            int shift;
             int d;
             int value;
             png_uint_32 i;
@@ -884,15 +884,15 @@
 
                if (shift == 0)
                {
-						shift = 4;
-						*dp++ = (png_byte)d;
+                  shift = 4;
+                  *dp++ = (png_byte)d;
                   d = 0;
                }
                else
                   shift -= 4;
             }
             if (shift != 4)
-					*dp = (png_byte)d;
+               *dp = (png_byte)d;
             break;
          }
          default:
@@ -902,7 +902,7 @@
             png_uint_32 i;
             int pixel_bytes;
 
-				/* start at the beginning */
+            /* start at the beginning */
             dp = row;
             /* find out how many bytes each pixel takes up */
             pixel_bytes = (row_info->pixel_depth >> 3);
@@ -920,7 +920,7 @@
                /* next pixel */
                dp += pixel_bytes;
             }
-				break;
+            break;
          }
       }
       /* set new row width */
@@ -944,7 +944,7 @@
    int minf, bpp;
    png_uint_32 i, v;
    png_uint_32 s0, s1, s2, s3, s4, mins;
-	png_bytep rp, pp, cp, lp;
+   png_bytep rp, pp, cp, lp;
 
    /* find out how many bytes offset each pixel is */
    bpp = (row_info->pixel_depth + 7) / 8;
@@ -956,7 +956,7 @@
       zero using anything >= 128 as negitive numbers. */
    s0 = s1 = s2 = s3 = s4 = 0;
 
-	for (i = 0, rp = row + 1, pp = prev_row + 1, lp = row + 1 - bpp,
+   for (i = 0, rp = row + 1, pp = prev_row + 1, lp = row + 1 - bpp,
          cp = prev_row + 1 - bpp;
       i < bpp; i++, rp++, pp++, lp++, cp++)
    {
@@ -992,7 +992,7 @@
    {
       int a, b, c, pa, pb, pc, p;
 
-		/* check none filter */
+      /* check none filter */
       v = *rp;
       if (v < 128)
          s0 += v;
@@ -1010,7 +1010,7 @@
       /* check up filter */
       v = (png_byte)(((int)*rp - (int)*pp) & 0xff);
 
-		if (v < 128)
+      if (v < 128)
          s2 += v;
       else
          s2 += 256 - v;
@@ -1028,7 +1028,7 @@
       c = *cp;
       a = *lp;
       p = a + b - c;
-		pa = abs(p - a);
+      pa = abs(p - a);
       pb = abs(p - b);
       pc = abs(p - c);
 
@@ -1052,7 +1052,7 @@
 
    if (s1 < mins)
    {
-		mins = s1;
+      mins = s1;
       minf = 1;
    }
 
@@ -1064,7 +1064,7 @@
 
    if (s3 < mins)
    {
-		mins = s3;
+      mins = s3;
       minf = 3;
    }
 
@@ -1074,20 +1074,20 @@
    }
 
    /* set filter byte */
-	row[0] = (png_byte)minf;
+   row[0] = (png_byte)minf;
 
    /* do filter */
    switch (minf)
    {
       /* sub filter */
       case 1:
-			for (i = bpp, rp = row + (png_size_t)row_info->rowbytes,
+         for (i = bpp, rp = row + (png_size_t)row_info->rowbytes,
             lp = row + (png_size_t)row_info->rowbytes - bpp;
             i < row_info->rowbytes; i++, rp--, lp--)
          {
             *rp = (png_byte)(((int)*rp - (int)*lp) & 0xff);
          }
-			break;
+         break;
       /* up filter */
       case 2:
          for (i = 0, rp = row + (png_size_t)row_info->rowbytes,
@@ -1099,7 +1099,7 @@
          break;
       /* avg filter */
       case 3:
-			for (i = row_info->rowbytes,
+         for (i = row_info->rowbytes,
             rp = row + (png_size_t)row_info->rowbytes,
             pp = prev_row + (png_size_t)row_info->rowbytes,
             lp = row + (png_size_t)row_info->rowbytes - bpp;
@@ -1117,7 +1117,7 @@
       case 4:
          for (i = row_info->rowbytes,
             rp = row + (png_size_t)row_info->rowbytes,
-				pp = prev_row + (png_size_t)row_info->rowbytes,
+            pp = prev_row + (png_size_t)row_info->rowbytes,
             lp = row + (png_size_t)row_info->rowbytes - bpp,
             cp = prev_row + (png_size_t)row_info->rowbytes - bpp;
             i > 0; i--, rp--, lp--, pp--, cp--)
@@ -1135,7 +1135,7 @@
                a = c = 0;
             }
             p = a + b - c;
-				pa = abs(p - a);
+            pa = abs(p - a);
             pb = abs(p - b);
             pc = abs(p - c);
 
diff --git a/readme.txt b/readme.txt
index f7ce8e0..b1c64ce 100644
--- a/readme.txt
+++ b/readme.txt
@@ -1,8 +1,8 @@
-readme.txt - for libpng 0.87
+readme.txt - for libpng 0.88
 
 This is a bug fix for the second beta version of libpng 1.0, and
-a first try at a progressive (push) reader.  It hasn't been
-tested as much as the pull reader, but seems to work ok.
+a more secure progressive (push) reader.  The progressive reader
+hasn't been tested as much as the pull reader, but seems to work ok.
 
 I've implemented the callback functions for the error/warning
 messages and the input/output.  See the libpng.txt