zlib 1.2.0.7
diff --git a/ChangeLog b/ChangeLog
index 0193989..cf9dcb6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,17 +1,28 @@
 
                 ChangeLog file for zlib
 
+Changes in 1.2.0.7 (21 September 2003)
+- Correct some debug formats in contrib/infback9
+- Cast a type in a debug statement in trees.c
+- Change search and replace delimiter in configure from % to # [Beebe]
+- Update contrib/untgz to 0.2 with various fixes [Truta]
+- Add build support for Amiga [Nikl]
+- Remove some directories in old that have been updated to 1.2
+- Add dylib building for Mac OS X in configure and Makefile.in
+- Remove old distribution stuff from Makefile
+- Update README to point for DLL_FAQ.txt, and add comment on Mac OS X
+- Update links in README
+
 Changes in 1.2.0.6 (13 September 2003)
 - Minor FAQ updates
 - Update contrib/minizip to 1.00 [Vollant]
 - Remove test of gz functions in example.c when GZ_COMPRESS defined [Truta]
-- Updated POSTINC comment for 68060 [Nikl]
-- Added contrib/infback9 with deflate64 decoding (unsupported)
+- Update POSTINC comment for 68060 [Nikl]
+- Add contrib/infback9 with deflate64 decoding (unsupported)
 - For MVS define NO_vsnprintf and undefine FAR [van Burik]
 - Add pragma for fdopen on MVS [van Burik]
 
 Changes in 1.2.0.5 (8 September 2003)
-- Add infback9 diffs to contrib
 - Add OF to inflateBackEnd() declaration in zlib.h
 - Remember start when using gzdopen in the middle of a file
 - Use internal off_t counters in gz* functions to properly handle seeks
diff --git a/Makefile b/Makefile
index ccf0a56..039280d 100644
--- a/Makefile
+++ b/Makefile
@@ -28,9 +28,10 @@
 LDSHARED=$(CC)
 CPP=$(CC) -E
 
-VER=1.2.0.6
 LIBS=libz.a
 SHAREDLIB=libz.so
+SHAREDLIBV=libz.so.1.2.0.7
+SHAREDLIBM=libz.so.1
 
 AR=ar rc
 RANLIB=ranlib
@@ -52,19 +53,6 @@
 
 TEST_OBJS = example.o minigzip.o
 
-# Note: this has not been updated for zlib 1.2.0
-DISTFILES = README FAQ INDEX ChangeLog configure Make*[a-z0-9] *.[ch] *.mms \
-  algorithm.txt zlib.3 zlib.html \
-  msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \
-  nt/Make*[a-z0-9] nt/zlib.dnt amiga/Make*.??? os2/M*.os2 os2/zlib.def \
-  contrib/RE*.contrib contrib/*.txt contrib/asm386/*.asm contrib/asm386/*.c \
-  contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/asm[56]86/*.?86 \
-  contrib/asm[56]86/*.S contrib/iostream/*.cpp \
-  contrib/iostream/*.h  contrib/iostream2/*.h contrib/iostream2/*.cpp \
-  contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32 \
-  contrib/minizip/[CM]*[pe] contrib/minizip/*.[ch] contrib/minizip/*.[td]?? \
-  contrib/delphi*/*.???
-
 all: example minigzip
 
 check: test
@@ -88,11 +76,11 @@
 	mv _match.o match.o
 	rm -f _match.s
 
-$(SHAREDLIB).$(VER): $(OBJS)
+$(SHAREDLIBV): $(OBJS)
 	$(LDSHARED) -o $@ $(OBJS)
-	rm -f $(SHAREDLIB) $(SHAREDLIB).1
+	rm -f $(SHAREDLIB) $(SHAREDLIBM)
 	ln -s $@ $(SHAREDLIB)
-	ln -s $@ $(SHAREDLIB).1
+	ln -s $@ $(SHAREDLIBM)
 
 example: example.o $(LIBS)
 	$(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
@@ -110,10 +98,10 @@
 	cp $(LIBS) $(libdir)
 	cd $(libdir); chmod 755 $(LIBS)
 	-@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
-	cd $(libdir); if test -f $(SHAREDLIB).$(VER); then \
-	  rm -f $(SHAREDLIB) $(SHAREDLIB).1; \
-	  ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB); \
-	  ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB).1; \
+	cd $(libdir); if test -f $(SHAREDLIBV); then \
+	  rm -f $(SHAREDLIB) $(SHAREDLIBM); \
+	  ln -s $(SHAREDLIBV) $(SHAREDLIB); \
+	  ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
 	  (ldconfig || true)  >/dev/null 2>&1; \
 	fi
 	cp zlib.3 $(man3dir)
@@ -123,20 +111,15 @@
 
 uninstall:
 	cd $(includedir); \
-	v=$(VER); \
-	if test -f zlib.h; then \
-	  v=`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`; \
-          rm -f zlib.h zconf.h; \
-	fi; \
 	cd $(libdir); rm -f libz.a; \
-	if test -f $(SHAREDLIB).$$v; then \
-	  rm -f $(SHAREDLIB).$$v $(SHAREDLIB) $(SHAREDLIB).1; \
+	if test -f $(SHAREDLIBV); then \
+	  rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
 	fi
 	cd $(man3dir); rm -f zlib.3
 
 mostlyclean: clean
 clean:
-	rm -f *.o *~ example minigzip libz.a libz.so* foo.gz so_locations \
+	rm -f *.o *~ example minigzip libz.* foo.gz so_locations \
 	   _match.s maketree contrib/infback9/*.o
 
 maintainer-clean: distclean
@@ -145,28 +128,6 @@
 	cp -p zconf.in.h zconf.h
 	rm -f .DS_Store
 
-zip:
-	echo Warning: this has not been updated for zlib 1.2.0 -- do not use
-	mv Makefile Makefile~; cp -p Makefile.in Makefile
-	rm -f test.c ztest*.c contrib/minizip/test.zip
-	v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
-	zip -ul9 zlib$$v $(DISTFILES)
-	mv Makefile~ Makefile
-
-dist:
-	echo Warning: this has not been updated for zlib 1.2.0 -- do not use
-	mv Makefile Makefile~; cp -p Makefile.in Makefile
-	rm -f test.c ztest*.c contrib/minizip/test.zip
-	d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
-	rm -f $$d.tar.gz; \
-	if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \
-	files=""; \
-	for f in $(DISTFILES); do files="$$files $$d/$$f"; done; \
-	cd ..; \
-	GZIP=-9 $(TAR) chofz $$d/$$d.tar.gz $$files; \
-	if test ! -d $$d; then rm -f $$d; fi
-	mv Makefile~ Makefile
-
 tags:
 	etags *.[ch]
 
diff --git a/Makefile.in b/Makefile.in
index ccf0a56..039280d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -28,9 +28,10 @@
 LDSHARED=$(CC)
 CPP=$(CC) -E
 
-VER=1.2.0.6
 LIBS=libz.a
 SHAREDLIB=libz.so
+SHAREDLIBV=libz.so.1.2.0.7
+SHAREDLIBM=libz.so.1
 
 AR=ar rc
 RANLIB=ranlib
@@ -52,19 +53,6 @@
 
 TEST_OBJS = example.o minigzip.o
 
-# Note: this has not been updated for zlib 1.2.0
-DISTFILES = README FAQ INDEX ChangeLog configure Make*[a-z0-9] *.[ch] *.mms \
-  algorithm.txt zlib.3 zlib.html \
-  msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \
-  nt/Make*[a-z0-9] nt/zlib.dnt amiga/Make*.??? os2/M*.os2 os2/zlib.def \
-  contrib/RE*.contrib contrib/*.txt contrib/asm386/*.asm contrib/asm386/*.c \
-  contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/asm[56]86/*.?86 \
-  contrib/asm[56]86/*.S contrib/iostream/*.cpp \
-  contrib/iostream/*.h  contrib/iostream2/*.h contrib/iostream2/*.cpp \
-  contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32 \
-  contrib/minizip/[CM]*[pe] contrib/minizip/*.[ch] contrib/minizip/*.[td]?? \
-  contrib/delphi*/*.???
-
 all: example minigzip
 
 check: test
