]> git.lizzy.rs Git - zlib.git/commitdiff
zlib 1.0.4 v1.0.4
authorMark Adler <madler@alumni.caltech.edu>
Sat, 10 Sep 2011 06:17:02 +0000 (23:17 -0700)
committerMark Adler <madler@alumni.caltech.edu>
Sat, 10 Sep 2011 06:17:02 +0000 (23:17 -0700)
31 files changed:
ChangeLog
INDEX
Makefile
Makefile.dj2
Makefile.in
Makefile.msc
Makefile.riscos [new file with mode: 0644]
README
algorithm.doc
deflate.c
deflate.h
gzio.c
infblock.c
infblock.h
infcodes.c
infcodes.h
inffast.c
inffast.h
inflate.c
inftrees.c
inftrees.h
infutil.c
infutil.h
minigzip.c
trees.c
zconf.h
zlib.def
zlib.h
zlib.rc
zutil.c
zutil.h

index ffbe1c4b70324a6284477b689d9a43e0de5d4903..218cfb0c5254afabfd223cea3db75b3f0b440542 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,25 @@
 
                ChangeLog file for zlib
 
+Changes in 1.0.4 (24 Jul 96)
+- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF
+  bit, so the decompressor could decompress all the correct data but went
+  on to attempt decompressing extra garbage data. This affected minigzip too.
+- zlibVersion and gzerror return const char* (needed for DLL)
+- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno)
+- use z_error only for DEBUG (avoid problem with DLLs)
+
+Changes in 1.0.3 (2 Jul 96)
+- use z_streamp instead of z_stream *, which is now a far pointer in MSDOS
+  small and medium models; this makes the library incompatible with previous
+  versions for these models. (No effect in large model or on other systems.)
+- return OK instead of BUF_ERROR if previous deflate call returned with
+  avail_out as zero but there is nothing to do
+- added memcmp for non STDC compilers
+- define NO_DUMMY_DECL for more Mac compilers (.h files merged incorrectly)
+- define __32BIT__ if __386__ or i386 is defined (pb. with Watcom and SCO)
+- better check for 16-bit mode MSC (avoids problem with Symantec)
+
 Changes in 1.0.2 (23 May 96)
 - added Windows DLL support
 - added a function zlibVersion (for the DLL support)
diff --git a/INDEX b/INDEX
index dc137531bb902cf6111b9d19715e2ffc06e6f5e1..bb1e3f0b135dd48b4743021091109bb9136b0414 100644 (file)
--- a/INDEX
+++ b/INDEX
@@ -7,6 +7,7 @@ Makefile.bor    makefile for Borland C/C++ 16-bit
 Makefile.dj2   makefile for DJGPP 2.x
 Makefile.in    makefile for Unix (template for configure)
 Makefile.msc   makefile for Microsoft C 16-bit
+Makefile.riscos makefile for RISCOS
 Makefile.sas   makefile for Amiga SAS/C
 Makefile.tc    makefile for Turbo C
 Makefile.wat   makefile for Watcom C
index f2ff262d910bc27af171aee6b264543e51c25e41..71b269b61ea1abb9586680e4391c6bf1d46bde8c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@ CFLAGS=-O
 LDFLAGS=-L. -lz
 LDSHARED=$(CC)
 
-VER=1.0.2
+VER=1.0.4
 LIBS=libz.a
 
 AR=ar rc
index 07a9bb16824e2ffab0f1f177c9ba145386f227c6..398f28bbee3630f3f3af1092e98b99379e4d3a10 100644 (file)
@@ -42,7 +42,6 @@ LDLIBS=-L. -lz
 LD=$(CC) -s -o
 LDSHARED=$(CC)
 
-VER=1.0.2
 INCL=zlib.h zconf.h
 LIBS=libz.a
 
@@ -68,10 +67,6 @@ test: all
 libz.a: $(OBJS)
        $(AR) $@ $(OBJS)
 
-libz.so.$(VER): $(OBJS)
-       $(LDSHARED) -o $@ $(OBJS)
-       $(RM) libz.so; ln -s $@ libz.so
-
 %.exe : %.o $(LIBS)
        $(LD) $@ $< $(LDLIBS)
 
@@ -90,7 +85,7 @@ uninstall:
        for %%p in ($(LIBS)) do $(RM) $(LIBRARY_PATH)\%%p
 
 clean:
-       for %%p in (*.d *.o *.exe libz.a libz.so*) do $(RM) %%p
+       for %%p in (*.d *.o *.exe libz.a libz.so* foo.gz) do $(RM) %%p
 
 DEPS := $(wildcard *.d)
 ifneq ($(DEPS),)
index f2ff262d910bc27af171aee6b264543e51c25e41..71b269b61ea1abb9586680e4391c6bf1d46bde8c 100644 (file)
@@ -22,7 +22,7 @@ CFLAGS=-O
 LDFLAGS=-L. -lz
 LDSHARED=$(CC)
 
-VER=1.0.2
+VER=1.0.4
 LIBS=libz.a
 
 AR=ar rc
index 3b7aabd5435e0bb05bd4e8794afcf3fe1373ad4f..112684af0f5f2fc1132400fdefa41f67dcda9d74 100644 (file)
@@ -28,6 +28,8 @@ OBJ2 = zutil$(O) inflate$(O) infblock$(O) inftrees$(O) infcodes$(O) \
 OBJP2 = zutil$(O)+inflate$(O)+infblock$(O)+inftrees$(O)+infcodes$(O)+\
   infutil$(O)+inffast$(O)
 
+all:  zlib.lib example.exe minigzip.exe
+
 adler32.obj: adler32.c zutil.h zlib.h zconf.h
        $(CC) -c $(CFLAGS) $*.c
 
@@ -80,7 +82,7 @@ minigzip.obj: minigzip.c zlib.h zconf.h
 
 # we must cut the command line to fit in the MS/DOS 128 byte limit:
 zlib.lib: $(OBJ1) $(OBJ2)
-        del zlib.lib
+       if exist zlib.lib del zlib.lib
        lib zlib $(OBJ1);
        lib zlib $(OBJ2);
 
diff --git a/Makefile.riscos b/Makefile.riscos
new file mode 100644 (file)
index 0000000..0f10aa8
--- /dev/null
@@ -0,0 +1,46 @@
+# Project:   zlib_1_03
+
+
+# Toolflags:
+CCflags = -c -depend !Depend -IC: -g -throwback  -DRISCOS  -fnah 
+C++flags = -c -depend !Depend -IC: -throwback
+Linkflags = -aif -c++ -o $@ 
+ObjAsmflags = -throwback -NoCache -depend !Depend
+CMHGflags = 
+LibFileflags = -c -l -o $@ 
+Squeezeflags = -o $@
+
+
+# Final targets:
+@.zlib_lib:   @.o.adler32 @.o.compress @.o.crc32 @.o.deflate @.o.gzio \
+        @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil @.o.trees \
+        @.o.uncompress @.o.zutil 
+        LibFile $(LibFileflags) @.o.adler32 @.o.compress @.o.crc32 @.o.deflate \
+        @.o.gzio @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil \
+        @.o.trees @.o.uncompress @.o.zutil 
+@.test:   @.tests.minigzip @.tests.example 
+        echo Please run "Test" in directory tests 
+@.tests.minigzip:   @.o.minigzip @.zlib_lib C:o.Stubs 
+        Link $(Linkflags) @.o.minigzip @.zlib_lib C:o.Stubs 
+@.tests.example:   @.o.example @.zlib_lib C:o.Stubs 
+        Link $(Linkflags) @.o.example @.zlib_lib C:o.Stubs 
+
+
+# User-editable dependencies:
+.c.o:
+        cc $(ccflags) -o $@ $<
+
+# Static dependencies:
+@.o.example:   @.tests.c.example
+        cc $(ccflags) -o @.o.example @.tests.c.example 
+@.o.minigzip:   @.tests.c.minigzip
+        cc $(ccflags) -o @.o.minigzip @.tests.c.minigzip 
+
+
+# Dynamic dependencies:
+o.minigzip:    tests.c.minigzip
+o.minigzip:    h.zlib
+o.minigzip:    h.zconf
+o.example:     tests.c.example
+o.example:     h.zlib
+o.example:     h.zconf
diff --git a/README b/README
index 217f3b16e5fc176a3bc4a9c4d6dec0f2244b29ef..28adc90b218b71c97a085def131df914fc31bcfa 100644 (file)
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-zlib 1.0.2 is a general purpose data compression library.  All the code
+zlib 1.0.4 is a general purpose data compression library.  All the code
 is reentrant (thread safe).  The data format used by the zlib library
 is described by RFCs (Request for Comments) 1950 to 1952 in the files 
 ftp://ds.internic.net/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate
@@ -18,21 +18,17 @@ makefiles such as Makefile.msc; for VMS, use Make_vms.com or descrip.mms.
 
 Questions about zlib should be sent to <zlib@quest.jpl.nasa.gov> or,
 if this fails, to the addresses given below in the Copyright section.
+The zlib home page is http://quest.jpl.nasa.gov/zlib/
+
+The changes made in version 1.0.4 are documented in the file ChangeLog.
+The main changes since 1.0.3 are:
+
+- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF
+  bit, so the decompressor could decompress all the correct data but went
+  on to attempt decompressing extra garbage data. This affected minigzip too.
+- zlibVersion and gzerror return const char* (needed for DLL)
+- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno)
 
-The changes made in version 1.0.2 are documented in the file ChangeLog.
-The main changes since 0.99 are:
-
-- fix array overlay in deflate.c which sometimes caused bad compressed data
-- fix inflate bug with empty stored block
-- fix MSDOS medium model which was broken in 0.99
-- fix deflateParams() which could generated bad compressed data.
-- added an INDEX file
-- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32),
-  Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas)
-- several portability improvements
-- added algorithm.doc
-- added Windows DLL support
-- added a function zlibVersion (for the DLL support)
 
 A Perl interface to zlib written by Paul Marquess <pmarquess@bfsec.bt.co.uk>
 is in the CPAN (Comprehensive Perl Archive Network) sites, such as:
@@ -46,7 +42,7 @@ Notes for some targets:
 
 - For 64-bit Iris, deflate.c must be compiled without any optimization.
   With -O, one libpng test fails. The test works in 32 bit mode (with
-  the -32 compiler flag).
+  the -32 compiler flag). The compiler bug has been reported to SGI.
 
 - zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1   
   it works when compiled with cc.
@@ -57,7 +53,10 @@ Notes for some targets:
 - To build a Windows DLL version, include in a DLL project zlib.def, zlib.rc
   and all .c files except example.c and minigzip.c; compile with -DZLIB_DLL
   For help on building a zlib DLL, contact Alessandro Iacopetti
-  <iaco@cicladi.unial.it>
+  <iaco@email.alessandria.alpcom.it>  http://lisa.unial.it/iaco ,
+  or contact Brad Clarke <bclarke@cyberus.ca>.
+
+- gzdopen is not supported on RISCOS
 
 
 Acknowledgments:
index 156058ae8c24d617d04a4a42ae955562ab4a0ab8..01902aff666343263e2aec8c59d10e1eacb31e02 100644 (file)
@@ -7,7 +7,7 @@ pointer to the previous string, in the form of a pair (distance,
 length).  Distances are limited to 32K bytes, and lengths are limited
 to 258 bytes. When a string does not occur anywhere in the previous
 32K bytes, it is emitted as a sequence of literal bytes.  (In this
-description, 'string' must be taken as an arbitrary sequence of bytes,
+description, `string' must be taken as an arbitrary sequence of bytes,
 and is not restricted to printable characters.)
 
 Literals or match lengths are compressed with one Huffman tree, and
@@ -16,7 +16,7 @@ in a compact form at the start of each block. The blocks can have any
 size (except that the compressed data for one block must fit in
 available memory). A block is terminated when deflate() determines that
 it would be useful to start another block with fresh trees. (This is
-somewhat similar to compress.)
+somewhat similar to the behavior of LZW-based _compress_.)
 
 Duplicated strings are found using a hash table. All input strings of
 length 3 are inserted in the hash table. A hash index is computed for
@@ -57,7 +57,7 @@ but saves time since there are both fewer insertions and fewer searches.
 
 2. Decompression algorithm (inflate)
 
-The real question is given a Huffman tree, how to decode fast.  The most
+The real question is, given a Huffman tree, how to decode fast.  The most
 important realization is that shorter codes are much more common than
 longer codes, so pay attention to decoding the short codes fast, and let
 the long codes take longer to decode.
@@ -84,7 +84,7 @@ all the data.  For inflate, which has 286 possible codes for the
 literal/length tree, the size of the first table is nine bits.  Also the
 distance trees have 30 possible values, and the size of the first table is
 six bits.  Note that for each of those cases, the table ended up one bit
-longer than the "average" code length, i.e. the code length of an
+longer than the ``average'' code length, i.e. the code length of an
 approximately flat code which would be a little more than eight bits for
 286 symbols and a little less than five bits for 30 symbols.  It would be
 interesting to see if optimizing the first level table for other
@@ -97,9 +97,9 @@ gzip@prep.ai.mit.edu    madler@alumni.caltech.edu
 
 References:
 
-[LZ77] Ziv J., Lempel A., "A Universal Algorithm for Sequential Data
-Compression", IEEE Transactions on Information Theory", Vol. 23, No. 3,
+[LZ77] Ziv J., Lempel A., ``A Universal Algorithm for Sequential Data
+Compression,'' IEEE Transactions on Information Theory, Vol. 23, No. 3,
 pp. 337-343.
 
-"DEFLATE Compressed Data Format Specification" available in
+``DEFLATE Compressed Data Format Specification'' available in
 ftp://ds.internic.net/rfc/rfc1951.txt
index f882a8795faacbbc9e80f65b87b1cd29b57c36ba..c6ba9b48cf135ef4435f852cbedcabfc2742fd9f 100644 (file)
--- a/deflate.c
+++ b/deflate.c
  *
  */
 
-/* $Id: deflate.c,v 1.13 1996/05/22 11:52:21 me Exp $ */
+/* $Id: deflate.c,v 1.15 1996/07/24 13:40:58 me Exp $ */
 
 #include "deflate.h"
 
-char deflate_copyright[] = " deflate 1.0.2 Copyright 1995-1996 Jean-loup Gailly ";
+char deflate_copyright[] = " deflate 1.0.4 Copyright 1995-1996 Jean-loup Gailly ";
 /*
   If you use the zlib library in a product, an acknowledgment is welcome
   in the documentation of your product. If for some reason you cannot
@@ -62,15 +62,25 @@ char deflate_copyright[] = " deflate 1.0.2 Copyright 1995-1996 Jean-loup Gailly
 /* ===========================================================================
  *  Function prototypes.
  */
+typedef enum {
+    need_more,      /* block not completed, need more input or more output */
+    block_done,     /* block flush performed */
+    finish_started, /* finish started, need only more output at next deflate */
+    finish_done     /* finish done, accept no more input or output */
+} block_state;
+
+typedef block_state (*compress_func) OF((deflate_state *s, int flush));
+/* Compression function. Returns the block state after the call. */
+
 local void fill_window    OF((deflate_state *s));
-local int  deflate_stored OF((deflate_state *s, int flush));
-local int  deflate_fast   OF((deflate_state *s, int flush));
-local int  deflate_slow   OF((deflate_state *s, int flush));
+local block_state deflate_stored OF((deflate_state *s, int flush));
+local block_state deflate_fast   OF((deflate_state *s, int flush));
+local block_state deflate_slow   OF((deflate_state *s, int flush));
 local void lm_init        OF((deflate_state *s));
 local uInt longest_match  OF((deflate_state *s, IPos cur_match));
 local void putShortMSB    OF((deflate_state *s, uInt b));
-local void flush_pending  OF((z_stream *strm));
-local int read_buf        OF((z_stream *strm, charf *buf, unsigned size));
+local void flush_pending  OF((z_streamstrm));
+local int read_buf        OF((z_streamstrm, charf *buf, unsigned size));
 #ifdef ASMV
       void match_init OF((void)); /* asm code initialization */
 #endif
@@ -97,9 +107,6 @@ local  void check_match OF((deflate_state *s, IPos start, IPos match,
  * See deflate.c for comments about the MIN_MATCH+1.
  */
 
-typedef int (*compress_func) OF((deflate_state *s, int flush));
-/* Compressing function */
-
 /* Values for max_lazy_match, good_match and max_chain_length, depending on
  * the desired pack level (0..9). The values given below have been tuned to
  * exclude worst case performance for pathological files. Better values may be
@@ -169,7 +176,7 @@ struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
 
 /* ========================================================================= */
 int deflateInit_(strm, level, version, stream_size)
-    z_stream *strm;
+    z_streamstrm;
     int level;
     const char *version;
     int stream_size;
@@ -182,7 +189,7 @@ int deflateInit_(strm, level, version, stream_size)
 /* ========================================================================= */
 int deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
                  version, stream_size)
-    z_stream *strm;
+    z_streamstrm;
     int  level;
     int  method;
     int  windowBits;
@@ -249,7 +256,7 @@ int deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
 
     if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
         s->pending_buf == Z_NULL) {
-        strm->msg = ERR_MSG(Z_MEM_ERROR);
+        strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);
         deflateEnd (strm);
         return Z_MEM_ERROR;
     }
@@ -265,7 +272,7 @@ int deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
 
 /* ========================================================================= */
 int deflateSetDictionary (strm, dictionary, dictLength)
-    z_stream *strm;
+    z_streamstrm;
     const Bytef *dictionary;
     uInt  dictLength;
 {
@@ -304,7 +311,7 @@ int deflateSetDictionary (strm, dictionary, dictLength)
 
 /* ========================================================================= */
 int deflateReset (strm)
-    z_stream *strm;
+    z_streamstrm;
 {
     deflate_state *s;
     
@@ -334,7 +341,7 @@ int deflateReset (strm)
 
 /* ========================================================================= */
 int deflateParams(strm, level, strategy)
-    z_stream *strm;
+    z_streamstrm;
     int level;
     int strategy;
 {
@@ -388,7 +395,7 @@ local void putShortMSB (s, b)
  * (See also read_buf()).
  */
 local void flush_pending(strm)
-    z_stream *strm;
+    z_streamstrm;
 {
     unsigned len = strm->state->pending;
 
@@ -408,14 +415,16 @@ local void flush_pending(strm)
 
 /* ========================================================================= */
 int deflate (strm, flush)
-    z_stream *strm;
+    z_streamstrm;
     int flush;
 {
     int old_flush; /* value of flush param for previous deflate call */
     deflate_state *s;
 
-    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
-    
+    if (strm == Z_NULL || strm->state == Z_NULL ||
+       flush > Z_FINISH || flush < 0) {
+        return Z_STREAM_ERROR;
+    }
     s = strm->state;
 
     if (strm->next_out == Z_NULL ||
@@ -447,14 +456,23 @@ int deflate (strm, flush)
        if (s->strstart != 0) {
            putShortMSB(s, (uInt)(strm->adler >> 16));
            putShortMSB(s, (uInt)(strm->adler & 0xffff));
-           strm->adler = 1L;
        }
+       strm->adler = 1L;
     }
 
     /* Flush as much pending output as possible */
     if (s->pending != 0) {
         flush_pending(strm);
-        if (strm->avail_out == 0) return Z_OK;
+        if (strm->avail_out == 0) {
+           /* Since avail_out is 0, deflate will be called again with
+            * more output space, but possibly with both pending and
+            * avail_in equal to zero. There won't be anything to do,
+            * but this is not an error situation so make sure we
+            * return OK instead of BUF_ERROR at next call of deflate:
+             */
+           s->last_flush = -1;
+           return Z_OK;
+       }
 
     /* Make sure there is something to do and avoid duplicate consecutive
      * flushes. For repeated and useless calls with Z_FINISH, we keep
@@ -474,22 +492,27 @@ int deflate (strm, flush)
      */
     if (strm->avail_in != 0 || s->lookahead != 0 ||
         (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
-        int quit;
+        block_state bstate;
 
-        if (flush == Z_FINISH) {
+       bstate = (*(configuration_table[s->level].func))(s, flush);
+
+        if (bstate == finish_started || bstate == finish_done) {
             s->status = FINISH_STATE;
         }
-       quit = (*(configuration_table[s->level].func))(s, flush);
-
-        if (quit || strm->avail_out == 0) return Z_OK;
-        /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
-         * of deflate should use the same flush parameter to make sure
-         * that the flush is complete. So we don't have to output an
-         * empty block here, this will be done at next call. This also
-         * ensures that for a very small output buffer, we emit at most
-         * one empty block.
-         */
-        if (flush != Z_NO_FLUSH && flush != Z_FINISH) {
+        if (bstate == need_more || bstate == finish_started) {
+           if (strm->avail_out == 0) {
+               s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
+           }
+           return Z_OK;
+           /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
+            * of deflate should use the same flush parameter to make sure
+            * that the flush is complete. So we don't have to output an
+            * empty block here, this will be done at next call. This also
+            * ensures that for a very small output buffer, we emit at most
+            * one empty block.
+            */
+       }
+        if (bstate == block_done) {
             if (flush == Z_PARTIAL_FLUSH) {
                 _tr_align(s);
             } else { /* FULL_FLUSH or SYNC_FLUSH */
@@ -502,7 +525,10 @@ int deflate (strm, flush)
                 }
             }
             flush_pending(strm);
-            if (strm->avail_out == 0) return Z_OK;
+           if (strm->avail_out == 0) {
+             s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
+             return Z_OK;
+           }
         }
     }
     Assert(strm->avail_out > 0, "bug2");
@@ -523,7 +549,7 @@ int deflate (strm, flush)
 
 /* ========================================================================= */
 int deflateEnd (strm)
-    z_stream *strm;
+    z_streamstrm;
 {
     int status;
 
@@ -544,8 +570,8 @@ int deflateEnd (strm)
 
 /* ========================================================================= */
 int deflateCopy (dest, source)
-    z_stream *dest;
-    z_stream *source;
+    z_streamdest;
+    z_streamsource;
 {
     if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
         return Z_STREAM_ERROR;
@@ -570,7 +596,7 @@ int deflateCopy (dest, source)
  * (See also flush_pending()).
  */
 local int read_buf(strm, buf, size)
-    z_stream *strm;
+    z_streamstrm;
     charf *buf;
     unsigned size;
 {
@@ -916,18 +942,18 @@ local void fill_window(s)
 /* Same but force premature exit if necessary. */
 #define FLUSH_BLOCK(s, eof) { \
    FLUSH_BLOCK_ONLY(s, eof); \
-   if (s->strm->avail_out == 0) return 1; \
+   if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \
 }
 
 /* ===========================================================================
  * Copy without compression as much as possible from the input stream, return
- * true if processing was terminated prematurely (no more input or output
- * space).  This function does not insert new strings in the dictionary
- * since uncompressible data is probably not useful. This function is used
+ * the current block state.
+ * This function does not insert new strings in the dictionary since
+ * uncompressible data is probably not useful. This function is used
  * only for the level=0 compression option.
  * NOTE: this function should be optimized to avoid extra copying.
  */
-local int deflate_stored(s, flush)
+local block_state deflate_stored(s, flush)
     deflate_state *s;
     int flush;
 {
@@ -939,7 +965,7 @@ local int deflate_stored(s, flush)
                   s->block_start >= (long)s->w_size, "slide too late");
 
             fill_window(s);
-            if (s->lookahead == 0 && flush == Z_NO_FLUSH) return 1;
+            if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more;
 
             if (s->lookahead == 0) break; /* flush the current block */
         }
@@ -961,17 +987,17 @@ local int deflate_stored(s, flush)
        }
     }
     FLUSH_BLOCK(s, flush == Z_FINISH);
-    return 0; /* normal exit */
+    return flush == Z_FINISH ? finish_done : block_done;
 }
 
 /* ===========================================================================
- * Compress as much as possible from the input stream, return true if
- * processing was terminated prematurely (no more input or output space).
+ * Compress as much as possible from the input stream, return the current
+ * block state.
  * This function does not perform lazy evaluation of matches and inserts
  * new strings in the dictionary only for unmatched strings or for short
  * matches. It is used only for the fast compression options.
  */
-local int deflate_fast(s, flush)
+local block_state deflate_fast(s, flush)
     deflate_state *s;
     int flush;
 {
@@ -986,8 +1012,9 @@ local int deflate_fast(s, flush)
          */
         if (s->lookahead < MIN_LOOKAHEAD) {
             fill_window(s);
-            if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) return 1;
-
+            if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
+               return need_more;
+           }
             if (s->lookahead == 0) break; /* flush the current block */
         }
 
@@ -1055,7 +1082,7 @@ local int deflate_fast(s, flush)
         if (bflush) FLUSH_BLOCK(s, 0);
     }
     FLUSH_BLOCK(s, flush == Z_FINISH);
-    return 0; /* normal exit */
+    return flush == Z_FINISH ? finish_done : block_done;
 }
 
 /* ===========================================================================
@@ -1063,7 +1090,7 @@ local int deflate_fast(s, flush)
  * evaluation for matches: a match is finally adopted only if there is
  * no better match at the next window position.
  */
-local int deflate_slow(s, flush)
+local block_state deflate_slow(s, flush)
     deflate_state *s;
     int flush;
 {
@@ -1079,8 +1106,9 @@ local int deflate_slow(s, flush)
          */
         if (s->lookahead < MIN_LOOKAHEAD) {
             fill_window(s);
-            if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) return 1;
-
+            if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
+               return need_more;
+           }
             if (s->lookahead == 0) break; /* flush the current block */
         }
 
@@ -1158,7 +1186,7 @@ local int deflate_slow(s, flush)
             }
             s->strstart++;
             s->lookahead--;
-            if (s->strm->avail_out == 0) return 1;
+            if (s->strm->avail_out == 0) return need_more;
         } else {
             /* There is no previous match to compare with, wait for
              * the next step to decide.
@@ -1175,6 +1203,5 @@ local int deflate_slow(s, flush)
         s->match_available = 0;
     }
     FLUSH_BLOCK(s, flush == Z_FINISH);
-    return 0;
+    return flush == Z_FINISH ? finish_done : block_done;
 }
-
index 95ca0c23fd21b2c77f2057cca9e3019f9c13308b..a7daf7fce1a883b0b0a10b0d37652e121ca53cd3 100644 (file)
--- a/deflate.h
+++ b/deflate.h
@@ -8,7 +8,7 @@
    subject to change. Applications should only use zlib.h.
  */
 
-/* $Id: deflate.h,v 1.9 1996/01/30 21:59:13 me Exp $ */
+/* $Id: deflate.h,v 1.10 1996/07/02 12:41:00 me Exp $ */
 
 #ifndef _DEFLATE_H
 #define _DEFLATE_H
@@ -80,7 +80,7 @@ typedef unsigned IPos;
  */
 
 typedef struct internal_state {
-    z_stream *strm;      /* pointer back to this zlib stream */
+    z_streamstrm;      /* pointer back to this zlib stream */
     int   status;        /* as the name implies */
     Bytef *pending_buf;  /* output still pending */
     Bytef *pending_out;  /* next pending byte to output to the stream */
diff --git a/gzio.c b/gzio.c
index 44ca9e8993aa1a3f09b50366f443812c031a13dc..6c82677aa6f7f71e459999d742898df9f81121fa 100644 (file)
--- a/gzio.c
+++ b/gzio.c
@@ -3,7 +3,7 @@
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
-/* $Id: gzio.c,v 1.13 1996/05/22 11:52:24 me Exp $ */
+/* $Id: gzio.c,v 1.14 1996/07/24 13:41:01 me Exp $ */
 
 #include <stdio.h>
 
@@ -496,7 +496,7 @@ int gzclose (file)
    errnum is set to Z_ERRNO and the application may consult errno
    to get the exact error code.
 */
-char*  gzerror (file, errnum)
+const char*  gzerror (file, errnum)
     gzFile file;
     int *errnum;
 {
@@ -505,19 +505,19 @@ char*  gzerror (file, errnum)
 
     if (s == NULL) {
         *errnum = Z_STREAM_ERROR;
-        return ERR_MSG(Z_STREAM_ERROR);
+        return (const char*)ERR_MSG(Z_STREAM_ERROR);
     }
     *errnum = s->z_err;
-    if (*errnum == Z_OK) return (char*)"";
+    if (*errnum == Z_OK) return (const char*)"";
 
     m =  (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg);
 
-    if (m == NULL || *m == '\0') m = ERR_MSG(s->z_err);
+    if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err);
 
     TRYFREE(s->msg);
     s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3);
     strcpy(s->msg, s->path);
     strcat(s->msg, ": ");
     strcat(s->msg, m);
-    return s->msg;
+    return (const char*)s->msg;
 }
index 733e983aba175d70c4a646aae09ebc38797e680a..cc2e6745a780ce5487f12198656ba7aec1be6364 100644 (file)
@@ -63,7 +63,7 @@ local uInt border[] = { /* Order of the bit length code lengths */
 
 void inflate_blocks_reset(s, z, c)
 inflate_blocks_statef *s;
-z_stream *z;
+z_streamz;
 uLongf *c;
 {
   if (s->checkfn != Z_NULL)
@@ -87,7 +87,7 @@ uLongf *c;
 
 
 inflate_blocks_statef *inflate_blocks_new(z, c, w)
-z_stream *z;
+z_streamz;
 check_func c;
 uInt w;
 {
@@ -115,7 +115,7 @@ uInt w;
 #endif
 int inflate_blocks(s, z, r)
 inflate_blocks_statef *s;
-z_stream *z;
+z_streamz;
 int r;
 {
   uInt t;               /* temporary storage */
@@ -381,7 +381,7 @@ int r;
 
 int inflate_blocks_free(s, z, c)
 inflate_blocks_statef *s;
-z_stream *z;
+z_streamz;
 uLongf *c;
 {
   inflate_blocks_reset(s, z, c);
index ee2c063f42dcb6f0341323ac65687b152a4c2321..3ecd50cd3a6218774dd764f4377d84c476a5b67d 100644 (file)
@@ -12,23 +12,23 @@ struct inflate_blocks_state;
 typedef struct inflate_blocks_state FAR inflate_blocks_statef;
 
 extern inflate_blocks_statef * inflate_blocks_new OF((
-    z_stream *z,
+    z_streamz,
     check_func c,               /* check function */
     uInt w));                   /* window size */
 
 extern int inflate_blocks OF((
     inflate_blocks_statef *,
-    z_stream *,
+    z_stream,
     int));                      /* initial return code */
 
 extern void inflate_blocks_reset OF((
     inflate_blocks_statef *,
-    z_stream *,
+    z_stream,
     uLongf *));                  /* check value on output */
 
 extern int inflate_blocks_free OF((
     inflate_blocks_statef *,
-    z_stream *,
+    z_stream,
     uLongf *));                  /* check value on output */
 
 extern void inflate_set_dictionary OF((
index 6314e8009f4da75f15a4c7a7ec28615c8752cea6..3ae3818a194ac576bc37ce87d260183972b7872e 100644 (file)
@@ -60,7 +60,7 @@ inflate_codes_statef *inflate_codes_new(bl, bd, tl, td, z)
 uInt bl, bd;
 inflate_huft *tl;
 inflate_huft *td; /* need separate declaration for Borland C++ */
-z_stream *z;
+z_streamz;
 {
   inflate_codes_statef *c;
 
@@ -80,7 +80,7 @@ z_stream *z;
 
 int inflate_codes(s, z, r)
 inflate_blocks_statef *s;
-z_stream *z;
+z_streamz;
 int r;
 {
   uInt j;               /* temporary storage */
@@ -240,7 +240,7 @@ int r;
 
 void inflate_codes_free(c, z)
 inflate_codes_statef *c;
-z_stream *z;
+z_streamz;
 {
   ZFREE(z, c);
   Tracev((stderr, "inflate:       codes free\n"));
index 8671efabafc43f6e723492f535c303a5086e04a6..c2c38df2c060488453ca71ea0a0059949ed2ba28 100644 (file)
@@ -14,14 +14,14 @@ typedef struct inflate_codes_state FAR inflate_codes_statef;
 extern inflate_codes_statef *inflate_codes_new OF((
     uInt, uInt,
     inflate_huft *, inflate_huft *,
-    z_stream *));
+    z_stream));
 
 extern int inflate_codes OF((
     inflate_blocks_statef *,
-    z_stream *,
+    z_stream,
     int));
 
 extern void inflate_codes_free OF((
     inflate_codes_statef *,
-    z_stream *));
+    z_stream));
 
index 209c0ee6384ba0627c07aedc67cb21fd15b911bc..86eee4a2992caf3268fa9025d115190db3371855 100644 (file)
--- a/inffast.c
+++ b/inffast.c
@@ -32,7 +32,7 @@ uInt bl, bd;
 inflate_huft *tl;
 inflate_huft *td; /* need separate declaration for Borland C++ */
 inflate_blocks_statef *s;
-z_stream *z;
+z_streamz;
 {
   inflate_huft *t;      /* temporary pointer */
   uInt e;               /* extra bits or operation */
index 843051ff36d1d3cacc4331586dbd514dafad16eb..8cc644efb1f31627be84c57440f0c085280204f2 100644 (file)
--- a/inffast.h
+++ b/inffast.h
@@ -14,4 +14,4 @@ extern int inflate_fast OF((
     inflate_huft *,
     inflate_huft *,
     inflate_blocks_statef *,
-    z_stream *));
+    z_stream));
index 4eed100c51c8300140f2b17a61270f0744909f70..74cc69c868472b42d38b3dca61121531ded3b262 100644 (file)
--- a/inflate.c
+++ b/inflate.c
@@ -49,7 +49,7 @@ struct internal_state {
 
 
 int inflateReset(z)
-z_stream *z;
+z_streamz;
 {
   uLong c;
 
@@ -65,7 +65,7 @@ z_stream *z;
 
 
 int inflateEnd(z)
-z_stream *z;
+z_streamz;
 {
   uLong c;
 
@@ -81,7 +81,7 @@ z_stream *z;
 
 
 int inflateInit2_(z, w, version, stream_size)
-z_stream *z;
+z_streamz;
 int w;
 const char *version;
 int stream_size;
@@ -138,7 +138,7 @@ int stream_size;
 
 
 int inflateInit_(z, version, stream_size)
-z_stream *z;
+z_streamz;
 const char *version;
 int stream_size;
 {
@@ -150,7 +150,7 @@ int stream_size;
 #define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++)
 
 int inflate(z, f)
-z_stream *z;
+z_streamz;
 int f;
 {
   int r;
@@ -272,7 +272,7 @@ int f;
 
 
 int inflateSetDictionary(z, dictionary, dictLength)
-z_stream *z;
+z_streamz;
 const Bytef *dictionary;
 uInt  dictLength;
 {
@@ -280,6 +280,7 @@ uInt  dictLength;
 
   if (z == Z_NULL || z->state == Z_NULL || z->state->mode != DICT0)
     return Z_STREAM_ERROR;
+
   if (adler32(1L, dictionary, dictLength) != z->adler) return Z_DATA_ERROR;
   z->adler = 1L;
 
@@ -295,7 +296,7 @@ uInt  dictLength;
 
 
 int inflateSync(z)
-z_stream *z;
+z_streamz;
 {
   uInt n;       /* number of bytes to look at */
   Bytef *p;     /* pointer to bytes */
index ebeac0d0b78ecbdcf25de5478987d648f752c846..90205bd1e57c0f51674a3ef082ecc69adf685cf1 100644 (file)
@@ -6,7 +6,7 @@
 #include "zutil.h"
 #include "inftrees.h"
 
-char inflate_copyright[] = " inflate 1.0.2 Copyright 1995-1996 Mark Adler ";
+char inflate_copyright[] = " inflate 1.0.4 Copyright 1995-1996 Mark Adler ";
 /*
   If you use the zlib library in a product, an acknowledgment is welcome
   in the documentation of your product. If for some reason you cannot
@@ -30,7 +30,7 @@ local int huft_build OF((
     uIntf *,            /* list of extra bits for non-simple codes */
     inflate_huft * FAR*,/* result: starting table */
     uIntf *,            /* maximum lookup bits (returns actual) */
-    z_stream *));       /* for zalloc function */
+    z_stream));       /* for zalloc function */
 
 local voidpf falloc OF((
     voidpf,             /* opaque pointer (not used) */
@@ -103,7 +103,7 @@ uIntf *d;               /* list of base values for non-simple codes */
 uIntf *e;               /* list of extra bits for non-simple codes */  
 inflate_huft * FAR *t;  /* result: starting table */
 uIntf *m;               /* maximum lookup bits, returns actual */
-z_stream *zs;           /* for zalloc function */
+z_streamzs;           /* for zalloc function */
 /* Given a list of code lengths and a maximum table size, make a set of
    tables to decode that set of codes.  Return Z_OK on success, Z_BUF_ERROR
    if the given code set is incomplete (the tables are still built in this
@@ -302,7 +302,7 @@ int inflate_trees_bits(c, bb, tb, z)
 uIntf *c;               /* 19 code lengths */
 uIntf *bb;              /* bits tree desired/actual depth */
 inflate_huft * FAR *tb; /* bits tree result */
-z_stream *z;            /* for zfree function */
+z_streamz;            /* for zfree function */
 {
   int r;
 
@@ -327,7 +327,7 @@ uIntf *bl;              /* literal desired/actual bit depth */
 uIntf *bd;              /* distance desired/actual bit depth */
 inflate_huft * FAR *tl; /* literal/length tree result */
 inflate_huft * FAR *td; /* distance tree result */
-z_stream *z;            /* for zfree function */
+z_streamz;            /* for zfree function */
 {
   int r;
 
@@ -442,7 +442,7 @@ inflate_huft * FAR *td;  /* distance tree result */
 
 int inflate_trees_free(t, z)
 inflate_huft *t;        /* table to free */
-z_stream *z;            /* for zfree function */
+z_streamz;            /* for zfree function */
 /* Free the malloc'ed tables built by huft_build(), which makes a linked
    list of the tables it made, with the links in a dummy first entry of
    each table. */
index 0f0ca2ba2aee1a8d31a4f0d21632f98ea7f5f7c6..b06613ddd3f6620869a550f672ba18e020460884 100644 (file)
@@ -35,7 +35,7 @@ extern int inflate_trees_bits OF((
     uIntf *,                    /* 19 code lengths */
     uIntf *,                    /* bits tree desired/actual depth */
     inflate_huft * FAR *,       /* bits tree result */
-    z_stream *));               /* for zalloc, zfree functions */
+    z_stream));               /* for zalloc, zfree functions */
 
 extern int inflate_trees_dynamic OF((
     uInt,                       /* number of literal/length codes */
@@ -45,7 +45,7 @@ extern int inflate_trees_dynamic OF((
     uIntf *,                    /* distance desired/actual bit depth */
     inflate_huft * FAR *,       /* literal/length tree result */
     inflate_huft * FAR *,       /* distance tree result */
-    z_stream *));               /* for zalloc, zfree functions */
+    z_stream));               /* for zalloc, zfree functions */
 
 extern int inflate_trees_fixed OF((
     uIntf *,                    /* literal desired/actual bit depth */
@@ -55,5 +55,5 @@ extern int inflate_trees_fixed OF((
 
 extern int inflate_trees_free OF((
     inflate_huft *,             /* tables to free */
-    z_stream *));               /* for zfree function */
+    z_stream));               /* for zfree function */
 
index b56f8cd86b5d80e8da57b9aa02b9b91f465dc015..eb21199c3509da1b5feb4bfa1f7048f491109a45 100644 (file)
--- a/infutil.c
+++ b/infutil.c
@@ -22,7 +22,7 @@ uInt inflate_mask[17] = {
 /* copy as much as possible from the sliding window to the output area */
 int inflate_flush(s, z, r)
 inflate_blocks_statef *s;
-z_stream *z;
+z_streamz;
 int r;
 {
   uInt n;
index ff7ac15978f916dbe21be60ff8d4b62b4230e79c..702cd290c37e8ba0329a8ae1e34f0be3dfa1ac85 100644 (file)
--- a/infutil.h
+++ b/infutil.h
@@ -91,7 +91,7 @@ extern uInt inflate_mask[17];
 /* copy as much as possible from the sliding window to the output area */
 extern int inflate_flush OF((
     inflate_blocks_statef *,
-    z_stream *,
+    z_stream,
     int));
 
 struct internal_state      {int dummy;}; /* for buggy compilers */
index bd0735b87527bc9d0c0cc26c862c3f861bcff7ba..fcee6a2bf41c0c83faf6da7b70d554aad42b04a1 100644 (file)
@@ -13,7 +13,7 @@
  * or in pipe mode.
  */
 
-/* $Id: minigzip.c,v 1.9 1996/05/22 11:52:32 me Exp $ */
+/* $Id: minigzip.c,v 1.10 1996/07/24 13:41:04 me Exp $ */
 
 #include <stdio.h>
 #include "zlib.h"
 #ifdef VMS
 #  define unlink delete
 #  define GZ_SUFFIX "-gz"
-#else
+#endif
+#ifdef RISCOS
+#  define unlink remove
+#  define GZ_SUFFIX "-gz"
+#  define fileno(file) file->__file
+#endif
+
+#ifndef GZ_SUFFIX
 #  define GZ_SUFFIX ".gz"
 #endif
 #define SUFFIX_LEN sizeof(GZ_SUFFIX)
diff --git a/trees.c b/trees.c
index f943d063e5207315f07e41e31b7dc39dd408e7fa..4c4d6f28915a1a6f6210a5d20db8bad9bc140ade 100644 (file)
--- a/trees.c
+++ b/trees.c
@@ -29,7 +29,7 @@
  *          Addison-Wesley, 1983. ISBN 0-201-06672-6.
  */
 
-/* $Id: trees.c,v 1.10 1996/05/22 11:52:34 me Exp $ */
+/* $Id: trees.c,v 1.11 1996/07/24 13:41:06 me Exp $ */
 
 #include "deflate.h"
 
@@ -154,7 +154,7 @@ local void copy_block     OF((deflate_state *s, charf *buf, unsigned len,
 
 #else /* DEBUG */
 #  define send_code(s, c, tree) \
-     { if (verbose>1) fprintf(stderr,"\ncd %3d ",(c)); \
+     { if (verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
        send_bits(s, tree[c].Code, tree[c].Len); }
 #endif
 
diff --git a/zconf.h b/zconf.h
index 69aa21b47d957c8c29a37ab6ae9b23408100ad15..5f6e887b71594f3884f9cd80f016e91e747007d3 100644 (file)
--- a/zconf.h
+++ b/zconf.h
@@ -3,7 +3,7 @@
  * For conditions of distribution and use, see copyright notice in zlib.h 
  */
 
-/* $Id: zconf.h,v 1.18 1996/05/23 16:51:18 me Exp $ */
+/* $Id: zconf.h,v 1.20 1996/07/02 15:09:28 me Exp $ */
 
 #ifndef _ZCONF_H
 #define _ZCONF_H
 #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
 #  define WIN32
 #endif
-#if (defined(__GNUC__) || defined(WIN32)) && !defined(__32BIT__)
-#  define __32BIT__
+#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)
+#  ifndef __32BIT__
+#    define __32BIT__
+#  endif
 #endif
 #if defined(__MSDOS__) && !defined(MSDOS)
 #  define MSDOS
@@ -80,9 +82,9 @@
 #  endif
 #endif
 
-#ifdef __MWERKS__ /* Metrowerks CodeWarrior declares fileno() in unix.h */
-#  include <unix.h>
-#  define NO_DUMMY_DECL /* buggy compiler merges all .h files incorrectly */
+/* Some Mac compilers merge all .h files incorrectly: */
+#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__)
+#  define NO_DUMMY_DECL
 #endif
 
 /* Maximum value for memLevel in deflateInit2 */
 #ifndef FAR
 #   define FAR
 #endif
-/* The Watcom compiler defines M_I86SM and __SMALL__ even in 32 bit mode */
-#if defined(__WATCOMC__) && defined(__386__) && defined(SMALL_MEDIUM)
-#  undef FAR
-#  define FAR
-#  undef SMALL_MEDIUM
-#endif
 
 typedef unsigned char  Byte;  /* 8 bits */
 typedef unsigned int   uInt;  /* 16 bits or more */
index 0f5049f24b98bc3d9b8e527102a9b15734676f5d..08c6d5501a4f5ca3814582d5efe38047811dbac5 100644 (file)
--- a/zlib.def
+++ b/zlib.def
@@ -8,7 +8,7 @@ SUBSYSTEM       WINDOWS
 
 STUB           'WINSTUB.EXE'
 
-VERSION                1.0.2
+VERSION                1.04
 
 CODE            EXECUTE READ
 
diff --git a/zlib.h b/zlib.h
index 1e614912a4996551e6ed3826dbb02814feeca46c..337fe9fe8a39323defc3646bd933f515cc0bd699 100644 (file)
--- a/zlib.h
+++ b/zlib.h
@@ -1,5 +1,5 @@
 /* zlib.h -- interface of the 'zlib' general purpose compression library
-  version 1.0.2, May 23rd, 1996.
+  version 1.0.4, Jul 24th, 1996.
 
   Copyright (C) 1995-1996 Jean-loup Gailly and Mark Adler
 
@@ -37,7 +37,7 @@ extern "C" {
 
 #include "zconf.h"
 
-#define ZLIB_VERSION "1.0.2"
+#define ZLIB_VERSION "1.0.4"
 
 /* 
      The 'zlib' compression library provides in-memory compression and
@@ -89,6 +89,8 @@ typedef struct z_stream_s {
     uLong   reserved;   /* reserved for future use */
 } z_stream;
 
+typedef z_stream FAR *z_streamp;
+
 /*
    The application must update next_in and avail_in when avail_in has
    dropped to zero. It must update next_out and avail_out when avail_out
@@ -166,7 +168,7 @@ typedef struct z_stream_s {
 
                         /* basic functions */
 
-extern char EXPORT *zlibVersion OF((void));
+extern const char * EXPORT zlibVersion OF((void));
 /* The application can compare zlibVersion and ZLIB_VERSION for consistency.
    If the first character differs, the library code actually used is
    not compatible with the zlib.h header file used by the application.
@@ -174,7 +176,7 @@ extern char EXPORT *zlibVersion OF((void));
  */
 
 /* 
-extern int EXPORT deflateInit OF((z_stream *strm, int level));
+extern int EXPORT deflateInit OF((z_streamstrm, int level));
 
      Initializes the internal stream state for compression. The fields
    zalloc, zfree and opaque must be initialized before by the caller.
@@ -196,7 +198,7 @@ extern int EXPORT deflateInit OF((z_stream *strm, int level));
 */
 
 
-extern int EXPORT deflate OF((z_stream *strm, int flush));
+extern int EXPORT deflate OF((z_streamstrm, int flush));
 /*
   Performs one or both of the following actions:
 
@@ -239,8 +241,8 @@ extern int EXPORT deflate OF((z_stream *strm, int flush));
   parameter and more output space (updated avail_out), until the flush is
   complete (deflate returns with non-zero avail_out).
 
-    If the parameter flush is set to Z_FINISH, all pending input is processed,
-  all pending output is flushed and deflate returns with Z_STREAM_END if there
+    If the parameter flush is set to Z_FINISH, pending input is processed,
+  pending output is flushed and deflate returns with Z_STREAM_END if there
   was enough output space; if deflate returns with Z_OK, this function must be
   called again with Z_FINISH and more output space (updated avail_out) but no
   more input data, until it returns with Z_STREAM_END or an error. After
@@ -265,7 +267,7 @@ extern int EXPORT deflate OF((z_stream *strm, int flush));
 */
 
 
-extern int EXPORT deflateEnd OF((z_stream *strm));
+extern int EXPORT deflateEnd OF((z_streamstrm));
 /*
      All dynamically allocated data structures for this stream are freed.
    This function discards any unprocessed input and does not flush any
@@ -280,7 +282,7 @@ extern int EXPORT deflateEnd OF((z_stream *strm));
 
 
 /* 
-extern int EXPORT inflateInit OF((z_stream *strm));
+extern int EXPORT inflateInit OF((z_streamstrm));
 
      Initializes the internal stream state for decompression. The fields
    zalloc, zfree and opaque must be initialized before by the caller.  If
@@ -295,7 +297,7 @@ extern int EXPORT inflateInit OF((z_stream *strm));
 */
 
 
-extern int EXPORT inflate OF((z_stream *strm, int flush));
+extern int EXPORT inflate OF((z_streamstrm, int flush));
 /*
   Performs one or both of the following actions:
 
@@ -350,7 +352,7 @@ extern int EXPORT inflate OF((z_stream *strm, int flush));
 */
 
 
-extern int EXPORT inflateEnd OF((z_stream *strm));
+extern int EXPORT inflateEnd OF((z_streamstrm));
 /*
      All dynamically allocated data structures for this stream are freed.
    This function discards any unprocessed input and does not flush any
@@ -368,7 +370,7 @@ extern int EXPORT inflateEnd OF((z_stream *strm));
 */
 
 /*   
-extern int EXPORT deflateInit2 OF((z_stream *strm,
+extern int EXPORT deflateInit2 OF((z_streamstrm,
                                    int  level,
                                    int  method,
                                    int  windowBits,
@@ -426,7 +428,7 @@ extern int EXPORT deflateInit2 OF((z_stream *strm,
    deflate(). 
 */
                             
-extern int EXPORT deflateSetDictionary OF((z_stream *strm,
+extern int EXPORT deflateSetDictionary OF((z_streamstrm,
                                            const Bytef *dictionary,
                                           uInt  dictLength));
 /*
@@ -455,8 +457,8 @@ extern int EXPORT deflateSetDictionary OF((z_stream *strm,
    be done by deflate(). 
 */
 
-extern int EXPORT deflateCopy OF((z_stream *dest,
-                                  z_stream *source));
+extern int EXPORT deflateCopy OF((z_streamdest,
+                                  z_streamsource));
 /*
      Sets the destination stream as a complete copy of the source stream.  If
    the source stream is using an application-supplied history buffer, a new
@@ -478,7 +480,7 @@ extern int EXPORT deflateCopy OF((z_stream *dest,
    destination.
 */
 
-extern int EXPORT deflateReset OF((z_stream *strm));
+extern int EXPORT deflateReset OF((z_streamstrm));
 /*
      This function is equivalent to deflateEnd followed by deflateInit,
    but does not free and reallocate all the internal compression state.
@@ -489,7 +491,7 @@ extern int EXPORT deflateReset OF((z_stream *strm));
    stream state was inconsistent (such as zalloc or state being NULL).
 */
 
-extern int EXPORT deflateParams OF((z_stream *strm, int level, int strategy));
+extern int EXPORT deflateParams OF((z_streamstrm, int level, int strategy));
 /*
      Dynamically update the compression level and compression strategy.
    This can be used to switch between compression and straight copy of
@@ -508,7 +510,7 @@ extern int EXPORT deflateParams OF((z_stream *strm, int level, int strategy));
 */
 
 /*   
-extern int EXPORT inflateInit2 OF((z_stream *strm,
+extern int EXPORT inflateInit2 OF((z_streamstrm,
                                    int  windowBits));
 
      This is another version of inflateInit with more compression options. The
@@ -542,7 +544,7 @@ extern int EXPORT inflateInit2 OF((z_stream *strm,
    inflate().
 */
 
-extern int EXPORT inflateSetDictionary OF((z_stream *strm,
+extern int EXPORT inflateSetDictionary OF((z_streamstrm,
                                           const Bytef *dictionary,
                                           uInt  dictLength));
 /*
@@ -561,7 +563,7 @@ extern int EXPORT inflateSetDictionary OF((z_stream *strm,
    inflate().
 */
 
-extern int EXPORT inflateSync OF((z_stream *strm));
+extern int EXPORT inflateSync OF((z_streamstrm));
 /* 
     Skips invalid compressed data until the special marker (see deflate()
   above) can be found, or until all available input is skipped. No output
@@ -576,7 +578,7 @@ extern int EXPORT inflateSync OF((z_stream *strm));
   until success or end of the input data.
 */
 
-extern int EXPORT inflateReset OF((z_stream *strm));
+extern int EXPORT inflateReset OF((z_streamstrm));
 /*
      This function is equivalent to inflateEnd followed by inflateInit,
    but does not free and reallocate all the internal decompression state.
@@ -690,7 +692,7 @@ extern int EXPORT    gzclose OF((gzFile file));
    error number (see function gzerror below).
 */
 
-extern char EXPORT  *gzerror OF((gzFile file, int *errnum));
+extern const char * EXPORT gzerror OF((gzFile file, int *errnum));
 /*
      Returns the error message for the last error which occurred on the
    given compressed file. errnum is set to zlib error number. If an
@@ -746,14 +748,14 @@ extern uLong EXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));
 /* deflateInit and inflateInit are macros to allow checking the zlib version
  * and the compiler's view of z_stream:
  */
-extern int EXPORT deflateInit_ OF((z_stream *strm, int level,
+extern int EXPORT deflateInit_ OF((z_streamstrm, int level,
                                   const char *version, int stream_size));
-extern int EXPORT inflateInit_ OF((z_stream *strm,
+extern int EXPORT inflateInit_ OF((z_streamstrm,
                                   const char *version, int stream_size));
-extern int EXPORT deflateInit2_ OF((z_stream *strm, int  level, int  method,
+extern int EXPORT deflateInit2_ OF((z_streamstrm, int  level, int  method,
                                    int windowBits, int memLevel, int strategy,
                                    const char *version, int stream_size));
-extern int EXPORT inflateInit2_ OF((z_stream *strm, int  windowBits,
+extern int EXPORT inflateInit2_ OF((z_streamstrm, int  windowBits,
                                    const char *version, int stream_size));
 #define deflateInit(strm, level) \
         deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))
diff --git a/zlib.rc b/zlib.rc
index 5e1d0f7f805b5cbed96f6ca07adb740ed323e85b..2c0a3e4defca14725ce05007bf77cc80fdd229a9 100644 (file)
--- a/zlib.rc
+++ b/zlib.rc
@@ -2,8 +2,8 @@
 
 #define IDR_VERSION1  1
 IDR_VERSION1   VERSIONINFO     MOVEABLE IMPURE LOADONCALL DISCARDABLE
-  FILEVERSION   1,0,2,0
-  PRODUCTVERSION 1,0,2,0
+  FILEVERSION   1,0,4,0
+  PRODUCTVERSION 1,0,4,0
   FILEFLAGSMASK        VS_FFI_FILEFLAGSMASK
   FILEFLAGS    0
   FILEOS       VOS_DOS_WINDOWS32
@@ -17,7 +17,7 @@ BEGIN
 
     BEGIN
       VALUE "FileDescription", "zlib data compression library\0"
-      VALUE "FileVersion",     "1.0.2\0"
+      VALUE "FileVersion",     "1.0.4\0"
       VALUE "InternalName",    "zlib\0"
       VALUE "OriginalFilename",        "zlib.lib\0"
       VALUE "ProductName",     "ZLib.DLL\0"
diff --git a/zutil.c b/zutil.c
index f32fda502c6d022efed8e154f169eb68e32bfa2e..734e27596d58f07d940fa704580b5c83cd41c8a3 100644 (file)
--- a/zutil.c
+++ b/zutil.c
@@ -3,7 +3,7 @@
  * For conditions of distribution and use, see copyright notice in zlib.h 
  */
 
-/* $Id: zutil.c,v 1.15 1996/05/23 17:11:36 me Exp $ */
+/* $Id: zutil.c,v 1.17 1996/07/24 13:41:12 me Exp $ */
 
 #include <stdio.h>
 
@@ -28,17 +28,19 @@ const char *z_errmsg[10] = {
 ""};
 
 
-char *zlibVersion()
+const char *zlibVersion()
 {
     return ZLIB_VERSION;
 }
 
+#ifdef DEBUG
 void z_error (m)
     char *m;
 {
     fprintf(stderr, "%s\n", m);
     exit(1);
 }
+#endif
 
 #ifndef HAVE_MEMCPY
 
@@ -53,6 +55,19 @@ void zmemcpy(dest, source, len)
     } while (--len != 0);
 }
 
+int zmemcmp(s1, s2, len)
+    Bytef* s1;
+    Bytef* s2;
+    uInt  len;
+{
+    uInt j;
+
+    for (j = 0; j < len; j++) {
+        if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
+    }
+    return 0;
+}
+
 void zmemzero(dest, len)
     Bytef* dest;
     uInt  len;
@@ -138,14 +153,14 @@ void  zcfree (voidpf opaque, voidpf ptr)
         return;
     }
     ptr = opaque; /* just to make some compilers happy */
-    z_error("zcfree: ptr not found");
+    Assert(0, "zcfree: ptr not found");
 }
 #endif
 #endif /* __TURBOC__ */
 
 
-#if defined(M_I86) && !(defined(__WATCOMC__) && defined(__386__))
-/* Microsoft C */
+#if defined(M_I86) && !defined(__32BIT__)
+/* Microsoft C in 16-bit mode */
 
 #  define MY_ZCALLOC
 
diff --git a/zutil.h b/zutil.h
index 5a53321597dbfa8b09cac1723c21606073b73e5d..c81a9f9263e6a7b3b76e545aad19f7252ebed7ec 100644 (file)
--- a/zutil.h
+++ b/zutil.h
@@ -8,14 +8,14 @@
    subject to change. Applications should only use zlib.h.
  */
 
-/* $Id: zutil.h,v 1.14 1996/05/22 11:52:40 me Exp $ */
+/* $Id: zutil.h,v 1.16 1996/07/24 13:41:13 me Exp $ */
 
 #ifndef _Z_UTIL_H
 #define _Z_UTIL_H
 
 #include "zlib.h"
 
-#if defined(MSDOS) || defined(VMS) || defined(CRAY) || defined(WIN32)
+#if defined(MSDOS)||defined(VMS)||defined(CRAY)||defined(WIN32)||defined(RISCOS)
 #   include <stddef.h>
 #   include <errno.h>
 #else
@@ -40,10 +40,10 @@ typedef unsigned long  ulg;
 extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
 /* (size given to avoid silly warnings with Visual C++) */
 
-#define ERR_MSG(err) (char*)z_errmsg[Z_NEED_DICT-(err)]
+#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
 
 #define ERR_RETURN(strm,err) \
-  return (strm->msg = ERR_MSG(err), (err))
+  return (strm->msg = (char*)ERR_MSG(err), (err))
 /* To be used only when the state is known to be valid */
 
         /* common constants */
@@ -116,7 +116,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
 #  define OS_CODE  0x0a
 #endif
 
-#ifdef _BEOS_
+#if defined(_BEOS_) || defined(RISCOS)
 #  define fdopen(fd,mode) NULL /* No fdopen() */
 #endif
 
@@ -163,6 +163,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
 #  endif
 #else
    extern void zmemcpy  OF((Bytef* dest, Bytef* source, uInt len));
+   extern int  zmemcmp  OF((Bytef* s1,   Bytef* s2, uInt len));
    extern void zmemzero OF((Bytef* dest, uInt len));
 #endif
 
@@ -172,6 +173,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
 #  ifndef verbose
 #    define verbose 0
 #  endif
+   extern void z_error    OF((char *m));
 #  define Assert(cond,msg) {if(!(cond)) z_error(msg);}
 #  define Trace(x) fprintf x
 #  define Tracev(x) {if (verbose) fprintf x ;}
@@ -190,8 +192,6 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
 
 typedef uLong (*check_func) OF((uLong check, const Bytef *buf, uInt len));
 
-extern void z_error    OF((char *m));
-
 voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
 void   zcfree  OF((voidpf opaque, voidpf ptr));