summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-09-09 23:19:21 -0700
committerMark Adler <madler@alumni.caltech.edu>2011-09-09 23:19:21 -0700
commitb8c9ecb0765fc39423c07613d909c5193378bdfd (patch)
treec2a2964d00dcfee6c7426ffcdf8e8060727bc2bf
parent6759211ad8a5006689216a86c3267bb503bfccc1 (diff)
downloadzlib-b8c9ecb0765fc39423c07613d909c5193378bdfd.tar.gz
zlib-b8c9ecb0765fc39423c07613d909c5193378bdfd.tar.bz2
zlib-b8c9ecb0765fc39423c07613d909c5193378bdfd.zip
zlib 1.0.9v1.0.9
-rw-r--r--ChangeLog24
-rw-r--r--Makefile12
-rw-r--r--Makefile.in12
-rw-r--r--README38
-rw-r--r--adler32.c2
-rw-r--r--compress.c4
-rwxr-xr-xconfigure11
-rw-r--r--contrib/asm386/gvmat32.asm696
-rw-r--r--contrib/asm386/gvmat32c.c63
-rw-r--r--contrib/asm386/zlibvc.dsp612
-rw-r--r--contrib/asm386/zlibvc.dsw29
-rw-r--r--contrib/asm386/zlibvc.mak781
-rw-r--r--crc32.c4
-rw-r--r--deflate.c36
-rw-r--r--example.c17
-rw-r--r--gzio.c92
-rw-r--r--infblock.c40
-rw-r--r--inflate.c32
-rw-r--r--inftrees.c161
-rw-r--r--inftrees.h23
-rw-r--r--infutil.h3
-rw-r--r--minigzip.c6
-rw-r--r--msdos/zlib.def5
-rw-r--r--msdos/zlib.rc6
-rw-r--r--nt/zlib.dnt3
-rw-r--r--test.c2
-rw-r--r--uncompr.c2
-rw-r--r--zconf.h44
-rw-r--r--zlib.36
-rw-r--r--zlib.h152
-rw-r--r--ztest28975.c1
-rw-r--r--zutil.c4
-rw-r--r--zutil.h2
33 files changed, 1460 insertions, 1465 deletions
diff --git a/ChangeLog b/ChangeLog
index a94955f..e4d8871 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,30 @@
1 1
2 ChangeLog file for zlib 2 ChangeLog file for zlib
3 3
4Changes in 1.0.9 (17 Feb 1998)
5- added gzputs and gzgets functions
6- do not clear eof flag in gzseek (Mark Diekhans)
7- fix gzseek for files in transparent mode (Mark Diekhans)
8- do not assume that vsprintf returns the number of bytes written (Jens Krinke)
9- replace EXPORT with ZEXPORT to avoid conflict with other programs
10- added compress2 in zconf.h, zlib.def, zlib.dnt
11- new asm code from Gilles Vollant in contrib/asm386
12- simplify the inflate code (Mark):
13 . Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new()
14 . ZALLOC the length list in inflate_trees_fixed() instead of using stack
15 . ZALLOC the value area for huft_build() instead of using stack
16 . Simplify Z_FINISH check in inflate()
17
18- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8
19- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi)
20- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with
21 the declaration of FAR (Gilles VOllant)
22- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann)
23- read_buf buf parameter of type Bytef* instead of charf*
24- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout)
25- do not redeclare unlink in minigzip.c for WIN32 (John Bowler)
26- fix check for presence of directories in "make install" (Ian Willis)
27
4Changes in 1.0.8 (27 Jan 1998) 28Changes in 1.0.8 (27 Jan 1998)
5- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant) 29- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant)
6- fix gzgetc and gzputc for big endian systems (Markus Oberhumer) 30- fix gzgetc and gzputc for big endian systems (Markus Oberhumer)
diff --git a/Makefile b/Makefile
index 0de616c..f6c3ca7 100644
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,7 @@ CFLAGS=-O
23LDFLAGS=-L. -lz 23LDFLAGS=-L. -lz
24LDSHARED=$(CC) 24LDSHARED=$(CC)
25 25
26VER=1.0.8 26VER=1.0.9
27LIBS=libz.a 27LIBS=libz.a
28SHAREDLIB=libz.so 28SHAREDLIB=libz.so
29 29
@@ -44,7 +44,7 @@ DISTFILES = README INDEX ChangeLog configure Make*[a-z0-9] *.[ch] descrip.mms \
44 algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \ 44 algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \
45 nt/Makefile.nt nt/zlib.dnt contrib/README.contrib contrib/*.txt \ 45 nt/Makefile.nt nt/zlib.dnt contrib/README.contrib contrib/*.txt \
46 contrib/asm386/*.asm contrib/asm386/*.c \ 46 contrib/asm386/*.asm contrib/asm386/*.c \
47 contrib/asm386/*.bat contrib/asm386/*.mak contrib/iostream/*.cpp \ 47 contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/iostream/*.cpp \
48 contrib/iostream/*.h contrib/iostream2/*.h contrib/iostream2/*.cpp \ 48 contrib/iostream/*.h contrib/iostream2/*.h contrib/iostream2/*.cpp \
49 contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32 49 contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32
50 50
@@ -77,12 +77,12 @@ minigzip: minigzip.o $(LIBS)
77 $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) 77 $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
78 78
79install: $(LIBS) 79install: $(LIBS)
80 -@if [ ! $(prefix)/include ]; then mkdir $(prefix)/include; fi 80 -@if [ ! -d $(prefix)/include ]; then mkdir $(prefix)/include; fi
81 -@if [ ! $(exec_prefix)/lib ]; then mkdir $(exec_prefix)/lib; fi 81 -@if [ ! -d $(exec_prefix)/lib ]; then mkdir $(exec_prefix)/lib; fi
82 cp zlib.h zconf.h $(prefix)/include 82 cp zlib.h zconf.h $(prefix)/include
83 chmod 644 $(prefix)/include/zlib.h $(prefix)/include/zconf.h 83 chmod 644 $(prefix)/include/zlib.h $(prefix)/include/zconf.h
84 cp $(LIBS) $(exec_prefix)/lib 84 cp $(LIBS) $(exec_prefix)/lib
85 cd $(exec_prefix)/lib; chmod 644 $(LIBS) 85 cd $(exec_prefix)/lib; chmod 755 $(LIBS)
86 -@(cd $(exec_prefix)/lib; $(RANLIB) libz.a || true) >/dev/null 2>&1 86 -@(cd $(exec_prefix)/lib; $(RANLIB) libz.a || true) >/dev/null 2>&1
87 cd $(exec_prefix)/lib; if test -f $(SHAREDLIB).$(VER); then \ 87 cd $(exec_prefix)/lib; if test -f $(SHAREDLIB).$(VER); then \
88 rm -f $(SHAREDLIB) $(SHAREDLIB).1; \ 88 rm -f $(SHAREDLIB) $(SHAREDLIB).1; \
@@ -112,12 +112,14 @@ distclean: clean
112 112
113zip: 113zip:
114 mv Makefile Makefile~; cp -p Makefile.in Makefile 114 mv Makefile Makefile~; cp -p Makefile.in Makefile
115 rm -f test.c ztest*.c
115 v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\ 116 v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
116 zip -ul9 zlib$$v $(DISTFILES) 117 zip -ul9 zlib$$v $(DISTFILES)
117 mv Makefile~ Makefile 118 mv Makefile~ Makefile
118 119
119dist: 120dist:
120 mv Makefile Makefile~; cp -p Makefile.in Makefile 121 mv Makefile Makefile~; cp -p Makefile.in Makefile
122 rm -f test.c ztest*.c
121 d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\ 123 d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
122 rm -f $$d.tar.gz; \ 124 rm -f $$d.tar.gz; \
123 if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \ 125 if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \
diff --git a/Makefile.in b/Makefile.in
index 0de616c..f6c3ca7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -23,7 +23,7 @@ CFLAGS=-O
23LDFLAGS=-L. -lz 23LDFLAGS=-L. -lz
24LDSHARED=$(CC) 24LDSHARED=$(CC)
25 25
26VER=1.0.8 26VER=1.0.9
27LIBS=libz.a 27LIBS=libz.a
28SHAREDLIB=libz.so 28SHAREDLIB=libz.so
29 29
@@ -44,7 +44,7 @@ DISTFILES = README INDEX ChangeLog configure Make*[a-z0-9] *.[ch] descrip.mms \
44 algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \ 44 algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \
45 nt/Makefile.nt nt/zlib.dnt contrib/README.contrib contrib/*.txt \ 45 nt/Makefile.nt nt/zlib.dnt contrib/README.contrib contrib/*.txt \
46 contrib/asm386/*.asm contrib/asm386/*.c \ 46 contrib/asm386/*.asm contrib/asm386/*.c \
47 contrib/asm386/*.bat contrib/asm386/*.mak contrib/iostream/*.cpp \ 47 contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/iostream/*.cpp \
48 contrib/iostream/*.h contrib/iostream2/*.h contrib/iostream2/*.cpp \ 48 contrib/iostream/*.h contrib/iostream2/*.h contrib/iostream2/*.cpp \
49 contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32 49 contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32
50 50
@@ -77,12 +77,12 @@ minigzip: minigzip.o $(LIBS)
77 $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) 77 $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
78 78
79install: $(LIBS) 79install: $(LIBS)
80 -@if [ ! $(prefix)/include ]; then mkdir $(prefix)/include; fi 80 -@if [ ! -d $(prefix)/include ]; then mkdir $(prefix)/include; fi
81 -@if [ ! $(exec_prefix)/lib ]; then mkdir $(exec_prefix)/lib; fi 81 -@if [ ! -d $(exec_prefix)/lib ]; then mkdir $(exec_prefix)/lib; fi
82 cp zlib.h zconf.h $(prefix)/include 82 cp zlib.h zconf.h $(prefix)/include
83 chmod 644 $(prefix)/include/zlib.h $(prefix)/include/zconf.h 83 chmod 644 $(prefix)/include/zlib.h $(prefix)/include/zconf.h
84 cp $(LIBS) $(exec_prefix)/lib 84 cp $(LIBS) $(exec_prefix)/lib
85 cd $(exec_prefix)/lib; chmod 644 $(LIBS) 85 cd $(exec_prefix)/lib; chmod 755 $(LIBS)
86 -@(cd $(exec_prefix)/lib; $(RANLIB) libz.a || true) >/dev/null 2>&1 86 -@(cd $(exec_prefix)/lib; $(RANLIB) libz.a || true) >/dev/null 2>&1
87 cd $(exec_prefix)/lib; if test -f $(SHAREDLIB).$(VER); then \ 87 cd $(exec_prefix)/lib; if test -f $(SHAREDLIB).$(VER); then \
88 rm -f $(SHAREDLIB) $(SHAREDLIB).1; \ 88 rm -f $(SHAREDLIB) $(SHAREDLIB).1; \
@@ -112,12 +112,14 @@ distclean: clean
112 112
113zip: 113zip:
114 mv Makefile Makefile~; cp -p Makefile.in Makefile 114 mv Makefile Makefile~; cp -p Makefile.in Makefile
115 rm -f test.c ztest*.c
115 v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\ 116 v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
116 zip -ul9 zlib$$v $(DISTFILES) 117 zip -ul9 zlib$$v $(DISTFILES)
117 mv Makefile~ Makefile 118 mv Makefile~ Makefile
118 119
119dist: 120dist:
120 mv Makefile Makefile~; cp -p Makefile.in Makefile 121 mv Makefile Makefile~; cp -p Makefile.in Makefile
122 rm -f test.c ztest*.c
121 d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\ 123 d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
122 rm -f $$d.tar.gz; \ 124 rm -f $$d.tar.gz; \
123 if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \ 125 if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \
diff --git a/README b/README
index 0adc66f..c1d217f 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
1zlib 1.0.8 is a general purpose data compression library. All the code 1zlib 1.0.9 is a general purpose data compression library. All the code
2is thread safe. The data format used by the zlib library 2is thread safe. The data format used by the zlib library
3is described by RFCs (Request for Comments) 1950 to 1952 in the files 3is described by RFCs (Request for Comments) 1950 to 1952 in the files
4ftp://ds.internic.net/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate 4ftp://ds.internic.net/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate
@@ -25,18 +25,22 @@ Mark Nelson wrote an article about zlib for the Jan. 1997 issue of
25Dr. Dobb's Journal; a copy of the article is available in 25Dr. Dobb's Journal; a copy of the article is available in
26http://web2.airmail.net/markn/articles/zlibtool/zlibtool.htm 26http://web2.airmail.net/markn/articles/zlibtool/zlibtool.htm
27 27
28The changes made in version 1.0.8 are documented in the file ChangeLog. 28The changes made in version 1.0.9 are documented in the file ChangeLog.
29The main changes since 1.0.7 are: 29The main changes since 1.0.8 are:
30
31- added gzputs and gzgets functions
32- do not clear eof flag in gzseek (Mark Diekhans)
33- fix gzseek for files in transparent mode (Mark Diekhans)
34- do not assume that vsprintf returns the number of bytes written (Jens Krinke)
35- replace EXPORT with ZEXPORT to avoid conflict with other programs
36- added compress2 in zconf.h, zlib.def, zlib.dnt
37- new asm code from Gilles Vollant in contrib/asm386
38- simplify the inflate code (Mark):
39 . Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new()
40 . ZALLOC the length list in inflate_trees_fixed() instead of using stack
41 . ZALLOC the value area for huft_build() instead of using stack
42 . Simplify Z_FINISH check in inflate()
30 43
31- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant)
32- fix gzgetc and gzputc for big endian systems (Markus Oberhumer)
33- added compress2() to allow setting the compression level
34- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong)
35- use constant arrays for the static trees in trees.c instead of computing
36 them at run time (thanks to Ken Raeburn for this suggestion). To create
37 trees.h, compile with GEN_TREES_H and run "make test".
38- check return code of example in "make test" and display result
39- pass minigzip command line options to file_compress
40 44
41Unsupported third party contributions are provided in directory "contrib". 45Unsupported third party contributions are provided in directory "contrib".
42 46
@@ -65,9 +69,6 @@ Notes for some targets:
65 See contrib/visual-basic.txt for more information. 69 See contrib/visual-basic.txt for more information.
66 I don't know how to handle structures in Visual Basic, sorry. 70 I don't know how to handle structures in Visual Basic, sorry.
67 71
68- "make test" fails on Solaris 2.6 with gcc 2.8.0. It works with cc and
69 with gcc 2.7.2.1.
70
71- For 64-bit Irix, deflate.c must be compiled without any optimization. 72- For 64-bit Irix, deflate.c must be compiled without any optimization.
72 With -O, one libpng test fails. The test works in 32 bit mode (with 73 With -O, one libpng test fails. The test works in 32 bit mode (with
73 the -n32 compiler flag). The compiler bug has been reported to SGI. 74 the -n32 compiler flag). The compiler bug has been reported to SGI.
@@ -75,11 +76,12 @@ Notes for some targets:
75- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 76- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1
76 it works when compiled with cc. 77 it works when compiled with cc.
77 78
78- zlib doesn't work on HP-UX 9.05 with one cc compiler (the one not 79- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works
79 accepting the -O option). It works with the other cc compiler. 80 with other compilers. Use "make test" to check your compiler.
80 81
81- For shared memory multiprocessors, the decompression code assumes that 82- For shared memory multiprocessors, the decompression code assumes that
82 writes to pointers are atomic. 83 writes to pointers are atomic. Also the functions zalloc and zfree passed
84 to deflateInit must be multi-threaded in this case.
83 85
84- gzdopen is not supported on RISCOS, BEOS and Mac 86- gzdopen is not supported on RISCOS, BEOS and Mac
85 87
diff --git a/adler32.c b/adler32.c
index 675a46c..16cf9a7 100644
--- a/adler32.c
+++ b/adler32.c
@@ -18,7 +18,7 @@
18#define DO16(buf) DO8(buf,0); DO8(buf,8); 18#define DO16(buf) DO8(buf,0); DO8(buf,8);
19 19
20/* ========================================================================= */ 20/* ========================================================================= */
21uLong EXPORT adler32(adler, buf, len) 21uLong ZEXPORT adler32(adler, buf, len)
22 uLong adler; 22 uLong adler;
23 const Bytef *buf; 23 const Bytef *buf;
24 uInt len; 24 uInt len;
diff --git a/compress.c b/compress.c
index b77674a..1cee470 100644
--- a/compress.c
+++ b/compress.c
@@ -18,7 +18,7 @@
18 memory, Z_BUF_ERROR if there was not enough room in the output buffer, 18 memory, Z_BUF_ERROR if there was not enough room in the output buffer,
19 Z_STREAM_ERROR if the level parameter is invalid. 19 Z_STREAM_ERROR if the level parameter is invalid.
20*/ 20*/
21int EXPORT compress2 (dest, destLen, source, sourceLen, level) 21int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
22 Bytef *dest; 22 Bytef *dest;
23 uLongf *destLen; 23 uLongf *destLen;
24 const Bytef *source; 24 const Bytef *source;
@@ -58,7 +58,7 @@ int EXPORT compress2 (dest, destLen, source, sourceLen, level)
58 58
59/* =========================================================================== 59/* ===========================================================================
60 */ 60 */
61int EXPORT compress (dest, destLen, source, sourceLen) 61int ZEXPORT compress (dest, destLen, source, sourceLen)
62 Bytef *dest; 62 Bytef *dest;
63 uLongf *destLen; 63 uLongf *destLen;
64 const Bytef *source; 64 const Bytef *source;
diff --git a/configure b/configure
index f0d01e8..bde53b1 100755
--- a/configure
+++ b/configure
@@ -14,6 +14,10 @@
14# (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure) 14# (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure)
15# LDSHARED is the command to be used to create a shared library 15# LDSHARED is the command to be used to create a shared library
16 16
17# Incorrect settings of CC or CFLAGS may prevent creating a shared library.
18# If you have problems, try without defining CC and CFLAGS before reporting
19# an error.
20
17LIBS=libz.a 21LIBS=libz.a
18SHAREDLIB=libz.so 22SHAREDLIB=libz.so
19VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h` 23VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
@@ -23,6 +27,8 @@ prefix=${prefix-/usr/local}
23exec_prefix=${exec_prefix-$prefix} 27exec_prefix=${exec_prefix-$prefix}
24shared_ext='.so' 28shared_ext='.so'
25shared=0 29shared=0
30old_cc="$CC"
31old_cflags="$CFLAGS"
26 32
27case "$1" in 33case "$1" in
28 -s* | --s*) shared=1; shift;; 34 -s* | --s*) shared=1; shift;;
@@ -96,9 +102,12 @@ if test $shared -eq 1; then
96 CFLAGS="$SFLAGS" 102 CFLAGS="$SFLAGS"
97 LIBS="$SHAREDLIB.$VER" 103 LIBS="$SHAREDLIB.$VER"
98 echo Building shared library $SHAREDLIB.$VER with $CC. 104 echo Building shared library $SHAREDLIB.$VER with $CC.
99 else 105 elif test -z "$old_cc" -a -z "$old_cflags"; then
100 echo No shared library suppport. 106 echo No shared library suppport.
101 shared=0; 107 shared=0;
108 else
109 echo 'No shared library suppport; try without defining CC and CFLAGS'
110 shared=0;
102 fi 111 fi
103fi 112fi
104if test $shared -eq 0; then 113if test $shared -eq 0; then
diff --git a/contrib/asm386/gvmat32.asm b/contrib/asm386/gvmat32.asm
index 2918a5d..28d527f 100644
--- a/contrib/asm386/gvmat32.asm
+++ b/contrib/asm386/gvmat32.asm
@@ -9,40 +9,36 @@
9; For Visual C++ 4.2 and ML 6.11c (version in directory \MASM611C of Win95 DDK) 9; For Visual C++ 4.2 and ML 6.11c (version in directory \MASM611C of Win95 DDK)
10; I compile with : "ml /coff /Zi /c gvmat32.asm" 10; I compile with : "ml /coff /Zi /c gvmat32.asm"
11; 11;
12; uInt longest_match_gvasm(IPos cur_match,int* match_start_ptr,uInt scan_end,
13; uInt scan_start,ush* prev,uch* window,int best_len,
14; IPos limit,uInt chain_length,uch* scanrp,
15; uInt nice_match);
16 12
17;uInt longest_match(s, cur_match) 13;uInt longest_match_7fff(s, cur_match)
18; deflate_state *s; 14; deflate_state *s;
19; IPos cur_match; /* current match */ 15; IPos cur_match; /* current match */
20 16
21 NbStack equ 76 17 NbStack equ 76
22 cur_match equ dword ptr[esp+NbStack-0] 18 cur_match equ dword ptr[esp+NbStack-0]
23 str_s equ dword ptr[esp+NbStack-4] 19 str_s equ dword ptr[esp+NbStack-4]
24 ; 5 dword on top (ret,ebp,esi,edi,ebx) 20; 5 dword on top (ret,ebp,esi,edi,ebx)
25 adrret equ dword ptr[esp+NbStack-8] 21 adrret equ dword ptr[esp+NbStack-8]
26 pushebp equ dword ptr[esp+NbStack-12] 22 pushebp equ dword ptr[esp+NbStack-12]
27 pushedi equ dword ptr[esp+NbStack-16] 23 pushedi equ dword ptr[esp+NbStack-16]
28 pushesi equ dword ptr[esp+NbStack-20] 24 pushesi equ dword ptr[esp+NbStack-20]
29 pushebx equ dword ptr[esp+NbStack-24] 25 pushebx equ dword ptr[esp+NbStack-24]
30 26
31 chain_length equ dword ptr [esp+NbStack-28] 27 chain_length equ dword ptr [esp+NbStack-28]
32 limit equ dword ptr [esp+NbStack-32] 28 limit equ dword ptr [esp+NbStack-32]
33 best_len equ dword ptr [esp+NbStack-36] 29 best_len equ dword ptr [esp+NbStack-36]
34 window equ dword ptr [esp+NbStack-40] 30 window equ dword ptr [esp+NbStack-40]
35 prev equ dword ptr [esp+NbStack-44] 31 prev equ dword ptr [esp+NbStack-44]
36 scan_start equ word ptr [esp+NbStack-48] 32 scan_start equ word ptr [esp+NbStack-48]
37 scan_end equ word ptr [esp+NbStack-52] 33 wmask equ dword ptr [esp+NbStack-52]
38 match_start_ptr equ dword ptr [esp+NbStack-56] 34 match_start_ptr equ dword ptr [esp+NbStack-56]
39 nice_match equ dword ptr [esp+NbStack-60] 35 nice_match equ dword ptr [esp+NbStack-60]
40 scanrp equ dword ptr [esp+NbStack-64] 36 scan equ dword ptr [esp+NbStack-64]
41 37
42 windowlen equ dword ptr [esp+NbStack-68] 38 windowlen equ dword ptr [esp+NbStack-68]
43 match_start equ dword ptr [esp+NbStack-72] 39 match_start equ dword ptr [esp+NbStack-72]
44 strend equ dword ptr [esp+NbStack-76] 40 strend equ dword ptr [esp+NbStack-76]
45 NbStackAdd equ (76-24) 41 NbStackAdd equ (NbStack-24)
46 42
47 .386p 43 .386p
48 44
@@ -50,11 +46,11 @@
50 .MODEL FLAT 46 .MODEL FLAT
51 47
52 48
53@lmtype TYPEDEF PROTO C :PTR , :SDWORD
54longest_match_c PROTO @lmtype
55 49
56 ; all the +4 offsets are due to the addition of pending_buf_size 50; all the +4 offsets are due to the addition of pending_buf_size (in zlib
57 ; in the deflate_state structure since the asm code was first written 51; in the deflate_state structure since the asm code was first written
52; (if you compile with zlib 1.0.4 or older, remove the +4).
53; Note : these value are good with a 8 bytes boundary pack structure
58 dep_chain_length equ 70h+4 54 dep_chain_length equ 70h+4
59 dep_window equ 2ch+4 55 dep_window equ 2ch+4
60 dep_strstart equ 60h+4 56 dep_strstart equ 60h+4
@@ -68,398 +64,496 @@ longest_match_c PROTO @lmtype
68 dep_lookahead equ 68h+4 64 dep_lookahead equ 68h+4
69 65
70 66
71_TEXT segment 67_TEXT segment
72 public _longest_match_asm7fff
73 68
74 MAX_MATCH equ 258 69IFDEF NOUNDERLINE
75 MIN_MATCH equ 3 70 public longest_match_7fff
76 MIN_LOOKAHEAD equ (MAX_MATCH+MIN_MATCH+1) 71; public match_init
77 72ELSE
78; initialize or check the variables used in match.asm. 73 public _longest_match_7fff
74; public _match_init
75ENDIF
79 76
77 MAX_MATCH equ 258
78 MIN_MATCH equ 3
79 MIN_LOOKAHEAD equ (MAX_MATCH+MIN_MATCH+1)
80 80
81; -----------------------------------------------------------------------
82; Set match_start to the longest match starting at the given string and
83; return its length. Matches shorter or equal to prev_length are discarded,
84; in which case the result is equal to prev_length and match_start is
85; garbage.
86; IN assertions: cur_match is the head of the hash chain for the current
87; string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
88 81
89; int longest_match(cur_match)
90 82
91_longest_match_asm7fff proc near 83IFDEF NOUNDERLINE
84;match_init proc near
85; ret
86;match_init endp
87ELSE
88;_match_init proc near
89; ret
90;_match_init endp
91ENDIF
92 92
93 93
94IFDEF NOUNDERLINE
95longest_match_7fff proc near
96ELSE
97_longest_match_7fff proc near
98ENDIF
94 99
95 ; return address 100 mov edx,[esp+4]
96 101
97 mov eax,[esp+4]
98 mov bx,[eax+dep_w_mask]
99 cmp bx,7fffh
100 jnz longest_match_c
101 102
102 push ebp
103 push edi
104 push esi
105 push ebx
106 103
107 sub esp,NbStackAdd 104 push ebp
105 push edi
106 push esi
107 push ebx
108 108
109 ;//mov ebp,str_s 109 sub esp,NbStackAdd
110 mov ebp,eax
111 110
112 mov eax,[ebp+dep_max_chain_length] 111; initialize or check the variables used in match.asm.
113 mov ebx,[ebp+dep_prev_length] 112 mov ebp,edx
114 cmp [ebp+dep_good_match],ebx ; if prev_length>=good_match chain_length >>= 2 113
115 ja noshr 114; chain_length = s->max_chain_length
116 shr eax,2 115; if (prev_length>=good_match) chain_length >>= 2
116 mov edx,[ebp+dep_chain_length]
117 mov ebx,[ebp+dep_prev_length]
118 cmp [ebp+dep_good_match],ebx
119 ja noshr
120 shr edx,2
117noshr: 121noshr:
118 mov edi,[ebp+dep_nice_match] 122; we increment chain_length because in the asm, the --chain_lenght is in the beginning of the loop
119 mov chain_length,eax 123 inc edx
120 mov edx,[ebp+dep_lookahead] 124 mov edi,[ebp+dep_nice_match]
121 cmp edx,edi 125 mov chain_length,edx
122;if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; 126 mov eax,[ebp+dep_lookahead]
123 jae nolookaheadnicematch 127 cmp eax,edi
124 mov edi,edx 128; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
129 jae nolookaheadnicematch
130 mov edi,eax
125nolookaheadnicematch: 131nolookaheadnicematch:
126 mov best_len,ebx 132; best_len = s->prev_length
127 133 mov best_len,ebx
128 134
129 mov esi,[ebp+dep_window] 135; window = s->window
130 mov ecx,[ebp+dep_strstart] 136 mov esi,[ebp+dep_window]
131 mov window,esi 137 mov ecx,[ebp+dep_strstart]
132 138 mov window,esi
133 mov nice_match,edi 139
134 add esi,ecx 140 mov nice_match,edi
135 mov scanrp,esi 141; scan = window + strstart
136 mov ax,word ptr [esi] 142 add esi,ecx
137 mov bx,word ptr [esi+ebx-1] 143 mov scan,esi
138 add esi,MAX_MATCH-1 144; dx = *window
139 mov scan_start,ax 145 mov dx,word ptr [esi]
140 mov strend,esi 146; bx = *(window+best_len-1)
141 mov scan_end,bx 147 mov bx,word ptr [esi+ebx-1]
148 add esi,MAX_MATCH-1
149; scan_start = *scan
150 mov scan_start,dx
151; strend = scan + MAX_MATCH-1
152 mov strend,esi
153; bx = scan_end = *(window+best_len-1)
142 154
143; IPos limit = s->strstart > (IPos)MAX_DIST(s) ? 155; IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
144; s->strstart - (IPos)MAX_DIST(s) : NIL; 156; s->strstart - (IPos)MAX_DIST(s) : NIL;
145 157
146 mov esi,[ebp+dep_w_size] 158 mov esi,[ebp+dep_w_size]
147 sub esi,MIN_LOOKAHEAD 159 sub esi,MIN_LOOKAHEAD
148 ; here esi = MAX_DIST(s) 160; here esi = MAX_DIST(s)
149 sub ecx,esi 161 sub ecx,esi
150 ja nodist 162 ja nodist
151 xor ecx,ecx 163 xor ecx,ecx
152nodist: 164nodist:
153 mov limit,ecx 165 mov limit,ecx
154
155
156
157
158 mov eax,[ebp+dep_prev]
159 mov prev,eax
160 166
161 mov ebx,dword ptr [ebp+dep_match_start] 167; prev = s->prev
162 mov bp,scan_start 168 mov edx,[ebp+dep_prev]
163 mov edx,cur_match 169 mov prev,edx
164 mov match_start,ebx
165 170
166 mov bx,scan_end 171;
167 mov eax,window 172 mov edx,dword ptr [ebp+dep_match_start]
168 mov edi,eax 173 mov bp,scan_start
169 add edi,best_len 174 mov eax,cur_match
170 mov esi,prev 175 mov match_start,edx
171 dec edi 176
172 mov windowlen,edi 177 mov edx,window
173 178 mov edi,edx
174 jmp beginloop2 179 add edi,best_len
175 align 4 180 mov esi,prev
181 dec edi
182; windowlen = window + best_len -1
183 mov windowlen,edi
184
185 jmp beginloop2
186 align 4
176 187
177; here, in the loop 188; here, in the loop
178;;;; eax = chain_length 189; eax = ax = cur_match
179; edx = dx = cur_match
180; ecx = limit 190; ecx = limit
181; bx = scan_end 191; bx = scan_end
182; bp = scan_start 192; bp = scan_start
183; edi = windowlen (window + best_len) 193; edi = windowlen (window + best_len -1)
184; esi = prev 194; esi = prev
185 195
186 196
187;// here; eax <=16 197;// here; chain_length <=16
188normalbeg0add16: 198normalbeg0add16:
189 add chain_length,16 199 add chain_length,16
190 jz exitloop 200 jz exitloop
191normalbeg0: 201normalbeg0:
192 cmp word ptr[edi+edx-0],bx 202 cmp word ptr[edi+eax],bx
193 je normalbeg2 203 je normalbeg2noroll
194 and edx,7fffh 204rcontlabnoroll:
195 mov dx,word ptr[esi+edx*2] 205; cur_match = prev[cur_match & wmask]
196 cmp ecx,edx 206 and eax,7fffh
197 jnb exitloop 207 mov ax,word ptr[esi+eax*2]
198 dec chain_length 208; if cur_match > limit, go to exitloop
199 jnz normalbeg0 209 cmp ecx,eax
200;jnbexitloopshort1: 210 jnb exitloop
201 jmp exitloop 211; if --chain_length != 0, go to exitloop
212 dec chain_length
213 jnz normalbeg0
214 jmp exitloop
215
216normalbeg2noroll:
217; if (scan_start==*(cur_match+window)) goto normalbeg2
218 cmp bp,word ptr[edx+eax]
219 jne rcontlabnoroll
220 jmp normalbeg2
202 221
203contloop3: 222contloop3:
204 mov edi,windowlen 223 mov edi,windowlen
205 224
206; cur_match = prev[cur_match & wmask] 225; cur_match = prev[cur_match & wmask]
207 and edx,7fffh 226 and eax,7fffh
208 mov dx,word ptr[esi+edx*2] 227 mov ax,word ptr[esi+eax*2]
209; if cur_match > limit, go to exitloop 228; if cur_match > limit, go to exitloop
210 cmp ecx,edx 229 cmp ecx,eax
211jnbexitloopshort1: 230jnbexitloopshort1:
212 jnb exitloop 231 jnb exitloop
213; if --chain_length != 0, go to exitloop 232; if --chain_length != 0, go to exitloop
214 233
234
235; begin the main loop
215beginloop2: 236beginloop2:
216 sub chain_length,16+1 237 sub chain_length,16+1
217 jna normalbeg0add16 238; if chain_length <=16, don't use the unrolled loop
239 jna normalbeg0add16
218 240
219do16: 241do16:
220 cmp word ptr[edi+edx],bx 242 cmp word ptr[edi+eax],bx
221 je normalbeg2dc0 243 je normalbeg2dc0
222 244
223maccn MACRO lab 245maccn MACRO lab
224 and edx,7fffh 246 and eax,7fffh
225 mov dx,word ptr[esi+edx*2] 247 mov ax,word ptr[esi+eax*2]
226 cmp ecx,edx 248 cmp ecx,eax
227 jnb exitloop 249 jnb exitloop
228 cmp word ptr[edi+edx-0],bx 250 cmp word ptr[edi+eax],bx
229 je lab 251 je lab
230 ENDM 252 ENDM
231 253
232rcontloop0: 254rcontloop0:
233 maccn normalbeg2dc1 255 maccn normalbeg2dc1
234 256
235rcontloop1: 257rcontloop1:
236 maccn normalbeg2dc2 258 maccn normalbeg2dc2
237 259
238rcontloop2: 260rcontloop2:
239 maccn normalbeg2dc3 261 maccn normalbeg2dc3
240 262
241rcontloop3: 263rcontloop3:
242 maccn normalbeg2dc4 264 maccn normalbeg2dc4
243 265
244rcontloop4: 266rcontloop4:
245 maccn normalbeg2dc5 267 maccn normalbeg2dc5
246 268
247rcontloop5: 269rcontloop5:
248 maccn normalbeg2dc6 270 maccn normalbeg2dc6
249 271
250rcontloop6: 272rcontloop6:
251 maccn normalbeg2dc7 273 maccn normalbeg2dc7
252 274
253rcontloop7: 275rcontloop7:
254 maccn normalbeg2dc8 276 maccn normalbeg2dc8
255 277
256rcontloop8: 278rcontloop8:
257 maccn normalbeg2dc9 279 maccn normalbeg2dc9
258 280
259rcontloop9: 281rcontloop9:
260 maccn normalbeg2dc10 282 maccn normalbeg2dc10
261 283
262rcontloop10: 284rcontloop10:
263 maccn normalbeg2dc11 285 maccn short normalbeg2dc11
264 286
265rcontloop11: 287rcontloop11:
266 maccn short normalbeg2dc12 288 maccn short normalbeg2dc12
267 289
268rcontloop12: 290rcontloop12:
269 maccn short normalbeg2dc13 291 maccn short normalbeg2dc13
270 292
271rcontloop13: 293rcontloop13:
272 maccn short normalbeg2dc14 294 maccn short normalbeg2dc14
273 295
274rcontloop14: 296rcontloop14:
275 maccn short normalbeg2dc15 297 maccn short normalbeg2dc15
276 298
277rcontloop15: 299rcontloop15:
278 and edx,7fffh 300 and eax,7fffh
279 mov dx,word ptr[esi+edx*2] 301 mov ax,word ptr[esi+eax*2]
280 cmp ecx,edx 302 cmp ecx,eax
281 jnb short exitloopshort 303 jnb exitloop
282 304
283 sub chain_length,16 305 sub chain_length,16
284 ja do16 306 ja do16
285 jmp normalbeg0add16 307 jmp normalbeg0add16
286 308
287;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 309;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
288 310
289exitloopshort: 311normbeg MACRO rcontlab,valsub
290 jmp exitloop 312; if we are here, we know that *(match+best_len-1) == scan_end
313 cmp bp,word ptr[edx+eax]
314; if (match != scan_start) goto rcontlab
315 jne rcontlab
316; calculate the good chain_length, and we'll compare scan and match string
317 add chain_length,16-valsub
318 jmp iseq
319 ENDM
291 320
292normbeg MACRO rcontlab,valsub 321
293 cmp bp,word ptr[eax+edx] 322normalbeg2dc11:
294 jne rcontlab 323 normbeg rcontloop11,11
295 add chain_length,16-valsub
296 jmp iseq
297 ENDM
298 324
299normalbeg2dc12: 325normalbeg2dc12:
300 normbeg rcontloop12,12 326 normbeg short rcontloop12,12
301 327
302normalbeg2dc13: 328normalbeg2dc13:
303 normbeg rcontloop13,13 329 normbeg short rcontloop13,13
304 330
305normalbeg2dc14: 331normalbeg2dc14:
306 normbeg rcontloop14,14 332 normbeg short rcontloop14,14
307 333
308normalbeg2dc15: 334normalbeg2dc15:
309 normbeg rcontloop15,15 335 normbeg short rcontloop15,15
310
311normalbeg2dc11:
312 normbeg rcontloop11,11
313 336
314normalbeg2dc10: 337normalbeg2dc10:
315 normbeg rcontloop10,10 338 normbeg rcontloop10,10
316
317 339
318normalbeg2dc9: 340normalbeg2dc9:
319 normbeg rcontloop9,9 341 normbeg rcontloop9,9
320 342
321normalbeg2dc8: 343normalbeg2dc8:
322 normbeg rcontloop8,8 344 normbeg rcontloop8,8
323 345
324normalbeg2dc7: 346normalbeg2dc7:
325 normbeg rcontloop7,7 347 normbeg rcontloop7,7
326
327normalbeg2dc5:
328 normbeg rcontloop5,5
329
330
331
332
333 348
334normalbeg2dc6: 349normalbeg2dc6:
335 normbeg rcontloop6,6 350 normbeg rcontloop6,6
351
352normalbeg2dc5:
353 normbeg rcontloop5,5
336 354
337normalbeg2dc4: 355normalbeg2dc4:
338 normbeg rcontloop4,4 356 normbeg rcontloop4,4
339 357
340normalbeg2dc3: 358normalbeg2dc3:
341 normbeg rcontloop3,3 359 normbeg rcontloop3,3
342 360
343normalbeg2dc2: 361normalbeg2dc2:
344 normbeg rcontloop2,2 362 normbeg rcontloop2,2
345 363
346normalbeg2dc1: 364normalbeg2dc1:
347 normbeg rcontloop1,1 365 normbeg rcontloop1,1
348 366
349normalbeg2dc0: 367normalbeg2dc0:
350 normbeg rcontloop0,0 368 normbeg rcontloop0,0
351 369
352 370
353; we go in normalbeg2 because *(ushf*)(match+best_len-1) == scan_end 371; we go in normalbeg2 because *(ushf*)(match+best_len-1) == scan_end
354 372
355normalbeg2: 373normalbeg2:
374 mov edi,window
356 375
357 ; 10 nop here take 10% time 376 cmp bp,word ptr[edi+eax]
358 mov edi,window 377 jne contloop3 ; if *(ushf*)match != scan_start, continue
359 ;mov chain_length,eax ; now, we need eax...
360
361 cmp bp,word ptr[edi+edx]
362 jne contloop3 ; if *(ushf*)match != scan_start, continue
363 378
364iseq: 379iseq:
380; if we are here, we know that *(match+best_len-1) == scan_end
381; and (match == scan_start)
365 382
366 mov edi,eax 383 mov edi,edx
367 mov esi,scanrp ; esi = scan 384 mov esi,scan ; esi = scan
368 add edi,edx ; edi = window + cur_match = match 385 add edi,eax ; edi = window + cur_match = match
369 386
370 387 mov edx,[esi+3] ; compare manually dword at match+3
371 mov eax,[esi+3] ; compare manually dword at match+3 388 xor edx,[edi+3] ; and scan +3
372 xor eax,[edi+3] ; and scan +3
373 389
374 jz begincompare ; if equal, go to long compare 390 jz begincompare ; if equal, go to long compare
375 391
376 ; we will determine the unmatch byte and calculate len (in esi) 392; we will determine the unmatch byte and calculate len (in esi)
377 or al,al 393 or dl,dl
378 je eq1rr 394 je eq1rr
379 mov esi,3 395 mov esi,3
380 jmp trfinval 396 jmp trfinval
381eq1rr: 397eq1rr:
382 or ax,ax 398 or dx,dx
383 je eq1 399 je eq1
384 400
385 mov esi,4 401 mov esi,4
386 jmp trfinval 402 jmp trfinval
387eq1: 403eq1:
388 shl eax,8 404 and edx,0ffffffh
389 jz eq11 405 jz eq11
390 mov esi,5 406 mov esi,5
391 jmp trfinval 407 jmp trfinval
392eq11: 408eq11:
393 mov esi,6 409 mov esi,6
394 jmp trfinval 410 jmp trfinval
395 411
396begincompare: 412begincompare:
397 ; here we now scan and match begin same 413 ; here we now scan and match begin same
398 add edi,6 414 add edi,6
399 add esi,6 415 add esi,6
400 mov ecx,(MAX_MATCH-(2+4))/4 ;//; scan for at most MAX_MATCH bytes 416 mov ecx,(MAX_MATCH-(2+4))/4 ; scan for at most MAX_MATCH bytes
401 repe cmpsd ;//; loop until mismatch 417 repe cmpsd ; loop until mismatch
402 418
403 je trfin ; go to trfin if not unmatch 419 je trfin ; go to trfin if not unmatch
404 ; we determine the unmatch byte 420; we determine the unmatch byte
405 sub esi,4 421 sub esi,4
406 mov eax,[edi-4] 422 mov edx,[edi-4]
407 xor eax,[esi] 423 xor edx,[esi]
408 or al,al 424
409 425 or dl,dl
410 jnz trfin 426 jnz trfin
411 inc esi 427 inc esi
412 428
413 or ax,ax 429 or dx,dx
414 jnz trfin 430 jnz trfin
415 inc esi 431 inc esi
416 432
417 shl eax,8 433 and edx,0ffffffh
418 jnz trfin 434 jnz trfin
419 inc esi 435 inc esi
420 436
421trfin: 437trfin:
422 sub esi,scanrp ; esi = len 438 sub esi,scan ; esi = len
423trfinval: 439trfinval:
424 cmp esi,best_len ; if len <= best_len, go contloop2 440; here we have finised compare, and esi contain len of equal string
425 jbe contloop2 441 cmp esi,best_len ; if len > best_len, go newbestlen
426 442 ja short newbestlen
427 mov best_len,esi ; len become best_len 443; now we restore edx, ecx and esi, for the big loop
428 444 mov esi,prev
429 mov match_start,edx 445 mov ecx,limit
430 cmp esi,nice_match ;//; if esi >= nice_match, exit 446 mov edx,window
431 mov ecx,scanrp 447 jmp contloop3
432 jae exitloop 448
433 add esi,window 449newbestlen:
434 add ecx,best_len 450 mov best_len,esi ; len become best_len
435 dec esi 451
436 mov windowlen,esi 452 mov match_start,eax ; save new position as match_start
437 mov bx,[ecx-1] 453 cmp esi,nice_match ; if best_len >= nice_match, exit
438 454 jae exitloop
439 455 mov ecx,scan
440; now we restore eax, ecx and esi, for the big loop : 456 mov edx,window ; restore edx=window
441contloop2: 457 add ecx,esi
442 mov esi,prev 458 add esi,edx
443 mov ecx,limit 459
444 ;mov eax,chain_length 460 dec esi
445 mov eax,window 461 mov windowlen,esi ; windowlen = window + best_len-1
446 jmp contloop3 462 mov bx,[ecx-1] ; bx = *(scan+best_len-1) = scan_end
447 463
448exitloop: 464; now we restore ecx and esi, for the big loop :
449 mov ebx,match_start 465 mov esi,prev
450 mov ebp,str_s 466 mov ecx,limit
451 mov dword ptr [ebp+dep_match_start],ebx 467 jmp contloop3
452 mov eax,best_len 468
453 add esp,NbStackAdd 469exitloop:
454 470; exit : s->match_start=match_start
455 471 mov ebx,match_start
456 pop ebx 472 mov ebp,str_s
457 pop esi 473 mov ecx,best_len
458 pop edi 474 mov dword ptr [ebp+dep_match_start],ebx
459 pop ebp 475 mov eax,dword ptr [ebp+dep_lookahead]
460 ret 476 cmp ecx,eax
461 477 ja minexlo
462_longest_match_asm7fff endp 478 mov eax,ecx
479minexlo:
480; return min(best_len,s->lookahead)
481
482; restore stack and register ebx,esi,edi,ebp
483 add esp,NbStackAdd
484
485 pop ebx
486 pop esi
487 pop edi
488 pop ebp
489 ret
490InfoAuthor:
491; please don't remove this string !
492; Your are free use gvmat32 in any fre or commercial apps if you don't remove the string in the binary!
493 db 0dh,0ah,"GVMat32 optimised assembly code written 1996-98 by Gilles Vollant",0dh,0ah
494
495
496
497IFDEF NOUNDERLINE
498longest_match_7fff endp
499ELSE
500_longest_match_7fff endp
501ENDIF
502
503
504IFDEF NOUNDERLINE
505cpudetect32 proc near
506ELSE
507_cpudetect32 proc near
508ENDIF
509
510
511 pushfd ; push original EFLAGS
512 pop eax ; get original EFLAGS
513 mov ecx, eax ; save original EFLAGS
514 xor eax, 40000h ; flip AC bit in EFLAGS
515 push eax ; save new EFLAGS value on stack
516 popfd ; replace current EFLAGS value
517 pushfd ; get new EFLAGS
518 pop eax ; store new EFLAGS in EAX
519 xor eax, ecx ; can’t toggle AC bit, processor=80386
520 jz end_cpu_is_386 ; jump if 80386 processor
521 push ecx
522 popfd ; restore AC bit in EFLAGS first
523
524 pushfd
525 pushfd
526 pop ecx
527
528 mov eax, ecx ; get original EFLAGS
529 xor eax, 200000h ; flip ID bit in EFLAGS
530 push eax ; save new EFLAGS value on stack
531 popfd ; replace current EFLAGS value
532 pushfd ; get new EFLAGS
533 pop eax ; store new EFLAGS in EAX
534 popfd ; restore original EFLAGS
535 xor eax, ecx ; can’t toggle ID bit,
536 je is_old_486 ; processor=old
537
538 mov eax,1
539 db 0fh,0a2h ;CPUID
540
541exitcpudetect:
542 ret
543
544end_cpu_is_386:
545 mov eax,0300h
546 jmp exitcpudetect
547
548is_old_486:
549 mov eax,0400h
550 jmp exitcpudetect
551
552IFDEF NOUNDERLINE
553cpudetect32 endp
554ELSE
555_cpudetect32 endp
556ENDIF
463 557
464_TEXT ends 558_TEXT ends
465end 559end
diff --git a/contrib/asm386/gvmat32c.c b/contrib/asm386/gvmat32c.c
index 43d530b..d853bb7 100644
--- a/contrib/asm386/gvmat32c.c
+++ b/contrib/asm386/gvmat32c.c
@@ -7,7 +7,6 @@
7 * (assembly code is faster with a fixed wmask) 7 * (assembly code is faster with a fixed wmask)
8 * 8 *
9 */ 9 */
10//#pragma optimize("agt",on)
11 10
12#include "deflate.h" 11#include "deflate.h"
13 12
@@ -15,65 +14,31 @@
15#include <windows.h> 14#include <windows.h>
16 15
17#ifdef ASMV 16#ifdef ASMV
18
19#define NIL 0 17#define NIL 0
20 18
21static unsigned int tot=0;
22static unsigned int totl0=0;
23static unsigned int totl0p0=0;
24static unsigned int ba0=0;
25static unsigned int ba1=0;
26static unsigned int cpta=0;
27static unsigned int cptb=0;
28
29#define UNALIGNED_OK 19#define UNALIGNED_OK
30#define gvshow(a,b,c,d)
31/*
32void gvshow(int chain_length,int len,int limit,ushf* prev)
33{
34static int ival=0;
35char sz[80];
36unsigned long i;
37int prev0=*prev;
38 ival++;
39 //wsprintf(sz,"call %u, len=%u, chain_length=%u\n",ival,len,chain_length);
40 //OutputDebugString(sz);
41 tot++;
42 if (limit==NIL)
43 totl0++;
44 if ((limit==NIL) && (prev0==0))
45 totl0p0++;
46 for (i=limit+1;i<32768;i++)
47 {
48 ush va=*(prev+i);
49 if (ba0>4000000000)
50 {
51 ba0+=10;
52 }
53 ba0++;
54 if ((va>limit) || (va==0))
55 continue;
56 ba1++;
57 }
58}
59*/
60 20
61 21
62/* if your C compiler don't add underline before function name, 22/* if your C compiler don't add underline before function name,
63 define ADD_UNDERLINE_ASMFUNC */ 23 define ADD_UNDERLINE_ASMFUNC */
64#ifdef ADD_UNDERLINE_ASMFUNC 24#ifdef ADD_UNDERLINE_ASMFUNC
65#define longest_match_asm7fff _longest_match_asm7fff 25#define longest_match_7fff _longest_match_7fff
66#endif 26#endif
27
28
29
67void match_init() 30void match_init()
68{ 31{
69} 32}
70 33
34unsigned long cpudetect32();
35
71uInt longest_match_c( 36uInt longest_match_c(
72 deflate_state *s, 37 deflate_state *s,
73 IPos cur_match); /* current match */ 38 IPos cur_match); /* current match */
74 39
75 40
76uInt longest_match_asm7fff( 41uInt longest_match_7fff(
77 deflate_state *s, 42 deflate_state *s,
78 IPos cur_match); /* current match */ 43 IPos cur_match); /* current match */
79 44
@@ -81,9 +46,15 @@ uInt longest_match(
81 deflate_state *s, 46 deflate_state *s,
82 IPos cur_match) /* current match */ 47 IPos cur_match) /* current match */
83{ 48{
84 if (s->w_mask == 0x7fff) 49 static uInt iIsPPro=2;
85 return longest_match_asm7fff(s,cur_match); 50
86 return longest_match_c(s,cur_match); 51 if ((s->w_mask == 0x7fff) && (iIsPPro==0))
52 return longest_match_7fff(s,cur_match);
53
54 if (iIsPPro==2)
55 iIsPPro = (((cpudetect32()/0x100)&0xf)>=6) ? 1 : 0;
56
57 return longest_match_c(s,cur_match);
87} 58}
88 59
89 60
@@ -222,7 +193,7 @@ uInt longest_match_c(s, cur_match)
222 } while ((cur_match = prev[cur_match & wmask]) > limit 193 } while ((cur_match = prev[cur_match & wmask]) > limit
223 && --chain_length != 0); 194 && --chain_length != 0);
224 195
225 if ((uInt)best_len <= s->lookahead) return best_len; 196 if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
226 return s->lookahead; 197 return s->lookahead;
227} 198}
228 199
diff --git a/contrib/asm386/zlibvc.dsp b/contrib/asm386/zlibvc.dsp
new file mode 100644
index 0000000..98676db
--- /dev/null
+++ b/contrib/asm386/zlibvc.dsp
@@ -0,0 +1,612 @@
1# Microsoft Developer Studio Project File - Name="zlibvc" - Package Owner=<4>
2# Microsoft Developer Studio Generated Build File, Format Version 5.00
3# ** DO NOT EDIT **
4
5# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
6# TARGTYPE "Win32 (ALPHA) Dynamic-Link Library" 0x0602
7
8CFG=zlibvc - Win32 Release
9!MESSAGE This is not a valid makefile. To build this project using NMAKE,
10!MESSAGE use the Export Makefile command and run
11!MESSAGE
12!MESSAGE NMAKE /f "zlibvc.mak".
13!MESSAGE
14!MESSAGE You can specify a configuration when running NMAKE
15!MESSAGE by defining the macro CFG on the command line. For example:
16!MESSAGE
17!MESSAGE NMAKE /f "zlibvc.mak" CFG="zlibvc - Win32 Release"
18!MESSAGE
19!MESSAGE Possible choices for configuration are:
20!MESSAGE
21!MESSAGE "zlibvc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
22!MESSAGE "zlibvc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
23!MESSAGE "zlibvc - Win32 ReleaseAxp" (based on\
24 "Win32 (ALPHA) Dynamic-Link Library")
25!MESSAGE "zlibvc - Win32 ReleaseWithoutAsm" (based on\
26 "Win32 (x86) Dynamic-Link Library")
27!MESSAGE "zlibvc - Win32 ReleaseWithoutCrtdll" (based on\
28 "Win32 (x86) Dynamic-Link Library")
29!MESSAGE
30
31# Begin Project
32# PROP Scc_ProjName ""
33# PROP Scc_LocalPath ""
34
35!IF "$(CFG)" == "zlibvc - Win32 Release"
36
37# PROP BASE Use_MFC 0
38# PROP BASE Use_Debug_Libraries 0
39# PROP BASE Output_Dir ".\Release"
40# PROP BASE Intermediate_Dir ".\Release"
41# PROP BASE Target_Dir ""
42# PROP Use_MFC 0
43# PROP Use_Debug_Libraries 0
44# PROP Output_Dir ".\Release"
45# PROP Intermediate_Dir ".\Release"
46# PROP Ignore_Export_Lib 0
47# PROP Target_Dir ""
48CPP=cl.exe
49# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
50# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /D "ASMV" /FAcs /FR /YX /FD /c
51MTL=midl.exe
52# ADD BASE MTL /nologo /D "NDEBUG" /win32
53# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
54RSC=rc.exe
55# ADD BASE RSC /l 0x40c /d "NDEBUG"
56# ADD RSC /l 0x40c /d "NDEBUG"
57BSC32=bscmake.exe
58# ADD BASE BSC32 /nologo
59# ADD BSC32 /nologo
60LINK32=link.exe
61# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
62# ADD LINK32 gvmat32.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\Release\zlib.dll"
63# SUBTRACT LINK32 /pdb:none
64
65!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
66
67# PROP BASE Use_MFC 0
68# PROP BASE Use_Debug_Libraries 1
69# PROP BASE Output_Dir ".\Debug"
70# PROP BASE Intermediate_Dir ".\Debug"
71# PROP BASE Target_Dir ""
72# PROP Use_MFC 0
73# PROP Use_Debug_Libraries 1
74# PROP Output_Dir ".\Debug"
75# PROP Intermediate_Dir ".\Debug"
76# PROP Target_Dir ""
77CPP=cl.exe
78# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
79# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /YX /FD /c
80MTL=midl.exe
81# ADD BASE MTL /nologo /D "_DEBUG" /win32
82# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
83RSC=rc.exe
84# ADD BASE RSC /l 0x40c /d "_DEBUG"
85# ADD RSC /l 0x40c /d "_DEBUG"
86BSC32=bscmake.exe
87# ADD BASE BSC32 /nologo
88# ADD BSC32 /nologo
89LINK32=link.exe
90# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
91# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:".\Debug\zlib.dll"
92
93!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
94
95# PROP BASE Use_MFC 0
96# PROP BASE Use_Debug_Libraries 0
97# PROP BASE Output_Dir "zlibvc__"
98# PROP BASE Intermediate_Dir "zlibvc__"
99# PROP BASE Ignore_Export_Lib 0
100# PROP BASE Target_Dir ""
101# PROP Use_MFC 0
102# PROP Use_Debug_Libraries 0
103# PROP Output_Dir "zlibvc__"
104# PROP Intermediate_Dir "zlibvc__"
105# PROP Ignore_Export_Lib 0
106# PROP Target_Dir ""
107MTL=midl.exe
108# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
109# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
110CPP=cl.exe
111# ADD BASE CPP /nologo /MT /Gt0 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /YX /FD /c
112# ADD CPP /nologo /MT /Gt0 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /YX /FD /c
113RSC=rc.exe
114# ADD BASE RSC /l 0x40c /d "NDEBUG"
115# ADD RSC /l 0x40c /d "NDEBUG"
116BSC32=bscmake.exe
117# ADD BASE BSC32 /nologo
118# ADD BSC32 /nologo
119LINK32=link.exe
120# ADD BASE LINK32 crtdll.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /map /machine:ALPHA /nodefaultlib /out:".\Release\zlib.dll"
121# SUBTRACT BASE LINK32 /pdb:none
122# ADD LINK32 crtdll.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /map /machine:ALPHA /nodefaultlib /out:"zlibvc__\zlib.dll"
123# SUBTRACT LINK32 /pdb:none
124
125!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
126
127# PROP BASE Use_MFC 0
128# PROP BASE Use_Debug_Libraries 0
129# PROP BASE Output_Dir "zlibvc_0"
130# PROP BASE Intermediate_Dir "zlibvc_0"
131# PROP BASE Ignore_Export_Lib 0
132# PROP BASE Target_Dir ""
133# PROP Use_MFC 0
134# PROP Use_Debug_Libraries 0
135# PROP Output_Dir "zlibvc_0"
136# PROP Intermediate_Dir "zlibvc_0"
137# PROP Ignore_Export_Lib 0
138# PROP Target_Dir ""
139CPP=cl.exe
140# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /YX /FD /c
141# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /YX /FD /c
142MTL=midl.exe
143# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
144# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
145RSC=rc.exe
146# ADD BASE RSC /l 0x40c /d "NDEBUG"
147# ADD RSC /l 0x40c /d "NDEBUG"
148BSC32=bscmake.exe
149# ADD BASE BSC32 /nologo
150# ADD BSC32 /nologo
151LINK32=link.exe
152# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\Release\zlib.dll"
153# SUBTRACT BASE LINK32 /pdb:none
154# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\zlibvc_0\zlib.dll"
155# SUBTRACT LINK32 /pdb:none
156
157!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
158
159# PROP BASE Use_MFC 0
160# PROP BASE Use_Debug_Libraries 0
161# PROP BASE Output_Dir "zlibvc_1"
162# PROP BASE Intermediate_Dir "zlibvc_1"
163# PROP BASE Ignore_Export_Lib 0
164# PROP BASE Target_Dir ""
165# PROP Use_MFC 0
166# PROP Use_Debug_Libraries 0
167# PROP Output_Dir "zlibvc_1"
168# PROP Intermediate_Dir "zlibvc_1"
169# PROP Ignore_Export_Lib 0
170# PROP Target_Dir ""
171CPP=cl.exe
172# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /D "ASMV" /FAcs /FR /YX /FD /c
173# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /D "ASMV" /FAcs /FR /YX /FD /c
174MTL=midl.exe
175# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
176# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
177RSC=rc.exe
178# ADD BASE RSC /l 0x40c /d "NDEBUG"
179# ADD RSC /l 0x40c /d "NDEBUG"
180BSC32=bscmake.exe
181# ADD BASE BSC32 /nologo
182# ADD BSC32 /nologo
183LINK32=link.exe
184# ADD BASE LINK32 gvmat32.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\Release\zlib.dll"
185# SUBTRACT BASE LINK32 /pdb:none
186# ADD LINK32 gvmat32.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\zlibvc_1\zlib.dll"
187# SUBTRACT LINK32 /pdb:none
188
189!ENDIF
190
191# Begin Target
192
193# Name "zlibvc - Win32 Release"
194# Name "zlibvc - Win32 Debug"
195# Name "zlibvc - Win32 ReleaseAxp"
196# Name "zlibvc - Win32 ReleaseWithoutAsm"
197# Name "zlibvc - Win32 ReleaseWithoutCrtdll"
198# Begin Group "Source Files"
199
200# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
201# Begin Source File
202
203SOURCE=.\adler32.c
204
205!IF "$(CFG)" == "zlibvc - Win32 Release"
206
207!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
208
209!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
210
211DEP_CPP_ADLER=\
212 ".\zconf.h"\
213 ".\zlib.h"\
214
215
216!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
217
218!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
219
220!ENDIF
221
222# End Source File
223# Begin Source File
224
225SOURCE=.\compress.c
226
227!IF "$(CFG)" == "zlibvc - Win32 Release"
228
229!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
230
231!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
232
233DEP_CPP_COMPR=\
234 ".\zconf.h"\
235 ".\zlib.h"\
236
237
238!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
239
240!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
241
242!ENDIF
243
244# End Source File
245# Begin Source File
246
247SOURCE=.\crc32.c
248
249!IF "$(CFG)" == "zlibvc - Win32 Release"
250
251!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
252
253!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
254
255DEP_CPP_CRC32=\
256 ".\zconf.h"\
257 ".\zlib.h"\
258
259
260!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
261
262!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
263
264!ENDIF
265
266# End Source File
267# Begin Source File
268
269SOURCE=.\deflate.c
270
271!IF "$(CFG)" == "zlibvc - Win32 Release"
272
273!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
274
275!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
276
277DEP_CPP_DEFLA=\
278 ".\deflate.h"\
279 ".\zconf.h"\
280 ".\zlib.h"\
281 ".\zutil.h"\
282
283
284!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
285
286!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
287
288!ENDIF
289
290# End Source File
291# Begin Source File
292
293SOURCE=.\gvmat32c.c
294
295!IF "$(CFG)" == "zlibvc - Win32 Release"
296
297!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
298
299!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
300
301!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
302
303!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
304
305!ENDIF
306
307# End Source File
308# Begin Source File
309
310SOURCE=.\gzio.c
311
312!IF "$(CFG)" == "zlibvc - Win32 Release"
313
314!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
315
316!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
317
318DEP_CPP_GZIO_=\
319 ".\zconf.h"\
320 ".\zlib.h"\
321 ".\zutil.h"\
322
323
324!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
325
326!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
327
328!ENDIF
329
330# End Source File
331# Begin Source File
332
333SOURCE=.\infblock.c
334
335!IF "$(CFG)" == "zlibvc - Win32 Release"
336
337!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
338
339!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
340
341DEP_CPP_INFBL=\
342 ".\infblock.h"\
343 ".\infcodes.h"\
344 ".\inftrees.h"\
345 ".\infutil.h"\
346 ".\zconf.h"\
347 ".\zlib.h"\
348 ".\zutil.h"\
349
350
351!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
352
353!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
354
355!ENDIF
356
357# End Source File
358# Begin Source File
359
360SOURCE=.\infcodes.c
361
362!IF "$(CFG)" == "zlibvc - Win32 Release"
363
364!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
365
366!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
367
368DEP_CPP_INFCO=\
369 ".\infblock.h"\
370 ".\infcodes.h"\
371 ".\inffast.h"\
372 ".\inftrees.h"\
373 ".\infutil.h"\
374 ".\zconf.h"\
375 ".\zlib.h"\
376 ".\zutil.h"\
377
378
379!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
380
381!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
382
383!ENDIF
384
385# End Source File
386# Begin Source File
387
388SOURCE=.\inffast.c
389
390!IF "$(CFG)" == "zlibvc - Win32 Release"
391
392!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
393
394!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
395
396DEP_CPP_INFFA=\
397 ".\infblock.h"\
398 ".\infcodes.h"\
399 ".\inffast.h"\
400 ".\inftrees.h"\
401 ".\infutil.h"\
402 ".\zconf.h"\
403 ".\zlib.h"\
404 ".\zutil.h"\
405
406
407!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
408
409!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
410
411!ENDIF
412
413# End Source File
414# Begin Source File
415
416SOURCE=.\inflate.c
417
418!IF "$(CFG)" == "zlibvc - Win32 Release"
419
420!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
421
422!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
423
424DEP_CPP_INFLA=\
425 ".\infblock.h"\
426 ".\zconf.h"\
427 ".\zlib.h"\
428 ".\zutil.h"\
429
430
431!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
432
433!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
434
435!ENDIF
436
437# End Source File
438# Begin Source File
439
440SOURCE=.\inftrees.c
441
442!IF "$(CFG)" == "zlibvc - Win32 Release"
443
444!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
445
446!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
447
448DEP_CPP_INFTR=\
449 ".\inftrees.h"\
450 ".\zconf.h"\
451 ".\zlib.h"\
452 ".\zutil.h"\
453
454
455!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
456
457!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
458
459!ENDIF
460
461# End Source File
462# Begin Source File
463
464SOURCE=.\infutil.c
465
466!IF "$(CFG)" == "zlibvc - Win32 Release"
467
468!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
469
470!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
471
472DEP_CPP_INFUT=\
473 ".\infblock.h"\
474 ".\infcodes.h"\
475 ".\inftrees.h"\
476 ".\infutil.h"\
477 ".\zconf.h"\
478 ".\zlib.h"\
479 ".\zutil.h"\
480
481
482!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
483
484!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
485
486!ENDIF
487
488# End Source File
489# Begin Source File
490
491SOURCE=.\trees.c
492
493!IF "$(CFG)" == "zlibvc - Win32 Release"
494
495!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
496
497!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
498
499DEP_CPP_TREES=\
500 ".\deflate.h"\
501 ".\zconf.h"\
502 ".\zlib.h"\
503 ".\zutil.h"\
504
505
506!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
507
508!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
509
510!ENDIF
511
512# End Source File
513# Begin Source File
514
515SOURCE=.\uncompr.c
516
517!IF "$(CFG)" == "zlibvc - Win32 Release"
518
519!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
520
521!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
522
523DEP_CPP_UNCOM=\
524 ".\zconf.h"\
525 ".\zlib.h"\
526
527
528!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
529
530!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
531
532!ENDIF
533
534# End Source File
535# Begin Source File
536
537SOURCE=.\zlib.rc
538# End Source File
539# Begin Source File
540
541SOURCE=.\zlibvc.def
542# End Source File
543# Begin Source File
544
545SOURCE=.\zutil.c
546
547!IF "$(CFG)" == "zlibvc - Win32 Release"
548
549!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
550
551!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
552
553DEP_CPP_ZUTIL=\
554 ".\zconf.h"\
555 ".\zlib.h"\
556 ".\zutil.h"\
557
558
559!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
560
561!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
562
563!ENDIF
564
565# End Source File
566# End Group
567# Begin Group "Header Files"
568
569# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
570# Begin Source File
571
572SOURCE=.\deflate.h
573# End Source File
574# Begin Source File
575
576SOURCE=.\infblock.h
577# End Source File
578# Begin Source File
579
580SOURCE=.\infcodes.h
581# End Source File
582# Begin Source File
583
584SOURCE=.\inffast.h
585# End Source File
586# Begin Source File
587
588SOURCE=.\inftrees.h
589# End Source File
590# Begin Source File
591
592SOURCE=.\infutil.h
593# End Source File
594# Begin Source File
595
596SOURCE=.\zconf.h
597# End Source File
598# Begin Source File
599
600SOURCE=.\zlib.h
601# End Source File
602# Begin Source File
603
604SOURCE=.\zutil.h
605# End Source File
606# End Group
607# Begin Group "Resource Files"
608
609# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
610# End Group
611# End Target
612# End Project
diff --git a/contrib/asm386/zlibvc.dsw b/contrib/asm386/zlibvc.dsw
new file mode 100644
index 0000000..b62e50b
--- /dev/null
+++ b/contrib/asm386/zlibvc.dsw
@@ -0,0 +1,29 @@
1Microsoft Developer Studio Workspace File, Format Version 5.00
2# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
3
4###############################################################################
5
6Project: "zlibvc"=".\zlibvc.dsp" - Package Owner=<4>
7
8Package=<5>
9{{{
10}}}
11
12Package=<4>
13{{{
14}}}
15
16###############################################################################
17
18Global:
19
20Package=<5>
21{{{
22}}}
23
24Package=<3>
25{{{
26}}}
27
28###############################################################################
29
diff --git a/contrib/asm386/zlibvc.mak b/contrib/asm386/zlibvc.mak
deleted file mode 100644
index ae3d14b..0000000
--- a/contrib/asm386/zlibvc.mak
+++ /dev/null
@@ -1,781 +0,0 @@
1# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
2# ** DO NOT EDIT **
3
4# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
5
6!IF "$(CFG)" == ""
7CFG=zlibvc - Win32 Debug
8!MESSAGE No configuration specified. Defaulting to zlibvc - Win32 Debug.
9!ENDIF
10
11!IF "$(CFG)" != "zlibvc - Win32 Release" && "$(CFG)" != "zlibvc - Win32 Debug"
12!MESSAGE Invalid configuration "$(CFG)" specified.
13!MESSAGE You can specify a configuration when running NMAKE on this makefile
14!MESSAGE by defining the macro CFG on the command line. For example:
15!MESSAGE
16!MESSAGE NMAKE /f "zlibvc.mak" CFG="zlibvc - Win32 Debug"
17!MESSAGE
18!MESSAGE Possible choices for configuration are:
19!MESSAGE
20!MESSAGE "zlibvc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
21!MESSAGE "zlibvc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
22!MESSAGE
23!ERROR An invalid configuration is specified.
24!ENDIF
25
26!IF "$(OS)" == "Windows_NT"
27NULL=
28!ELSE
29NULL=nul
30!ENDIF
31################################################################################
32# Begin Project
33# PROP Target_Last_Scanned "zlibvc - Win32 Debug"
34CPP=cl.exe
35RSC=rc.exe
36MTL=mktyplib.exe
37
38!IF "$(CFG)" == "zlibvc - Win32 Release"
39
40# PROP BASE Use_MFC 0
41# PROP BASE Use_Debug_Libraries 0
42# PROP BASE Output_Dir "Release"
43# PROP BASE Intermediate_Dir "Release"
44# PROP BASE Target_Dir ""
45# PROP Use_MFC 0
46# PROP Use_Debug_Libraries 0
47# PROP Output_Dir "Release"
48# PROP Intermediate_Dir "Release"
49# PROP Target_Dir ""
50OUTDIR=.\Release
51INTDIR=.\Release
52
53ALL : "$(OUTDIR)\zlib.dll" "$(OUTDIR)\zlibvc.bsc"
54
55CLEAN :
56 -@erase "$(INTDIR)\adler32.obj"
57 -@erase "$(INTDIR)\adler32.sbr"
58 -@erase "$(INTDIR)\compress.obj"
59 -@erase "$(INTDIR)\compress.sbr"
60 -@erase "$(INTDIR)\crc32.obj"
61 -@erase "$(INTDIR)\crc32.sbr"
62 -@erase "$(INTDIR)\deflate.obj"
63 -@erase "$(INTDIR)\deflate.sbr"
64 -@erase "$(INTDIR)\gvmat32c.obj"
65 -@erase "$(INTDIR)\gvmat32c.sbr"
66 -@erase "$(INTDIR)\gzio.obj"
67 -@erase "$(INTDIR)\gzio.sbr"
68 -@erase "$(INTDIR)\infblock.obj"
69 -@erase "$(INTDIR)\infblock.sbr"
70 -@erase "$(INTDIR)\infcodes.obj"
71 -@erase "$(INTDIR)\infcodes.sbr"
72 -@erase "$(INTDIR)\inffast.obj"
73 -@erase "$(INTDIR)\inffast.sbr"
74 -@erase "$(INTDIR)\inflate.obj"
75 -@erase "$(INTDIR)\inflate.sbr"
76 -@erase "$(INTDIR)\inftrees.obj"
77 -@erase "$(INTDIR)\inftrees.sbr"
78 -@erase "$(INTDIR)\infutil.obj"
79 -@erase "$(INTDIR)\infutil.sbr"
80 -@erase "$(INTDIR)\trees.obj"
81 -@erase "$(INTDIR)\trees.sbr"
82 -@erase "$(INTDIR)\uncompr.obj"
83 -@erase "$(INTDIR)\uncompr.sbr"
84 -@erase "$(INTDIR)\zlib.res"
85 -@erase "$(INTDIR)\zutil.obj"
86 -@erase "$(INTDIR)\zutil.sbr"
87 -@erase "$(OUTDIR)\zlib.dll"
88 -@erase "$(OUTDIR)\zlib.exp"
89 -@erase "$(OUTDIR)\zlib.lib"
90 -@erase "$(OUTDIR)\zlib.map"
91 -@erase "$(OUTDIR)\zlibvc.bsc"
92
93"$(OUTDIR)" :
94 if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
95
96# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
97# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D fdopen=_fdopen /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "ASMV" /FR /YX /c
98CPP_PROJ=/nologo /MT /W3 /GX /O2 /D "NDEBUG" /D fdopen=_fdopen /D "WIN32" /D\
99 "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "ASMV"\
100 /FR"$(INTDIR)/" /Fp"$(INTDIR)/zlibvc.pch" /YX /Fo"$(INTDIR)/" /c
101CPP_OBJS=.\Release/
102CPP_SBRS=.\Release/
103# ADD BASE MTL /nologo /D "NDEBUG" /win32
104# ADD MTL /nologo /D "NDEBUG" /win32
105MTL_PROJ=/nologo /D "NDEBUG" /win32
106# ADD BASE RSC /l 0x40c /d "NDEBUG"
107# ADD RSC /l 0x40c /d "NDEBUG"
108RSC_PROJ=/l 0x40c /fo"$(INTDIR)/zlib.res" /d "NDEBUG"
109BSC32=bscmake.exe
110# ADD BASE BSC32 /nologo
111# ADD BSC32 /nologo
112BSC32_FLAGS=/nologo /o"$(OUTDIR)/zlibvc.bsc"
113BSC32_SBRS= \
114 "$(INTDIR)\adler32.sbr" \
115 "$(INTDIR)\compress.sbr" \
116 "$(INTDIR)\crc32.sbr" \
117 "$(INTDIR)\deflate.sbr" \
118 "$(INTDIR)\gvmat32c.sbr" \
119 "$(INTDIR)\gzio.sbr" \
120 "$(INTDIR)\infblock.sbr" \
121 "$(INTDIR)\infcodes.sbr" \
122 "$(INTDIR)\inffast.sbr" \
123 "$(INTDIR)\inflate.sbr" \
124 "$(INTDIR)\inftrees.sbr" \
125 "$(INTDIR)\infutil.sbr" \
126 "$(INTDIR)\trees.sbr" \
127 "$(INTDIR)\uncompr.sbr" \
128 "$(INTDIR)\zutil.sbr"
129
130"$(OUTDIR)\zlibvc.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
131 $(BSC32) @<<
132 $(BSC32_FLAGS) $(BSC32_SBRS)
133<<
134
135LINK32=link.exe
136# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
137# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:"Release/zlib.dll"
138LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
139 advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo\
140 /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)/zlib.pdb"\
141 /map:"$(INTDIR)/zlib.map" /machine:I386 /nodefaultlib /def:".\zlib.def"\
142 /out:"$(OUTDIR)/zlib.dll" /implib:"$(OUTDIR)/zlib.lib"
143DEF_FILE= \
144 ".\zlib.def"
145LINK32_OBJS= \
146 "$(INTDIR)\adler32.obj" \
147 "$(INTDIR)\compress.obj" \
148 "$(INTDIR)\crc32.obj" \
149 "$(INTDIR)\deflate.obj" \
150 "$(INTDIR)\gvmat32c.obj" \
151 "$(INTDIR)\gzio.obj" \
152 "$(INTDIR)\infblock.obj" \
153 "$(INTDIR)\infcodes.obj" \
154 "$(INTDIR)\inffast.obj" \
155 "$(INTDIR)\inflate.obj" \
156 "$(INTDIR)\inftrees.obj" \
157 "$(INTDIR)\infutil.obj" \
158 "$(INTDIR)\trees.obj" \
159 "$(INTDIR)\uncompr.obj" \
160 "$(INTDIR)\zlib.res" \
161 "$(INTDIR)\zutil.obj" \
162 ".\GVMAT32.obj"
163
164"$(OUTDIR)\zlib.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
165 $(LINK32) @<<
166 $(LINK32_FLAGS) $(LINK32_OBJS)
167<<
168
169!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
170
171# PROP BASE Use_MFC 0
172# PROP BASE Use_Debug_Libraries 1
173# PROP BASE Output_Dir "Debug"
174# PROP BASE Intermediate_Dir "Debug"
175# PROP BASE Target_Dir ""
176# PROP Use_MFC 0
177# PROP Use_Debug_Libraries 1
178# PROP Output_Dir "Debug"
179# PROP Intermediate_Dir "Debug"
180# PROP Target_Dir ""
181OUTDIR=.\Debug
182INTDIR=.\Debug
183
184ALL : "$(OUTDIR)\zlib.dll"
185
186CLEAN :
187 -@erase "$(INTDIR)\adler32.obj"
188 -@erase "$(INTDIR)\compress.obj"
189 -@erase "$(INTDIR)\crc32.obj"
190 -@erase "$(INTDIR)\deflate.obj"
191 -@erase "$(INTDIR)\gvmat32c.obj"
192 -@erase "$(INTDIR)\gzio.obj"
193 -@erase "$(INTDIR)\infblock.obj"
194 -@erase "$(INTDIR)\infcodes.obj"
195 -@erase "$(INTDIR)\inffast.obj"
196 -@erase "$(INTDIR)\inflate.obj"
197 -@erase "$(INTDIR)\inftrees.obj"
198 -@erase "$(INTDIR)\infutil.obj"
199 -@erase "$(INTDIR)\trees.obj"
200 -@erase "$(INTDIR)\uncompr.obj"
201 -@erase "$(INTDIR)\vc40.idb"
202 -@erase "$(INTDIR)\vc40.pdb"
203 -@erase "$(INTDIR)\zlib.res"
204 -@erase "$(INTDIR)\zutil.obj"
205 -@erase "$(OUTDIR)\zlib.dll"
206 -@erase "$(OUTDIR)\zlib.exp"
207 -@erase "$(OUTDIR)\zlib.ilk"
208 -@erase "$(OUTDIR)\zlib.lib"
209 -@erase "$(OUTDIR)\zlib.pdb"
210
211"$(OUTDIR)" :
212 if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
213
214# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
215# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /YX /c
216CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS"\
217 /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL"\
218 /Fp"$(INTDIR)/zlibvc.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c
219CPP_OBJS=.\Debug/
220CPP_SBRS=.\.
221# ADD BASE MTL /nologo /D "_DEBUG" /win32
222# ADD MTL /nologo /D "_DEBUG" /win32
223MTL_PROJ=/nologo /D "_DEBUG" /win32
224# ADD BASE RSC /l 0x40c /d "_DEBUG"
225# ADD RSC /l 0x40c /d "_DEBUG"
226RSC_PROJ=/l 0x40c /fo"$(INTDIR)/zlib.res" /d "_DEBUG"
227BSC32=bscmake.exe
228# ADD BASE BSC32 /nologo
229# ADD BSC32 /nologo
230BSC32_FLAGS=/nologo /o"$(OUTDIR)/zlibvc.bsc"
231BSC32_SBRS= \
232
233LINK32=link.exe
234# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
235# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"Debug/zlib.dll"
236LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
237 advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo\
238 /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)/zlib.pdb" /debug\
239 /machine:I386 /def:".\zlib.def" /out:"$(OUTDIR)/zlib.dll"\
240 /implib:"$(OUTDIR)/zlib.lib"
241DEF_FILE= \
242 ".\zlib.def"
243LINK32_OBJS= \
244 "$(INTDIR)\adler32.obj" \
245 "$(INTDIR)\compress.obj" \
246 "$(INTDIR)\crc32.obj" \
247 "$(INTDIR)\deflate.obj" \
248 "$(INTDIR)\gvmat32c.obj" \
249 "$(INTDIR)\gzio.obj" \
250 "$(INTDIR)\infblock.obj" \
251 "$(INTDIR)\infcodes.obj" \
252 "$(INTDIR)\inffast.obj" \
253 "$(INTDIR)\inflate.obj" \
254 "$(INTDIR)\inftrees.obj" \
255 "$(INTDIR)\infutil.obj" \
256 "$(INTDIR)\trees.obj" \
257 "$(INTDIR)\uncompr.obj" \
258 "$(INTDIR)\zlib.res" \
259 "$(INTDIR)\zutil.obj" \
260 ".\GVMAT32.obj"
261
262"$(OUTDIR)\zlib.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
263 $(LINK32) @<<
264 $(LINK32_FLAGS) $(LINK32_OBJS)
265<<
266
267!ENDIF
268
269.c{$(CPP_OBJS)}.obj:
270 $(CPP) $(CPP_PROJ) $<
271
272.cpp{$(CPP_OBJS)}.obj:
273 $(CPP) $(CPP_PROJ) $<
274
275.cxx{$(CPP_OBJS)}.obj:
276 $(CPP) $(CPP_PROJ) $<
277
278.c{$(CPP_SBRS)}.sbr:
279 $(CPP) $(CPP_PROJ) $<
280
281.cpp{$(CPP_SBRS)}.sbr:
282 $(CPP) $(CPP_PROJ) $<
283
284.cxx{$(CPP_SBRS)}.sbr:
285 $(CPP) $(CPP_PROJ) $<
286
287################################################################################
288# Begin Target
289
290# Name "zlibvc - Win32 Release"
291# Name "zlibvc - Win32 Debug"
292
293!IF "$(CFG)" == "zlibvc - Win32 Release"
294
295!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
296
297!ENDIF
298
299################################################################################
300# Begin Source File
301
302SOURCE=.\adler32.c
303DEP_CPP_ADLER=\
304 ".\zconf.h"\
305 ".\zlib.h"\
306
307
308!IF "$(CFG)" == "zlibvc - Win32 Release"
309
310
311"$(INTDIR)\adler32.obj" : $(SOURCE) $(DEP_CPP_ADLER) "$(INTDIR)"
312
313"$(INTDIR)\adler32.sbr" : $(SOURCE) $(DEP_CPP_ADLER) "$(INTDIR)"
314
315
316!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
317
318
319"$(INTDIR)\adler32.obj" : $(SOURCE) $(DEP_CPP_ADLER) "$(INTDIR)"
320
321
322!ENDIF
323
324# End Source File
325################################################################################
326# Begin Source File
327
328SOURCE=.\compress.c
329DEP_CPP_COMPR=\
330 ".\zconf.h"\
331 ".\zlib.h"\
332
333
334!IF "$(CFG)" == "zlibvc - Win32 Release"
335
336
337"$(INTDIR)\compress.obj" : $(SOURCE) $(DEP_CPP_COMPR) "$(INTDIR)"
338
339"$(INTDIR)\compress.sbr" : $(SOURCE) $(DEP_CPP_COMPR) "$(INTDIR)"
340
341
342!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
343
344
345"$(INTDIR)\compress.obj" : $(SOURCE) $(DEP_CPP_COMPR) "$(INTDIR)"
346
347
348!ENDIF
349
350# End Source File
351################################################################################
352# Begin Source File
353
354SOURCE=.\crc32.c
355DEP_CPP_CRC32=\
356 ".\zconf.h"\
357 ".\zlib.h"\
358
359
360!IF "$(CFG)" == "zlibvc - Win32 Release"
361
362
363"$(INTDIR)\crc32.obj" : $(SOURCE) $(DEP_CPP_CRC32) "$(INTDIR)"
364
365"$(INTDIR)\crc32.sbr" : $(SOURCE) $(DEP_CPP_CRC32) "$(INTDIR)"
366
367
368!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
369
370
371"$(INTDIR)\crc32.obj" : $(SOURCE) $(DEP_CPP_CRC32) "$(INTDIR)"
372
373
374!ENDIF
375
376# End Source File
377################################################################################
378# Begin Source File
379
380SOURCE=.\deflate.c
381
382!IF "$(CFG)" == "zlibvc - Win32 Release"
383
384DEP_CPP_DEFLA=\
385 ".\deflate.h"\
386 ".\zconf.h"\
387 ".\zlib.h"\
388 ".\zutil.h"\
389
390
391"$(INTDIR)\deflate.obj" : $(SOURCE) $(DEP_CPP_DEFLA) "$(INTDIR)"
392
393"$(INTDIR)\deflate.sbr" : $(SOURCE) $(DEP_CPP_DEFLA) "$(INTDIR)"
394
395
396!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
397
398DEP_CPP_DEFLA=\
399 ".\deflate.h"\
400 ".\zconf.h"\
401 ".\zlib.h"\
402 ".\zutil.h"\
403
404NODEP_CPP_DEFLA=\
405 ".\local"\
406
407
408"$(INTDIR)\deflate.obj" : $(SOURCE) $(DEP_CPP_DEFLA) "$(INTDIR)"
409
410
411!ENDIF
412
413# End Source File
414################################################################################
415# Begin Source File
416
417SOURCE=.\gzio.c
418DEP_CPP_GZIO_=\
419 ".\zconf.h"\
420 ".\zlib.h"\
421 ".\zutil.h"\
422
423
424!IF "$(CFG)" == "zlibvc - Win32 Release"
425
426
427"$(INTDIR)\gzio.obj" : $(SOURCE) $(DEP_CPP_GZIO_) "$(INTDIR)"
428
429"$(INTDIR)\gzio.sbr" : $(SOURCE) $(DEP_CPP_GZIO_) "$(INTDIR)"
430
431
432!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
433
434
435"$(INTDIR)\gzio.obj" : $(SOURCE) $(DEP_CPP_GZIO_) "$(INTDIR)"
436
437
438!ENDIF
439
440# End Source File
441################################################################################
442# Begin Source File
443
444SOURCE=.\infblock.c
445DEP_CPP_INFBL=\
446 ".\infblock.h"\
447 ".\infcodes.h"\
448 ".\inftrees.h"\
449 ".\infutil.h"\
450 ".\zconf.h"\
451 ".\zlib.h"\
452 ".\zutil.h"\
453
454
455!IF "$(CFG)" == "zlibvc - Win32 Release"
456
457
458"$(INTDIR)\infblock.obj" : $(SOURCE) $(DEP_CPP_INFBL) "$(INTDIR)"
459
460"$(INTDIR)\infblock.sbr" : $(SOURCE) $(DEP_CPP_INFBL) "$(INTDIR)"
461
462
463!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
464
465
466"$(INTDIR)\infblock.obj" : $(SOURCE) $(DEP_CPP_INFBL) "$(INTDIR)"
467
468
469!ENDIF
470
471# End Source File
472################################################################################
473# Begin Source File
474
475SOURCE=.\infcodes.c
476DEP_CPP_INFCO=\
477 ".\infblock.h"\
478 ".\infcodes.h"\
479 ".\inffast.h"\
480 ".\inftrees.h"\
481 ".\infutil.h"\
482 ".\zconf.h"\
483 ".\zlib.h"\
484 ".\zutil.h"\
485
486
487!IF "$(CFG)" == "zlibvc - Win32 Release"
488
489
490"$(INTDIR)\infcodes.obj" : $(SOURCE) $(DEP_CPP_INFCO) "$(INTDIR)"
491
492"$(INTDIR)\infcodes.sbr" : $(SOURCE) $(DEP_CPP_INFCO) "$(INTDIR)"
493
494
495!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
496
497
498"$(INTDIR)\infcodes.obj" : $(SOURCE) $(DEP_CPP_INFCO) "$(INTDIR)"
499
500
501!ENDIF
502
503# End Source File
504################################################################################
505# Begin Source File
506
507SOURCE=.\inffast.c
508DEP_CPP_INFFA=\
509 ".\infblock.h"\
510 ".\infcodes.h"\
511 ".\inffast.h"\
512 ".\inftrees.h"\
513 ".\infutil.h"\
514 ".\zconf.h"\
515 ".\zlib.h"\
516 ".\zutil.h"\
517
518
519!IF "$(CFG)" == "zlibvc - Win32 Release"
520
521
522"$(INTDIR)\inffast.obj" : $(SOURCE) $(DEP_CPP_INFFA) "$(INTDIR)"
523
524"$(INTDIR)\inffast.sbr" : $(SOURCE) $(DEP_CPP_INFFA) "$(INTDIR)"
525
526
527!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
528
529
530"$(INTDIR)\inffast.obj" : $(SOURCE) $(DEP_CPP_INFFA) "$(INTDIR)"
531
532
533!ENDIF
534
535# End Source File
536################################################################################
537# Begin Source File
538
539SOURCE=.\inflate.c
540DEP_CPP_INFLA=\
541 ".\infblock.h"\
542 ".\zconf.h"\
543 ".\zlib.h"\
544 ".\zutil.h"\
545
546
547!IF "$(CFG)" == "zlibvc - Win32 Release"
548
549
550"$(INTDIR)\inflate.obj" : $(SOURCE) $(DEP_CPP_INFLA) "$(INTDIR)"
551
552"$(INTDIR)\inflate.sbr" : $(SOURCE) $(DEP_CPP_INFLA) "$(INTDIR)"
553
554
555!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
556
557
558"$(INTDIR)\inflate.obj" : $(SOURCE) $(DEP_CPP_INFLA) "$(INTDIR)"
559
560
561!ENDIF
562
563# End Source File
564################################################################################
565# Begin Source File
566
567SOURCE=.\inftrees.c
568DEP_CPP_INFTR=\
569 ".\inftrees.h"\
570 ".\zconf.h"\
571 ".\zlib.h"\
572 ".\zutil.h"\
573
574
575!IF "$(CFG)" == "zlibvc - Win32 Release"
576
577
578"$(INTDIR)\inftrees.obj" : $(SOURCE) $(DEP_CPP_INFTR) "$(INTDIR)"
579
580"$(INTDIR)\inftrees.sbr" : $(SOURCE) $(DEP_CPP_INFTR) "$(INTDIR)"
581
582
583!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
584
585
586"$(INTDIR)\inftrees.obj" : $(SOURCE) $(DEP_CPP_INFTR) "$(INTDIR)"
587
588
589!ENDIF
590
591# End Source File
592################################################################################
593# Begin Source File
594
595SOURCE=.\infutil.c
596DEP_CPP_INFUT=\
597 ".\infblock.h"\
598 ".\infcodes.h"\
599 ".\inftrees.h"\
600 ".\infutil.h"\
601 ".\zconf.h"\
602 ".\zlib.h"\
603 ".\zutil.h"\
604
605
606!IF "$(CFG)" == "zlibvc - Win32 Release"
607
608
609"$(INTDIR)\infutil.obj" : $(SOURCE) $(DEP_CPP_INFUT) "$(INTDIR)"
610
611"$(INTDIR)\infutil.sbr" : $(SOURCE) $(DEP_CPP_INFUT) "$(INTDIR)"
612
613
614!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
615
616
617"$(INTDIR)\infutil.obj" : $(SOURCE) $(DEP_CPP_INFUT) "$(INTDIR)"
618
619
620!ENDIF
621
622# End Source File
623################################################################################
624# Begin Source File
625
626SOURCE=.\trees.c
627DEP_CPP_TREES=\
628 ".\deflate.h"\
629 ".\zconf.h"\
630 ".\zlib.h"\
631 ".\zutil.h"\
632
633
634!IF "$(CFG)" == "zlibvc - Win32 Release"
635
636
637"$(INTDIR)\trees.obj" : $(SOURCE) $(DEP_CPP_TREES) "$(INTDIR)"
638
639"$(INTDIR)\trees.sbr" : $(SOURCE) $(DEP_CPP_TREES) "$(INTDIR)"
640
641
642!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
643
644
645"$(INTDIR)\trees.obj" : $(SOURCE) $(DEP_CPP_TREES) "$(INTDIR)"
646
647
648!ENDIF
649
650# End Source File
651################################################################################
652# Begin Source File
653
654SOURCE=.\uncompr.c
655
656!IF "$(CFG)" == "zlibvc - Win32 Release"
657
658DEP_CPP_UNCOM=\
659 ".\zconf.h"\
660 ".\zlib.h"\
661
662
663"$(INTDIR)\uncompr.obj" : $(SOURCE) $(DEP_CPP_UNCOM) "$(INTDIR)"
664
665"$(INTDIR)\uncompr.sbr" : $(SOURCE) $(DEP_CPP_UNCOM) "$(INTDIR)"
666
667
668!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
669
670DEP_CPP_UNCOM=\
671 ".\zconf.h"\
672 ".\zlib.h"\
673
674NODEP_CPP_UNCOM=\
675 ".\uncompress"\
676
677
678"$(INTDIR)\uncompr.obj" : $(SOURCE) $(DEP_CPP_UNCOM) "$(INTDIR)"
679
680
681!ENDIF
682
683# End Source File
684################################################################################
685# Begin Source File
686
687SOURCE=.\zutil.c
688DEP_CPP_ZUTIL=\
689 ".\zconf.h"\
690 ".\zlib.h"\
691 ".\zutil.h"\
692
693
694!IF "$(CFG)" == "zlibvc - Win32 Release"
695
696
697"$(INTDIR)\zutil.obj" : $(SOURCE) $(DEP_CPP_ZUTIL) "$(INTDIR)"
698
699"$(INTDIR)\zutil.sbr" : $(SOURCE) $(DEP_CPP_ZUTIL) "$(INTDIR)"
700
701
702!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
703
704
705"$(INTDIR)\zutil.obj" : $(SOURCE) $(DEP_CPP_ZUTIL) "$(INTDIR)"
706
707
708!ENDIF
709
710# End Source File
711################################################################################
712# Begin Source File
713
714SOURCE=.\zlib.rc
715
716"$(INTDIR)\zlib.res" : $(SOURCE) "$(INTDIR)"
717 $(RSC) $(RSC_PROJ) $(SOURCE)
718
719
720# End Source File
721################################################################################
722# Begin Source File
723
724SOURCE=.\zlib.def
725
726!IF "$(CFG)" == "zlibvc - Win32 Release"
727
728!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
729
730!ENDIF
731
732# End Source File
733################################################################################
734# Begin Source File
735
736SOURCE=.\GVMAT32.obj
737
738!IF "$(CFG)" == "zlibvc - Win32 Release"
739
740!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
741
742!ENDIF
743
744# End Source File
745################################################################################
746# Begin Source File
747
748SOURCE=.\gvmat32c.c
749
750!IF "$(CFG)" == "zlibvc - Win32 Release"
751
752DEP_CPP_GVMAT=\
753 ".\deflate.h"\
754 ".\zconf.h"\
755 ".\zlib.h"\
756 ".\zutil.h"\
757
758
759"$(INTDIR)\gvmat32c.obj" : $(SOURCE) $(DEP_CPP_GVMAT) "$(INTDIR)"
760
761"$(INTDIR)\gvmat32c.sbr" : $(SOURCE) $(DEP_CPP_GVMAT) "$(INTDIR)"
762
763
764!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
765
766DEP_CPP_GVMAT=\
767 ".\deflate.h"\
768 ".\zconf.h"\
769 ".\zlib.h"\
770 ".\zutil.h"\
771
772
773"$(INTDIR)\gvmat32c.obj" : $(SOURCE) $(DEP_CPP_GVMAT) "$(INTDIR)"
774
775
776!ENDIF
777
778# End Source File
779# End Target
780# End Project
781################################################################################
diff --git a/crc32.c b/crc32.c
index cc9851e..a91101a 100644
--- a/crc32.c
+++ b/crc32.c
@@ -124,7 +124,7 @@ local const uLongf crc_table[256] = {
124/* ========================================================================= 124/* =========================================================================
125 * This function can be used by asm versions of crc32() 125 * This function can be used by asm versions of crc32()
126 */ 126 */
127const uLongf * EXPORT get_crc_table() 127const uLongf * ZEXPORT get_crc_table()
128{ 128{
129#ifdef DYNAMIC_CRC_TABLE 129#ifdef DYNAMIC_CRC_TABLE
130 if (crc_table_empty) make_crc_table(); 130 if (crc_table_empty) make_crc_table();
@@ -139,7 +139,7 @@ const uLongf * EXPORT get_crc_table()
139#define DO8(buf) DO4(buf); DO4(buf); 139#define DO8(buf) DO4(buf); DO4(buf);
140 140
141/* ========================================================================= */ 141/* ========================================================================= */
142uLong EXPORT crc32(crc, buf, len) 142uLong ZEXPORT crc32(crc, buf, len)
143 uLong crc; 143 uLong crc;
144 const Bytef *buf; 144 const Bytef *buf;
145 uInt len; 145 uInt len;
diff --git a/deflate.c b/deflate.c
index 16d6a1d..e9c14d7 100644
--- a/deflate.c
+++ b/deflate.c
@@ -52,7 +52,7 @@
52#include "deflate.h" 52#include "deflate.h"
53 53
54const char deflate_copyright[] = 54const char deflate_copyright[] =
55 " deflate 1.0.8 Copyright 1995-1998 Jean-loup Gailly "; 55 " deflate 1.0.9 Copyright 1995-1998 Jean-loup Gailly ";
56/* 56/*
57 If you use the zlib library in a product, an acknowledgment is welcome 57 If you use the zlib library in a product, an acknowledgment is welcome
58 in the documentation of your product. If for some reason you cannot 58 in the documentation of your product. If for some reason you cannot
@@ -80,7 +80,7 @@ local block_state deflate_slow OF((deflate_state *s, int flush));
80local void lm_init OF((deflate_state *s)); 80local void lm_init OF((deflate_state *s));
81local void putShortMSB OF((deflate_state *s, uInt b)); 81local void putShortMSB OF((deflate_state *s, uInt b));
82local void flush_pending OF((z_streamp strm)); 82local void flush_pending OF((z_streamp strm));
83local int read_buf OF((z_streamp strm, charf *buf, unsigned size)); 83local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
84#ifdef ASMV 84#ifdef ASMV
85 void match_init OF((void)); /* asm code initialization */ 85 void match_init OF((void)); /* asm code initialization */
86 uInt longest_match OF((deflate_state *s, IPos cur_match)); 86 uInt longest_match OF((deflate_state *s, IPos cur_match));
@@ -175,10 +175,10 @@ struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
175 */ 175 */
176#define CLEAR_HASH(s) \ 176#define CLEAR_HASH(s) \
177 s->head[s->hash_size-1] = NIL; \ 177 s->head[s->hash_size-1] = NIL; \
178 zmemzero((charf *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); 178 zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
179 179
180/* ========================================================================= */ 180/* ========================================================================= */
181int EXPORT deflateInit_(strm, level, version, stream_size) 181int ZEXPORT deflateInit_(strm, level, version, stream_size)
182 z_streamp strm; 182 z_streamp strm;
183 int level; 183 int level;
184 const char *version; 184 const char *version;
@@ -190,7 +190,7 @@ int EXPORT deflateInit_(strm, level, version, stream_size)
190} 190}
191 191
192/* ========================================================================= */ 192/* ========================================================================= */
193int EXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, 193int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
194 version, stream_size) 194 version, stream_size)
195 z_streamp strm; 195 z_streamp strm;
196 int level; 196 int level;
@@ -276,7 +276,7 @@ int EXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
276} 276}
277 277
278/* ========================================================================= */ 278/* ========================================================================= */
279int EXPORT deflateSetDictionary (strm, dictionary, dictLength) 279int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
280 z_streamp strm; 280 z_streamp strm;
281 const Bytef *dictionary; 281 const Bytef *dictionary;
282 uInt dictLength; 282 uInt dictLength;
@@ -299,7 +299,7 @@ int EXPORT deflateSetDictionary (strm, dictionary, dictLength)
299 dictionary += dictLength - length; /* use the tail of the dictionary */ 299 dictionary += dictLength - length; /* use the tail of the dictionary */
300#endif 300#endif
301 } 301 }
302 zmemcpy((charf *)s->window, dictionary, length); 302 zmemcpy(s->window, dictionary, length);
303 s->strstart = length; 303 s->strstart = length;
304 s->block_start = (long)length; 304 s->block_start = (long)length;
305 305
@@ -317,7 +317,7 @@ int EXPORT deflateSetDictionary (strm, dictionary, dictLength)
317} 317}
318 318
319/* ========================================================================= */ 319/* ========================================================================= */
320int EXPORT deflateReset (strm) 320int ZEXPORT deflateReset (strm)
321 z_streamp strm; 321 z_streamp strm;
322{ 322{
323 deflate_state *s; 323 deflate_state *s;
@@ -347,7 +347,7 @@ int EXPORT deflateReset (strm)
347} 347}
348 348
349/* ========================================================================= */ 349/* ========================================================================= */
350int EXPORT deflateParams(strm, level, strategy) 350int ZEXPORT deflateParams(strm, level, strategy)
351 z_streamp strm; 351 z_streamp strm;
352 int level; 352 int level;
353 int strategy; 353 int strategy;
@@ -421,7 +421,7 @@ local void flush_pending(strm)
421} 421}
422 422
423/* ========================================================================= */ 423/* ========================================================================= */
424int EXPORT deflate (strm, flush) 424int ZEXPORT deflate (strm, flush)
425 z_streamp strm; 425 z_streamp strm;
426 int flush; 426 int flush;
427{ 427{
@@ -555,7 +555,7 @@ int EXPORT deflate (strm, flush)
555} 555}
556 556
557/* ========================================================================= */ 557/* ========================================================================= */
558int EXPORT deflateEnd (strm) 558int ZEXPORT deflateEnd (strm)
559 z_streamp strm; 559 z_streamp strm;
560{ 560{
561 int status; 561 int status;
@@ -585,7 +585,7 @@ int EXPORT deflateEnd (strm)
585 * To simplify the source, this is not supported for 16-bit MSDOS (which 585 * To simplify the source, this is not supported for 16-bit MSDOS (which
586 * doesn't have enough memory anyway to duplicate compression states). 586 * doesn't have enough memory anyway to duplicate compression states).
587 */ 587 */
588int EXPORT deflateCopy (dest, source) 588int ZEXPORT deflateCopy (dest, source)
589 z_streamp dest; 589 z_streamp dest;
590 z_streamp source; 590 z_streamp source;
591{ 591{
@@ -647,7 +647,7 @@ int EXPORT deflateCopy (dest, source)
647 */ 647 */
648local int read_buf(strm, buf, size) 648local int read_buf(strm, buf, size)
649 z_streamp strm; 649 z_streamp strm;
650 charf *buf; 650 Bytef *buf;
651 unsigned size; 651 unsigned size;
652{ 652{
653 unsigned len = strm->avail_in; 653 unsigned len = strm->avail_in;
@@ -857,8 +857,8 @@ local void check_match(s, start, match, length)
857 int length; 857 int length;
858{ 858{
859 /* check that the match is indeed a match */ 859 /* check that the match is indeed a match */
860 if (zmemcmp((charf *)s->window + match, 860 if (zmemcmp(s->window + match,
861 (charf *)s->window + start, length) != EQUAL) { 861 s->window + start, length) != EQUAL) {
862 fprintf(stderr, " start %u, match %u, length %d\n", 862 fprintf(stderr, " start %u, match %u, length %d\n",
863 start, match, length); 863 start, match, length);
864 do { 864 do {
@@ -911,8 +911,7 @@ local void fill_window(s)
911 */ 911 */
912 } else if (s->strstart >= wsize+MAX_DIST(s)) { 912 } else if (s->strstart >= wsize+MAX_DIST(s)) {
913 913
914 zmemcpy((charf *)s->window, (charf *)s->window+wsize, 914 zmemcpy(s->window, s->window+wsize, (unsigned)wsize);
915 (unsigned)wsize);
916 s->match_start -= wsize; 915 s->match_start -= wsize;
917 s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ 916 s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
918 s->block_start -= (long) wsize; 917 s->block_start -= (long) wsize;
@@ -956,8 +955,7 @@ local void fill_window(s)
956 */ 955 */
957 Assert(more >= 2, "more < 2"); 956 Assert(more >= 2, "more < 2");
958 957
959 n = read_buf(s->strm, (charf *)s->window + s->strstart + s->lookahead, 958 n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
960 more);
961 s->lookahead += n; 959 s->lookahead += n;
962 960
963 /* Initialize the hash value now that we have some input: */ 961 /* Initialize the hash value now that we have some input: */
diff --git a/example.c b/example.c
index 656ab37..5b3404a 100644
--- a/example.c
+++ b/example.c
@@ -95,7 +95,11 @@ void test_gzio(out, in, uncompr, uncomprLen)
95 exit(1); 95 exit(1);
96 } 96 }
97 gzputc(file, 'h'); 97 gzputc(file, 'h');
98 if (gzprintf(file, "%s, %s!", "ello", "hello") != len-2) { 98 if (gzputs(file, "ello") != 4) {
99 fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err));
100 exit(1);
101 }
102 if (gzprintf(file, ", %s!", "hello") != 8) {
99 fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err)); 103 fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err));
100 exit(1); 104 exit(1);
101 } 105 }
@@ -132,16 +136,17 @@ void test_gzio(out, in, uncompr, uncomprLen)
132 exit(1); 136 exit(1);
133 } 137 }
134 138
135 uncomprLen = gzread(file, uncompr, (unsigned)uncomprLen); 139 gzgets(file, (char*)uncompr, uncomprLen);
136 if (uncomprLen != 7) { 140 uncomprLen = strlen((char*)uncompr);
137 fprintf(stderr, "gzread err after gzseek: %s\n", gzerror(file, &err)); 141 if (uncomprLen != 6) { /* "hello!" */
142 fprintf(stderr, "gzgets err after gzseek: %s\n", gzerror(file, &err));
138 exit(1); 143 exit(1);
139 } 144 }
140 if (strcmp((char*)uncompr, hello+7)) { 145 if (strcmp((char*)uncompr, hello+7)) {
141 fprintf(stderr, "bad gzread after gzseek\n"); 146 fprintf(stderr, "bad gzgets after gzseek\n");
142 exit(1); 147 exit(1);
143 } else { 148 } else {
144 printf("gzread() after gzseek: %s\n", uncompr); 149 printf("gzgets() after gzseek: %s\n", uncompr);
145 } 150 }
146 151
147 gzclose(file); 152 gzclose(file);
diff --git a/gzio.c b/gzio.c
index a9aa830..b816494 100644
--- a/gzio.c
+++ b/gzio.c
@@ -167,7 +167,7 @@ local gzFile gz_open (path, mode, fd)
167/* =========================================================================== 167/* ===========================================================================
168 Opens a gzip (.gz) file for reading or writing. 168 Opens a gzip (.gz) file for reading or writing.
169*/ 169*/
170gzFile EXPORT gzopen (path, mode) 170gzFile ZEXPORT gzopen (path, mode)
171 const char *path; 171 const char *path;
172 const char *mode; 172 const char *mode;
173{ 173{
@@ -178,7 +178,7 @@ gzFile EXPORT gzopen (path, mode)
178 Associate a gzFile with the file descriptor fd. fd is not dup'ed here 178 Associate a gzFile with the file descriptor fd. fd is not dup'ed here
179 to mimic the behavio(u)r of fdopen. 179 to mimic the behavio(u)r of fdopen.
180*/ 180*/
181gzFile EXPORT gzdopen (fd, mode) 181gzFile ZEXPORT gzdopen (fd, mode)
182 int fd; 182 int fd;
183 const char *mode; 183 const char *mode;
184{ 184{
@@ -193,7 +193,7 @@ gzFile EXPORT gzdopen (fd, mode)
193/* =========================================================================== 193/* ===========================================================================
194 * Update the compression level and strategy 194 * Update the compression level and strategy
195 */ 195 */
196int EXPORT gzsetparams (file, level, strategy) 196int ZEXPORT gzsetparams (file, level, strategy)
197 gzFile file; 197 gzFile file;
198 int level; 198 int level;
199 int strategy; 199 int strategy;
@@ -339,7 +339,7 @@ local int destroy (s)
339 Reads the given number of uncompressed bytes from the compressed file. 339 Reads the given number of uncompressed bytes from the compressed file.
340 gzread returns the number of bytes actually read (0 for end of file). 340 gzread returns the number of bytes actually read (0 for end of file).
341*/ 341*/
342int EXPORT gzread (file, buf, len) 342int ZEXPORT gzread (file, buf, len)
343 gzFile file; 343 gzFile file;
344 voidp buf; 344 voidp buf;
345 unsigned len; 345 unsigned len;
@@ -375,7 +375,10 @@ int EXPORT gzread (file, buf, len)
375 s->stream.avail_out -= fread(next_out, 1, s->stream.avail_out, 375 s->stream.avail_out -= fread(next_out, 1, s->stream.avail_out,
376 s->file); 376 s->file);
377 } 377 }
378 return (int)(len - s->stream.avail_out); 378 len -= s->stream.avail_out;
379 s->stream.total_in += (uLong)len;
380 s->stream.total_out += (uLong)len;
381 return (int)len;
379 } 382 }
380 if (s->stream.avail_in == 0 && !s->z_eof) { 383 if (s->stream.avail_in == 0 && !s->z_eof) {
381 384
@@ -425,7 +428,7 @@ int EXPORT gzread (file, buf, len)
425 Reads one byte from the compressed file. gzgetc returns this byte 428 Reads one byte from the compressed file. gzgetc returns this byte
426 or -1 in case of end of file or error. 429 or -1 in case of end of file or error.
427*/ 430*/
428int EXPORT gzgetc(file) 431int ZEXPORT gzgetc(file)
429 gzFile file; 432 gzFile file;
430{ 433{
431 unsigned char c; 434 unsigned char c;
@@ -434,12 +437,35 @@ int EXPORT gzgetc(file)
434} 437}
435 438
436 439
440/* ===========================================================================
441 Reads bytes from the compressed file until len-1 characters are
442 read, or a newline character is read and transferred to buf, or an
443 end-of-file condition is encountered. The string is then terminated
444 with a null character.
445 gzgets returns buf, or Z_NULL in case of error.
446
447 The current implementation is not optimized at all.
448*/
449char * ZEXPORT gzgets(file, buf, len)
450 gzFile file;
451 char *buf;
452 int len;
453{
454 char *b = buf;
455 if (buf == Z_NULL || len <= 0) return Z_NULL;
456
457 while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') ;
458 *buf = '\0';
459 return b == buf && len > 0 ? Z_NULL : b;
460}
461
462
437#ifndef NO_DEFLATE 463#ifndef NO_DEFLATE
438/* =========================================================================== 464/* ===========================================================================
439 Writes the given number of uncompressed bytes into the compressed file. 465 Writes the given number of uncompressed bytes into the compressed file.
440 gzwrite returns the number of bytes actually written (0 in case of error). 466 gzwrite returns the number of bytes actually written (0 in case of error).
441*/ 467*/
442int EXPORT gzwrite (file, buf, len) 468int ZEXPORT gzwrite (file, buf, len)
443 gzFile file; 469 gzFile file;
444 const voidp buf; 470 const voidp buf;
445 unsigned len; 471 unsigned len;
@@ -478,7 +504,7 @@ int EXPORT gzwrite (file, buf, len)
478#ifdef STDC 504#ifdef STDC
479#include <stdarg.h> 505#include <stdarg.h>
480 506
481int EXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...) 507int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...)
482{ 508{
483 char buf[Z_BUFSIZE]; 509 char buf[Z_BUFSIZE];
484 va_list va; 510 va_list va;
@@ -486,18 +512,19 @@ int EXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...)
486 512
487 va_start(va, format); 513 va_start(va, format);
488#ifdef HAS_vsnprintf 514#ifdef HAS_vsnprintf
489 len = vsnprintf(buf, sizeof(buf), format, va); 515 (void)vsnprintf(buf, sizeof(buf), format, va);
490#else 516#else
491 len = vsprintf(buf, format, va); 517 (void)vsprintf(buf, format, va);
492#endif 518#endif
493 va_end(va); 519 va_end(va);
520 len = strlen(buf); /* some *sprintf don't return the nb of bytes written */
494 if (len <= 0) return 0; 521 if (len <= 0) return 0;
495 522
496 return gzwrite(file, buf, (unsigned)len); 523 return gzwrite(file, buf, (unsigned)len);
497} 524}
498#else /* not ANSI C */ 525#else /* not ANSI C */
499 526
500int EXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, 527int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
501 a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) 528 a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
502 gzFile file; 529 gzFile file;
503 const char *format; 530 const char *format;
@@ -525,7 +552,7 @@ int EXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
525 Writes c, converted to an unsigned char, into the compressed file. 552 Writes c, converted to an unsigned char, into the compressed file.
526 gzputc returns the value that was written, or -1 in case of error. 553 gzputc returns the value that was written, or -1 in case of error.
527*/ 554*/
528int EXPORT gzputc(file, c) 555int ZEXPORT gzputc(file, c)
529 gzFile file; 556 gzFile file;
530 int c; 557 int c;
531{ 558{
@@ -536,6 +563,19 @@ int EXPORT gzputc(file, c)
536 563
537 564
538/* =========================================================================== 565/* ===========================================================================
566 Writes the given null-terminated string to the compressed file, excluding
567 the terminating null character.
568 gzputs returns the number of characters written, or -1 in case of error.
569*/
570int ZEXPORT gzputs(file, s)
571 gzFile file;
572 const char *s;
573{
574 return gzwrite(file, (const voidp)s, (unsigned)strlen(s));
575}
576
577
578/* ===========================================================================
539 Flushes all pending output into the compressed file. The parameter 579 Flushes all pending output into the compressed file. The parameter
540 flush is as in the deflate() function. 580 flush is as in the deflate() function.
541*/ 581*/
@@ -578,7 +618,7 @@ local int do_flush (file, flush)
578 return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; 618 return s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
579} 619}
580 620
581int EXPORT gzflush (file, flush) 621int ZEXPORT gzflush (file, flush)
582 gzFile file; 622 gzFile file;
583 int flush; 623 int flush;
584{ 624{
@@ -599,17 +639,17 @@ int EXPORT gzflush (file, flush)
599 SEEK_END is not implemented, returns error. 639 SEEK_END is not implemented, returns error.
600 In this version of the library, gzseek can be extremely slow. 640 In this version of the library, gzseek can be extremely slow.
601*/ 641*/
602z_off_t EXPORT gzseek (file, offset, whence) 642z_off_t ZEXPORT gzseek (file, offset, whence)
603 gzFile file; 643 gzFile file;
604 z_off_t offset; 644 z_off_t offset;
605 int whence; 645 int whence;
606{ 646{
607 gz_stream *s = (gz_stream*)file; 647 gz_stream *s = (gz_stream*)file;
608 648
609 if (s == NULL || whence == SEEK_END || s->z_err == Z_ERRNO) return -1L; 649 if (s == NULL || whence == SEEK_END ||
610 650 s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) {
611 s->z_err = Z_OK; 651 return -1L;
612 s->z_eof = 0; 652 }
613 653
614 if (s->mode == 'w') { 654 if (s->mode == 'w') {
615#ifdef NO_DEFLATE 655#ifdef NO_DEFLATE
@@ -639,8 +679,6 @@ z_off_t EXPORT gzseek (file, offset, whence)
639 } 679 }
640 /* Rest of function is for reading only */ 680 /* Rest of function is for reading only */
641 681
642 if (s->z_err == Z_DATA_ERROR) return -1L;
643
644 /* compute absolute position */ 682 /* compute absolute position */
645 if (whence == SEEK_CUR) { 683 if (whence == SEEK_CUR) {
646 offset += s->stream.total_out; 684 offset += s->stream.total_out;
@@ -651,7 +689,9 @@ z_off_t EXPORT gzseek (file, offset, whence)
651 /* map to fseek */ 689 /* map to fseek */
652 s->stream.avail_in = 0; 690 s->stream.avail_in = 0;
653 s->stream.next_in = s->inbuf; 691 s->stream.next_in = s->inbuf;
654 if (fseek(s->file, offset, SEEK_SET) < 0) return -1L; 692 if (fseek(s->file, offset, SEEK_SET) < 0) return -1L;
693
694 s->stream.total_in = s->stream.total_out = (uLong)offset;
655 return offset; 695 return offset;
656 } 696 }
657 697
@@ -680,7 +720,7 @@ z_off_t EXPORT gzseek (file, offset, whence)
680/* =========================================================================== 720/* ===========================================================================
681 Rewinds input file. 721 Rewinds input file.
682*/ 722*/
683int EXPORT gzrewind (file) 723int ZEXPORT gzrewind (file)
684 gzFile file; 724 gzFile file;
685{ 725{
686 gz_stream *s = (gz_stream*)file; 726 gz_stream *s = (gz_stream*)file;
@@ -706,7 +746,7 @@ int EXPORT gzrewind (file)
706 given compressed file. This position represents a number of bytes in the 746 given compressed file. This position represents a number of bytes in the
707 uncompressed data stream. 747 uncompressed data stream.
708*/ 748*/
709z_off_t EXPORT gztell (file) 749z_off_t ZEXPORT gztell (file)
710 gzFile file; 750 gzFile file;
711{ 751{
712 return gzseek(file, 0L, SEEK_CUR); 752 return gzseek(file, 0L, SEEK_CUR);
@@ -716,7 +756,7 @@ z_off_t EXPORT gztell (file)
716 Returns 1 when EOF has previously been detected reading the given 756 Returns 1 when EOF has previously been detected reading the given
717 input stream, otherwise zero. 757 input stream, otherwise zero.
718*/ 758*/
719int EXPORT gzeof (file) 759int ZEXPORT gzeof (file)
720 gzFile file; 760 gzFile file;
721{ 761{
722 gz_stream *s = (gz_stream*)file; 762 gz_stream *s = (gz_stream*)file;
@@ -759,7 +799,7 @@ local uLong getLong (s)
759 Flushes all pending output if necessary, closes the compressed file 799 Flushes all pending output if necessary, closes the compressed file
760 and deallocates all the (de)compression state. 800 and deallocates all the (de)compression state.
761*/ 801*/
762int EXPORT gzclose (file) 802int ZEXPORT gzclose (file)
763 gzFile file; 803 gzFile file;
764{ 804{
765 int err; 805 int err;
@@ -788,7 +828,7 @@ int EXPORT gzclose (file)
788 errnum is set to Z_ERRNO and the application may consult errno 828 errnum is set to Z_ERRNO and the application may consult errno
789 to get the exact error code. 829 to get the exact error code.
790*/ 830*/
791const char* EXPORT gzerror (file, errnum) 831const char* ZEXPORT gzerror (file, errnum)
792 gzFile file; 832 gzFile file;
793 int *errnum; 833 int *errnum;
794{ 834{
diff --git a/infblock.c b/infblock.c
index 7e9c7af..17943ab 100644
--- a/infblock.c
+++ b/infblock.c
@@ -71,11 +71,7 @@ uLongf *c;
71 if (s->mode == BTREE || s->mode == DTREE) 71 if (s->mode == BTREE || s->mode == DTREE)
72 ZFREE(z, s->sub.trees.blens); 72 ZFREE(z, s->sub.trees.blens);
73 if (s->mode == CODES) 73 if (s->mode == CODES)
74 {
75 inflate_codes_free(s->sub.decode.codes, z); 74 inflate_codes_free(s->sub.decode.codes, z);
76 inflate_trees_free(s->sub.decode.td, z);
77 inflate_trees_free(s->sub.decode.tl, z);
78 }
79 s->mode = TYPE; 75 s->mode = TYPE;
80 s->bitk = 0; 76 s->bitk = 0;
81 s->bitb = 0; 77 s->bitb = 0;
@@ -96,8 +92,15 @@ uInt w;
96 if ((s = (inflate_blocks_statef *)ZALLOC 92 if ((s = (inflate_blocks_statef *)ZALLOC
97 (z,1,sizeof(struct inflate_blocks_state))) == Z_NULL) 93 (z,1,sizeof(struct inflate_blocks_state))) == Z_NULL)
98 return s; 94 return s;
95 if ((s->hufts =
96 (inflate_huft *)ZALLOC(z, sizeof(inflate_huft), MANY)) == Z_NULL)
97 {
98 ZFREE(z, s);
99 return Z_NULL;
100 }
99 if ((s->window = (Bytef *)ZALLOC(z, 1, w)) == Z_NULL) 101 if ((s->window = (Bytef *)ZALLOC(z, 1, w)) == Z_NULL)
100 { 102 {
103 ZFREE(z, s->hufts);
101 ZFREE(z, s); 104 ZFREE(z, s);
102 return Z_NULL; 105 return Z_NULL;
103 } 106 }
@@ -110,9 +113,6 @@ uInt w;
110} 113}
111 114
112 115
113#ifdef DEBUG
114 extern uInt inflate_hufts;
115#endif
116int inflate_blocks(s, z, r) 116int inflate_blocks(s, z, r)
117inflate_blocks_statef *s; 117inflate_blocks_statef *s;
118z_streamp z; 118z_streamp z;
@@ -153,15 +153,13 @@ int r;
153 uInt bl, bd; 153 uInt bl, bd;
154 inflate_huft *tl, *td; 154 inflate_huft *tl, *td;
155 155
156 inflate_trees_fixed(&bl, &bd, &tl, &td); 156 inflate_trees_fixed(&bl, &bd, &tl, &td, z);
157 s->sub.decode.codes = inflate_codes_new(bl, bd, tl, td, z); 157 s->sub.decode.codes = inflate_codes_new(bl, bd, tl, td, z);
158 if (s->sub.decode.codes == Z_NULL) 158 if (s->sub.decode.codes == Z_NULL)
159 { 159 {
160 r = Z_MEM_ERROR; 160 r = Z_MEM_ERROR;
161 LEAVE 161 LEAVE
162 } 162 }
163 s->sub.decode.tl = Z_NULL; /* don't try to free these */
164 s->sub.decode.td = Z_NULL;
165 } 163 }
166 DUMPBITS(3) 164 DUMPBITS(3)
167 s->mode = CODES; 165 s->mode = CODES;
@@ -244,7 +242,7 @@ int r;
244 s->sub.trees.blens[border[s->sub.trees.index++]] = 0; 242 s->sub.trees.blens[border[s->sub.trees.index++]] = 0;
245 s->sub.trees.bb = 7; 243 s->sub.trees.bb = 7;
246 t = inflate_trees_bits(s->sub.trees.blens, &s->sub.trees.bb, 244 t = inflate_trees_bits(s->sub.trees.blens, &s->sub.trees.bb,
247 &s->sub.trees.tb, z); 245 &s->sub.trees.tb, s->hufts, z);
248 if (t != Z_OK) 246 if (t != Z_OK)
249 { 247 {
250 ZFREE(z, s->sub.trees.blens); 248 ZFREE(z, s->sub.trees.blens);
@@ -286,7 +284,6 @@ int r;
286 if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) || 284 if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) ||
287 (c == 16 && i < 1)) 285 (c == 16 && i < 1))
288 { 286 {
289 inflate_trees_free(s->sub.trees.tb, z);
290 ZFREE(z, s->sub.trees.blens); 287 ZFREE(z, s->sub.trees.blens);
291 s->mode = BAD; 288 s->mode = BAD;
292 z->msg = (char*)"invalid bit length repeat"; 289 z->msg = (char*)"invalid bit length repeat";
@@ -300,7 +297,6 @@ int r;
300 s->sub.trees.index = i; 297 s->sub.trees.index = i;
301 } 298 }
302 } 299 }
303 inflate_trees_free(s->sub.trees.tb, z);
304 s->sub.trees.tb = Z_NULL; 300 s->sub.trees.tb = Z_NULL;
305 { 301 {
306 uInt bl, bd; 302 uInt bl, bd;
@@ -310,11 +306,9 @@ int r;
310 bl = 9; /* must be <= 9 for lookahead assumptions */ 306 bl = 9; /* must be <= 9 for lookahead assumptions */
311 bd = 6; /* must be <= 9 for lookahead assumptions */ 307 bd = 6; /* must be <= 9 for lookahead assumptions */
312 t = s->sub.trees.table; 308 t = s->sub.trees.table;
313#ifdef DEBUG
314 inflate_hufts = 0;
315#endif
316 t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f), 309 t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f),
317 s->sub.trees.blens, &bl, &bd, &tl, &td, z); 310 s->sub.trees.blens, &bl, &bd, &tl, &td,
311 s->hufts, z);
318 ZFREE(z, s->sub.trees.blens); 312 ZFREE(z, s->sub.trees.blens);
319 if (t != Z_OK) 313 if (t != Z_OK)
320 { 314 {
@@ -323,18 +317,13 @@ int r;
323 r = t; 317 r = t;
324 LEAVE 318 LEAVE
325 } 319 }
326 Tracev((stderr, "inflate: trees ok, %d * %d bytes used\n", 320 Tracev((stderr, "inflate: trees ok\n"));
327 inflate_hufts, sizeof(inflate_huft)));
328 if ((c = inflate_codes_new(bl, bd, tl, td, z)) == Z_NULL) 321 if ((c = inflate_codes_new(bl, bd, tl, td, z)) == Z_NULL)
329 { 322 {
330 inflate_trees_free(td, z);
331 inflate_trees_free(tl, z);
332 r = Z_MEM_ERROR; 323 r = Z_MEM_ERROR;
333 LEAVE 324 LEAVE
334 } 325 }
335 s->sub.decode.codes = c; 326 s->sub.decode.codes = c;
336 s->sub.decode.tl = tl;
337 s->sub.decode.td = td;
338 } 327 }
339 s->mode = CODES; 328 s->mode = CODES;
340 case CODES: 329 case CODES:
@@ -343,8 +332,6 @@ int r;
343 return inflate_flush(s, z, r); 332 return inflate_flush(s, z, r);
344 r = Z_OK; 333 r = Z_OK;
345 inflate_codes_free(s->sub.decode.codes, z); 334 inflate_codes_free(s->sub.decode.codes, z);
346 inflate_trees_free(s->sub.decode.td, z);
347 inflate_trees_free(s->sub.decode.tl, z);
348 LOAD 335 LOAD
349 Tracev((stderr, "inflate: codes end, %lu total out\n", 336 Tracev((stderr, "inflate: codes end, %lu total out\n",
350 z->total_out + (q >= s->read ? q - s->read : 337 z->total_out + (q >= s->read ? q - s->read :
@@ -386,6 +373,7 @@ z_streamp z;
386{ 373{
387 inflate_blocks_reset(s, z, Z_NULL); 374 inflate_blocks_reset(s, z, Z_NULL);
388 ZFREE(z, s->window); 375 ZFREE(z, s->window);
376 ZFREE(z, s->hufts);
389 ZFREE(z, s); 377 ZFREE(z, s);
390 Tracev((stderr, "inflate: blocks freed\n")); 378 Tracev((stderr, "inflate: blocks freed\n"));
391 return Z_OK; 379 return Z_OK;
@@ -397,7 +385,7 @@ inflate_blocks_statef *s;
397const Bytef *d; 385const Bytef *d;
398uInt n; 386uInt n;
399{ 387{
400 zmemcpy((charf *)s->window, d, n); 388 zmemcpy(s->window, d, n);
401 s->read = s->write = s->window + n; 389 s->read = s->write = s->window + n;
402} 390}
403 391
diff --git a/inflate.c b/inflate.c
index 3cff366..7b9bc3b 100644
--- a/inflate.c
+++ b/inflate.c
@@ -50,7 +50,7 @@ struct internal_state {
50}; 50};
51 51
52 52
53int EXPORT inflateReset(z) 53int ZEXPORT inflateReset(z)
54z_streamp z; 54z_streamp z;
55{ 55{
56 if (z == Z_NULL || z->state == Z_NULL) 56 if (z == Z_NULL || z->state == Z_NULL)
@@ -64,7 +64,7 @@ z_streamp z;
64} 64}
65 65
66 66
67int EXPORT inflateEnd(z) 67int ZEXPORT inflateEnd(z)
68z_streamp z; 68z_streamp z;
69{ 69{
70 if (z == Z_NULL || z->state == Z_NULL || z->zfree == Z_NULL) 70 if (z == Z_NULL || z->state == Z_NULL || z->zfree == Z_NULL)
@@ -78,7 +78,7 @@ z_streamp z;
78} 78}
79 79
80 80
81int EXPORT inflateInit2_(z, w, version, stream_size) 81int ZEXPORT inflateInit2_(z, w, version, stream_size)
82z_streamp z; 82z_streamp z;
83int w; 83int w;
84const char *version; 84const char *version;
@@ -135,7 +135,7 @@ int stream_size;
135} 135}
136 136
137 137
138int EXPORT inflateInit_(z, version, stream_size) 138int ZEXPORT inflateInit_(z, version, stream_size)
139z_streamp z; 139z_streamp z;
140const char *version; 140const char *version;
141int stream_size; 141int stream_size;
@@ -144,18 +144,19 @@ int stream_size;
144} 144}
145 145
146 146
147#define NEEDBYTE {if(z->avail_in==0)return r; if (f != Z_FINISH) r = Z_OK;} 147#define NEEDBYTE {if(z->avail_in==0)return r;r=f;}
148#define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++) 148#define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++)
149 149
150int EXPORT inflate(z, f) 150int ZEXPORT inflate(z, f)
151z_streamp z; 151z_streamp z;
152int f; 152int f;
153{ 153{
154 int r; 154 int r;
155 uInt b; 155 uInt b;
156 156
157 if (z == Z_NULL || z->state == Z_NULL || z->next_in == Z_NULL || f < 0) 157 if (z == Z_NULL || z->state == Z_NULL || z->next_in == Z_NULL)
158 return Z_STREAM_ERROR; 158 return Z_STREAM_ERROR;
159 f = f == Z_FINISH ? Z_BUF_ERROR : Z_OK;
159 r = Z_BUF_ERROR; 160 r = Z_BUF_ERROR;
160 while (1) switch (z->state->mode) 161 while (1) switch (z->state->mode)
161 { 162 {
@@ -190,7 +191,7 @@ int f;
190 if (!(b & PRESET_DICT)) 191 if (!(b & PRESET_DICT))
191 { 192 {
192 z->state->mode = BLOCKS; 193 z->state->mode = BLOCKS;
193 break; 194 break;
194 } 195 }
195 z->state->mode = DICT4; 196 z->state->mode = DICT4;
196 case DICT4: 197 case DICT4:
@@ -224,9 +225,10 @@ int f;
224 z->state->sub.marker = 0; /* can try inflateSync */ 225 z->state->sub.marker = 0; /* can try inflateSync */
225 break; 226 break;
226 } 227 }
228 if (r == Z_OK)
229 r = f;
227 if (r != Z_STREAM_END) 230 if (r != Z_STREAM_END)
228 return f == Z_FINISH && r == Z_OK ? Z_BUF_ERROR : r; 231 return r;
229 r = Z_OK;
230 inflate_blocks_reset(z->state->blocks, z, &z->state->sub.check.was); 232 inflate_blocks_reset(z->state->blocks, z, &z->state->sub.check.was);
231 if (z->state->nowrap) 233 if (z->state->nowrap)
232 { 234 {
@@ -234,7 +236,6 @@ int f;
234 break; 236 break;
235 } 237 }
236 z->state->mode = CHECK4; 238 z->state->mode = CHECK4;
237 if (f == Z_FINISH) r = Z_BUF_ERROR;
238 case CHECK4: 239 case CHECK4:
239 NEEDBYTE 240 NEEDBYTE
240 z->state->sub.check.need = (uLong)NEXTBYTE << 24; 241 z->state->sub.check.need = (uLong)NEXTBYTE << 24;
@@ -273,7 +274,7 @@ int f;
273} 274}
274 275
275 276
276int EXPORT inflateSetDictionary(z, dictionary, dictLength) 277int ZEXPORT inflateSetDictionary(z, dictionary, dictLength)
277z_streamp z; 278z_streamp z;
278const Bytef *dictionary; 279const Bytef *dictionary;
279uInt dictLength; 280uInt dictLength;
@@ -297,7 +298,7 @@ uInt dictLength;
297} 298}
298 299
299 300
300int EXPORT inflateSync(z) 301int ZEXPORT inflateSync(z)
301z_streamp z; 302z_streamp z;
302{ 303{
303 uInt n; /* number of bytes to look at */ 304 uInt n; /* number of bytes to look at */
@@ -321,8 +322,7 @@ z_streamp z;
321 /* search */ 322 /* search */
322 while (n && m < 4) 323 while (n && m < 4)
323 { 324 {
324 static const Byte mark[4] = {0, 0, 0xff, 0xff}; 325 if (*p == (Byte)(m < 2 ? 0 : (Byte)0xff))
325 if (*p == mark[m])
326 m++; 326 m++;
327 else if (*p) 327 else if (*p)
328 m = 0; 328 m = 0;
@@ -355,7 +355,7 @@ z_streamp z;
355 * decompressing, PPP checks that at the end of input packet, inflate is 355 * decompressing, PPP checks that at the end of input packet, inflate is
356 * waiting for these length bytes. 356 * waiting for these length bytes.
357 */ 357 */
358int EXPORT inflateSyncPoint(z) 358int ZEXPORT inflateSyncPoint(z)
359z_streamp z; 359z_streamp z;
360{ 360{
361 if (z == Z_NULL || z->state == Z_NULL || z->state->blocks == Z_NULL) 361 if (z == Z_NULL || z->state == Z_NULL || z->state->blocks == Z_NULL)
diff --git a/inftrees.c b/inftrees.c
index 3c2facf..282f277 100644
--- a/inftrees.c
+++ b/inftrees.c
@@ -7,7 +7,7 @@
7#include "inftrees.h" 7#include "inftrees.h"
8 8
9const char inflate_copyright[] = 9const char inflate_copyright[] =
10 " inflate 1.0.8 Copyright 1995-1998 Mark Adler "; 10 " inflate 1.0.9 Copyright 1995-1998 Mark Adler ";
11/* 11/*
12 If you use the zlib library in a product, an acknowledgment is welcome 12 If you use the zlib library in a product, an acknowledgment is welcome
13 in the documentation of your product. If for some reason you cannot 13 in the documentation of your product. If for some reason you cannot
@@ -31,12 +31,9 @@ local int huft_build OF((
31 const uIntf *, /* list of extra bits for non-simple codes */ 31 const uIntf *, /* list of extra bits for non-simple codes */
32 inflate_huft * FAR*,/* result: starting table */ 32 inflate_huft * FAR*,/* result: starting table */
33 uIntf *, /* maximum lookup bits (returns actual) */ 33 uIntf *, /* maximum lookup bits (returns actual) */
34 z_streamp )); /* for zalloc function */ 34 inflate_huft *, /* space for trees */
35 35 uInt *, /* hufts used in space */
36local voidpf falloc OF(( 36 uIntf * )); /* space for values */
37 voidpf, /* opaque pointer (not used) */
38 uInt, /* number of items */
39 uInt)); /* size of item */
40 37
41/* Tables for deflate from PKZIP's appnote.txt. */ 38/* Tables for deflate from PKZIP's appnote.txt. */
42local const uInt cplens[31] = { /* Copy lengths for literal codes 257..285 */ 39local const uInt cplens[31] = { /* Copy lengths for literal codes 257..285 */
@@ -90,21 +87,18 @@ local const uInt cpdext[30] = { /* Extra bits for distance codes */
90 87
91/* If BMAX needs to be larger than 16, then h and x[] should be uLong. */ 88/* If BMAX needs to be larger than 16, then h and x[] should be uLong. */
92#define BMAX 15 /* maximum bit length of any code */ 89#define BMAX 15 /* maximum bit length of any code */
93#define N_MAX 288 /* maximum number of codes in any set */
94
95#ifdef DEBUG
96 uInt inflate_hufts;
97#endif
98 90
99local int huft_build(b, n, s, d, e, t, m, zs) 91local int huft_build(b, n, s, d, e, t, m, hp, hn, v)
100uIntf *b; /* code lengths in bits (all assumed <= BMAX) */ 92uIntf *b; /* code lengths in bits (all assumed <= BMAX) */
101uInt n; /* number of codes (assumed <= N_MAX) */ 93uInt n; /* number of codes (assumed <= 288) */
102uInt s; /* number of simple-valued codes (0..s-1) */ 94uInt s; /* number of simple-valued codes (0..s-1) */
103const uIntf *d; /* list of base values for non-simple codes */ 95const uIntf *d; /* list of base values for non-simple codes */
104const uIntf *e; /* list of extra bits for non-simple codes */ 96const uIntf *e; /* list of extra bits for non-simple codes */
105inflate_huft * FAR *t; /* result: starting table */ 97inflate_huft * FAR *t; /* result: starting table */
106uIntf *m; /* maximum lookup bits, returns actual */ 98uIntf *m; /* maximum lookup bits, returns actual */
107z_streamp zs; /* for zalloc function */ 99inflate_huft *hp; /* space for trees */
100uInt *hn; /* hufts used in space */
101uIntf *v; /* working area: values in order of bit length */
108/* Given a list of code lengths and a maximum table size, make a set of 102/* Given a list of code lengths and a maximum table size, make a set of
109 tables to decode that set of codes. Return Z_OK on success, Z_BUF_ERROR 103 tables to decode that set of codes. Return Z_OK on success, Z_BUF_ERROR
110 if the given code set is incomplete (the tables are still built in this 104 if the given code set is incomplete (the tables are still built in this
@@ -121,11 +115,11 @@ z_streamp zs; /* for zalloc function */
121 register uInt j; /* counter */ 115 register uInt j; /* counter */
122 register int k; /* number of bits in current code */ 116 register int k; /* number of bits in current code */
123 int l; /* bits per table (returned in m) */ 117 int l; /* bits per table (returned in m) */
118 uInt mask; /* (1 << w) - 1, to avoid cc -O bug on HP */
124 register uIntf *p; /* pointer into c[], b[], or v[] */ 119 register uIntf *p; /* pointer into c[], b[], or v[] */
125 inflate_huft *q; /* points to current table */ 120 inflate_huft *q; /* points to current table */
126 struct inflate_huft_s r; /* table entry for structure assignment */ 121 struct inflate_huft_s r; /* table entry for structure assignment */
127 inflate_huft *u[BMAX]; /* table stack */ 122 inflate_huft *u[BMAX]; /* table stack */
128 uInt v[N_MAX]; /* values in order of bit length */
129 register int w; /* bits before this table == (l * h) */ 123 register int w; /* bits before this table == (l * h) */
130 uInt x[BMAX+1]; /* bit offsets, then code stack */ 124 uInt x[BMAX+1]; /* bit offsets, then code stack */
131 uIntf *xp; /* pointer into x */ 125 uIntf *xp; /* pointer into x */
@@ -233,20 +227,16 @@ z_streamp zs; /* for zalloc function */
233 } 227 }
234 z = 1 << j; /* table entries for j-bit table */ 228 z = 1 << j; /* table entries for j-bit table */
235 229
236 /* allocate and link in new table */ 230 /* allocate new table */
237 if ((q = (inflate_huft *)ZALLOC 231 if (*hn + z > MANY) /* (note: doesn't matter for fixed) */
238 (zs,z + 1,sizeof(inflate_huft))) == Z_NULL)
239 {
240 if (h)
241 inflate_trees_free(u[0], zs);
242 return Z_MEM_ERROR; /* not enough memory */ 232 return Z_MEM_ERROR; /* not enough memory */
233 u[h] = q = hp + *hn;
234 *hn += z;
235 if (t != Z_NULL) /* first table is returned result */
236 {
237 *t = q;
238 t = Z_NULL;
243 } 239 }
244#ifdef DEBUG
245 inflate_hufts += z + 1;
246#endif
247 *t = q + 1; /* link to list for huft_free() */
248 *(t = &(q->next)) = Z_NULL;
249 u[h] = ++q; /* table starts after link */
250 240
251 /* connect to last table, if there is one */ 241 /* connect to last table, if there is one */
252 if (h) 242 if (h)
@@ -286,10 +276,12 @@ z_streamp zs; /* for zalloc function */
286 i ^= j; 276 i ^= j;
287 277
288 /* backup over finished tables */ 278 /* backup over finished tables */
289 while ((i & ((1 << w) - 1)) != x[h]) 279 mask = (1 << w) - 1; /* needed on HP, cc -O bug */
280 while ((i & mask) != x[h])
290 { 281 {
291 h--; /* don't need to update q */ 282 h--; /* don't need to update q */
292 w -= l; 283 w -= l;
284 mask = (1 << w) - 1;
293 } 285 }
294 } 286 }
295 } 287 }
@@ -300,28 +292,34 @@ z_streamp zs; /* for zalloc function */
300} 292}
301 293
302 294
303int inflate_trees_bits(c, bb, tb, z) 295int inflate_trees_bits(c, bb, tb, hp, z)
304uIntf *c; /* 19 code lengths */ 296uIntf *c; /* 19 code lengths */
305uIntf *bb; /* bits tree desired/actual depth */ 297uIntf *bb; /* bits tree desired/actual depth */
306inflate_huft * FAR *tb; /* bits tree result */ 298inflate_huft * FAR *tb; /* bits tree result */
307z_streamp z; /* for zfree function */ 299inflate_huft *hp; /* space for trees */
300z_streamp z; /* for messages */
308{ 301{
309 int r; 302 int r;
303 uInt hn = 0; /* hufts used in space */
304 uIntf *v; /* work area for huft_build */
310 305
311 r = huft_build(c, 19, 19, (uIntf*)Z_NULL, (uIntf*)Z_NULL, tb, bb, z); 306 if ((v = (uIntf*)ZALLOC(z, 19, sizeof(uInt))) == Z_NULL)
307 return Z_MEM_ERROR;
308 r = huft_build(c, 19, 19, (uIntf*)Z_NULL, (uIntf*)Z_NULL,
309 tb, bb, hp, &hn, v);
312 if (r == Z_DATA_ERROR) 310 if (r == Z_DATA_ERROR)
313 z->msg = (char*)"oversubscribed dynamic bit lengths tree"; 311 z->msg = (char*)"oversubscribed dynamic bit lengths tree";
314 else if (r == Z_BUF_ERROR || *bb == 0) 312 else if (r == Z_BUF_ERROR || *bb == 0)
315 { 313 {
316 inflate_trees_free(*tb, z);
317 z->msg = (char*)"incomplete dynamic bit lengths tree"; 314 z->msg = (char*)"incomplete dynamic bit lengths tree";
318 r = Z_DATA_ERROR; 315 r = Z_DATA_ERROR;
319 } 316 }
317 ZFREE(z, v);
320 return r; 318 return r;
321} 319}
322 320
323 321
324int inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, z) 322int inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, hp, z)
325uInt nl; /* number of literal/length codes */ 323uInt nl; /* number of literal/length codes */
326uInt nd; /* number of distance codes */ 324uInt nd; /* number of distance codes */
327uIntf *c; /* that many (total) code lengths */ 325uIntf *c; /* that many (total) code lengths */
@@ -329,27 +327,34 @@ uIntf *bl; /* literal desired/actual bit depth */
329uIntf *bd; /* distance desired/actual bit depth */ 327uIntf *bd; /* distance desired/actual bit depth */
330inflate_huft * FAR *tl; /* literal/length tree result */ 328inflate_huft * FAR *tl; /* literal/length tree result */
331inflate_huft * FAR *td; /* distance tree result */ 329inflate_huft * FAR *td; /* distance tree result */
332z_streamp z; /* for zfree function */ 330inflate_huft *hp; /* space for trees */
331z_streamp z; /* for messages */
333{ 332{
334 int r; 333 int r;
334 uInt hn = 0; /* hufts used in space */
335 uIntf *v; /* work area for huft_build */
336
337 /* allocate work area */
338 if ((v = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)
339 return Z_MEM_ERROR;
335 340
336 /* build literal/length tree */ 341 /* build literal/length tree */
337 r = huft_build(c, nl, 257, cplens, cplext, tl, bl, z); 342 r = huft_build(c, nl, 257, cplens, cplext, tl, bl, hp, &hn, v);
338 if (r != Z_OK || *bl == 0) 343 if (r != Z_OK || *bl == 0)
339 { 344 {
340 if (r == Z_DATA_ERROR) 345 if (r == Z_DATA_ERROR)
341 z->msg = (char*)"oversubscribed literal/length tree"; 346 z->msg = (char*)"oversubscribed literal/length tree";
342 else if (r != Z_MEM_ERROR) 347 else if (r != Z_MEM_ERROR)
343 { 348 {
344 inflate_trees_free(*tl, z);
345 z->msg = (char*)"incomplete literal/length tree"; 349 z->msg = (char*)"incomplete literal/length tree";
346 r = Z_DATA_ERROR; 350 r = Z_DATA_ERROR;
347 } 351 }
352 ZFREE(z, v);
348 return r; 353 return r;
349 } 354 }
350 355
351 /* build distance tree */ 356 /* build distance tree */
352 r = huft_build(c + nl, nd, 0, cpdist, cpdext, td, bd, z); 357 r = huft_build(c + nl, nd, 0, cpdist, cpdext, td, bd, hp, &hn, v);
353 if (r != Z_OK || (*bd == 0 && nl > 257)) 358 if (r != Z_OK || (*bd == 0 && nl > 257))
354 { 359 {
355 if (r == Z_DATA_ERROR) 360 if (r == Z_DATA_ERROR)
@@ -359,7 +364,6 @@ z_streamp z; /* for zfree function */
359 r = Z_OK; 364 r = Z_OK;
360 } 365 }
361#else 366#else
362 inflate_trees_free(*td, z);
363 z->msg = (char*)"incomplete distance tree"; 367 z->msg = (char*)"incomplete distance tree";
364 r = Z_DATA_ERROR; 368 r = Z_DATA_ERROR;
365 } 369 }
@@ -368,19 +372,20 @@ z_streamp z; /* for zfree function */
368 z->msg = (char*)"empty distance tree with lengths"; 372 z->msg = (char*)"empty distance tree with lengths";
369 r = Z_DATA_ERROR; 373 r = Z_DATA_ERROR;
370 } 374 }
371 inflate_trees_free(*tl, z); 375 ZFREE(z, v);
372 return r; 376 return r;
373#endif 377#endif
374 } 378 }
375 379
376 /* done */ 380 /* done */
381 ZFREE(z, v);
377 return Z_OK; 382 return Z_OK;
378} 383}
379 384
380 385
381/* build fixed tables only once--keep them here */ 386/* build fixed tables only once--keep them here */
382local int fixed_built = 0; 387local int fixed_built = 0;
383#define FIXEDH 530 /* number of hufts used by fixed tables */ 388#define FIXEDH 424 /* number of hufts used by fixed tables */
384local inflate_huft fixed_mem[FIXEDH]; 389local inflate_huft fixed_mem[FIXEDH];
385local uInt fixed_bl; 390local uInt fixed_bl;
386local uInt fixed_bd; 391local uInt fixed_bd;
@@ -388,36 +393,29 @@ local inflate_huft *fixed_tl;
388local inflate_huft *fixed_td; 393local inflate_huft *fixed_td;
389 394
390 395
391local voidpf falloc(q, n, s) 396int inflate_trees_fixed(bl, bd, tl, td, z)
392voidpf q; /* opaque pointer */
393uInt n; /* number of items */
394uInt s; /* size of item */
395{
396 Assert(s == sizeof(inflate_huft) && n <= *(intf *)q,
397 "inflate_trees falloc overflow");
398 *(intf *)q -= n+s-s; /* s-s to avoid warning */
399 return (voidpf)(fixed_mem + *(intf *)q);
400}
401
402
403int inflate_trees_fixed(bl, bd, tl, td)
404uIntf *bl; /* literal desired/actual bit depth */ 397uIntf *bl; /* literal desired/actual bit depth */
405uIntf *bd; /* distance desired/actual bit depth */ 398uIntf *bd; /* distance desired/actual bit depth */
406inflate_huft * FAR *tl; /* literal/length tree result */ 399inflate_huft * FAR *tl; /* literal/length tree result */
407inflate_huft * FAR *td; /* distance tree result */ 400inflate_huft * FAR *td; /* distance tree result */
401z_streamp z; /* for memory allocation */
408{ 402{
409 /* build fixed tables if not already (multiple overlapped executions ok) */ 403 /* build fixed tables if not already (multiple overlapped executions ok) */
410 if (!fixed_built) 404 if (!fixed_built)
411 { 405 {
412 int k; /* temporary variable */ 406 int k; /* temporary variable */
413 unsigned c[288]; /* length list for huft_build */ 407 uInt f = 0; /* number of hufts used in fixed_mem */
414 z_stream z; /* for falloc function */ 408 uIntf *c; /* length list for huft_build */
415 int f = FIXEDH; /* number of hufts left in fixed_mem */ 409 uIntf *v; /* work area for huft_build */
416 410
417 /* set up fake z_stream for memory routines */ 411 /* allocate memory */
418 z.zalloc = falloc; 412 if ((c = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)
419 z.zfree = Z_NULL; 413 return Z_MEM_ERROR;
420 z.opaque = (voidpf)&f; 414 if ((v = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)
415 {
416 ZFREE(z, c);
417 return Z_MEM_ERROR;
418 }
421 419
422 /* literal table */ 420 /* literal table */
423 for (k = 0; k < 144; k++) 421 for (k = 0; k < 144; k++)
@@ -429,16 +427,19 @@ inflate_huft * FAR *td; /* distance tree result */
429 for (; k < 288; k++) 427 for (; k < 288; k++)
430 c[k] = 8; 428 c[k] = 8;
431 fixed_bl = 7; 429 fixed_bl = 7;
432 huft_build(c, 288, 257, cplens, cplext, &fixed_tl, &fixed_bl, &z); 430 huft_build(c, 288, 257, cplens, cplext, &fixed_tl, &fixed_bl,
431 fixed_mem, &f, v);
433 432
434 /* distance table */ 433 /* distance table */
435 for (k = 0; k < 30; k++) 434 for (k = 0; k < 30; k++)
436 c[k] = 5; 435 c[k] = 5;
437 fixed_bd = 5; 436 fixed_bd = 5;
438 huft_build(c, 30, 0, cpdist, cpdext, &fixed_td, &fixed_bd, &z); 437 huft_build(c, 30, 0, cpdist, cpdext, &fixed_td, &fixed_bd,
438 fixed_mem, &f, v);
439 439
440 /* done */ 440 /* done */
441 Assert(f == 0, "invalid build of fixed tables"); 441 ZFREE(z, v);
442 ZFREE(z, c);
442 fixed_built = 1; 443 fixed_built = 1;
443 } 444 }
444 *bl = fixed_bl; 445 *bl = fixed_bl;
@@ -447,33 +448,3 @@ inflate_huft * FAR *td; /* distance tree result */
447 *td = fixed_td; 448 *td = fixed_td;
448 return Z_OK; 449 return Z_OK;
449} 450}
450
451
452int inflate_trees_free(t, z)
453inflate_huft *t; /* table to free */
454z_streamp z; /* for zfree function */
455/* Free the malloc'ed tables built by huft_build(), which makes a linked
456 list of the tables it made, with the links in a dummy first entry of
457 each table. */
458{
459 register inflate_huft *p, *q, *r;
460
461 /* Reverse linked list */
462 p = Z_NULL;
463 q = t;
464 while (q != Z_NULL)
465 {
466 r = (q - 1)->next;
467 (q - 1)->next = p;
468 p = q;
469 q = r;
470 }
471 /* Go through linked list, freeing from the malloced (t[-1]) address. */
472 while (p != Z_NULL)
473 {
474 q = (--p)->next;
475 ZFREE(z,p);
476 p = q;
477 }
478 return Z_OK;
479}
diff --git a/inftrees.h b/inftrees.h
index e3db75a..c2513d1 100644
--- a/inftrees.h
+++ b/inftrees.h
@@ -27,15 +27,19 @@ struct inflate_huft_s {
27 } more; 27 } more;
28}; 28};
29 29
30#ifdef DEBUG 30/* Maximum size of dynamic tree. The maximum found in a long but non-
31 extern uInt inflate_hufts; 31 exhaustive search was 1041 huft structures (875 for length/literals
32#endif 32 and 166 for distances, the latter actually the result of an
33 exhaustive search). The actual maximum is not known, but the
34 value below is more than safe. */
35#define MANY 1440
33 36
34extern int inflate_trees_bits OF(( 37extern int inflate_trees_bits OF((
35 uIntf *, /* 19 code lengths */ 38 uIntf *, /* 19 code lengths */
36 uIntf *, /* bits tree desired/actual depth */ 39 uIntf *, /* bits tree desired/actual depth */
37 inflate_huft * FAR *, /* bits tree result */ 40 inflate_huft * FAR *, /* bits tree result */
38 z_streamp )); /* for zalloc, zfree functions */ 41 inflate_huft *, /* space for trees */
42 z_streamp)); /* for messages */
39 43
40extern int inflate_trees_dynamic OF(( 44extern int inflate_trees_dynamic OF((
41 uInt, /* number of literal/length codes */ 45 uInt, /* number of literal/length codes */
@@ -45,15 +49,12 @@ extern int inflate_trees_dynamic OF((
45 uIntf *, /* distance desired/actual bit depth */ 49 uIntf *, /* distance desired/actual bit depth */
46 inflate_huft * FAR *, /* literal/length tree result */ 50 inflate_huft * FAR *, /* literal/length tree result */
47 inflate_huft * FAR *, /* distance tree result */ 51 inflate_huft * FAR *, /* distance tree result */
48 z_streamp )); /* for zalloc, zfree functions */ 52 inflate_huft *, /* space for trees */
53 z_streamp)); /* for messages */
49 54
50extern int inflate_trees_fixed OF(( 55extern int inflate_trees_fixed OF((
51 uIntf *, /* literal desired/actual bit depth */ 56 uIntf *, /* literal desired/actual bit depth */
52 uIntf *, /* distance desired/actual bit depth */ 57 uIntf *, /* distance desired/actual bit depth */
53 inflate_huft * FAR *, /* literal/length tree result */ 58 inflate_huft * FAR *, /* literal/length tree result */
54 inflate_huft * FAR *)); /* distance tree result */ 59 inflate_huft * FAR *, /* distance tree result */
55 60 z_streamp)); /* for memory allocation */
56extern int inflate_trees_free OF((
57 inflate_huft *, /* tables to free */
58 z_streamp )); /* for zfree function */
59
diff --git a/infutil.h b/infutil.h
index 121316b..99d1135 100644
--- a/infutil.h
+++ b/infutil.h
@@ -41,8 +41,6 @@ struct inflate_blocks_state {
41 inflate_huft *tb; /* bit length decoding tree */ 41 inflate_huft *tb; /* bit length decoding tree */
42 } trees; /* if DTREE, decoding info for trees */ 42 } trees; /* if DTREE, decoding info for trees */
43 struct { 43 struct {
44 inflate_huft *tl;
45 inflate_huft *td; /* trees to free */
46 inflate_codes_statef 44 inflate_codes_statef
47 *codes; 45 *codes;
48 } decode; /* if CODES, current state */ 46 } decode; /* if CODES, current state */
@@ -52,6 +50,7 @@ struct inflate_blocks_state {
52 /* mode independent information */ 50 /* mode independent information */
53 uInt bitk; /* bits in bit buffer */ 51 uInt bitk; /* bits in bit buffer */
54 uLong bitb; /* bit buffer */ 52 uLong bitb; /* bit buffer */
53 inflate_huft *hufts; /* single malloc for tree space */
55 Bytef *window; /* sliding window */ 54 Bytef *window; /* sliding window */
56 Bytef *end; /* one byte after sliding window */ 55 Bytef *end; /* one byte after sliding window */
57 Bytef *read; /* window read pointer */ 56 Bytef *read; /* window read pointer */
diff --git a/minigzip.c b/minigzip.c
index fb7f278..14d1277 100644
--- a/minigzip.c
+++ b/minigzip.c
@@ -44,13 +44,15 @@
44# define fileno(file) file->__file 44# define fileno(file) file->__file
45#endif 45#endif
46 46
47#ifndef WIN32 /* unlink already in stdio.h for WIN32 */
48 extern int unlink OF((const char *));
49#endif
50
47#ifndef GZ_SUFFIX 51#ifndef GZ_SUFFIX
48# define GZ_SUFFIX ".gz" 52# define GZ_SUFFIX ".gz"
49#endif 53#endif
50#define SUFFIX_LEN (sizeof(GZ_SUFFIX)-1) 54#define SUFFIX_LEN (sizeof(GZ_SUFFIX)-1)
51 55
52extern int unlink OF((const char *));
53
54#define BUFLEN 4096 56#define BUFLEN 4096
55#define MAX_NAME_LEN 1024 57#define MAX_NAME_LEN 1024
56 58
diff --git a/msdos/zlib.def b/msdos/zlib.def
index 9bcdea4..89e626c 100644
--- a/msdos/zlib.def
+++ b/msdos/zlib.def
@@ -8,7 +8,7 @@ SUBSYSTEM WINDOWS
8 8
9STUB 'WINSTUB.EXE' 9STUB 'WINSTUB.EXE'
10 10
11VERSION 1.08 11VERSION 1.09
12 12
13CODE EXECUTE READ 13CODE EXECUTE READ
14 14
@@ -55,3 +55,6 @@ EXPORTS
55 zError @36 55 zError @36
56 inflateSyncPoint @37 56 inflateSyncPoint @37
57 get_crc_table @38 57 get_crc_table @38
58 compress2 @39
59 gzputs @40
60 gzgets @41
diff --git a/msdos/zlib.rc b/msdos/zlib.rc
index cda7744..86690ec 100644
--- a/msdos/zlib.rc
+++ b/msdos/zlib.rc
@@ -2,8 +2,8 @@
2 2
3#define IDR_VERSION1 1 3#define IDR_VERSION1 1
4IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE 4IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
5 FILEVERSION 1,0,8,0 5 FILEVERSION 1,0,9,0
6 PRODUCTVERSION 1,0,8,0 6 PRODUCTVERSION 1,0,9,0
7 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 7 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
8 FILEFLAGS 0 8 FILEFLAGS 0
9 FILEOS VOS_DOS_WINDOWS32 9 FILEOS VOS_DOS_WINDOWS32
@@ -17,7 +17,7 @@ BEGIN
17 17
18 BEGIN 18 BEGIN
19 VALUE "FileDescription", "zlib data compression library\0" 19 VALUE "FileDescription", "zlib data compression library\0"
20 VALUE "FileVersion", "1.0.8\0" 20 VALUE "FileVersion", "1.0.9\0"
21 VALUE "InternalName", "zlib\0" 21 VALUE "InternalName", "zlib\0"
22 VALUE "OriginalFilename", "zlib.dll\0" 22 VALUE "OriginalFilename", "zlib.dll\0"
23 VALUE "ProductName", "ZLib.DLL\0" 23 VALUE "ProductName", "ZLib.DLL\0"
diff --git a/nt/zlib.dnt b/nt/zlib.dnt
index 18c990c..7f9475c 100644
--- a/nt/zlib.dnt
+++ b/nt/zlib.dnt
@@ -42,3 +42,6 @@ EXPORTS
42 zError @36 42 zError @36
43 inflateSyncPoint @37 43 inflateSyncPoint @37
44 get_crc_table @38 44 get_crc_table @38
45 compress2 @39
46 gzputs @40
47 gzgets @41
diff --git a/test.c b/test.c
deleted file mode 100644
index 4ac763a..0000000
--- a/test.c
+++ /dev/null
@@ -1,2 +0,0 @@
1extern int getchar();
2int hello() {return getchar();}
diff --git a/uncompr.c b/uncompr.c
index 2db47c4..d103321 100644
--- a/uncompr.c
+++ b/uncompr.c
@@ -22,7 +22,7 @@
22 enough memory, Z_BUF_ERROR if there was not enough room in the output 22 enough memory, Z_BUF_ERROR if there was not enough room in the output
23 buffer, or Z_DATA_ERROR if the input data was corrupted. 23 buffer, or Z_DATA_ERROR if the input data was corrupted.
24*/ 24*/
25int EXPORT uncompress (dest, destLen, source, sourceLen) 25int ZEXPORT uncompress (dest, destLen, source, sourceLen)
26 Bytef *dest; 26 Bytef *dest;
27 uLongf *destLen; 27 uLongf *destLen;
28 const Bytef *source; 28 const Bytef *source;
diff --git a/zconf.h b/zconf.h
index 7bc054f..89e1a16 100644
--- a/zconf.h
+++ b/zconf.h
@@ -30,6 +30,7 @@
30# define inflateSyncPoint z_inflateSyncPoint 30# define inflateSyncPoint z_inflateSyncPoint
31# define inflateReset z_inflateReset 31# define inflateReset z_inflateReset
32# define compress z_compress 32# define compress z_compress
33# define compress2 z_compress2
33# define uncompress z_uncompress 34# define uncompress z_uncompress
34# define adler32 z_adler32 35# define adler32 z_adler32
35# define crc32 z_crc32 36# define crc32 z_crc32
@@ -158,6 +159,29 @@
158# define FAR __far 159# define FAR __far
159# endif 160# endif
160#endif 161#endif
162
163/* Compile with -DZLIB_DLL for Windows DLL support */
164#if (defined(_WINDOWS) || defined(WINDOWS)) && defined(ZLIB_DLL)
165# ifdef FAR
166# undef FAR
167# endif
168# include <windows.h>
169# define ZEXPORT WINAPI
170# ifdef WIN32
171# define ZEXPORTVA WINAPIV
172# else
173# define ZEXPORTVA FAR _cdecl _export
174# endif
175#else
176# if defined (__BORLANDC__) && defined (_Windows) && defined (__DLL__)
177# define ZEXPORT _export
178# define ZEXPORTVA _export
179# else
180# define ZEXPORT
181# define ZEXPORTVA
182# endif
183#endif
184
161#ifndef FAR 185#ifndef FAR
162# define FAR 186# define FAR
163#endif 187#endif
@@ -198,26 +222,6 @@ typedef uLong FAR uLongf;
198# define z_off_t long 222# define z_off_t long
199#endif 223#endif
200 224
201/* Compile with -DZLIB_DLL for Windows DLL support */
202#if (defined(_WINDOWS) || defined(WINDOWS)) && defined(ZLIB_DLL)
203# undef FAR
204# include <windows.h>
205# define EXPORT WINAPI
206# ifdef WIN32
207# define EXPORTVA WINAPIV
208# else
209# define EXPORTVA FAR _cdecl _export
210# endif
211#else
212# if defined (__BORLANDC__) && defined (_Windows) && defined (__DLL__)
213# define EXPORT _export
214# define EXPORTVA _export
215# else
216# define EXPORT
217# define EXPORTVA
218# endif
219#endif
220
221/* MVS linker does not support external names larger than 8 bytes */ 225/* MVS linker does not support external names larger than 8 bytes */
222#if defined(__MVS__) 226#if defined(__MVS__)
223# pragma map(deflateInit_,"DEIN") 227# pragma map(deflateInit_,"DEIN")
diff --git a/zlib.3 b/zlib.3
index 3c442bc..a969834 100644
--- a/zlib.3
+++ b/zlib.3
@@ -1,10 +1,10 @@
1.TH ZLIB 3 "26 January 1998" 1.TH ZLIB 3 "16 February 1998"
2.SH NAME 2.SH NAME
3zlib \- compression/decompression library 3zlib \- compression/decompression library
4.SH SYNOPSIS 4.SH SYNOPSIS
5[see 5[see
6.I zlib.h 6.I zlib.h
7for full descripton] 7for full description]
8.SH DESCRIPTION 8.SH DESCRIPTION
9The 9The
10.I zlib 10.I zlib
@@ -81,7 +81,7 @@ These documents are also available in other formats from:
81.IP 81.IP
82ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html 82ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html
83.SH AUTHORS 83.SH AUTHORS
84Version 1.0.8. 84Version 1.0.9.
85Copyright (C) 1995-1998 Jean-loup Gailly (jloup@gzip.org) 85Copyright (C) 1995-1998 Jean-loup Gailly (jloup@gzip.org)
86and Mark Adler (madler@alumni.caltech.edu). 86and Mark Adler (madler@alumni.caltech.edu).
87.LP 87.LP
diff --git a/zlib.h b/zlib.h
index 2319835..5bcbf12 100644
--- a/zlib.h
+++ b/zlib.h
@@ -1,5 +1,5 @@
1/* zlib.h -- interface of the 'zlib' general purpose compression library 1/* zlib.h -- interface of the 'zlib' general purpose compression library
2 version 1.0.8, Jan 27th, 1998 2 version 1.0.9, Feb 16th, 1998
3 3
4 Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler 4 Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler
5 5
@@ -37,7 +37,7 @@ extern "C" {
37 37
38#include "zconf.h" 38#include "zconf.h"
39 39
40#define ZLIB_VERSION "1.0.8" 40#define ZLIB_VERSION "1.0.9"
41 41
42/* 42/*
43 The 'zlib' compression library provides in-memory compression and 43 The 'zlib' compression library provides in-memory compression and
@@ -101,6 +101,9 @@ typedef z_stream FAR *z_streamp;
101 opaque value. 101 opaque value.
102 102
103 zalloc must return Z_NULL if there is not enough memory for the object. 103 zalloc must return Z_NULL if there is not enough memory for the object.
104 If zlib is used in a multi-threaded application, zalloc and zfree must be
105 thread safe.
106
104 On 16-bit systems, the functions zalloc and zfree must be able to allocate 107 On 16-bit systems, the functions zalloc and zfree must be able to allocate
105 exactly 65536 bytes, but will not be required to allocate more than this 108 exactly 65536 bytes, but will not be required to allocate more than this
106 if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, 109 if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
@@ -165,7 +168,7 @@ typedef z_stream FAR *z_streamp;
165 168
166 /* basic functions */ 169 /* basic functions */
167 170
168extern const char * EXPORT zlibVersion OF((void)); 171extern const char * ZEXPORT zlibVersion OF((void));
169/* The application can compare zlibVersion and ZLIB_VERSION for consistency. 172/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
170 If the first character differs, the library code actually used is 173 If the first character differs, the library code actually used is
171 not compatible with the zlib.h header file used by the application. 174 not compatible with the zlib.h header file used by the application.
@@ -173,7 +176,7 @@ extern const char * EXPORT zlibVersion OF((void));
173 */ 176 */
174 177
175/* 178/*
176extern int EXPORT deflateInit OF((z_streamp strm, int level)); 179extern int ZEXPORT deflateInit OF((z_streamp strm, int level));
177 180
178 Initializes the internal stream state for compression. The fields 181 Initializes the internal stream state for compression. The fields
179 zalloc, zfree and opaque must be initialized before by the caller. 182 zalloc, zfree and opaque must be initialized before by the caller.
@@ -195,7 +198,7 @@ extern int EXPORT deflateInit OF((z_streamp strm, int level));
195*/ 198*/
196 199
197 200
198extern int EXPORT deflate OF((z_streamp strm, int flush)); 201extern int ZEXPORT deflate OF((z_streamp strm, int flush));
199/* 202/*
200 deflate compresses as much data as possible, and stops when the input 203 deflate compresses as much data as possible, and stops when the input
201 buffer becomes empty or the output buffer becomes full. It may introduce some 204 buffer becomes empty or the output buffer becomes full. It may introduce some
@@ -272,7 +275,7 @@ extern int EXPORT deflate OF((z_streamp strm, int flush));
272*/ 275*/
273 276
274 277
275extern int EXPORT deflateEnd OF((z_streamp strm)); 278extern int ZEXPORT deflateEnd OF((z_streamp strm));
276/* 279/*
277 All dynamically allocated data structures for this stream are freed. 280 All dynamically allocated data structures for this stream are freed.
278 This function discards any unprocessed input and does not flush any 281 This function discards any unprocessed input and does not flush any
@@ -287,7 +290,7 @@ extern int EXPORT deflateEnd OF((z_streamp strm));
287 290
288 291
289/* 292/*
290extern int EXPORT inflateInit OF((z_streamp strm)); 293extern int ZEXPORT inflateInit OF((z_streamp strm));
291 294
292 Initializes the internal stream state for decompression. The fields 295 Initializes the internal stream state for decompression. The fields
293 next_in, avail_in, zalloc, zfree and opaque must be initialized before by 296 next_in, avail_in, zalloc, zfree and opaque must be initialized before by
@@ -307,7 +310,7 @@ extern int EXPORT inflateInit OF((z_streamp strm));
307*/ 310*/
308 311
309 312
310extern int EXPORT inflate OF((z_streamp strm, int flush)); 313extern int ZEXPORT inflate OF((z_streamp strm, int flush));
311/* 314/*
312 inflate decompresses as much data as possible, and stops when the input 315 inflate decompresses as much data as possible, and stops when the input
313 buffer becomes empty or the output buffer becomes full. It may some 316 buffer becomes empty or the output buffer becomes full. It may some
@@ -376,7 +379,7 @@ extern int EXPORT inflate OF((z_streamp strm, int flush));
376*/ 379*/
377 380
378 381
379extern int EXPORT inflateEnd OF((z_streamp strm)); 382extern int ZEXPORT inflateEnd OF((z_streamp strm));
380/* 383/*
381 All dynamically allocated data structures for this stream are freed. 384 All dynamically allocated data structures for this stream are freed.
382 This function discards any unprocessed input and does not flush any 385 This function discards any unprocessed input and does not flush any
@@ -394,12 +397,12 @@ extern int EXPORT inflateEnd OF((z_streamp strm));
394*/ 397*/
395 398
396/* 399/*
397extern int EXPORT deflateInit2 OF((z_streamp strm, 400extern int ZEXPORT deflateInit2 OF((z_streamp strm,
398 int level, 401 int level,
399 int method, 402 int method,
400 int windowBits, 403 int windowBits,
401 int memLevel, 404 int memLevel,
402 int strategy)); 405 int strategy));
403 406
404 This is another version of deflateInit with more compression options. The 407 This is another version of deflateInit with more compression options. The
405 fields next_in, zalloc, zfree and opaque must be initialized before by 408 fields next_in, zalloc, zfree and opaque must be initialized before by
@@ -437,9 +440,9 @@ extern int EXPORT deflateInit2 OF((z_streamp strm,
437 not perform any compression: this will be done by deflate(). 440 not perform any compression: this will be done by deflate().
438*/ 441*/
439 442
440extern int EXPORT deflateSetDictionary OF((z_streamp strm, 443extern int ZEXPORT deflateSetDictionary OF((z_streamp strm,
441 const Bytef *dictionary, 444 const Bytef *dictionary,
442 uInt dictLength)); 445 uInt dictLength));
443/* 446/*
444 Initializes the compression dictionary from the given byte sequence 447 Initializes the compression dictionary from the given byte sequence
445 without producing any compressed output. This function must be called 448 without producing any compressed output. This function must be called
@@ -473,8 +476,8 @@ extern int EXPORT deflateSetDictionary OF((z_streamp strm,
473 perform any compression: this will be done by deflate(). 476 perform any compression: this will be done by deflate().
474*/ 477*/
475 478
476extern int EXPORT deflateCopy OF((z_streamp dest, 479extern int ZEXPORT deflateCopy OF((z_streamp dest,
477 z_streamp source)); 480 z_streamp source));
478/* 481/*
479 Sets the destination stream as a complete copy of the source stream. 482 Sets the destination stream as a complete copy of the source stream.
480 483
@@ -491,7 +494,7 @@ extern int EXPORT deflateCopy OF((z_streamp dest,
491 destination. 494 destination.
492*/ 495*/
493 496
494extern int EXPORT deflateReset OF((z_streamp strm)); 497extern int ZEXPORT deflateReset OF((z_streamp strm));
495/* 498/*
496 This function is equivalent to deflateEnd followed by deflateInit, 499 This function is equivalent to deflateEnd followed by deflateInit,
497 but does not free and reallocate all the internal compression state. 500 but does not free and reallocate all the internal compression state.
@@ -502,7 +505,7 @@ extern int EXPORT deflateReset OF((z_streamp strm));
502 stream state was inconsistent (such as zalloc or state being NULL). 505 stream state was inconsistent (such as zalloc or state being NULL).
503*/ 506*/
504 507
505extern int EXPORT deflateParams OF((z_streamp strm, int level, int strategy)); 508extern int ZEXPORT deflateParams OF((z_streamp strm, int level, int strategy));
506/* 509/*
507 Dynamically update the compression level and compression strategy. The 510 Dynamically update the compression level and compression strategy. The
508 interpretation of level and strategy is as in deflateInit2. This can be 511 interpretation of level and strategy is as in deflateInit2. This can be
@@ -522,8 +525,8 @@ extern int EXPORT deflateParams OF((z_streamp strm, int level, int strategy));
522*/ 525*/
523 526
524/* 527/*
525extern int EXPORT inflateInit2 OF((z_streamp strm, 528extern int ZEXPORT inflateInit2 OF((z_streamp strm,
526 int windowBits)); 529 int windowBits));
527 530
528 This is another version of inflateInit with an extra parameter. The 531 This is another version of inflateInit with an extra parameter. The
529 fields next_in, avail_in, zalloc, zfree and opaque must be initialized 532 fields next_in, avail_in, zalloc, zfree and opaque must be initialized
@@ -544,9 +547,9 @@ extern int EXPORT inflateInit2 OF((z_streamp strm,
544 modified, but next_out and avail_out are unchanged.) 547 modified, but next_out and avail_out are unchanged.)
545*/ 548*/
546 549
547extern int EXPORT inflateSetDictionary OF((z_streamp strm, 550extern int ZEXPORT inflateSetDictionary OF((z_streamp strm,
548 const Bytef *dictionary, 551 const Bytef *dictionary,
549 uInt dictLength)); 552 uInt dictLength));
550/* 553/*
551 Initializes the decompression dictionary from the given uncompressed byte 554 Initializes the decompression dictionary from the given uncompressed byte
552 sequence. This function must be called immediately after a call of inflate 555 sequence. This function must be called immediately after a call of inflate
@@ -563,7 +566,7 @@ extern int EXPORT inflateSetDictionary OF((z_streamp strm,
563 inflate(). 566 inflate().
564*/ 567*/
565 568
566extern int EXPORT inflateSync OF((z_streamp strm)); 569extern int ZEXPORT inflateSync OF((z_streamp strm));
567/* 570/*
568 Skips invalid compressed data until a full flush point (see above the 571 Skips invalid compressed data until a full flush point (see above the
569 description of deflate with Z_FULL_FLUSH) can be found, or until all 572 description of deflate with Z_FULL_FLUSH) can be found, or until all
@@ -578,7 +581,7 @@ extern int EXPORT inflateSync OF((z_streamp strm));
578 until success or end of the input data. 581 until success or end of the input data.
579*/ 582*/
580 583
581extern int EXPORT inflateReset OF((z_streamp strm)); 584extern int ZEXPORT inflateReset OF((z_streamp strm));
582/* 585/*
583 This function is equivalent to inflateEnd followed by inflateInit, 586 This function is equivalent to inflateEnd followed by inflateInit,
584 but does not free and reallocate all the internal decompression state. 587 but does not free and reallocate all the internal decompression state.
@@ -599,8 +602,8 @@ extern int EXPORT inflateReset OF((z_streamp strm));
599 utility functions can easily be modified if you need special options. 602 utility functions can easily be modified if you need special options.
600*/ 603*/
601 604
602extern int EXPORT compress OF((Bytef *dest, uLongf *destLen, 605extern int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
603 const Bytef *source, uLong sourceLen)); 606 const Bytef *source, uLong sourceLen));
604/* 607/*
605 Compresses the source buffer into the destination buffer. sourceLen is 608 Compresses the source buffer into the destination buffer. sourceLen is
606 the byte length of the source buffer. Upon entry, destLen is the total 609 the byte length of the source buffer. Upon entry, destLen is the total
@@ -614,9 +617,9 @@ extern int EXPORT compress OF((Bytef *dest, uLongf *destLen,
614 buffer. 617 buffer.
615*/ 618*/
616 619
617extern int EXPORT compress2 OF((Bytef *dest, uLongf *destLen, 620extern int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
618 const Bytef *source, uLong sourceLen, 621 const Bytef *source, uLong sourceLen,
619 int level)); 622 int level));
620/* 623/*
621 Compresses the source buffer into the destination buffer. The level 624 Compresses the source buffer into the destination buffer. The level
622 parameter has the same meaning as in deflateInit. sourceLen is the byte 625 parameter has the same meaning as in deflateInit. sourceLen is the byte
@@ -629,8 +632,8 @@ extern int EXPORT compress2 OF((Bytef *dest, uLongf *destLen,
629 Z_STREAM_ERROR if the level parameter is invalid. 632 Z_STREAM_ERROR if the level parameter is invalid.
630*/ 633*/
631 634
632extern int EXPORT uncompress OF((Bytef *dest, uLongf *destLen, 635extern int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
633 const Bytef *source, uLong sourceLen)); 636 const Bytef *source, uLong sourceLen));
634/* 637/*
635 Decompresses the source buffer into the destination buffer. sourceLen is 638 Decompresses the source buffer into the destination buffer. sourceLen is
636 the byte length of the source buffer. Upon entry, destLen is the total 639 the byte length of the source buffer. Upon entry, destLen is the total
@@ -650,7 +653,7 @@ extern int EXPORT uncompress OF((Bytef *dest, uLongf *destLen,
650 653
651typedef voidp gzFile; 654typedef voidp gzFile;
652 655
653extern gzFile EXPORT gzopen OF((const char *path, const char *mode)); 656extern gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
654/* 657/*
655 Opens a gzip (.gz) file for reading or writing. The mode parameter 658 Opens a gzip (.gz) file for reading or writing. The mode parameter
656 is as in fopen ("rb" or "wb") but can also include a compression level 659 is as in fopen ("rb" or "wb") but can also include a compression level
@@ -666,7 +669,7 @@ extern gzFile EXPORT gzopen OF((const char *path, const char *mode));
666 can be checked to distinguish the two cases (if errno is zero, the 669 can be checked to distinguish the two cases (if errno is zero, the
667 zlib error is Z_MEM_ERROR). */ 670 zlib error is Z_MEM_ERROR). */
668 671
669extern gzFile EXPORT gzdopen OF((int fd, const char *mode)); 672extern gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
670/* 673/*
671 gzdopen() associates a gzFile with the file descriptor fd. File 674 gzdopen() associates a gzFile with the file descriptor fd. File
672 descriptors are obtained from calls like open, dup, creat, pipe or 675 descriptors are obtained from calls like open, dup, creat, pipe or
@@ -679,7 +682,7 @@ extern gzFile EXPORT gzdopen OF((int fd, const char *mode));
679 the (de)compression state. 682 the (de)compression state.
680*/ 683*/
681 684
682extern int EXPORT gzsetparams OF((gzFile file, int level, int strategy)); 685extern int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
683/* 686/*
684 Dynamically update the compression level or strategy. See the description 687 Dynamically update the compression level or strategy. See the description
685 of deflateInit2 for the meaning of these parameters. 688 of deflateInit2 for the meaning of these parameters.
@@ -687,7 +690,7 @@ extern int EXPORT gzsetparams OF((gzFile file, int level, int strategy));
687 opened for writing. 690 opened for writing.
688*/ 691*/
689 692
690extern int EXPORT gzread OF((gzFile file, voidp buf, unsigned len)); 693extern int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
691/* 694/*
692 Reads the given number of uncompressed bytes from the compressed file. 695 Reads the given number of uncompressed bytes from the compressed file.
693 If the input file was not in gzip format, gzread copies the given number 696 If the input file was not in gzip format, gzread copies the given number
@@ -695,33 +698,49 @@ extern int EXPORT gzread OF((gzFile file, voidp buf, unsigned len));
695 gzread returns the number of uncompressed bytes actually read (0 for 698 gzread returns the number of uncompressed bytes actually read (0 for
696 end of file, -1 for error). */ 699 end of file, -1 for error). */
697 700
698extern int EXPORT gzwrite OF((gzFile file, const voidp buf, unsigned len)); 701extern int ZEXPORT gzwrite OF((gzFile file, const voidp buf, unsigned len));
699/* 702/*
700 Writes the given number of uncompressed bytes into the compressed file. 703 Writes the given number of uncompressed bytes into the compressed file.
701 gzwrite returns the number of uncompressed bytes actually written 704 gzwrite returns the number of uncompressed bytes actually written
702 (0 in case of error). 705 (0 in case of error).
703*/ 706*/
704 707
705extern int EXPORTVA gzprintf OF((gzFile file, const char *format, ...)); 708extern int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
706/* 709/*
707 Converts, formats, and writes the args to the compressed file under 710 Converts, formats, and writes the args to the compressed file under
708 control of the format string, as in fprintf. gzprintf returns the number of 711 control of the format string, as in fprintf. gzprintf returns the number of
709 uncompressed bytes actually written (0 in case of error). 712 uncompressed bytes actually written (0 in case of error).
710*/ 713*/
711 714
712extern int EXPORT gzputc OF((gzFile file, int c)); 715extern int ZEXPORT gzputs OF((gzFile file, const char *s));
716/*
717 Writes the given null-terminated string to the compressed file, excluding
718 the terminating null character.
719 gzputs returns the number of characters written, or -1 in case of error.
720*/
721
722extern char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
723/*
724 Reads bytes from the compressed file until len-1 characters are read, or
725 a newline character is read and transferred to buf, or an end-of-file
726 condition is encountered. The string is then terminated with a null
727 character.
728 gzgets returns buf, or Z_NULL in case of error.
729*/
730
731extern int ZEXPORT gzputc OF((gzFile file, int c));
713/* 732/*
714 Writes c, converted to an unsigned char, into the compressed file. 733 Writes c, converted to an unsigned char, into the compressed file.
715 gzputc returns the value that was written, or -1 in case of error. 734 gzputc returns the value that was written, or -1 in case of error.
716*/ 735*/
717 736
718extern int EXPORT gzgetc OF((gzFile file)); 737extern int ZEXPORT gzgetc OF((gzFile file));
719/* 738/*
720 Reads one byte from the compressed file. gzgetc returns this byte 739 Reads one byte from the compressed file. gzgetc returns this byte
721 or -1 in case of end of file or error. 740 or -1 in case of end of file or error.
722*/ 741*/
723 742
724extern int EXPORT gzflush OF((gzFile file, int flush)); 743extern int ZEXPORT gzflush OF((gzFile file, int flush));
725/* 744/*
726 Flushes all pending output into the compressed file. The parameter 745 Flushes all pending output into the compressed file. The parameter
727 flush is as in the deflate() function. The return value is the zlib 746 flush is as in the deflate() function. The return value is the zlib
@@ -731,7 +750,7 @@ extern int EXPORT gzflush OF((gzFile file, int flush));
731 degrade compression. 750 degrade compression.
732*/ 751*/
733 752
734extern z_off_t EXPORT gzseek OF((gzFile file, z_off_t offset, int whence)); 753extern z_off_t ZEXPORT gzseek OF((gzFile file, z_off_t offset, int whence));
735/* 754/*
736 Sets the starting position for the next gzread or gzwrite on the given 755 Sets the starting position for the next gzread or gzwrite on the given
737 compressed file. The offset represents a number of bytes in the 756 compressed file. The offset represents a number of bytes in the
@@ -748,14 +767,14 @@ extern z_off_t EXPORT gzseek OF((gzFile file, z_off_t offset, int whence));
748 would be before the current position. 767 would be before the current position.
749*/ 768*/
750 769
751extern int EXPORT gzrewind OF((gzFile file)); 770extern int ZEXPORT gzrewind OF((gzFile file));
752/* 771/*
753 Rewinds the given file. This function is supported only for reading. 772 Rewinds the given file. This function is supported only for reading.
754 773
755 gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) 774 gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
756*/ 775*/
757 776
758extern z_off_t EXPORT gztell OF((gzFile file)); 777extern z_off_t ZEXPORT gztell OF((gzFile file));
759/* 778/*
760 Returns the starting position for the next gzread or gzwrite on the 779 Returns the starting position for the next gzread or gzwrite on the
761 given compressed file. This position represents a number of bytes in the 780 given compressed file. This position represents a number of bytes in the
@@ -764,20 +783,20 @@ extern z_off_t EXPORT gztell OF((gzFile file));
764 gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) 783 gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
765*/ 784*/
766 785
767extern int EXPORT gzeof OF((gzFile file)); 786extern int ZEXPORT gzeof OF((gzFile file));
768/* 787/*
769 Returns 1 when EOF has previously been detected reading the given 788 Returns 1 when EOF has previously been detected reading the given
770 input stream, otherwise zero. 789 input stream, otherwise zero.
771*/ 790*/
772 791
773extern int EXPORT gzclose OF((gzFile file)); 792extern int ZEXPORT gzclose OF((gzFile file));
774/* 793/*
775 Flushes all pending output if necessary, closes the compressed file 794 Flushes all pending output if necessary, closes the compressed file
776 and deallocates all the (de)compression state. The return value is the zlib 795 and deallocates all the (de)compression state. The return value is the zlib
777 error number (see function gzerror below). 796 error number (see function gzerror below).
778*/ 797*/
779 798
780extern const char * EXPORT gzerror OF((gzFile file, int *errnum)); 799extern const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
781/* 800/*
782 Returns the error message for the last error which occurred on the 801 Returns the error message for the last error which occurred on the
783 given compressed file. errnum is set to zlib error number. If an 802 given compressed file. errnum is set to zlib error number. If an
@@ -794,7 +813,7 @@ extern const char * EXPORT gzerror OF((gzFile file, int *errnum));
794 compression library. 813 compression library.
795*/ 814*/
796 815
797extern uLong EXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); 816extern uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
798 817
799/* 818/*
800 Update a running Adler-32 checksum with the bytes buf[0..len-1] and 819 Update a running Adler-32 checksum with the bytes buf[0..len-1] and
@@ -811,7 +830,7 @@ extern uLong EXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
811 if (adler != original_adler) error(); 830 if (adler != original_adler) error();
812*/ 831*/
813 832
814extern uLong EXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); 833extern uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
815/* 834/*
816 Update a running crc with the bytes buf[0..len-1] and return the updated 835 Update a running crc with the bytes buf[0..len-1] and return the updated
817 crc. If buf is NULL, this function returns the required initial value 836 crc. If buf is NULL, this function returns the required initial value
@@ -833,22 +852,23 @@ extern uLong EXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
833/* deflateInit and inflateInit are macros to allow checking the zlib version 852/* deflateInit and inflateInit are macros to allow checking the zlib version
834 * and the compiler's view of z_stream: 853 * and the compiler's view of z_stream:
835 */ 854 */
836extern int EXPORT deflateInit_ OF((z_streamp strm, int level, 855extern int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
837 const char *version, int stream_size)); 856 const char *version, int stream_size));
838extern int EXPORT inflateInit_ OF((z_streamp strm, 857extern int ZEXPORT inflateInit_ OF((z_streamp strm,
839 const char *version, int stream_size)); 858 const char *version, int stream_size));
840extern int EXPORT deflateInit2_ OF((z_streamp strm, int level, int method, 859extern int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
841 int windowBits, int memLevel, int strategy, 860 int windowBits, int memLevel,
842 const char *version, int stream_size)); 861 int strategy, const char *version,
843extern int EXPORT inflateInit2_ OF((z_streamp strm, int windowBits, 862 int stream_size));
844 const char *version, int stream_size)); 863extern int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
864 const char *version, int stream_size));
845#define deflateInit(strm, level) \ 865#define deflateInit(strm, level) \
846 deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) 866 deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
847#define inflateInit(strm) \ 867#define inflateInit(strm) \
848 inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) 868 inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))
849#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ 869#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
850 deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ 870 deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
851 (strategy), ZLIB_VERSION, sizeof(z_stream)) 871 (strategy), ZLIB_VERSION, sizeof(z_stream))
852#define inflateInit2(strm, windowBits) \ 872#define inflateInit2(strm, windowBits) \
853 inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) 873 inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
854 874
@@ -857,9 +877,9 @@ extern int EXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
857 struct internal_state {int dummy;}; /* hack for buggy compilers */ 877 struct internal_state {int dummy;}; /* hack for buggy compilers */
858#endif 878#endif
859 879
860extern const char * EXPORT zError OF((int err)); 880extern const char * ZEXPORT zError OF((int err));
861extern int EXPORT inflateSyncPoint OF((z_streamp z)); 881extern int ZEXPORT inflateSyncPoint OF((z_streamp z));
862extern const uLongf * EXPORT get_crc_table OF((void)); 882extern const uLongf * ZEXPORT get_crc_table OF((void));
863 883
864#ifdef __cplusplus 884#ifdef __cplusplus
865} 885}
diff --git a/ztest28975.c b/ztest28975.c
deleted file mode 100644
index 6ecfc44..0000000
--- a/ztest28975.c
+++ /dev/null
@@ -1 +0,0 @@
1int hello() {return 0;}
diff --git a/zutil.c b/zutil.c
index 87f6678..5a3fe6e 100644
--- a/zutil.c
+++ b/zutil.c
@@ -26,7 +26,7 @@ const char *z_errmsg[10] = {
26""}; 26""};
27 27
28 28
29const char * EXPORT zlibVersion() 29const char * ZEXPORT zlibVersion()
30{ 30{
31 return ZLIB_VERSION; 31 return ZLIB_VERSION;
32} 32}
@@ -49,7 +49,7 @@ void z_error (m)
49/* exported to allow conversion of error code to string for compress() and 49/* exported to allow conversion of error code to string for compress() and
50 * uncompress() 50 * uncompress()
51 */ 51 */
52const char * EXPORT zError(err) 52const char * ZEXPORT zError(err)
53 int err; 53 int err;
54{ 54{
55 return ERR_MSG(err); 55 return ERR_MSG(err);
diff --git a/zutil.h b/zutil.h
index ac30b8e..5e403d1 100644
--- a/zutil.h
+++ b/zutil.h
@@ -208,7 +208,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
208#endif 208#endif
209 209
210 210
211typedef uLong (EXPORT *check_func) OF((uLong check, const Bytef *buf, 211typedef uLong (ZEXPORT *check_func) OF((uLong check, const Bytef *buf,
212 uInt len)); 212 uInt len));
213voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); 213voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
214void zcfree OF((voidpf opaque, voidpf ptr)); 214void zcfree OF((voidpf opaque, voidpf ptr));