summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-09-09 23:15:17 -0700
committerMark Adler <madler@alumni.caltech.edu>2011-09-09 23:15:17 -0700
commite26a448e9673d67dc2866e11a48d24fc352e5f80 (patch)
treea2dc10debfd34979dde501afbf1cce6a6c3cbcb7
parent423eb40306489f9c88f7dba32c2f69179166730b (diff)
downloadzlib-1.0.2.tar.gz
zlib-1.0.2.tar.bz2
zlib-1.0.2.zip
zlib 1.0.2v1.0.2
-rw-r--r--ChangeLog10
-rw-r--r--INDEX4
-rw-r--r--Makefile9
-rw-r--r--Makefile.dj261
-rw-r--r--Makefile.in9
-rw-r--r--README29
-rw-r--r--adler32.c2
-rw-r--r--algorithm.doc105
-rw-r--r--compress.c5
-rw-r--r--deflate.c4
-rw-r--r--example.c13
-rw-r--r--gzio.c2
-rw-r--r--inftrees.c2
-rw-r--r--infutil.c3
-rw-r--r--minigzip.c2
-rw-r--r--trees.c2
-rw-r--r--zconf.h28
-rw-r--r--zlib.def46
-rw-r--r--zlib.h119
-rw-r--r--zlib.rc32
-rw-r--r--zutil.c9
-rw-r--r--zutil.h2
22 files changed, 379 insertions, 119 deletions
diff --git a/ChangeLog b/ChangeLog
index 36e05dc..ffbe1c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,16 @@
1 1
2 ChangeLog file for zlib 2 ChangeLog file for zlib
3 3
4Changes in 1.0.2 (23 May 96)
5- added Windows DLL support
6- added a function zlibVersion (for the DLL support)
7- fixed declarations using Bytef in infutil.c (pb with MSDOS medium model)
8- Bytef is define's instead of typedef'd only for Borland C
9- avoid reading uninitialized memory in example.c
10- mention in README that the zlib format is now RFC1950
11- updated Makefile.dj2
12- added algorithm.doc
13
4Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion] 14Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion]
5- fix array overlay in deflate.c which sometimes caused bad compressed data 15- fix array overlay in deflate.c which sometimes caused bad compressed data
6- fix inflate bug with empty stored block 16- fix inflate bug with empty stored block
diff --git a/INDEX b/INDEX
index c4a3ede..dc13753 100644
--- a/INDEX
+++ b/INDEX
@@ -11,8 +11,12 @@ Makefile.sas makefile for Amiga SAS/C
11Makefile.tc makefile for Turbo C 11Makefile.tc makefile for Turbo C
12Makefile.wat makefile for Watcom C 12Makefile.wat makefile for Watcom C
13README guess what 13README guess what
14algorithm.doc description of the compression & decompression algorithms
14configure configure script for Unix 15configure configure script for Unix
15descrip.mms makefile for Vax/VMS 16descrip.mms makefile for Vax/VMS
17zlib.def definition file for Windows DLL
18zlib.rc definition file for Windows DLL
19
16 20
17 zlib public header files (must be kept): 21 zlib public header files (must be kept):
18zconf.h 22zconf.h
diff --git a/Makefile b/Makefile
index 3b41059..f2ff262 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@ CFLAGS=-O
22LDFLAGS=-L. -lz 22LDFLAGS=-L. -lz
23LDSHARED=$(CC) 23LDSHARED=$(CC)
24 24
25VER=1.0.1 25VER=1.0.2
26LIBS=libz.a 26LIBS=libz.a
27 27
28AR=ar rc 28AR=ar rc
@@ -37,7 +37,8 @@ OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
37 37
38TEST_OBJS = example.o minigzip.o 38TEST_OBJS = example.o minigzip.o
39 39
40DISTFILES = README INDEX ChangeLog configure Make*[a-z0-9] descrip.mms *.[ch] 40DISTFILES = README INDEX ChangeLog configure Make*[a-z0-9] descrip.mms \
41 zlib.def zlib.rc algorithm.doc *.[ch]
41 42
42all: example minigzip 43all: example minigzip
43 44
@@ -85,8 +86,8 @@ clean:
85 86
86zip: 87zip:
87 mv Makefile Makefile~; cp -p Makefile.in Makefile 88 mv Makefile Makefile~; cp -p Makefile.in Makefile
88 v=`sed -n -e 's/\./-/g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\ 89 v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
89 zip -ul9 zlib-$$v $(DISTFILES) 90 zip -ul9 zlib$$v $(DISTFILES)
90 mv Makefile~ Makefile 91 mv Makefile~ Makefile
91 92
92dist: 93dist:
diff --git a/Makefile.dj2 b/Makefile.dj2
index 82f55ea..07a9bb1 100644
--- a/Makefile.dj2
+++ b/Makefile.dj2
@@ -2,32 +2,51 @@
2# Copyright (C) 1995-1996 Jean-loup Gailly. 2# Copyright (C) 1995-1996 Jean-loup Gailly.
3# For conditions of distribution and use, see copyright notice in zlib.h 3# For conditions of distribution and use, see copyright notice in zlib.h
4 4
5# To compile and test, type: 5# To compile, or to compile and test, type:
6#
6# make -fmakefile.dj2; make test -fmakefile.dj2 7# make -fmakefile.dj2; make test -fmakefile.dj2
7 8#
8# To install libz.a, zconf.h and zlib.h in the djgpp directories, type: 9# To install libz.a, zconf.h and zlib.h in the djgpp directories, type:
10#
9# make install -fmakefile.dj2 11# make install -fmakefile.dj2
10# after first defining LIBRARY_PATH and INCLUDE_PATH in djgpp.env for [make]. 12#
11# Alternately these variables may be defined below. 13# after first defining LIBRARY_PATH and INCLUDE_PATH in djgpp.env as
14# in the sample below if the pattern of the DJGPP distribution is to
15# be followed. Remember that, while <sp>'es around <=> are ignored in
16# makefiles, they are *not* in batch files or in djgpp.env.
17# - - - - -
18# [make]
19# INCLUDE_PATH=%\>;INCLUDE_PATH%%\DJDIR%\include
20# LIBRARY_PATH=%\>;LIBRARY_PATH%%\DJDIR%\lib
21# BUTT=-m486
22# - - - - -
23# Alternately, these variables may be defined below, overriding the values
24# in djgpp.env, as
25INCLUDE_PATH=c:\usr\include
12 26
13CC=gcc 27CC=gcc
14 28
15#CFLAGS=-MMD -O 29#CFLAGS=-MMD -O
16#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 30#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
17#CFLAGS=-MMD -g -DDEBUG 31#CFLAGS=-MMD -g -DDEBUG
18CFLAGS=-MMD -O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ 32CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
19 -Wstrict-prototypes -Wmissing-prototypes 33 -Wstrict-prototypes -Wmissing-prototypes
34
35# If cp.exe is not found, replace with copy /Y .
36CP=cp -f
37# If install.exe is not found, replace with $(CP).
20INSTALL=install 38INSTALL=install
39# The default value of RM is "rm -f." If "rm.exe" is not found, uncomment:
40# RM=del
21LDLIBS=-L. -lz 41LDLIBS=-L. -lz
22LD=$(CC) -s -o 42LD=$(CC) -s -o
23LDSHARED=$(CC) 43LDSHARED=$(CC)
24 44
25VER=1.0 45VER=1.0.2
46INCL=zlib.h zconf.h
26LIBS=libz.a 47LIBS=libz.a
27 48
28AR=ar rcs 49AR=ar rcs
29# The default value of RM is "rm -f." If "rm.exe" is not found, uncomment:
30# RM=del
31 50
32prefix=/usr/local 51prefix=/usr/local
33exec_prefix = $(prefix) 52exec_prefix = $(prefix)
@@ -37,10 +56,6 @@ OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
37 56
38TEST_OBJS = example.o minigzip.o 57TEST_OBJS = example.o minigzip.o
39 58
40DISTFILES = README Change.Log configur Makefile.in Makefile Makefile.msc \
41 Makefile.bor Makefile.tc Make_vms.com descrip.mms zlib099.pat \
42 *.bak *.old *.[ch]
43
44all: example.exe minigzip.exe 59all: example.exe minigzip.exe
45 60
46test: all 61test: all
@@ -55,23 +70,27 @@ libz.a: $(OBJS)
55 70
56libz.so.$(VER): $(OBJS) 71libz.so.$(VER): $(OBJS)
57 $(LDSHARED) -o $@ $(OBJS) 72 $(LDSHARED) -o $@ $(OBJS)
58 rm -f libz.so; ln -s $@ libz.so 73 $(RM) libz.so; ln -s $@ libz.so
59 74
60%.exe : %.o $(LIBS) 75%.exe : %.o $(LIBS)
61 $(LD) $@ $< $(LDLIBS) 76 $(LD) $@ $< $(LDLIBS)
62 77
63# INCLUDE_PATH and LIBRARY_PATH were set for [make] in djgpp.env 78# INCLUDE_PATH and LIBRARY_PATH were set for [make] in djgpp.env .
79
80.PHONY : uninstall clean
64 81
65install: $(LIBS) 82install: $(INCL) $(LIBS)
66 $(INSTALL) zlib.h zconf.h $(INCLUDE_PATH) 83 -@if not exist $(INCLUDE_PATH)\nul mkdir $(INCLUDE_PATH)
67 $(INSTALL) $(LIBS) $(LIBRARY_PATH) 84 -@if not exist $(LIBRARY_PATH)\nul mkdir $(LIBRARY_PATH)
85 for %%f in ($(INCL)) do $(INSTALL) %%f $(INCLUDE_PATH)
86 for %%p in ($(LIBS)) do $(INSTALL) %%p $(LIBRARY_PATH)
68 87
69uninstall: 88uninstall:
70 $(RM) $(LIBRARY_PATH)/$(LIBS) 89 for %%f in ($(INCL)) do $(RM) $(INCLUDE_PATH)\%%f
71 $(RM) $(INCLUDE_PATH)/zlib.h $(INCLUDE_PATH)/zconf.h 90 for %%p in ($(LIBS)) do $(RM) $(LIBRARY_PATH)\%%p
72 91
73clean: 92clean:
74 $(RM) *.d *.o *.~ *.exe libz.a libz.so* foo.gz 93 for %%p in (*.d *.o *.exe libz.a libz.so*) do $(RM) %%p
75 94
76DEPS := $(wildcard *.d) 95DEPS := $(wildcard *.d)
77ifneq ($(DEPS),) 96ifneq ($(DEPS),)
diff --git a/Makefile.in b/Makefile.in
index 3b41059..f2ff262 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -22,7 +22,7 @@ CFLAGS=-O
22LDFLAGS=-L. -lz 22LDFLAGS=-L. -lz
23LDSHARED=$(CC) 23LDSHARED=$(CC)
24 24
25VER=1.0.1 25VER=1.0.2
26LIBS=libz.a 26LIBS=libz.a
27 27
28AR=ar rc 28AR=ar rc
@@ -37,7 +37,8 @@ OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
37 37
38TEST_OBJS = example.o minigzip.o 38TEST_OBJS = example.o minigzip.o
39 39
40DISTFILES = README INDEX ChangeLog configure Make*[a-z0-9] descrip.mms *.[ch] 40DISTFILES = README INDEX ChangeLog configure Make*[a-z0-9] descrip.mms \
41 zlib.def zlib.rc algorithm.doc *.[ch]
41 42
42all: example minigzip 43all: example minigzip
43 44
@@ -85,8 +86,8 @@ clean:
85 86
86zip: 87zip:
87 mv Makefile Makefile~; cp -p Makefile.in Makefile 88 mv Makefile Makefile~; cp -p Makefile.in Makefile
88 v=`sed -n -e 's/\./-/g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\ 89 v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
89 zip -ul9 zlib-$$v $(DISTFILES) 90 zip -ul9 zlib$$v $(DISTFILES)
90 mv Makefile~ Makefile 91 mv Makefile~ Makefile
91 92
92dist: 93dist:
diff --git a/README b/README
index dd72d94..217f3b1 100644
--- a/README
+++ b/README
@@ -1,8 +1,9 @@
1zlib 1.0.1 is a general purpose data compression library. All the code 1zlib 1.0.2 is a general purpose data compression library. All the code
2is reentrant (thread safe). The data format used by the zlib library 2is reentrant (thread safe). The data format used by the zlib library
3is described in the files zlib-3.3.doc, deflate-1.3.doc and 3is described by RFCs (Request for Comments) 1950 to 1952 in the files
4gzip-4.3.doc, available in various formats from 4ftp://ds.internic.net/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate
5ftp://swrinde.nde.swri.edu/pub/png/documents/zlib/ 5format) and rfc1952.txt (gzip format). These documents are also available in
6other formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html
6 7
7All functions of the compression library are documented in the file 8All functions of the compression library are documented in the file
8zlib.h. A usage example of the library is given in the file example.c 9zlib.h. A usage example of the library is given in the file example.c
@@ -18,9 +19,8 @@ makefiles such as Makefile.msc; for VMS, use Make_vms.com or descrip.mms.
18Questions about zlib should be sent to <zlib@quest.jpl.nasa.gov> or, 19Questions about zlib should be sent to <zlib@quest.jpl.nasa.gov> or,
19if this fails, to the addresses given below in the Copyright section. 20if this fails, to the addresses given below in the Copyright section.
20 21
21The changes made in version 1.0.1 are documented in the file ChangeLog. 22The changes made in version 1.0.2 are documented in the file ChangeLog.
22Version number 1.0 was skipped to avoid confusion with version 0.99 23The main changes since 0.99 are:
23which had some references to 1.0 already. The main changes since 0.99 are:
24 24
25- fix array overlay in deflate.c which sometimes caused bad compressed data 25- fix array overlay in deflate.c which sometimes caused bad compressed data
26- fix inflate bug with empty stored block 26- fix inflate bug with empty stored block
@@ -30,6 +30,14 @@ which had some references to 1.0 already. The main changes since 0.99 are:
30- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32), 30- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32),
31 Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas) 31 Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas)
32- several portability improvements 32- several portability improvements
33- added algorithm.doc
34- added Windows DLL support
35- added a function zlibVersion (for the DLL support)
36
37A Perl interface to zlib written by Paul Marquess <pmarquess@bfsec.bt.co.uk>
38is in the CPAN (Comprehensive Perl Archive Network) sites, such as:
39ftp://ftp.cis.ufl.edu/pub/perl/CPAN/modules/by-module/Compress/Compress-Zlib*
40
33 41
34Notes for some targets: 42Notes for some targets:
35 43
@@ -46,9 +54,10 @@ Notes for some targets:
46- zlib doesn't work on HP-UX 9.05 with one cc compiler (the one not 54- zlib doesn't work on HP-UX 9.05 with one cc compiler (the one not
47 accepting the -O option). It works with the other cc compiler. 55 accepting the -O option). It works with the other cc compiler.
48 56
49A Perl interface to zlib written by Paul Marquess <pmarquess@bfsec.bt.co.uk> 57- To build a Windows DLL version, include in a DLL project zlib.def, zlib.rc
50is in the CPAN (Comprehensive Perl Archive Network) sites, such as: 58 and all .c files except example.c and minigzip.c; compile with -DZLIB_DLL
51ftp://ftp.cis.ufl.edu/pub/perl/CPAN/modules/by-module/Compress/Compress-Zlib* 59 For help on building a zlib DLL, contact Alessandro Iacopetti
60 <iaco@cicladi.unial.it>
52 61
53 62
54Acknowledgments: 63Acknowledgments:
diff --git a/adler32.c b/adler32.c
index b6b5519..c9dcf93 100644
--- a/adler32.c
+++ b/adler32.c
@@ -3,7 +3,7 @@
3 * For conditions of distribution and use, see copyright notice in zlib.h 3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */ 4 */
5 5
6/* $Id: adler32.c,v 1.9 1996/01/30 21:59:09 me Exp $ */ 6/* $Id: adler32.c,v 1.10 1996/05/22 11:52:18 me Exp $ */
7 7
8#include "zlib.h" 8#include "zlib.h"
9 9
diff --git a/algorithm.doc b/algorithm.doc
new file mode 100644
index 0000000..156058a
--- /dev/null
+++ b/algorithm.doc
@@ -0,0 +1,105 @@
11. Compression algorithm (deflate)
2
3The deflation algorithm used by zlib (also zip and gzip) is a variation of
4LZ77 (Lempel-Ziv 1977, see reference below). It finds duplicated strings in
5the input data. The second occurrence of a string is replaced by a
6pointer to the previous string, in the form of a pair (distance,
7length). Distances are limited to 32K bytes, and lengths are limited
8to 258 bytes. When a string does not occur anywhere in the previous
932K bytes, it is emitted as a sequence of literal bytes. (In this
10description, 'string' must be taken as an arbitrary sequence of bytes,
11and is not restricted to printable characters.)
12
13Literals or match lengths are compressed with one Huffman tree, and
14match distances are compressed with another tree. The trees are stored
15in a compact form at the start of each block. The blocks can have any
16size (except that the compressed data for one block must fit in
17available memory). A block is terminated when deflate() determines that
18it would be useful to start another block with fresh trees. (This is
19somewhat similar to compress.)
20
21Duplicated strings are found using a hash table. All input strings of
22length 3 are inserted in the hash table. A hash index is computed for
23the next 3 bytes. If the hash chain for this index is not empty, all
24strings in the chain are compared with the current input string, and
25the longest match is selected.
26
27The hash chains are searched starting with the most recent strings, to
28favor small distances and thus take advantage of the Huffman encoding.
29The hash chains are singly linked. There are no deletions from the
30hash chains, the algorithm simply discards matches that are too old.
31
32To avoid a worst-case situation, very long hash chains are arbitrarily
33truncated at a certain length, determined by a runtime option (level
34parameter of deflateInit). So deflate() does not always find the longest
35possible match but generally finds a match which is long enough.
36
37deflate() also defers the selection of matches with a lazy evaluation
38mechanism. After a match of length N has been found, deflate() searches for a
39longer match at the next input byte. If a longer match is found, the
40previous match is truncated to a length of one (thus producing a single
41literal byte) and the longer match is emitted afterwards. Otherwise,
42the original match is kept, and the next match search is attempted only
43N steps later.
44
45The lazy match evaluation is also subject to a runtime parameter. If
46the current match is long enough, deflate() reduces the search for a longer
47match, thus speeding up the whole process. If compression ratio is more
48important than speed, deflate() attempts a complete second search even if
49the first match is already long enough.
50
51The lazy match evaluation is not performed for the fastest compression
52modes (level parameter 1 to 3). For these fast modes, new strings
53are inserted in the hash table only when no match was found, or
54when the match is not too long. This degrades the compression ratio
55but saves time since there are both fewer insertions and fewer searches.
56
57
582. Decompression algorithm (inflate)
59
60The real question is given a Huffman tree, how to decode fast. The most
61important realization is that shorter codes are much more common than
62longer codes, so pay attention to decoding the short codes fast, and let
63the long codes take longer to decode.
64
65inflate() sets up a first level table that covers some number of bits of
66input less than the length of longest code. It gets that many bits from the
67stream, and looks it up in the table. The table will tell if the next
68code is that many bits or less and how many, and if it is, it will tell
69the value, else it will point to the next level table for which inflate()
70grabs more bits and tries to decode a longer code.
71
72How many bits to make the first lookup is a tradeoff between the time it
73takes to decode and the time it takes to build the table. If building the
74table took no time (and if you had infinite memory), then there would only
75be a first level table to cover all the way to the longest code. However,
76building the table ends up taking a lot longer for more bits since short
77codes are replicated many times in such a table. What inflate() does is
78simply to make the number of bits in the first table a variable, and set it
79for the maximum speed.
80
81inflate() sends new trees relatively often, so it is possibly set for a
82smaller first level table than an application that has only one tree for
83all the data. For inflate, which has 286 possible codes for the
84literal/length tree, the size of the first table is nine bits. Also the
85distance trees have 30 possible values, and the size of the first table is
86six bits. Note that for each of those cases, the table ended up one bit
87longer than the "average" code length, i.e. the code length of an
88approximately flat code which would be a little more than eight bits for
89286 symbols and a little less than five bits for 30 symbols. It would be
90interesting to see if optimizing the first level table for other
91applications gave values within a bit or two of the flat code size.
92
93
94Jean-loup Gailly Mark Adler
95gzip@prep.ai.mit.edu madler@alumni.caltech.edu
96
97
98References:
99
100[LZ77] Ziv J., Lempel A., "A Universal Algorithm for Sequential Data
101Compression", IEEE Transactions on Information Theory", Vol. 23, No. 3,
102pp. 337-343.
103
104"DEFLATE Compressed Data Format Specification" available in
105ftp://ds.internic.net/rfc/rfc1951.txt
diff --git a/compress.c b/compress.c
index 1c58400..590c451 100644
--- a/compress.c
+++ b/compress.c
@@ -3,7 +3,7 @@
3 * For conditions of distribution and use, see copyright notice in zlib.h 3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */ 4 */
5 5
6/* $Id: compress.c,v 1.9 1996/01/30 21:59:09 me Exp $ */ 6/* $Id: compress.c,v 1.10 1996/05/23 16:51:12 me Exp $ */
7 7
8#include "zlib.h" 8#include "zlib.h"
9 9
@@ -30,9 +30,10 @@ int compress (dest, destLen, source, sourceLen)
30 30
31 stream.next_in = (Bytef*)source; 31 stream.next_in = (Bytef*)source;
32 stream.avail_in = (uInt)sourceLen; 32 stream.avail_in = (uInt)sourceLen;
33#ifdef MAXSEG_64K
33 /* Check for source > 64K on 16-bit machine: */ 34 /* Check for source > 64K on 16-bit machine: */
34 if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; 35 if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
35 36#endif
36 stream.next_out = dest; 37 stream.next_out = dest;
37 stream.avail_out = (uInt)*destLen; 38 stream.avail_out = (uInt)*destLen;
38 if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; 39 if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
diff --git a/deflate.c b/deflate.c
index 64710e6..f882a87 100644
--- a/deflate.c
+++ b/deflate.c
@@ -47,11 +47,11 @@
47 * 47 *
48 */ 48 */
49 49
50/* $Id: deflate.c,v 1.12 1996/01/30 21:59:11 me Exp $ */ 50/* $Id: deflate.c,v 1.13 1996/05/22 11:52:21 me Exp $ */
51 51
52#include "deflate.h" 52#include "deflate.h"
53 53
54char deflate_copyright[] = " deflate 1.0.1 Copyright 1995-1996 Jean-loup Gailly "; 54char deflate_copyright[] = " deflate 1.0.2 Copyright 1995-1996 Jean-loup Gailly ";
55/* 55/*
56 If you use the zlib library in a product, an acknowledgment is welcome 56 If you use the zlib library in a product, an acknowledgment is welcome
57 in the documentation of your product. If for some reason you cannot 57 in the documentation of your product. If for some reason you cannot
diff --git a/example.c b/example.c
index 175fa81..5e4dc6d 100644
--- a/example.c
+++ b/example.c
@@ -3,7 +3,7 @@
3 * For conditions of distribution and use, see copyright notice in zlib.h 3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */ 4 */
5 5
6/* $Id: example.c,v 1.13 1996/01/30 21:59:13 me Exp $ */ 6/* $Id: example.c,v 1.16 1996/05/23 17:11:28 me Exp $ */
7 7
8#include <stdio.h> 8#include <stdio.h>
9#include "zlib.h" 9#include "zlib.h"
@@ -462,16 +462,19 @@ int main(argc, argv)
462 uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */ 462 uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */
463 uLong uncomprLen = comprLen; 463 uLong uncomprLen = comprLen;
464 464
465 if (zlib_version[0] != ZLIB_VERSION[0]) { 465 if (zlibVersion()[0] != ZLIB_VERSION[0]) {
466 fprintf(stderr, "incompatible zlib version\n"); 466 fprintf(stderr, "incompatible zlib version\n");
467 exit(1); 467 exit(1);
468 468
469 } else if (strcmp(zlib_version, ZLIB_VERSION) != 0) { 469 } else if (strcmp(zlibVersion(), ZLIB_VERSION) != 0) {
470 fprintf(stderr, "warning: different zlib version\n"); 470 fprintf(stderr, "warning: different zlib version\n");
471 } 471 }
472 472
473 compr = (Byte*)malloc((uInt)comprLen); 473 compr = (Byte*)calloc((uInt)comprLen, 1);
474 uncompr = (Byte*)calloc((uInt)uncomprLen, 1); /* must be cleared */ 474 uncompr = (Byte*)calloc((uInt)uncomprLen, 1);
475 /* compr and uncompr are cleared to avoid reading uninitialized
476 * data and to ensure that uncompr compresses well.
477 */
475 if (compr == Z_NULL || uncompr == Z_NULL) { 478 if (compr == Z_NULL || uncompr == Z_NULL) {
476 printf("out of memory\n"); 479 printf("out of memory\n");
477 exit(1); 480 exit(1);
diff --git a/gzio.c b/gzio.c
index 6f6832b..44ca9e8 100644
--- a/gzio.c
+++ b/gzio.c
@@ -3,7 +3,7 @@
3 * For conditions of distribution and use, see copyright notice in zlib.h 3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */ 4 */
5 5
6/* $Id: gzio.c,v 1.12 1996/01/30 21:59:14 me Exp $ */ 6/* $Id: gzio.c,v 1.13 1996/05/22 11:52:24 me Exp $ */
7 7
8#include <stdio.h> 8#include <stdio.h>
9 9
diff --git a/inftrees.c b/inftrees.c
index 3bf39a6..ebeac0d 100644
--- a/inftrees.c
+++ b/inftrees.c
@@ -6,7 +6,7 @@
6#include "zutil.h" 6#include "zutil.h"
7#include "inftrees.h" 7#include "inftrees.h"
8 8
9char inflate_copyright[] = " inflate 1.0.1 Copyright 1995-1996 Mark Adler "; 9char inflate_copyright[] = " inflate 1.0.2 Copyright 1995-1996 Mark Adler ";
10/* 10/*
11 If you use the zlib library in a product, an acknowledgment is welcome 11 If you use the zlib library in a product, an acknowledgment is welcome
12 in the documentation of your product. If for some reason you cannot 12 in the documentation of your product. If for some reason you cannot
diff --git a/infutil.c b/infutil.c
index 7099b6d..b56f8cd 100644
--- a/infutil.c
+++ b/infutil.c
@@ -26,7 +26,8 @@ z_stream *z;
26int r; 26int r;
27{ 27{
28 uInt n; 28 uInt n;
29 Bytef *p, *q; 29 Bytef *p;
30 Bytef *q;
30 31
31 /* local copies of source and destination pointers */ 32 /* local copies of source and destination pointers */
32 p = z->next_out; 33 p = z->next_out;
diff --git a/minigzip.c b/minigzip.c
index eee52a5..bd0735b 100644
--- a/minigzip.c
+++ b/minigzip.c
@@ -13,7 +13,7 @@
13 * or in pipe mode. 13 * or in pipe mode.
14 */ 14 */
15 15
16/* $Id: minigzip.c,v 1.8 1996/01/30 21:59:23 me Exp $ */ 16/* $Id: minigzip.c,v 1.9 1996/05/22 11:52:32 me Exp $ */
17 17
18#include <stdio.h> 18#include <stdio.h>
19#include "zlib.h" 19#include "zlib.h"
diff --git a/trees.c b/trees.c
index fcfe68b..f943d06 100644
--- a/trees.c
+++ b/trees.c
@@ -29,7 +29,7 @@
29 * Addison-Wesley, 1983. ISBN 0-201-06672-6. 29 * Addison-Wesley, 1983. ISBN 0-201-06672-6.
30 */ 30 */
31 31
32/* $Id: trees.c,v 1.5 1995/05/03 17:27:12 jloup Exp $ */ 32/* $Id: trees.c,v 1.10 1996/05/22 11:52:34 me Exp $ */
33 33
34#include "deflate.h" 34#include "deflate.h"
35 35
diff --git a/zconf.h b/zconf.h
index 6ab1e4f..69aa21b 100644
--- a/zconf.h
+++ b/zconf.h
@@ -3,7 +3,7 @@
3 * For conditions of distribution and use, see copyright notice in zlib.h 3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */ 4 */
5 5
6/* $Id: zconf.h,v 1.12 1995/05/03 17:27:12 jloup Exp $ */ 6/* $Id: zconf.h,v 1.18 1996/05/23 16:51:18 me Exp $ */
7 7
8#ifndef _ZCONF_H 8#ifndef _ZCONF_H
9#define _ZCONF_H 9#define _ZCONF_H
@@ -37,7 +37,7 @@
37# define Byte z_Byte 37# define Byte z_Byte
38# define uInt z_uInt 38# define uInt z_uInt
39# define uLong z_uLong 39# define uLong z_uLong
40/* # define Bytef z_Bytef */ 40# define Bytef z_Bytef
41# define charf z_charf 41# define charf z_charf
42# define intf z_intf 42# define intf z_intf
43# define uIntf z_uIntf 43# define uIntf z_uIntf
@@ -128,7 +128,8 @@
128 * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, 128 * to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
129 * just define FAR to be empty. 129 * just define FAR to be empty.
130 */ 130 */
131#if defined(M_I86SM) || defined(M_I86MM) /* MSC small or medium model */ 131#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__)
132 /* MSC small or medium model */
132# define SMALL_MEDIUM 133# define SMALL_MEDIUM
133# ifdef _MSC_VER 134# ifdef _MSC_VER
134# define FAR __far 135# define FAR __far
@@ -137,14 +138,16 @@
137# endif 138# endif
138#endif 139#endif
139#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) 140#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))
141# ifndef __32BIT__
140# define SMALL_MEDIUM 142# define SMALL_MEDIUM
141# define FAR __far 143# define FAR __far
144# endif
142#endif 145#endif
143#ifndef FAR 146#ifndef FAR
144# define FAR 147# define FAR
145#endif 148#endif
146/* The Watcom compiler defines M_I86SM and __SMALL__ even in 32 bit mode */ 149/* The Watcom compiler defines M_I86SM and __SMALL__ even in 32 bit mode */
147#if defined(__WATCOMC__) && defined(__386__) 150#if defined(__WATCOMC__) && defined(__386__) && defined(SMALL_MEDIUM)
148# undef FAR 151# undef FAR
149# define FAR 152# define FAR
150# undef SMALL_MEDIUM 153# undef SMALL_MEDIUM
@@ -154,8 +157,12 @@ typedef unsigned char Byte; /* 8 bits */
154typedef unsigned int uInt; /* 16 bits or more */ 157typedef unsigned int uInt; /* 16 bits or more */
155typedef unsigned long uLong; /* 32 bits or more */ 158typedef unsigned long uLong; /* 32 bits or more */
156 159
157/* "typedef Byte FAR Bytef;" doesn't work with Borland C/C++ */ 160#if defined(__BORLANDC__) && defined(SMALL_MEDIUM)
158#define Bytef Byte FAR 161 /* Borland C/C++ ignores FAR inside typedef */
162# define Bytef Byte FAR
163#else
164 typedef Byte FAR Bytef;
165#endif
159typedef char FAR charf; 166typedef char FAR charf;
160typedef int FAR intf; 167typedef int FAR intf;
161typedef uInt FAR uIntf; 168typedef uInt FAR uIntf;
@@ -169,4 +176,13 @@ typedef uLong FAR uLongf;
169 typedef Byte *voidp; 176 typedef Byte *voidp;
170#endif 177#endif
171 178
179
180/* Compile with -DZLIB_DLL for Windows DLL support */
181#if (defined(_WINDOWS) || defined(WINDOWS)) && defined(ZLIB_DLL)
182# include <windows.h>
183# define EXPORT WINAPI
184#else
185# define EXPORT
186#endif
187
172#endif /* _ZCONF_H */ 188#endif /* _ZCONF_H */
diff --git a/zlib.def b/zlib.def
new file mode 100644
index 0000000..0f5049f
--- /dev/null
+++ b/zlib.def
@@ -0,0 +1,46 @@
1LIBRARY "zlib"
2
3DESCRIPTION '"""zlib data compression library"""'
4
5EXETYPE NT
6
7SUBSYSTEM WINDOWS
8
9STUB 'WINSTUB.EXE'
10
11VERSION 1.0.2
12
13CODE EXECUTE READ
14
15DATA READ WRITE
16
17HEAPSIZE 1048576,4096
18
19EXPORTS
20 zlibVersion
21 deflate
22 deflateEnd
23 inflate
24 inflateEnd
25 deflateSetDictionary
26 deflateCopy
27 deflateReset
28 deflateParams
29 inflateSetDictionary
30 inflateSync
31 inflateReset
32 compress
33 uncompress
34 gzopen
35 gzdopen
36 gzread
37 gzwrite
38 gzflush
39 gzclose
40 gzerror
41 adler32
42 crc32
43 deflateInit_
44 inflateInit_
45 deflateInit2_
46 inflateInit2_
diff --git a/zlib.h b/zlib.h
index 47960c2..1e61491 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.1, May 20th, 1996. 2 version 1.0.2, May 23rd, 1996.
3 3
4 Copyright (C) 1995-1996 Jean-loup Gailly and Mark Adler 4 Copyright (C) 1995-1996 Jean-loup Gailly and Mark Adler
5 5
@@ -21,7 +21,12 @@
21 21
22 Jean-loup Gailly Mark Adler 22 Jean-loup Gailly Mark Adler
23 gzip@prep.ai.mit.edu madler@alumni.caltech.edu 23 gzip@prep.ai.mit.edu madler@alumni.caltech.edu
24 */ 24
25
26 The data format used by the zlib library is described by RFCs (Request for
27 Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
28 (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
29*/
25 30
26#ifndef _ZLIB_H 31#ifndef _ZLIB_H
27#define _ZLIB_H 32#define _ZLIB_H
@@ -32,7 +37,7 @@ extern "C" {
32 37
33#include "zconf.h" 38#include "zconf.h"
34 39
35#define ZLIB_VERSION "1.0.1" 40#define ZLIB_VERSION "1.0.2"
36 41
37/* 42/*
38 The 'zlib' compression library provides in-memory compression and 43 The 'zlib' compression library provides in-memory compression and
@@ -156,16 +161,20 @@ typedef struct z_stream_s {
156 161
157#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ 162#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
158 163
159extern const char *zlib_version; 164#define zlib_version zlibVersion()
160/* The application can compare zlib_version and ZLIB_VERSION for consistency. 165/* for compatibility with versions < 1.0.2 */
166
167 /* basic functions */
168
169extern char EXPORT *zlibVersion OF((void));
170/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
161 If the first character differs, the library code actually used is 171 If the first character differs, the library code actually used is
162 not compatible with the zlib.h header file used by the application. 172 not compatible with the zlib.h header file used by the application.
173 This check is automatically made by deflateInit and inflateInit.
163 */ 174 */
164 175
165 /* basic functions */
166
167/* 176/*
168extern int deflateInit OF((z_stream *strm, int level)); 177extern int EXPORT deflateInit OF((z_stream *strm, int level));
169 178
170 Initializes the internal stream state for compression. The fields 179 Initializes the internal stream state for compression. The fields
171 zalloc, zfree and opaque must be initialized before by the caller. 180 zalloc, zfree and opaque must be initialized before by the caller.
@@ -187,7 +196,7 @@ extern int deflateInit OF((z_stream *strm, int level));
187*/ 196*/
188 197
189 198
190extern int deflate OF((z_stream *strm, int flush)); 199extern int EXPORT deflate OF((z_stream *strm, int flush));
191/* 200/*
192 Performs one or both of the following actions: 201 Performs one or both of the following actions:
193 202
@@ -256,7 +265,7 @@ extern int deflate OF((z_stream *strm, int flush));
256*/ 265*/
257 266
258 267
259extern int deflateEnd OF((z_stream *strm)); 268extern int EXPORT deflateEnd OF((z_stream *strm));
260/* 269/*
261 All dynamically allocated data structures for this stream are freed. 270 All dynamically allocated data structures for this stream are freed.
262 This function discards any unprocessed input and does not flush any 271 This function discards any unprocessed input and does not flush any
@@ -271,7 +280,7 @@ extern int deflateEnd OF((z_stream *strm));
271 280
272 281
273/* 282/*
274extern int inflateInit OF((z_stream *strm)); 283extern int EXPORT inflateInit OF((z_stream *strm));
275 284
276 Initializes the internal stream state for decompression. The fields 285 Initializes the internal stream state for decompression. The fields
277 zalloc, zfree and opaque must be initialized before by the caller. If 286 zalloc, zfree and opaque must be initialized before by the caller. If
@@ -286,7 +295,7 @@ extern int inflateInit OF((z_stream *strm));
286*/ 295*/
287 296
288 297
289extern int inflate OF((z_stream *strm, int flush)); 298extern int EXPORT inflate OF((z_stream *strm, int flush));
290/* 299/*
291 Performs one or both of the following actions: 300 Performs one or both of the following actions:
292 301
@@ -341,7 +350,7 @@ extern int inflate OF((z_stream *strm, int flush));
341*/ 350*/
342 351
343 352
344extern int inflateEnd OF((z_stream *strm)); 353extern int EXPORT inflateEnd OF((z_stream *strm));
345/* 354/*
346 All dynamically allocated data structures for this stream are freed. 355 All dynamically allocated data structures for this stream are freed.
347 This function discards any unprocessed input and does not flush any 356 This function discards any unprocessed input and does not flush any
@@ -359,12 +368,12 @@ extern int inflateEnd OF((z_stream *strm));
359*/ 368*/
360 369
361/* 370/*
362extern int deflateInit2 OF((z_stream *strm, 371extern int EXPORT deflateInit2 OF((z_stream *strm,
363 int level, 372 int level,
364 int method, 373 int method,
365 int windowBits, 374 int windowBits,
366 int memLevel, 375 int memLevel,
367 int strategy)); 376 int strategy));
368 377
369 This is another version of deflateInit with more compression options. The 378 This is another version of deflateInit with more compression options. The
370 fields next_in, zalloc, zfree and opaque must be initialized before by 379 fields next_in, zalloc, zfree and opaque must be initialized before by
@@ -417,9 +426,9 @@ extern int deflateInit2 OF((z_stream *strm,
417 deflate(). 426 deflate().
418*/ 427*/
419 428
420extern int deflateSetDictionary OF((z_stream *strm, 429extern int EXPORT deflateSetDictionary OF((z_stream *strm,
421 const Bytef *dictionary, 430 const Bytef *dictionary,
422 uInt dictLength)); 431 uInt dictLength));
423/* 432/*
424 Initializes the compression dictionary (history buffer) from the given 433 Initializes the compression dictionary (history buffer) from the given
425 byte sequence without producing any compressed output. This function must 434 byte sequence without producing any compressed output. This function must
@@ -446,8 +455,8 @@ extern int deflateSetDictionary OF((z_stream *strm,
446 be done by deflate(). 455 be done by deflate().
447*/ 456*/
448 457
449extern int deflateCopy OF((z_stream *dest, 458extern int EXPORT deflateCopy OF((z_stream *dest,
450 z_stream *source)); 459 z_stream *source));
451/* 460/*
452 Sets the destination stream as a complete copy of the source stream. If 461 Sets the destination stream as a complete copy of the source stream. If
453 the source stream is using an application-supplied history buffer, a new 462 the source stream is using an application-supplied history buffer, a new
@@ -469,7 +478,7 @@ extern int deflateCopy OF((z_stream *dest,
469 destination. 478 destination.
470*/ 479*/
471 480
472extern int deflateReset OF((z_stream *strm)); 481extern int EXPORT deflateReset OF((z_stream *strm));
473/* 482/*
474 This function is equivalent to deflateEnd followed by deflateInit, 483 This function is equivalent to deflateEnd followed by deflateInit,
475 but does not free and reallocate all the internal compression state. 484 but does not free and reallocate all the internal compression state.
@@ -480,7 +489,7 @@ extern int deflateReset OF((z_stream *strm));
480 stream state was inconsistent (such as zalloc or state being NULL). 489 stream state was inconsistent (such as zalloc or state being NULL).
481*/ 490*/
482 491
483extern int deflateParams OF((z_stream *strm, int level, int strategy)); 492extern int EXPORT deflateParams OF((z_stream *strm, int level, int strategy));
484/* 493/*
485 Dynamically update the compression level and compression strategy. 494 Dynamically update the compression level and compression strategy.
486 This can be used to switch between compression and straight copy of 495 This can be used to switch between compression and straight copy of
@@ -499,8 +508,8 @@ extern int deflateParams OF((z_stream *strm, int level, int strategy));
499*/ 508*/
500 509
501/* 510/*
502extern int inflateInit2 OF((z_stream *strm, 511extern int EXPORT inflateInit2 OF((z_stream *strm,
503 int windowBits)); 512 int windowBits));
504 513
505 This is another version of inflateInit with more compression options. The 514 This is another version of inflateInit with more compression options. The
506 fields next_out, zalloc, zfree and opaque must be initialized before by 515 fields next_out, zalloc, zfree and opaque must be initialized before by
@@ -533,9 +542,9 @@ extern int inflateInit2 OF((z_stream *strm,
533 inflate(). 542 inflate().
534*/ 543*/
535 544
536extern int inflateSetDictionary OF((z_stream *strm, 545extern int EXPORT inflateSetDictionary OF((z_stream *strm,
537 const Bytef *dictionary, 546 const Bytef *dictionary,
538 uInt dictLength)); 547 uInt dictLength));
539/* 548/*
540 Initializes the decompression dictionary (history buffer) from the given 549 Initializes the decompression dictionary (history buffer) from the given
541 uncompressed byte sequence. This function must be called immediately after 550 uncompressed byte sequence. This function must be called immediately after
@@ -552,7 +561,7 @@ extern int inflateSetDictionary OF((z_stream *strm,
552 inflate(). 561 inflate().
553*/ 562*/
554 563
555extern int inflateSync OF((z_stream *strm)); 564extern int EXPORT inflateSync OF((z_stream *strm));
556/* 565/*
557 Skips invalid compressed data until the special marker (see deflate() 566 Skips invalid compressed data until the special marker (see deflate()
558 above) can be found, or until all available input is skipped. No output 567 above) can be found, or until all available input is skipped. No output
@@ -567,7 +576,7 @@ extern int inflateSync OF((z_stream *strm));
567 until success or end of the input data. 576 until success or end of the input data.
568*/ 577*/
569 578
570extern int inflateReset OF((z_stream *strm)); 579extern int EXPORT inflateReset OF((z_stream *strm));
571/* 580/*
572 This function is equivalent to inflateEnd followed by inflateInit, 581 This function is equivalent to inflateEnd followed by inflateInit,
573 but does not free and reallocate all the internal decompression state. 582 but does not free and reallocate all the internal decompression state.
@@ -588,8 +597,8 @@ extern int inflateReset OF((z_stream *strm));
588 utility functions can easily be modified if you need special options. 597 utility functions can easily be modified if you need special options.
589*/ 598*/
590 599
591extern int compress OF((Bytef *dest, uLongf *destLen, 600extern int EXPORT compress OF((Bytef *dest, uLongf *destLen,
592 const Bytef *source, uLong sourceLen)); 601 const Bytef *source, uLong sourceLen));
593/* 602/*
594 Compresses the source buffer into the destination buffer. sourceLen is 603 Compresses the source buffer into the destination buffer. sourceLen is
595 the byte length of the source buffer. Upon entry, destLen is the total 604 the byte length of the source buffer. Upon entry, destLen is the total
@@ -603,8 +612,8 @@ extern int compress OF((Bytef *dest, uLongf *destLen,
603 buffer. 612 buffer.
604*/ 613*/
605 614
606extern int uncompress OF((Bytef *dest, uLongf *destLen, 615extern int EXPORT uncompress OF((Bytef *dest, uLongf *destLen,
607 const Bytef *source, uLong sourceLen)); 616 const Bytef *source, uLong sourceLen));
608/* 617/*
609 Decompresses the source buffer into the destination buffer. sourceLen is 618 Decompresses the source buffer into the destination buffer. sourceLen is
610 the byte length of the source buffer. Upon entry, destLen is the total 619 the byte length of the source buffer. Upon entry, destLen is the total
@@ -624,7 +633,7 @@ extern int uncompress OF((Bytef *dest, uLongf *destLen,
624 633
625typedef voidp gzFile; 634typedef voidp gzFile;
626 635
627extern gzFile gzopen OF((const char *path, const char *mode)); 636extern gzFile EXPORT gzopen OF((const char *path, const char *mode));
628/* 637/*
629 Opens a gzip (.gz) file for reading or writing. The mode parameter 638 Opens a gzip (.gz) file for reading or writing. The mode parameter
630 is as in fopen ("rb" or "wb") but can also include a compression level 639 is as in fopen ("rb" or "wb") but can also include a compression level
@@ -636,7 +645,7 @@ extern gzFile gzopen OF((const char *path, const char *mode));
636 zlib error is Z_MEM_ERROR). 645 zlib error is Z_MEM_ERROR).
637*/ 646*/
638 647
639extern gzFile gzdopen OF((int fd, const char *mode)); 648extern gzFile EXPORT gzdopen OF((int fd, const char *mode));
640/* 649/*
641 gzdopen() associates a gzFile with the file descriptor fd. File 650 gzdopen() associates a gzFile with the file descriptor fd. File
642 descriptors are obtained from calls like open, dup, creat, pipe or 651 descriptors are obtained from calls like open, dup, creat, pipe or
@@ -649,7 +658,7 @@ extern gzFile gzdopen OF((int fd, const char *mode));
649 the (de)compression state. 658 the (de)compression state.
650*/ 659*/
651 660
652extern int gzread OF((gzFile file, voidp buf, unsigned len)); 661extern int EXPORT gzread OF((gzFile file, voidp buf, unsigned len));
653/* 662/*
654 Reads the given number of uncompressed bytes from the compressed file. 663 Reads the given number of uncompressed bytes from the compressed file.
655 If the input file was not in gzip format, gzread copies the given number 664 If the input file was not in gzip format, gzread copies the given number
@@ -657,14 +666,14 @@ extern int gzread OF((gzFile file, voidp buf, unsigned len));
657 gzread returns the number of uncompressed bytes actually read (0 for 666 gzread returns the number of uncompressed bytes actually read (0 for
658 end of file, -1 for error). */ 667 end of file, -1 for error). */
659 668
660extern int gzwrite OF((gzFile file, const voidp buf, unsigned len)); 669extern int EXPORT gzwrite OF((gzFile file, const voidp buf, unsigned len));
661/* 670/*
662 Writes the given number of uncompressed bytes into the compressed file. 671 Writes the given number of uncompressed bytes into the compressed file.
663 gzwrite returns the number of uncompressed bytes actually written 672 gzwrite returns the number of uncompressed bytes actually written
664 (0 in case of error). 673 (0 in case of error).
665*/ 674*/
666 675
667extern int gzflush OF((gzFile file, int flush)); 676extern int EXPORT gzflush OF((gzFile file, int flush));
668/* 677/*
669 Flushes all pending output into the compressed file. The parameter 678 Flushes all pending output into the compressed file. The parameter
670 flush is as in the deflate() function. The return value is the zlib 679 flush is as in the deflate() function. The return value is the zlib
@@ -674,14 +683,14 @@ extern int gzflush OF((gzFile file, int flush));
674 degrade compression. 683 degrade compression.
675*/ 684*/
676 685
677extern int gzclose OF((gzFile file)); 686extern int EXPORT gzclose OF((gzFile file));
678/* 687/*
679 Flushes all pending output if necessary, closes the compressed file 688 Flushes all pending output if necessary, closes the compressed file
680 and deallocates all the (de)compression state. The return value is the zlib 689 and deallocates all the (de)compression state. The return value is the zlib
681 error number (see function gzerror below). 690 error number (see function gzerror below).
682*/ 691*/
683 692
684extern char* gzerror OF((gzFile file, int *errnum)); 693extern char EXPORT *gzerror OF((gzFile file, int *errnum));
685/* 694/*
686 Returns the error message for the last error which occurred on the 695 Returns the error message for the last error which occurred on the
687 given compressed file. errnum is set to zlib error number. If an 696 given compressed file. errnum is set to zlib error number. If an
@@ -698,7 +707,7 @@ extern char* gzerror OF((gzFile file, int *errnum));
698 compression library. 707 compression library.
699*/ 708*/
700 709
701extern uLong adler32 OF((uLong adler, const Bytef *buf, uInt len)); 710extern uLong EXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
702 711
703/* 712/*
704 Update a running Adler-32 checksum with the bytes buf[0..len-1] and 713 Update a running Adler-32 checksum with the bytes buf[0..len-1] and
@@ -715,7 +724,7 @@ extern uLong adler32 OF((uLong adler, const Bytef *buf, uInt len));
715 if (adler != original_adler) error(); 724 if (adler != original_adler) error();
716*/ 725*/
717 726
718extern uLong crc32 OF((uLong crc, const Bytef *buf, uInt len)); 727extern uLong EXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
719/* 728/*
720 Update a running crc with the bytes buf[0..len-1] and return the updated 729 Update a running crc with the bytes buf[0..len-1] and return the updated
721 crc. If buf is NULL, this function returns the required initial value 730 crc. If buf is NULL, this function returns the required initial value
@@ -737,15 +746,15 @@ extern uLong crc32 OF((uLong crc, const Bytef *buf, uInt len));
737/* deflateInit and inflateInit are macros to allow checking the zlib version 746/* deflateInit and inflateInit are macros to allow checking the zlib version
738 * and the compiler's view of z_stream: 747 * and the compiler's view of z_stream:
739 */ 748 */
740extern int deflateInit_ OF((z_stream *strm, int level, 749extern int EXPORT deflateInit_ OF((z_stream *strm, int level,
741 const char *version, int stream_size)); 750 const char *version, int stream_size));
742extern int inflateInit_ OF((z_stream *strm, 751extern int EXPORT inflateInit_ OF((z_stream *strm,
743 const char *version, int stream_size)); 752 const char *version, int stream_size));
744extern int deflateInit2_ OF((z_stream *strm, int level, int method, 753extern int EXPORT deflateInit2_ OF((z_stream *strm, int level, int method,
745 int windowBits, int memLevel, int strategy, 754 int windowBits, int memLevel, int strategy,
746 const char *version, int stream_size)); 755 const char *version, int stream_size));
747extern int inflateInit2_ OF((z_stream *strm, int windowBits, 756extern int EXPORT inflateInit2_ OF((z_stream *strm, int windowBits,
748 const char *version, int stream_size)); 757 const char *version, int stream_size));
749#define deflateInit(strm, level) \ 758#define deflateInit(strm, level) \
750 deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) 759 deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
751#define inflateInit(strm) \ 760#define inflateInit(strm) \
diff --git a/zlib.rc b/zlib.rc
new file mode 100644
index 0000000..5e1d0f7
--- /dev/null
+++ b/zlib.rc
@@ -0,0 +1,32 @@
1#include <windows.h>
2
3#define IDR_VERSION1 1
4IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
5 FILEVERSION 1,0,2,0
6 PRODUCTVERSION 1,0,2,0
7 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
8 FILEFLAGS 0
9 FILEOS VOS_DOS_WINDOWS32
10 FILETYPE VFT_DLL
11 FILESUBTYPE 0 // not used
12BEGIN
13 BLOCK "StringFileInfo"
14 BEGIN
15 BLOCK "040904E4"
16 //language ID = U.S. English, char set = Windows, Multilingual
17
18 BEGIN
19 VALUE "FileDescription", "zlib data compression library\0"
20 VALUE "FileVersion", "1.0.2\0"
21 VALUE "InternalName", "zlib\0"
22 VALUE "OriginalFilename", "zlib.lib\0"
23 VALUE "ProductName", "ZLib.DLL\0"
24 VALUE "Comments", "DLL support by Alessandro Iacopetti\0"
25 VALUE "LegalCopyright", "(C) 1995-1996 Jean-loup Gailly & Mark Adler\0"
26 END
27 END
28 BLOCK "VarFileInfo"
29 BEGIN
30 VALUE "Translation", 0x0409, 1252
31 END
32END
diff --git a/zutil.c b/zutil.c
index 66ddae4..f32fda5 100644
--- a/zutil.c
+++ b/zutil.c
@@ -3,7 +3,7 @@
3 * For conditions of distribution and use, see copyright notice in zlib.h 3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */ 4 */
5 5
6/* $Id: zutil.c,v 1.12 1996/01/30 21:59:29 me Exp $ */ 6/* $Id: zutil.c,v 1.15 1996/05/23 17:11:36 me Exp $ */
7 7
8#include <stdio.h> 8#include <stdio.h>
9 9
@@ -15,8 +15,6 @@ struct internal_state {int dummy;}; /* for buggy compilers */
15extern void exit OF((int)); 15extern void exit OF((int));
16#endif 16#endif
17 17
18const char *zlib_version = ZLIB_VERSION;
19
20const char *z_errmsg[10] = { 18const char *z_errmsg[10] = {
21"need dictionary", /* Z_NEED_DICT 2 */ 19"need dictionary", /* Z_NEED_DICT 2 */
22"stream end", /* Z_STREAM_END 1 */ 20"stream end", /* Z_STREAM_END 1 */
@@ -30,6 +28,11 @@ const char *z_errmsg[10] = {
30""}; 28""};
31 29
32 30
31char *zlibVersion()
32{
33 return ZLIB_VERSION;
34}
35
33void z_error (m) 36void z_error (m)
34 char *m; 37 char *m;
35{ 38{
diff --git a/zutil.h b/zutil.h
index 3abd8c4..5a53321 100644
--- a/zutil.h
+++ b/zutil.h
@@ -8,7 +8,7 @@
8 subject to change. Applications should only use zlib.h. 8 subject to change. Applications should only use zlib.h.
9 */ 9 */
10 10
11/* $Id: zutil.h,v 1.13 1996/01/30 21:59:29 me Exp $ */ 11/* $Id: zutil.h,v 1.14 1996/05/22 11:52:40 me Exp $ */
12 12
13#ifndef _Z_UTIL_H 13#ifndef _Z_UTIL_H
14#define _Z_UTIL_H 14#define _Z_UTIL_H