@@ -88,11 +76,11 @@
 	mv _match.o match.o
 	rm -f _match.s
 
-$(SHAREDLIB).$(VER): $(OBJS)
+$(SHAREDLIBV): $(OBJS)
 	$(LDSHARED) -o $@ $(OBJS)
-	rm -f $(SHAREDLIB) $(SHAREDLIB).1
+	rm -f $(SHAREDLIB) $(SHAREDLIBM)
 	ln -s $@ $(SHAREDLIB)
-	ln -s $@ $(SHAREDLIB).1
+	ln -s $@ $(SHAREDLIBM)
 
 example: example.o $(LIBS)
 	$(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
@@ -110,10 +98,10 @@
 	cp $(LIBS) $(libdir)
 	cd $(libdir); chmod 755 $(LIBS)
 	-@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
-	cd $(libdir); if test -f $(SHAREDLIB).$(VER); then \
-	  rm -f $(SHAREDLIB) $(SHAREDLIB).1; \
-	  ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB); \
-	  ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB).1; \
+	cd $(libdir); if test -f $(SHAREDLIBV); then \
+	  rm -f $(SHAREDLIB) $(SHAREDLIBM); \
+	  ln -s $(SHAREDLIBV) $(SHAREDLIB); \
+	  ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
 	  (ldconfig || true)  >/dev/null 2>&1; \
 	fi
 	cp zlib.3 $(man3dir)
@@ -123,20 +111,15 @@
 
 uninstall:
 	cd $(includedir); \
-	v=$(VER); \
-	if test -f zlib.h; then \
-	  v=`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`; \
-          rm -f zlib.h zconf.h; \
-	fi; \
 	cd $(libdir); rm -f libz.a; \
-	if test -f $(SHAREDLIB).$$v; then \
-	  rm -f $(SHAREDLIB).$$v $(SHAREDLIB) $(SHAREDLIB).1; \
+	if test -f $(SHAREDLIBV); then \
+	  rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
 	fi
 	cd $(man3dir); rm -f zlib.3
 
 mostlyclean: clean
 clean:
-	rm -f *.o *~ example minigzip libz.a libz.so* foo.gz so_locations \
+	rm -f *.o *~ example minigzip libz.* foo.gz so_locations \
 	   _match.s maketree contrib/infback9/*.o
 
 maintainer-clean: distclean
@@ -145,28 +128,6 @@
 	cp -p zconf.in.h zconf.h
 	rm -f .DS_Store
 
-zip:
-	echo Warning: this has not been updated for zlib 1.2.0 -- do not use
-	mv Makefile Makefile~; cp -p Makefile.in Makefile
-	rm -f test.c ztest*.c contrib/minizip/test.zip
-	v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
-	zip -ul9 zlib$$v $(DISTFILES)
-	mv Makefile~ Makefile
-
-dist:
-	echo Warning: this has not been updated for zlib 1.2.0 -- do not use
-	mv Makefile Makefile~; cp -p Makefile.in Makefile
-	rm -f test.c ztest*.c contrib/minizip/test.zip
-	d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
-	rm -f $$d.tar.gz; \
-	if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \
-	files=""; \
-	for f in $(DISTFILES); do files="$$files $$d/$$f"; done; \
-	cd ..; \
-	GZIP=-9 $(TAR) chofz $$d/$$d.tar.gz $$files; \
-	if test ! -d $$d; then rm -f $$d; fi
-	mv Makefile~ Makefile
-
 tags:
 	etags *.[ch]
 
diff --git a/README b/README
index db5ce3c..eda18fa 100644
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
 ZLIB DATA COMPRESSION LIBRARY
 
-zlib 1.2.0.6 is a general purpose data compression library.  All the code is
+zlib 1.2.0.7 is a general purpose data compression library.  All the code is
 thread safe.  The data format used by the zlib library is described by RFCs
 (Request for Comments) 1950 to 1952 in the files
 http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
@@ -8,7 +8,7 @@
 formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html
 
 All functions of the compression library are documented in the file zlib.h
-(volunteer to write man pages welcome, contact jloup@gzip.org). A usage example
+(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example
 of the library is given in the file example.c which also tests that the library
 is working correctly. Another example is given in the file minigzip.c. The
 compression library itself is composed of all source files except example.c and
@@ -34,12 +34,12 @@
 issue of  Dr. Dobb's Journal; a copy of the article is available in
 http://dogma.net/markn/articles/zlibtool/zlibtool.htm
 
-The changes made in version 1.2.0.6 are documented in the file ChangeLog.
+The changes made in version 1.2.0.7 are documented in the file ChangeLog.
 
 Unsupported third party contributions are provided in directory "contrib".
 
 A Java implementation of zlib is available in the Java Development Kit
-http://www.javasoft.com/products/JDK/1.1/docs/api/Package-java.util.zip.html
+http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/package-summary.html
 See the zlib home page http://www.zlib.org for details.
 
 A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is in the
@@ -51,26 +51,16 @@
 http://www.python.org/doc/lib/module-zlib.html
 
 A zlib binding for TCL written by Andreas Kupries <a.kupries@westend.com> is
-availlable at http://www.westend.com/~kupries/doc/trf/man/man.html
+availlable at http://www.oche.de/~akupries/soft/trf/trf_zip.html
 
 An experimental package to read and write files in .zip format, written on top
-of zlib by Gilles Vollant <info@winimage.com>, is available at
-http://www.winimage.com/zLibDll/unzip.html and also in the contrib/minizip
-directory of zlib.
+of zlib by Gilles Vollant <info@winimage.com>, is available in the
+contrib/minizip directory of zlib.
 
 
 Notes for some targets:
 
-- To build a Windows DLL version, include in a DLL project zlib.def, zlib.rc
-  and all .c files except example.c and minigzip.c; compile with -DZLIB_DLL The
-  zlib DLL support was initially done by Alessandro Iacopetti and is now
-  maintained by Gilles Vollant <info@winimage.com>. Check the zlib DLL home
-  page at http://www.winimage.com/zLibDll
-
-  From Visual Basic, you can call the DLL functions which do not take a
-  structure as argument: compress, uncompress and all gz* functions. See
-  contrib/visual-basic.txt for more information, or get
-  http://www.tcfb.com/dowseware/cmp-z-it.zip
+- For Windows DLL versions, please see win32/DLL_FAQ.txt
 
 - For 64-bit Irix, deflate.c must be compiled without any optimization. With
   -O, one libpng test fails. The test works in 32 bit mode (with the -n32
@@ -90,8 +80,11 @@
 - For Turbo C the small model is supported only with reduced performance to
   avoid any far allocation; it was tested with -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3
 
-- For PalmOs, see http://www.cs.uit.no/~perm/PASTA/pilot/software.html Per
-  Harald Myrvang <perm@stud.cs.uit.no>
+- For PalmOs, see http://palmzlib.sourceforge.net/
+
+- When building a shared, i.e. dynamic library on Mac OS X, the library must be
+  installed before testing (do "make install" before "make test"), since the
+  library location is specified in the library.
 
 
 Acknowledgments:
diff --git a/amiga/Makefile.pup b/amiga/Makefile.pup
new file mode 100644
index 0000000..3f7e155
--- /dev/null
+++ b/amiga/Makefile.pup
@@ -0,0 +1,66 @@
+# Amiga powerUP (TM) Makefile
+# makefile for libpng and SAS C V6.58/7.00 PPC compiler
+# Copyright (C) 1998 by Andreas R. Kleinert
+
+LIBNAME	= libzip.a
+
+CC	= scppc
+CFLAGS	= NOSTKCHK NOSINT OPTIMIZE OPTGO OPTPEEP OPTINLOCAL OPTINL \
+	  OPTLOOP OPTRDEP=8 OPTDEP=8 OPTCOMP=8 NOVER
+AR	= ppc-amigaos-ar cr
+RANLIB	= ppc-amigaos-ranlib
+LD	= ppc-amigaos-ld -r
+LDFLAGS	= -o
+LDLIBS	= LIB:scppc.a LIB:end.o
+RM	= delete quiet
+
+OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
+       zutil.o inflate.o infback.o inftrees.o inffast.o
+
+TEST_OBJS = example.o minigzip.o
+
+all: example minigzip
+
+check: test
+test: all
+	example
+	echo hello world | minigzip | minigzip -d
+
+$(LIBNAME): $(OBJS)
+	$(AR) $@ $(OBJS)
+	-$(RANLIB) $@
+
+example: example.o $(LIBNAME)
+	$(LD) $(LDFLAGS) $@ LIB:c_ppc.o $@.o $(LIBNAME) $(LDLIBS)
+
+minigzip: minigzip.o $(LIBNAME)
+	$(LD) $(LDFLAGS) $@ LIB:c_ppc.o $@.o $(LIBNAME) $(LDLIBS)
+
+mostlyclean: clean
+clean:
+	$(RM) *.o example minigzip $(LIBNAME) foo.gz
+
+zip:
+	zip -ul9 zlib README ChangeLog Makefile Make????.??? Makefile.?? \
+	  descrip.mms *.[ch]
+
+tgz:
+	cd ..; tar cfz zlib/zlib.tgz zlib/README zlib/ChangeLog zlib/Makefile \
+	  zlib/Make????.??? zlib/Makefile.?? zlib/descrip.mms zlib/*.[ch]
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+adler32.o: zlib.h zconf.h
+compress.o: zlib.h zconf.h
+crc32.o: crc32.h zlib.h zconf.h
+deflate.o: deflate.h zutil.h zlib.h zconf.h
+example.o: zlib.h zconf.h
+gzio.o: zutil.h zlib.h zconf.h
+inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
+inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
+infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
+inftrees.o: zutil.h zlib.h zconf.h inftrees.h
+minigzip.o: zlib.h zconf.h
+trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
+uncompr.o: zlib.h zconf.h
+zutil.o: zutil.h zlib.h zconf.h
diff --git a/old/amiga/Makefile.sas b/amiga/Makefile.sas
similarity index 61%
rename from old/amiga/Makefile.sas
rename to amiga/Makefile.sas
index 5323e82..d6842b8 100644
--- a/old/amiga/Makefile.sas
+++ b/amiga/Makefile.sas
@@ -10,22 +10,24 @@
 LDFLAGS=LIB z.lib
 
 SCOPTIONS=OPTSCHED OPTINLINE OPTALIAS OPTTIME OPTINLOCAL STRMERGE \
-       NOICONS PARMS=BOTH NOSTACKCHECK UTILLIB NOVERSION ERRORREXX 
+       NOICONS PARMS=BOTH NOSTACKCHECK UTILLIB NOVERSION ERRORREXX \
+       DEF=POSTINC
 
 OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
-       zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
+       zutil.o inflate.o infback.o inftrees.o inffast.o
 
 TEST_OBJS = example.o minigzip.o
 
 all: SCOPTIONS example minigzip
 
+check: test
 test: all
-	`cd`/example
+	example
 	echo hello world | minigzip | minigzip -d 
 
 install: z.lib
-	copy zlib.h zconf.h INCLUDE: clone
-	copy z.lib LIB: clone
+	copy clone zlib.h zconf.h INCLUDE:
+	copy clone z.lib LIB:
 
 z.lib: $(OBJS)
 	oml z.lib r $(OBJS)
@@ -36,29 +38,28 @@
 minigzip: minigzip.o z.lib
 	$(CC) $(CFLAGS) LINK TO $@ minigzip.o $(LDFLAGS)
 
+mostlyclean: clean
 clean:
-	-delete force quiet *.o example minigzip z.lib foo.gz *.lnk SCOPTIONS
+	-delete force quiet example minigzip *.o z.lib foo.gz *.lnk SCOPTIONS
 
-SCOPTIONS: Smakefile
-        copy to $@ <from <
+SCOPTIONS: Makefile.sas
+	copy to $@ <from <
 $(SCOPTIONS)
 <
 
 # DO NOT DELETE THIS LINE -- make depend depends on it.
 
-adler32.o: zutil.h zlib.h zconf.h
+adler32.o: zlib.h zconf.h
 compress.o: zlib.h zconf.h
-crc32.o: zutil.h zlib.h zconf.h
+crc32.o: crc32.h zlib.h zconf.h
 deflate.o: deflate.h zutil.h zlib.h zconf.h
 example.o: zlib.h zconf.h
 gzio.o: zutil.h zlib.h zconf.h
-infblock.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
-infcodes.o: zutil.h zlib.h zconf.h inftrees.h infutil.h infcodes.h inffast.h
-inffast.o: zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h
-inflate.o: zutil.h zlib.h zconf.h infblock.h
+inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
+inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
+infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
 inftrees.o: zutil.h zlib.h zconf.h inftrees.h
-infutil.o: zutil.h zlib.h zconf.h inftrees.h infutil.h
 minigzip.o: zlib.h zconf.h
-trees.o: deflate.h zutil.h zlib.h zconf.h
+trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
 uncompr.o: zlib.h zconf.h
 zutil.o: zutil.h zlib.h zconf.h
diff --git a/configure b/configure
index 9999de8..e570a7a 100755
--- a/configure
+++ b/configure
@@ -20,8 +20,9 @@
 
 LIBS=libz.a
 LDFLAGS="-L. ${LIBS}"
-SHAREDLIB=libz.so
 VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
+VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h`
+VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h`
 AR=${AR-"ar rc"}
 RANLIB=${RANLIB-"ranlib"}
 prefix=${prefix-/usr/local}
@@ -55,10 +56,6 @@
     esac
 done
 
-if [ $shared -eq 1 ]; then
-  LDFLAGS="-L. ${SHAREDLIB}"
-fi
-
 test=ztest$$
 cat > $test.c <<EOF
 extern int getchar();
@@ -85,6 +82,13 @@
   HP-UX*)        LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"}
                  shared_ext='.sl'
                  SHAREDLIB='libz.sl';;
+  Darwin*)   shared_ext='.dylib'
+             SHAREDLIB=libz$shared_ext
+             SHAREDLIBV=libz.$VER$shared_ext
+             SHAREDLIBM=libz.$VER1$shared_ext
+             LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name /usr/lib/$SHAREDLIBV -compatibility_version $VER2 -current_version $VER"}
+             libdir='/usr/lib'
+             includedir='/usr/include';;
   *)             LDSHARED=${LDSHARED-"$cc -shared"};;
   esac
 else
@@ -102,7 +106,7 @@
              LDSHARED=${LDSHARED-"cc -shared"};;
   OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"}
              CFLAGS=${CFLAGS-"-O -std1"}
-             LDSHARED=${LDSHARED-"cc -shared  -Wl,-soname,$SHAREDLIB -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"};;
+             LDSHARED=${LDSHARED-"cc -shared  -Wl,-soname,libz.so -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"};;
   OSF1*)     SFLAGS=${CFLAGS-"-O -std1"}
              CFLAGS=${CFLAGS-"-O -std1"}
              LDSHARED=${LDSHARED-"cc -shared"};;
@@ -143,14 +147,18 @@
   esac
 fi
 
+SHAREDLIB=${SHAREDLIB-"libz$shared_ext"}
+SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"}
+SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"}
+
 if test $shared -eq 1; then
   echo Checking for shared library support...
   # we must test in two steps (cc then ld), required at least on SunOS 4.x
   if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" &&
      test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then
     CFLAGS="$SFLAGS"
-    LIBS="$SHAREDLIB.$VER"
-    echo Building shared library $SHAREDLIB.$VER with $CC.
+    LIBS="$SHAREDLIBV"
+    echo Building shared library $SHAREDLIBV with $CC.
   elif test -z "$old_cc" -a -z "$old_cflags"; then
     echo No shared library support.
     shared=0;
@@ -162,6 +170,8 @@
 if test $shared -eq 0; then
   LDSHARED="$CC"
   echo Building static library $LIBS version $VER with $CC.
+else
+  LDFLAGS="-L. ${SHAREDLIBV}"
 fi
 
 cat > $test.c <<EOF
@@ -422,19 +432,20 @@
 
 # udpate Makefile
 sed < Makefile.in "
-/^CC *=/s%=.*%=$CC%
-/^CFLAGS *=/s%=.*%=$CFLAGS%
-/^CPP *=/s%=.*%=$CPP%
-/^LDSHARED *=/s%=.*%=$LDSHARED%
-/^LIBS *=/s%=.*%=$LIBS%
-/^SHAREDLIB *=/s%=.*%=$SHAREDLIB%
-/^AR *=/s%=.*%=$AR%
-/^RANLIB *=/s%=.*%=$RANLIB%
-/^VER *=/s%=.*%=$VER%
-/^prefix *=/s%=.*%=$prefix%
-/^exec_prefix *=/s%=.*%=$exec_prefix%
-/^libdir *=/s%=.*%=$libdir%
-/^includedir *=/s%=.*%=$includedir%
-/^mandir *=/s%=.*%=$mandir%
-/^LDFLAGS *=/s%=.*%=$LDFLAGS%
+/^CC *=/s#=.*#=$CC#
+/^CFLAGS *=/s#=.*#=$CFLAGS#
+/^CPP *=/s#=.*#=$CPP#
+/^LDSHARED *=/s#=.*#=$LDSHARED#
+/^LIBS *=/s#=.*#=$LIBS#
+/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
+/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
+/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
+/^AR *=/s#=.*#=$AR#
+/^RANLIB *=/s#=.*#=$RANLIB#
+/^prefix *=/s#=.*#=$prefix#
+/^exec_prefix *=/s#=.*#=$exec_prefix#
+/^libdir *=/s#=.*#=$libdir#
+/^includedir *=/s#=.*#=$includedir#
+/^mandir *=/s#=.*#=$mandir#
+/^LDFLAGS *=/s#=.*#=$LDFLAGS#
 " > Makefile
diff --git a/contrib/infback9/infback9.c b/contrib/infback9/infback9.c
index fb6acb4..34a95fc 100644
--- a/contrib/infback9/infback9.c
+++ b/contrib/infback9/infback9.c
@@ -321,7 +321,7 @@
                 break;
             }
             length = (unsigned)hold & 0xffff;
-            Tracev((stderr, "inflate:       stored length %u\n",
+            Tracev((stderr, "inflate:       stored length %lu\n",
                     length));
             INITBITS();
 
@@ -507,7 +507,7 @@
                 length += BITS(extra);
                 DROPBITS(extra);
             }
-            Tracevv((stderr, "inflate:         length %u\n", length));
+            Tracevv((stderr, "inflate:         length %lu\n", length));
 
             /* get distance code */
             for (;;) {
@@ -545,7 +545,7 @@
                 mode = BAD;
                 break;
             }
-            Tracevv((stderr, "inflate:         distance %u\n", offset));
+            Tracevv((stderr, "inflate:         distance %lu\n", offset));
 
             /* copy match from window to output */
             do {
diff --git a/contrib/infback9/inftree9.c b/contrib/infback9/inftree9.c
index 0c544cf..2829a84 100644
--- a/contrib/infback9/inftree9.c
+++ b/contrib/infback9/inftree9.c
@@ -9,7 +9,7 @@
 #define MAXBITS 15
 
 const char inflate9_copyright[] =
-   " inflate9 1.2.0.6 Copyright 1995-2003 Mark Adler ";
+   " inflate9 1.2.0.7 Copyright 1995-2003 Mark Adler ";
 /*
   If you use the zlib library in a product, an acknowledgment is welcome
   in the documentation of your product. If for some reason you cannot
@@ -64,7 +64,7 @@
     static const unsigned short lext[31] = { /* Length codes 257..285 extra */
         128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
         130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
-        133, 133, 133, 133, 144, 65, 77};
+        133, 133, 133, 133, 144, 71, 69};
     static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
         1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
         65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,
diff --git a/contrib/untgz/untgz.c b/contrib/untgz/untgz.c
index 478d744..d748b69 100644
--- a/contrib/untgz/untgz.c
+++ b/contrib/untgz/untgz.c
@@ -1,8 +1,9 @@
 /*
- * untgz.c -- Display contents and/or extract file from
- * a gzip'd TAR file
+ * untgz.c -- Display contents and extract files from a gzip'd TAR file
+ *
  * written by "Pedro A. Aranda Guti\irrez" <paag@tid.es>
  * adaptation to Unix by Jean-loup Gailly <jloup@gzip.org>
+ * various fixes by Cosmin Truta <cosmint@cs.ubbcluj.ro>
  */
 
 #include <stdio.h>
@@ -10,7 +11,9 @@
 #include <string.h>
 #include <time.h>
 #include <errno.h>
-#include <fcntl.h>
+
+#include "zlib.h"
+
 #ifdef unix
 # include <unistd.h>
 #else
@@ -18,27 +21,22 @@
 # include <io.h>
 #endif
 
-#include "zlib.h"
-
 #ifdef WIN32
 #include <windows.h>
 #  ifndef F_OK
-#    define F_OK (0)
+#    define F_OK  0
 #  endif
+#  define mkdir(dirname,mode)   _mkdir(dirname)
 #  ifdef _MSC_VER
-#    define mkdir(dirname,mode) _mkdir(dirname)
 #    define strdup(str)         _strdup(str)
-#    define unlink(fn)          _unlink(fn)
 #    define access(path,mode)   _access(path,mode)
-#  else
-#    define mkdir(dirname,mode) _mkdir(dirname)
 #  endif
 #else
 #  include <utime.h>
 #endif
 
 
-/* Values used in typeflag field.  */
+/* values used in typeflag field */
 
 #define REGTYPE  '0'            /* regular file */
 #define AREGTYPE '\0'           /* regular file */
@@ -78,40 +76,38 @@
   struct tar_header  header;
 };
 
-enum { TGZ_EXTRACT = 0, TGZ_LIST };
+enum { TGZ_EXTRACT, TGZ_LIST, TGZ_INVALID };
 
-static char *TGZfname   OF((const char *));
+char *TGZfname          OF((const char *));
 void TGZnotfound        OF((const char *));
 
 int getoct              OF((char *, int));
 char *strtime           OF((time_t *));
-int setftime            OF((char *, time_t));
+int setfiletime         OF((char *, time_t));
 int ExprMatch           OF((char *, char *));
 
 int makedir             OF((char *));
 int matchname           OF((int, int, char **, char *));
 
 void error              OF((const char *));
-int  tar                OF((gzFile, int, int, int, char **));
+int tar                 OF((gzFile, int, int, int, char **));
 
 void help               OF((int));
 int main                OF((int, char **));
 
 char *prog;
 
-/* This will give a benign warning */
+const char *TGZsuffix[] = { "\0", ".tar", ".tar.gz", ".taz", ".tgz", NULL };
 
-static char *TGZsuffix[] = { "\0", ".tar", ".tar.gz", ".taz", ".tgz", NULL };
+/* return the file name of the TGZ archive */
+/* or NULL if it does not exist */
 
-/* Return the real name of the TGZ archive */
-/* or NULL if it does not exist. */
-
-static char *TGZfname (const char *fname)
+char *TGZfname (const char *arcname)
 {
   static char buffer[1024];
   int origlen,i;
 
-  strcpy(buffer,fname);
+  strcpy(buffer,arcname);
   origlen = strlen(buffer);
 
   for (i=0; TGZsuffix[i]; i++)
@@ -123,55 +119,67 @@
   return NULL;
 }
 
+
 /* error message for the filename */
 
-void TGZnotfound (const char *fname)
+void TGZnotfound (const char *arcname)
 {
   int i;
 
-  fprintf(stderr,"%s : couldn't find ",prog);
+  fprintf(stderr,"%s: Couldn't find ",prog);
   for (i=0;TGZsuffix[i];i++)
     fprintf(stderr,(TGZsuffix[i+1]) ? "%s%s, " : "or %s%s\n",
-            fname,
+            arcname,
             TGZsuffix[i]);
   exit(1);
 }
 
 
-/* help functions */
+/* convert octal digits to int */
+/* on error return -1 */
 
 int getoct (char *p,int width)
 {
   int result = 0;
   char c;
 
-  while (width --)
+  while (width--)
     {
       c = *p++;
-      if (c == ' ')
-        continue;
       if (c == 0)
         break;
+      if (c == ' ')
+        continue;
+      if (c < '0' || c > '7')
+        return -1;
       result = result * 8 + (c - '0');
     }
   return result;
 }
 
+
+/* convert time_t to string */
+/* use the "YYYY/MM/DD hh:mm:ss" format */
+
 char *strtime (time_t *t)
 {
   struct tm   *local;
   static char result[32];
 
   local = localtime(t);
-  sprintf(result,"%2d/%02d/%4d %02d:%02d:%02d",
-          local->tm_mday, local->tm_mon+1, local->tm_year+1900,
-          local->tm_hour, local->tm_min,   local->tm_sec);
+  sprintf(result,"%4d/%02d/%02d %02d:%02d:%02d",
+          local->tm_year+1900, local->tm_mon+1, local->tm_mday,
+          local->tm_hour, local->tm_min, local->tm_sec);
   return result;
 }
 
-int setftime (char *fname,time_t ftime)
+
+/* set file time */
+
+int setfiletime (char *fname,time_t ftime)
 {
 #ifdef WIN32
+  static int isWinNT = -1;
   SYSTEMTIME st;
   FILETIME locft, modft;
   struct tm *loctm;
@@ -194,8 +202,11 @@
       !LocalFileTimeToFileTime(&locft, &modft))
     return -1;
 
-  hFile = CreateFile(fname, GENERIC_READ | GENERIC_WRITE,
-                     0, NULL, OPEN_EXISTING, 0, 0);
+  if (isWinNT < 0)
+    isWinNT = (GetVersion() < 0x80000000) ? 1 : 0;
+  hFile = CreateFile(fname, GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
+                     (isWinNT ? FILE_FLAG_BACKUP_SEMANTICS : 0),
+                     NULL);
   if (hFile == INVALID_HANDLE_VALUE)
     return -1;
   result = SetFileTime(hFile, NULL, NULL, &modft) ? 0 : -1;
@@ -246,10 +257,9 @@
     }
 }
 
-/* recursive make directory */
-/* abort if you get an ENOENT errno somewhere in the middle */
-/* e.g. ignore error "mkdir on existing directory" */
-/* */
+
+/* recursive mkdir */
+/* abort on ENOENT; ignore other errors like "directory already exists" */
 /* return 1 if OK */
 /*        0 on error */
 
@@ -266,7 +276,7 @@
   if (buffer[len-1] == '/') {
     buffer[len-1] = '\0';
   }
-  if (mkdir(buffer, 0775) == 0)
+  if (mkdir(buffer, 0755) == 0)
     {
       free(buffer);
       return 1;
@@ -281,9 +291,9 @@
         p++;
       hold = *p;
       *p = 0;
-      if ((mkdir(buffer, 0775) == -1) && (errno == ENOENT))
+      if ((mkdir(buffer, 0755) == -1) && (errno == ENOENT))
         {
-          fprintf(stderr,"%s: couldn't create directory %s\n",prog,buffer);
+          fprintf(stderr,"%s: Couldn't create directory %s\n",prog,buffer);
           free(buffer);
           return 0;
         }
@@ -295,9 +305,10 @@
   return 1;
 }
 
+
 int matchname (int arg,int argc,char **argv,char *fname)
 {
-  if (arg == argc)              /* no arguments given (untgz tgzarchive) */
+  if (arg == argc)      /* no arguments given (untgz tgzarchive) */
     return 1;
 
   while (arg < argc)
@@ -308,7 +319,7 @@
 }
 
 
-/* Tar file list or extract */
+/* tar file list or extract */
 
 int tar (gzFile in,int action,int arg,int argc,char **argv)
 {
@@ -319,22 +330,26 @@
   int    remaining = 0;
   FILE   *outfile = NULL;
   char   fname[BLOCKSIZE];
+  int    tarmode;
   time_t tartime;
 
   if (action == TGZ_LIST)
-    printf("     day      time     size                       file\n"
+    printf("    date      time     size                       file\n"
            " ---------- -------- --------- -------------------------------------\n");
   while (1)
     {
       len = gzread(in, &buffer, BLOCKSIZE);
       if (len < 0)
-        error (gzerror(in, &err));
+        error(gzerror(in, &err));
       /*
        * Always expect complete blocks to process
        * the tar information.
        */
       if (len != BLOCKSIZE)
-        error("gzread: incomplete block read");
+        {
+          action = TGZ_INVALID; /* force error exit */
+          remaining = 0;        /* force I/O cleanup */
+        }
 
       /*
        * If we have to get a tar header
@@ -346,9 +361,16 @@
            * or the end-of-tar block,
            * we are done
            */
-          if ((len == 0)  || (buffer.header.name[0]== 0)) break;
+          if ((len == 0) || (buffer.header.name[0] == 0)) break;
 
+          tarmode = getoct(buffer.header.mode,8);
           tartime = (time_t)getoct(buffer.header.mtime,12);
+          if (tarmode == -1 || tartime == (time_t)-1)
+            {
+              buffer.header.name[0] = 0;
+              action = TGZ_INVALID;
+            }
+
           strcpy(fname,buffer.header.name);
 
           switch (buffer.header.typeflag)
@@ -357,16 +379,24 @@
               if (action == TGZ_LIST)
                 printf(" %s     <dir> %s\n",strtime(&tartime),fname);
               if (action == TGZ_EXTRACT)
-                makedir(fname);
+                {
+                  makedir(fname);
+                  setfiletime(fname,tartime);
+                }
               break;
             case REGTYPE:
             case AREGTYPE:
               remaining = getoct(buffer.header.size,12);
+              if (remaining == -1)
+                {
+                  action = TGZ_INVALID;
+                  break;
+                }
               if (action == TGZ_LIST)
                 printf(" %s %9d %s\n",strtime(&tartime),remaining,fname);
-              if (action == TGZ_EXTRACT)
+              else if (action == TGZ_EXTRACT)
                 {
-                  if ((remaining) && (matchname(arg,argc,argv,fname)))
+                  if (matchname(arg,argc,argv,fname))
                     {
                       outfile = fopen(fname,"wb");
                       if (outfile == NULL) {
@@ -379,18 +409,15 @@
                           outfile = fopen(fname,"wb");
                         }
                       }
-                      fprintf(stderr,
-                              "%s %s\n",
-                              (outfile) ? "Extracting" : "Couldn't create",
-                              fname);
+                      if (outfile != NULL)
+                        printf("Extracting %s\n",fname);
+                      else
+                        fprintf(stderr, "%s: Couldn't create %s",prog,fname);
                     }
                   else
                     outfile = NULL;
                 }
-              /*
-               * could have no contents
-               */
-              getheader = (remaining) ? 0 : 1;
+              getheader = 0;
               break;
             default:
               if (action == TGZ_LIST)
@@ -402,27 +429,39 @@
         {
           unsigned int bytes = (remaining > BLOCKSIZE) ? BLOCKSIZE : remaining;
 
-          if ((action == TGZ_EXTRACT) && (outfile != NULL))
+          if (outfile != NULL)
             {
               if (fwrite(&buffer,sizeof(char),bytes,outfile) != bytes)
                 {
-                  fprintf(stderr,"%s : error writing %s skipping...\n",prog,fname);
+                  fprintf(stderr,"%s: Error writing %s -- skipping\n",prog,fname);
                   fclose(outfile);
-                  unlink(fname);
+                  outfile = NULL;
+                  remove(fname);
                 }
             }
           remaining -= bytes;
-          if (remaining == 0)
+        }
+
+      if (remaining == 0)
+        {
+          getheader = 1;
+          if (outfile != NULL)
             {
-              getheader = 1;
-              if ((action == TGZ_EXTRACT) && (outfile != NULL))
-                {
-                  fclose(outfile);
-                  outfile = NULL;
-                  setftime(fname,tartime);
-                }
+              fclose(outfile);
+              outfile = NULL;
+              if (action != TGZ_INVALID)
+                setfiletime(fname,tartime);
             }
         }
+
+      /*
+       * Abandon if errors are found
+       */
+      if (action == TGZ_INVALID)
+        {
+          error("broken archive");
+          break;
+        }
     }
 
   if (gzclose(in) != Z_OK)
@@ -432,30 +471,32 @@
 }
 
 
-/* =========================================================== */
+/* ============================================================ */
 
 void help(int exitval)
 {
-  fprintf(stderr,
-          "untgz version 0.1\n"
-          " a sample application of zlib\n\n"
-          "Usage : untgz file.tgz            to extract all files\n"
-          "        untgz file.tgz fname ...  to extract selected files\n"
-          "        untgz -l file.tgz         to list archive contents\n"
-          "        untgz -h                  to display this help\n\n");
+  printf("untgz version 0.2\n"
+         "  using zlib version %s\n\n",
+         zlibVersion());
+  printf("Usage: untgz file.tgz            extract all files\n"
+         "       untgz file.tgz fname ...  extract selected files\n"
+         "       untgz -l file.tgz         list archive contents\n"
+         "       untgz -h                  display this help\n");
   exit(exitval);
 }
 
 void error(const char *msg)
 {
-    fprintf(stderr, "%s: %s\n", prog, msg);
-    exit(1);
+  fprintf(stderr, "%s: %s\n", prog, msg);
+  exit(1);
 }
 
 
-/* ====================================================================== */
+/* ============================================================ */
 
-int _CRT_glob = 0;      /* disable globbing of the arguments */
+#if defined(WIN32) && defined(__GNUC__)
+int _CRT_glob = 0;      /* disable argument globbing in MinGW */
+#endif
 
 int main(int argc,char **argv)
 {
@@ -464,7 +505,6 @@
     char        *TGZfile;
     gzFile      *f;
 
-
     prog = strrchr(argv[0],'\\');
     if (prog == NULL)
       {
@@ -514,16 +554,14 @@
         f = gzopen(TGZfile,"rb");
         if (f == NULL)
           {
-            fprintf(stderr,"%s: Couldn't gzopen %s\n",
-                    prog,
-                    TGZfile);
+            fprintf(stderr,"%s: Couldn't gzopen %s\n",prog,TGZfile);
             return 1;
           }
         exit(tar(f, action, arg, argc, argv));
       break;
 
       default:
-        error("Unknown option!");
+        error("Unknown option");
         exit(1);
       }
 
diff --git a/deflate.c b/deflate.c
index ac083ae..ddc0c5e 100644
--- a/deflate.c
+++ b/deflate.c
@@ -52,7 +52,7 @@
 #include "deflate.h"
 
 const char deflate_copyright[] =
-   " deflate 1.2.0.6 Copyright 1995-2003 Jean-loup Gailly ";
+   " deflate 1.2.0.7 Copyright 1995-2003 Jean-loup Gailly ";
 /*
   If you use the zlib library in a product, an acknowledgment is welcome
   in the documentation of your product. If for some reason you cannot
diff --git a/inftrees.c b/inftrees.c
index 204afe6..75bc22f 100644
--- a/inftrees.c
+++ b/inftrees.c
@@ -9,7 +9,7 @@
 #define MAXBITS 15
 
 const char inflate_copyright[] =
-   " inflate 1.2.0.6 Copyright 1995-2003 Mark Adler ";
+   " inflate 1.2.0.7 Copyright 1995-2003 Mark Adler ";
 /*
   If you use the zlib library in a product, an acknowledgment is welcome
   in the documentation of your product. If for some reason you cannot
@@ -62,7 +62,7 @@
         35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
     static const unsigned short lext[31] = { /* Length codes 257..285 extra */
         16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
-        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 65, 77};
+        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 71, 69};
     static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
         1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
         257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
diff --git a/old/README b/old/README
index ea9cd22..e2700df 100644
--- a/old/README
+++ b/old/README
@@ -1,3 +1,3 @@
-This directory contains files that have not been updated for zlib 1.2.0.
+This directory contains files that have not been updated for zlib 1.2.
 
 (Volunteers are encouraged to help clean this up.  Thanks.)
diff --git a/old/amiga/Makefile.pup b/old/amiga/Makefile.pup
deleted file mode 100644
index 6cfad1d..0000000
--- a/old/amiga/Makefile.pup
+++ /dev/null
@@ -1,66 +0,0 @@
-# Amiga powerUP (TM) Makefile
-# makefile for libpng and SAS C V6.58/7.00 PPC compiler
-# Copyright (C) 1998 by Andreas R. Kleinert
-
-CC       = scppc
-CFLAGS   = NOSTKCHK NOSINT OPTIMIZE OPTGO OPTPEEP OPTINLOCAL OPTINL \
-           OPTLOOP OPTRDEP=8 OPTDEP=8 OPTCOMP=8
-LIBNAME  = libzip.a
-AR       = ppc-amigaos-ar
-AR_FLAGS = cr
-RANLIB   = ppc-amigaos-ranlib
-LDFLAGS  = -r -o
-LDLIBS   = LIB:scppc.a
-LN       = ppc-amigaos-ld
-RM       = delete quiet
-
-OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
-       zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
-
-TEST_OBJS = example.o minigzip.o
-
-all: example minigzip
-
-test: all
-        example
-        echo hello world | minigzip | minigzip -d
-
-$(LIBNAME): $(OBJS)
-            $(AR) $(AR_FLAGS) $@ $(OBJS)
-            $(RANLIB) $@
-
-example: example.o $(LIBNAME)
-        $(LN) $(LDFLAGS) example LIB:c_ppc.o example.o $(LIBNAME) $(LDLIBS) LIB:end.o
-
-minigzip: minigzip.o $(LIBNAME)
-        $(LN) $(LDFLAGS) minigzip LIB:c_ppc.o minigzip.o $(LIBNAME) $(LDLIBS) LIB:end.o
-
-clean:
-        $(RM) *.o example minigzip $(LIBNAME) foo.gz
-
-zip:
-        zip -ul9 zlib README ChangeLog Makefile Make????.??? Makefile.?? \
-          descrip.mms *.[ch]
-
-tgz:
-        cd ..; tar cfz zlib/zlib.tgz zlib/README zlib/ChangeLog zlib/Makefile \
-          zlib/Make????.??? zlib/Makefile.?? zlib/descrip.mms zlib/*.[ch]
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-adler32.o: zutil.h zlib.h zconf.h
-compress.o: zlib.h zconf.h
-crc32.o: zutil.h zlib.h zconf.h
-deflate.o: deflate.h zutil.h zlib.h zconf.h
-example.o: zlib.h zconf.h
-gzio.o: zutil.h zlib.h zconf.h
-infblock.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
-infcodes.o: zutil.h zlib.h zconf.h inftrees.h infutil.h infcodes.h inffast.h
-inffast.o: zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h
-inflate.o: zutil.h zlib.h zconf.h infblock.h
-inftrees.o: zutil.h zlib.h zconf.h inftrees.h
-infutil.o: zutil.h zlib.h zconf.h inftrees.h infutil.h
-minigzip.o: zlib.h zconf.h
-trees.o: deflate.h zutil.h zlib.h zconf.h
-uncompr.o: zlib.h zconf.h
-zutil.o: zutil.h zlib.h zconf.h
diff --git a/old/msdos/Makefile.b32 b/old/msdos/Makefile.b32
deleted file mode 100644
index 3802ea4..0000000
--- a/old/msdos/Makefile.b32
+++ /dev/null
@@ -1,104 +0,0 @@
-# Makefile for zlib
-# Borland C++
-
-# This version of the zlib makefile was adapted by Chris Young for use
-# with Borland C 4.5x with the Dos Power Pack for a 32-bit protected mode
-# flat memory model.  It was created for use with POV-Ray ray tracer and
-# you may choose to edit the CFLAGS to suit your needs but the
-# switches -WX and -DMSDOS are required.
-# -- Chris Young 76702.1655@compuserve.com
-
-# To use, do "make -fmakefile.b32"
-
-# See zconf.h for details about the memory requirements.
-
-# ------------- Borland C++ -------------
-MODEL=-WX
-CFLAGS= $(MODEL) -P-C -K -N- -k- -d -3 -r- -v- -f -DMSDOS
-CC=bcc32
-LD=bcc32
-LIB=tlib
-LDFLAGS= $(MODEL)
-O=.obj
-
-# variables
-OBJ1 = adler32$(O) compress$(O) crc32$(O) gzio$(O) uncompr$(O) deflate$(O) \
-  trees$(O)
-OBJP1 = adler32$(O)+compress$(O)+crc32$(O)+gzio$(O)+uncompr$(O)+deflate$(O)+\
-  trees$(O)
-OBJ2 = zutil$(O) inflate$(O) infblock$(O) inftrees$(O) infcodes$(O) \
-  infutil$(O) inffast$(O)
-OBJP2 = zutil$(O)+inflate$(O)+infblock$(O)+inftrees$(O)+infcodes$(O)+\
-  infutil$(O)+inffast$(O)
-
-all: test
-
-adler32.obj: adler32.c zlib.h zconf.h
-	$(CC) -c $(CFLAGS) $*.c
-
-compress.obj: compress.c zlib.h zconf.h
-	$(CC) -c $(CFLAGS) $*.c
-
-crc32.obj: crc32.c zlib.h zconf.h
-	$(CC) -c $(CFLAGS) $*.c
-
-deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
-	$(CC) -c $(CFLAGS) $*.c
-
-gzio.obj: gzio.c zutil.h zlib.h zconf.h
-	$(CC) -c $(CFLAGS) $*.c
-
-infblock.obj: infblock.c zutil.h zlib.h zconf.h infblock.h inftrees.h\
-   infcodes.h infutil.h
-	$(CC) -c $(CFLAGS) $*.c
-
-infcodes.obj: infcodes.c zutil.h zlib.h zconf.h inftrees.h infutil.h\
-   infcodes.h inffast.h
-	$(CC) -c $(CFLAGS) $*.c
-
-inflate.obj: inflate.c zutil.h zlib.h zconf.h infblock.h
-	$(CC) -c $(CFLAGS) $*.c
-
-inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
-	$(CC) -c $(CFLAGS) $*.c
-
-infutil.obj: infutil.c zutil.h zlib.h zconf.h inftrees.h infutil.h
-	$(CC) -c $(CFLAGS) $*.c
-
-inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h
-	$(CC) -c $(CFLAGS) $*.c
-
-trees.obj: trees.c deflate.h zutil.h zlib.h zconf.h
-	$(CC) -c $(CFLAGS) $*.c
-
-uncompr.obj: uncompr.c zlib.h zconf.h
-	$(CC) -c $(CFLAGS) $*.c
-
-zutil.obj: zutil.c zutil.h zlib.h zconf.h
-	$(CC) -c $(CFLAGS) $*.c
-
-example.obj: example.c zlib.h zconf.h
-	$(CC) -c $(CFLAGS) $*.c
-
-minigzip.obj: minigzip.c zlib.h zconf.h
-	$(CC) -c $(CFLAGS) $*.c
-
-# we must cut the command line to fit in the MS/DOS 128 byte limit:
-zlib.lib: $(OBJ1) $(OBJ2)
-	del zlib.lib
-	$(LIB) zlib +$(OBJP1)
-	$(LIB) zlib +$(OBJP2)
-
-example.exe: example.obj zlib.lib
-	$(LD) $(LDFLAGS) example.obj zlib.lib
-
-minigzip.exe: minigzip.obj zlib.lib
-	$(LD) $(LDFLAGS) minigzip.obj zlib.lib
-
-test: example.exe minigzip.exe
-	example
-	echo hello world | minigzip | minigzip -d
-
-#clean:
-#	del *.obj
-#	del *.exe
diff --git a/old/msdos/Makefile.wat b/old/msdos/Makefile.wat
deleted file mode 100644
index 065fe4c..0000000
--- a/old/msdos/Makefile.wat
+++ /dev/null
@@ -1,103 +0,0 @@
-# Makefile for zlib
-# Watcom 10a
-
-# This version of the zlib makefile was adapted by Chris Young for use
-# with Watcom 10a 32-bit protected mode flat memory model.  It was created
-# for use with POV-Ray ray tracer and you may choose to edit the CFLAGS to
-# suit your needs but the -DMSDOS is required.
-# -- Chris Young 76702.1655@compuserve.com
-
-# To use, do "wmake -f makefile.wat"
-
-# See zconf.h for details about the memory requirements.
-
-# ------------- Watcom 10a -------------
-MODEL=-mf
-CFLAGS= $(MODEL) -fpi87 -fp5 -zp4 -5r -w5 -oneatx -DMSDOS
-CC=wcc386
-LD=wcl386
-LIB=wlib -b -c
-LDFLAGS=
-O=.obj
-
-# variables
-OBJ1=adler32$(O) compress$(O) crc32$(O) gzio$(O) uncompr$(O) deflate$(O)
-OBJ2=trees$(O) zutil$(O) inflate$(O) infblock$(O) inftrees$(O) infcodes$(O)
-OBJ3=infutil$(O) inffast$(O)
-OBJP1=adler32$(O)+compress$(O)+crc32$(O)+gzio$(O)+uncompr$(O)+deflate$(O)
-OBJP2=trees$(O)+zutil$(O)+inflate$(O)+infblock$(O)+inftrees$(O)+infcodes$(O)
-OBJP3=infutil$(O)+inffast$(O)
-
-all: test
-
-adler32.obj: adler32.c zlib.h zconf.h
-	$(CC) $(CFLAGS) $*.c
-
-compress.obj: compress.c zlib.h zconf.h
-	$(CC) $(CFLAGS) $*.c
-
-crc32.obj: crc32.c zlib.h zconf.h
-	$(CC) $(CFLAGS) $*.c
-
-deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
-	$(CC) $(CFLAGS) $*.c
-
-gzio.obj: gzio.c zutil.h zlib.h zconf.h
-	$(CC) $(CFLAGS) $*.c
-
-infblock.obj: infblock.c zutil.h zlib.h zconf.h infblock.h inftrees.h &
-  infcodes.h infutil.h
-	$(CC) $(CFLAGS) $*.c
-
-infcodes.obj: infcodes.c zutil.h zlib.h zconf.h inftrees.h infutil.h &
-  infcodes.h inffast.h
-	$(CC) $(CFLAGS) $*.c
-
-inflate.obj: inflate.c zutil.h zlib.h zconf.h infblock.h
-	$(CC) $(CFLAGS) $*.c
-
-inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
-	$(CC) $(CFLAGS) $*.c
-
-infutil.obj: infutil.c zutil.h zlib.h zconf.h inftrees.h infutil.h
-	$(CC) $(CFLAGS) $*.c
-
-inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h
-	$(CC) $(CFLAGS) $*.c
-
-trees.obj: trees.c deflate.h zutil.h zlib.h zconf.h
-	$(CC) $(CFLAGS) $*.c
-
-uncompr.obj: uncompr.c zlib.h zconf.h
-	$(CC) $(CFLAGS) $*.c
-
-zutil.obj: zutil.c zutil.h zlib.h zconf.h
-	$(CC) $(CFLAGS) $*.c
-
-example.obj: example.c zlib.h zconf.h
-	$(CC) $(CFLAGS) $*.c
-
-minigzip.obj: minigzip.c zlib.h zconf.h
-	$(CC) $(CFLAGS) $*.c
-
-# we must cut the command line to fit in the MS/DOS 128 byte limit:
-zlib.lib: $(OBJ1) $(OBJ2) $(OBJ3)
-	del zlib.lib
-	$(LIB) zlib.lib +$(OBJP1)
-	$(LIB) zlib.lib +$(OBJP2)
-	$(LIB) zlib.lib +$(OBJP3)
-
-example.exe: example.obj zlib.lib
-	$(LD) $(LDFLAGS) example.obj zlib.lib
-
-minigzip.exe: minigzip.obj zlib.lib
-	$(LD) $(LDFLAGS) minigzip.obj zlib.lib
-
-test: minigzip.exe example.exe
-	example
-	echo hello world | minigzip | minigzip -d >test
-	type test
-
-#clean:
-#	del *.obj
-#	del *.exe
diff --git a/qnx/package.qpg b/qnx/package.qpg
index f07311f..f7c9e73 100644
--- a/qnx/package.qpg
+++ b/qnx/package.qpg
@@ -25,10 +25,10 @@
       <QPG:Files>
          <QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/>
          <QPG:Add file="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/>
-         <QPG:Add file="../libz.so.1.2.0.6" install="/opt/lib/" user="root:bin" permission="644"/>
-         <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.0.6"/>
-         <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.0.6"/>
-         <QPG:Add file="../libz.so.1.2.0.6" install="/opt/lib/" component="slib"/>
+         <QPG:Add file="../libz.so.1.2.0.7" install="/opt/lib/" user="root:bin" permission="644"/>
+         <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.0.7"/>
+         <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.0.7"/>
+         <QPG:Add file="../libz.so.1.2.0.7" install="/opt/lib/" component="slib"/>
       </QPG:Files>
 
       <QPG:PackageFilter>
@@ -63,7 +63,7 @@
             </QPM:ProductDescription>
 
             <QPM:ReleaseDescription>
-               <QPM:ReleaseVersion>1.2.0.6</QPM:ReleaseVersion>
+               <QPM:ReleaseVersion>1.2.0.7</QPM:ReleaseVersion>
                <QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
                <QPM:ReleaseStability>Stable</QPM:ReleaseStability>
                <QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor>
diff --git a/trees.c b/trees.c
index 5f6d4af..bb09554 100644
--- a/trees.c
+++ b/trees.c
@@ -1107,7 +1107,8 @@
         } /* literal or match pair ? */
 
         /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
-        Assert(s->pending < s->lit_bufsize + 2*lx, "pendingBuf overflow");
+        Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
+               "pendingBuf overflow");
 
     } while (lx < s->last_lit);
 
diff --git a/win32/zlib1.rc b/win32/zlib1.rc
index f5f2a1f..9c26467 100644
--- a/win32/zlib1.rc
+++ b/win32/zlib1.rc
@@ -5,8 +5,8 @@
 #else
 VS_VERSION_INFO		VERSIONINFO	MOVEABLE IMPURE LOADONCALL DISCARDABLE
 #endif
-  FILEVERSION		1,2,0,6
-  PRODUCTVERSION	1,2,0,6
+  FILEVERSION		1,2,0,7
+  PRODUCTVERSION	1,2,0,7
   FILEFLAGSMASK		VS_FFI_FILEFLAGSMASK
 #ifdef _DEBUG
   FILEFLAGS		1
@@ -23,12 +23,12 @@
     //language ID = U.S. English, char set = Windows, Multilingual
     BEGIN
       VALUE "FileDescription",	"zlib data compression library\0"
-      VALUE "FileVersion",	"1.2.0.6\0"
+      VALUE "FileVersion",	"1.2.0.7\0"
       VALUE "InternalName",	"zlib1.dll\0"
       VALUE "LegalCopyright",	"(C) 1995-2003 Jean-loup Gailly & Mark Adler\0"
       VALUE "OriginalFilename",	"zlib1.dll\0"
       VALUE "ProductName",	"zlib\0"
-      VALUE "ProductVersion",	"1.2.0.6\0"
+      VALUE "ProductVersion",	"1.2.0.7\0"
       VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
     END
   END
diff --git a/zlib.3 b/zlib.3
index 92a436a..0a1a57e 100644
--- a/zlib.3
+++ b/zlib.3
@@ -1,4 +1,4 @@
-.TH ZLIB 3 "13 September 2003"
+.TH ZLIB 3 "21 September 2003"
 .SH NAME
 zlib \- compression/decompression library
 .SH SYNOPSIS
@@ -133,7 +133,7 @@
 Send questions and/or comments to zlib@gzip.org,
 or (for the Windows DLL version) to Gilles Vollant (info@winimage.com).
 .SH AUTHORS
-Version 1.2.0.6
+Version 1.2.0.7
 Copyright (C) 1995-2003 Jean-loup Gailly (jloup@gzip.org)
 and Mark Adler (madler@alumni.caltech.edu).
 .LP
diff --git a/zlib.h b/zlib.h
index 61a69a2..c38b83c 100644
--- a/zlib.h
+++ b/zlib.h
@@ -1,5 +1,5 @@
 /* zlib.h -- interface of the 'zlib' general purpose compression library
-  version 1.2.0.6, September 13th, 2003
+  version 1.2.0.7, September 21st, 2003
 
   Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler
 
@@ -37,8 +37,8 @@
 extern "C" {
 #endif
 
-#define ZLIB_VERSION "1.2.0.6"
-#define ZLIB_VERNUM 0x1206
+#define ZLIB_VERSION "1.2.0.7"
+#define ZLIB_VERNUM 0x1207
 
 /*
      The 'zlib' compression library provides in-memory compression and
diff --git a/zutil.h b/zutil.h
index db678b0..c2c98d9 100644
--- a/zutil.h
+++ b/zutil.h
@@ -181,6 +181,9 @@
 #      define vsnprintf _vsnprintf
 #    endif
 #  endif
+#  ifdef __SASC
+#    define NO_vsnprintf
+#  endif
 #endif
 
 #ifdef HAVE_STRERROR