]> git.lizzy.rs Git - zlib.git/commitdiff
zlib 1.2.5.1 v1.2.5.1
authorMark Adler <madler@alumni.caltech.edu>
Sun, 11 Sep 2011 18:04:49 +0000 (11:04 -0700)
committerMark Adler <madler@alumni.caltech.edu>
Sun, 11 Sep 2011 18:04:49 +0000 (11:04 -0700)
58 files changed:
ChangeLog
FAQ
INDEX
Makefile.in
README
adler32.c
as400/bndsrc [new file with mode: 0644]
as400/compile.clp [new file with mode: 0644]
as400/readme.txt [new file with mode: 0644]
as400/zlib.inc [new file with mode: 0644]
configure
contrib/asm686/match.S
contrib/delphi/ZLib.pas
contrib/dotzlib/DotZLib/UnitTests.cs
contrib/infback9/inftree9.c
contrib/masmx86/inffas32.asm
contrib/masmx86/match686.asm
contrib/minizip/ioapi.c
contrib/minizip/ioapi.h
contrib/minizip/miniunz.c
contrib/minizip/minizip.c
contrib/minizip/unzip.c
contrib/pascal/zlibpas.pas
contrib/puff/Makefile
contrib/puff/puff.c
contrib/puff/puff.h
contrib/puff/pufftest.c [new file with mode: 0644]
contrib/puff/zeros.raw
contrib/vstudio/vc10/zlib.rc
contrib/vstudio/vc10/zlibvc.def
contrib/vstudio/vc9/zlib.rc
contrib/vstudio/vc9/zlibvc.def
crc32.c
crc32.h
deflate.c
deflate.h
doc/algorithm.txt
example.c
gzlib.c
gzwrite.c
inftrees.c
old/as400/bndsrc [deleted file]
old/as400/compile.clp [deleted file]
old/as400/readme.txt [deleted file]
old/as400/zlib.inc [deleted file]
qnx/package.qpg
treebuild.xml
win32/Makefile.gcc
win32/Makefile.msc
win32/zlib.def
zconf.h
zconf.h.cmakein
zconf.h.in
zlib.3
zlib.3.pdf
zlib.h
zlib.map
zutil.c

index f310bb0fcdb176111b1ded729adf39484a0e9551..a4e5384011d83ad452c97ea79dff488947aabbd4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,57 @@
 
                 ChangeLog file for zlib
 
+Changes in 1.2.5.1 (10 Sep 2011)
+- Update FAQ entry on shared builds (#13)
+- Avoid symbolic argument to chmod in Makefile.in
+- Fix bug and add consts in contrib/puff [Oberhumer]
+- Update contrib/puff/zeros.raw test file to have all block types
+- Add full coverage test for puff in contrib/puff/Makefile
+- Fix static-only-build install in Makefile.in
+- Fix bug in unzGetCurrentFileInfo() in contrib/minizip [Kuno]
+- Add libz.a dependency to shared in Makefile.in for parallel builds
+- Spell out "number" (instead of "nb") in zlib.h for total_in, total_out
+- Replace $(...) with `...` in configure for non-bash sh [Bowler]
+- Add darwin* to Darwin* and solaris* to SunOS\ 5* in configure [Groffen]
+- Add solaris* to Linux* in configure to allow gcc use [Groffen]
+- Add *bsd* to Linux* case in configure [Bar-Lev]
+- Add inffast.obj to dependencies in win32/Makefile.msc
+- Correct spelling error in deflate.h [Kohler]
+- Change libzdll.a again to libz.dll.a (!) in win32/Makefile.gcc
+- Add test to configure for GNU C looking for gcc in output of $cc -v
+- Add zlib.pc generation to win32/Makefile.gcc [Weigelt]
+- Fix bug in zlib.h for _FILE_OFFSET_BITS set and _LARGEFILE64_SOURCE not
+- Add comment in zlib.h that adler32_combine with len2 < 0 makes no sense
+- Make NO_DIVIDE option in adler32.c much faster (thanks to John Reiser)
+- Make stronger test in zconf.h to include unistd.h for LFS
+- Apply Darwin patches for 64-bit file offsets to contrib/minizip [Slack]
+- Fix zlib.h LFS support when Z_PREFIX used
+- Add updated as400 support (removed from old) [Monnerat]
+- Avoid deflate sensitivity to volatile input data
+- Avoid division in adler32_combine for NO_DIVIDE
+- Clarify the use of Z_FINISH with deflateBound() amount of space
+- Set binary for output file in puff.c
+- Use u4 type for crc_table to avoid conversion warnings
+- Apply casts in zlib.h to avoid conversion warnings
+- Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller]
+- Improve inflateSync() documentation to note indeterminancy
+- Add deflatePending() function to return the amount of pending output
+- Correct the spelling of "specification" in FAQ [Randers-Pehrson]
+- Add a check in configure for stdarg.h, use for gzprintf()
+- Check that pointers fit in ints when gzprint() compiled old style
+- Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler]
+- Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt]
+- Add debug records in assmebler code [Londer]
+- Update RFC references to use http://tools.ietf.org/html/... [Li]
+- Add --archs option, use of libtool to configure for Mac OS X [Borstel]
+
 Changes in 1.2.5 (19 Apr 2010)
 - Disable visibility attribute in win32/Makefile.gcc [Bar-Lev]
 - Default to libdir as sharedlibdir in configure [Nieder]
 - Update copyright dates on modified source files
 - Update trees.c to be able to generate modified trees.h
 - Exit configure for MinGW, suggesting win32/Makefile.gcc
+- Check for NULL path in gz_open [Homurlu]
 
 Changes in 1.2.4.5 (18 Apr 2010)
 - Set sharedlibdir in configure [Torok]
@@ -261,7 +306,7 @@ Changes in 1.2.3.4 (21 Dec 2009)
 - Clear bytes after deflate lookahead to avoid use of uninitialized data
 - Change a limit in inftrees.c to be more transparent to Coverity Prevent
 - Update win32/zlib.def with exported symbols from zlib.h
-- Correct spelling error in zlib.h [Willem]
+- Correct spelling errors in zlib.h [Willem, Sobrado]
 - Allow Z_BLOCK for deflate() to force a new block
 - Allow negative bits in inflatePrime() to delete existing bit buffer
 - Add Z_TREES flush option to inflate() to return at end of trees
diff --git a/FAQ b/FAQ
index 1a22750a58e40c0a3db4302108773c5242e1ff66..03676dd2d7817673fa00beea2a09ea5c0ecab884 100644 (file)
--- a/FAQ
+++ b/FAQ
@@ -84,8 +84,10 @@ The lastest zlib FAQ is at http://zlib.net/zlib_faq.html
 
 13. How can I make a Unix shared library?
 
-    make clean
-    ./configure -s
+    By default a shared (and a static) library is built for Unix.  So:
+
+    make distclean
+    ./configure
     make
 
 14. How do I install a shared zlib library on Unix?
@@ -325,7 +327,7 @@ The lastest zlib FAQ is at http://zlib.net/zlib_faq.html
     correctly points to the zlib specification in RFC 1950 for the "deflate"
     transfer encoding, there have been reports of servers and browsers that
     incorrectly produce or expect raw deflate data per the deflate
-    specficiation in RFC 1951, most notably Microsoft.  So even though the
+    specification in RFC 1951, most notably Microsoft.  So even though the
     "deflate" transfer encoding using the zlib format would be the more
     efficient approach (and in fact exactly what the zlib format was designed
     for), using the "gzip" transfer encoding is probably more reliable due to
diff --git a/INDEX b/INDEX
index f6c51ca1759fc8435a8dce00301eda710dcf9eb0..791f6abe7c45706dfd2f6cd8d46dc77eafd95657 100644 (file)
--- a/INDEX
+++ b/INDEX
@@ -17,6 +17,7 @@ zlib.pc.in      Template for pkg-config descriptor
 zlib2ansi       perl script to convert source files for C++ compilation
 
 amiga/          makefiles for Amiga SAS C
+as400/         makefiles for AS/400
 doc/            documentation for formats and algorithms
 msdos/          makefiles for MSDOS
 nintendods/     makefile for Nintendo DS
index 5b15bd00d737715f26d8997477de0b773e2fdda4..861970d1b2d9a169f6d0f1cee4157aaf9f26710c 100644 (file)
@@ -1,5 +1,5 @@
 # Makefile for zlib
-# Copyright (C) 1995-2010 Jean-loup Gailly.
+# Copyright (C) 1995-2011 Jean-loup Gailly.
 # For conditions of distribution and use, see copyright notice in zlib.h
 
 # To compile and test, type:
@@ -32,7 +32,7 @@ CPP=$(CC) -E
 
 STATICLIB=libz.a
 SHAREDLIB=libz.so
-SHAREDLIBV=libz.so.1.2.5
+SHAREDLIBV=libz.so.1.2.5.1
 SHAREDLIBM=libz.so.1
 LIBS=$(STATICLIB) $(SHAREDLIBV)
 
@@ -136,7 +136,7 @@ minigzip64.o: minigzip.c zlib.h zconf.h
        $(CC) $(SFLAGS) -DPIC -c -o objs/$*.o $<
        -@mv objs/$*.o $@
 
-$(SHAREDLIBV): $(PIC_OBJS)
+placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a
        $(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
        rm -f $(SHAREDLIB) $(SHAREDLIBM)
        ln -s $@ $(SHAREDLIB)
@@ -168,14 +168,16 @@ install-libs: $(LIBS)
        -@if [ ! -d $(DESTDIR)$(man3dir)      ]; then mkdir -p $(DESTDIR)$(man3dir); fi
        -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
        cp $(STATICLIB) $(DESTDIR)$(libdir)
-       cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)
-       cd $(DESTDIR)$(libdir); chmod u=rw,go=r $(STATICLIB)
-       -@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
-       -@cd $(DESTDIR)$(sharedlibdir); if test "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
-         chmod 755 $(SHAREDLIBV); \
-         rm -f $(SHAREDLIB) $(SHAREDLIBM); \
-         ln -s $(SHAREDLIBV) $(SHAREDLIB); \
-         ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
+       chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB)
+       -@($(RANLIB) $(DESTDIR)$(libdir)/libz.a || true) >/dev/null 2>&1
+       -@if test -n "$(SHAREDLIBV)"; then \
+         cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \
+         echo "cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \
+         chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
+         echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \
+         rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
+         ln -s $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
+         ln -s $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
          ($(LDCONFIG) || true)  >/dev/null 2>&1; \
        fi
        cp zlib.3 $(DESTDIR)$(man3dir)
@@ -193,7 +195,7 @@ install: install-libs
 uninstall:
        cd $(DESTDIR)$(includedir); rm -f zlib.h zconf.h
        cd $(DESTDIR)$(libdir); rm -f libz.a; \
-       if test "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
+       if test -n "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
          rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
        fi
        cd $(DESTDIR)$(man3dir); rm -f zlib.3
diff --git a/README b/README
index d4219bf889f5bb7e8bc70ea7d092a9974dcbcf8d..7870cc2f7c1c410a1dc7d67c3f309597cd5291b3 100644 (file)
--- a/README
+++ b/README
@@ -1,10 +1,10 @@
 ZLIB DATA COMPRESSION LIBRARY
 
-zlib 1.2.5 is a general purpose data compression library.  All the code is
+zlib 1.2.5.1 is a general purpose data compression library.  All the code is
 thread safe.  The data format used by the zlib library is described by RFCs
 (Request for Comments) 1950 to 1952 in the files
-http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
-and rfc1952.txt (gzip format).
+http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
+rfc1952 (gzip format).
 
 All functions of the compression library are documented in the file zlib.h
 (volunteer to write man pages welcome, contact zlib@gzip.org).  A usage example
@@ -31,7 +31,7 @@ Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan.  1997
 issue of Dr.  Dobb's Journal; a copy of the article is available at
 http://marknelson.us/1997/01/01/zlib-engine/ .
 
-The changes made in version 1.2.5 are documented in the file ChangeLog.
+The changes made in version 1.2.5.1 are documented in the file ChangeLog.
 
 Unsupported third party contributions are provided in directory contrib/ .
 
@@ -84,7 +84,7 @@ Acknowledgments:
 
 Copyright notice:
 
- (C) 1995-2010 Jean-loup Gailly and Mark Adler
+ (C) 1995-2011 Jean-loup Gailly and Mark Adler
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
index 65ad6a5adc44c00428b35eb15ff26d16f9ef209b..a868f073d8a0e35dcb3ec812b41b1d3f0acdd84d 100644 (file)
--- a/adler32.c
+++ b/adler32.c
@@ -1,5 +1,5 @@
 /* adler32.c -- compute the Adler-32 checksum of a data stream
- * Copyright (C) 1995-2007 Mark Adler
+ * Copyright (C) 1995-2011 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
@@ -9,9 +9,9 @@
 
 #define local static
 
-local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2);
+local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
 
-#define BASE 65521UL    /* largest prime smaller than 65536 */
+#define BASE 65521      /* largest prime smaller than 65536 */
 #define NMAX 5552
 /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
 
@@ -21,39 +21,44 @@ local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2);
 #define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
 #define DO16(buf)   DO8(buf,0); DO8(buf,8);
 
-/* use NO_DIVIDE if your processor does not do division in hardware */
+/* use NO_DIVIDE if your processor does not do division in hardware --
+   try it both ways to see which is faster */
 #ifdef NO_DIVIDE
-#  define MOD(a) \
+/* note that this assumes BASE is 65521, where 65536 % 65521 == 15
+   (thank you to John Reiser for pointing this out) */
+#  define CHOP(a) \
+    do { \
+        unsigned long tmp = a >> 16; \
+        a &= 0xffffUL; \
+        a += (tmp << 4) - tmp; \
+    } while (0)
+#  define MOD28(a) \
     do { \
-        if (a >= (BASE << 16)) a -= (BASE << 16); \
-        if (a >= (BASE << 15)) a -= (BASE << 15); \
-        if (a >= (BASE << 14)) a -= (BASE << 14); \
-        if (a >= (BASE << 13)) a -= (BASE << 13); \
-        if (a >= (BASE << 12)) a -= (BASE << 12); \
-        if (a >= (BASE << 11)) a -= (BASE << 11); \
-        if (a >= (BASE << 10)) a -= (BASE << 10); \
-        if (a >= (BASE << 9)) a -= (BASE << 9); \
-        if (a >= (BASE << 8)) a -= (BASE << 8); \
-        if (a >= (BASE << 7)) a -= (BASE << 7); \
-        if (a >= (BASE << 6)) a -= (BASE << 6); \
-        if (a >= (BASE << 5)) a -= (BASE << 5); \
-        if (a >= (BASE << 4)) a -= (BASE << 4); \
-        if (a >= (BASE << 3)) a -= (BASE << 3); \
-        if (a >= (BASE << 2)) a -= (BASE << 2); \
-        if (a >= (BASE << 1)) a -= (BASE << 1); \
+        CHOP(a); \
         if (a >= BASE) a -= BASE; \
     } while (0)
-#  define MOD4(a) \
+#  define MOD(a) \
     do { \
-        if (a >= (BASE << 4)) a -= (BASE << 4); \
-        if (a >= (BASE << 3)) a -= (BASE << 3); \
-        if (a >= (BASE << 2)) a -= (BASE << 2); \
-        if (a >= (BASE << 1)) a -= (BASE << 1); \
+        CHOP(a); \
+        MOD28(a); \
+    } while (0)
+#  define MOD63(a) \
+    do { /* this assumes a is not negative */ \
+        z_off64_t tmp = a >> 32; \
+        a &= 0xffffffffL; \
+        a += (tmp << 8) - (tmp << 5) + tmp; \
+        tmp = a >> 16; \
+        a &= 0xffffL; \
+        a += (tmp << 4) - tmp; \
+        tmp = a >> 16; \
+        a &= 0xffffL; \
+        a += (tmp << 4) - tmp; \
         if (a >= BASE) a -= BASE; \
     } while (0)
 #else
 #  define MOD(a) a %= BASE
-#  define MOD4(a) a %= BASE
+#  define MOD28(a) a %= BASE
+#  define MOD63(a) a %= BASE
 #endif
 
 /* ========================================================================= */
@@ -92,7 +97,7 @@ uLong ZEXPORT adler32(adler, buf, len)
         }
         if (adler >= BASE)
             adler -= BASE;
-        MOD4(sum2);             /* only added so many BASE's */
+        MOD28(sum2);            /* only added so many BASE's */
         return adler | (sum2 << 16);
     }
 
@@ -137,8 +142,13 @@ local uLong adler32_combine_(adler1, adler2, len2)
     unsigned long sum2;
     unsigned rem;
 
+    /* for negative len, return invalid adler32 as a clue for debugging */
+    if (len2 < 0)
+        return 0xffffffffUL;
+
     /* the derivation of this formula is left as an exercise for the reader */
-    rem = (unsigned)(len2 % BASE);
+    MOD63(len2);                /* assumes len2 >= 0 */
+    rem = (unsigned)len2;
     sum1 = adler1 & 0xffff;
     sum2 = rem * sum1;
     MOD(sum2);
diff --git a/as400/bndsrc b/as400/bndsrc
new file mode 100644 (file)
index 0000000..06c3f43
--- /dev/null
@@ -0,0 +1,183 @@
+STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('ZLIB')
+
+/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
+/*   Version 1.1.3 entry points.                                    */
+/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
+
+/********************************************************************/
+/*   *MODULE      ADLER32      ZLIB         01/02/01  00:15:09      */
+/********************************************************************/
+
+  EXPORT SYMBOL("adler32")
+
+/********************************************************************/
+/*   *MODULE      COMPRESS     ZLIB         01/02/01  00:15:09      */
+/********************************************************************/
+
+  EXPORT SYMBOL("compress")
+  EXPORT SYMBOL("compress2")
+
+/********************************************************************/
+/*   *MODULE      CRC32        ZLIB         01/02/01  00:15:09      */
+/********************************************************************/
+
+  EXPORT SYMBOL("crc32")
+  EXPORT SYMBOL("get_crc_table")
+
+/********************************************************************/
+/*   *MODULE      DEFLATE      ZLIB         01/02/01  00:15:09      */
+/********************************************************************/
+
+  EXPORT SYMBOL("deflate")
+  EXPORT SYMBOL("deflateEnd")
+  EXPORT SYMBOL("deflateSetDictionary")
+  EXPORT SYMBOL("deflateCopy")
+  EXPORT SYMBOL("deflateReset")
+  EXPORT SYMBOL("deflateParams")
+  EXPORT SYMBOL("deflatePending")
+  EXPORT SYMBOL("deflatePrime")
+  EXPORT SYMBOL("deflateInit_")
+  EXPORT SYMBOL("deflateInit2_")
+
+/********************************************************************/
+/*   *MODULE      GZIO         ZLIB         01/02/01  00:15:09      */
+/********************************************************************/
+
+  EXPORT SYMBOL("gzopen")
+  EXPORT SYMBOL("gzdopen")
+  EXPORT SYMBOL("gzsetparams")
+  EXPORT SYMBOL("gzread")
+  EXPORT SYMBOL("gzwrite")
+  EXPORT SYMBOL("gzprintf")
+  EXPORT SYMBOL("gzputs")
+  EXPORT SYMBOL("gzgets")
+  EXPORT SYMBOL("gzputc")
+  EXPORT SYMBOL("gzgetc")
+  EXPORT SYMBOL("gzflush")
+  EXPORT SYMBOL("gzseek")
+  EXPORT SYMBOL("gzrewind")
+  EXPORT SYMBOL("gztell")
+  EXPORT SYMBOL("gzeof")
+  EXPORT SYMBOL("gzclose")
+  EXPORT SYMBOL("gzerror")
+
+/********************************************************************/
+/*   *MODULE      INFLATE      ZLIB         01/02/01  00:15:09      */
+/********************************************************************/
+
+  EXPORT SYMBOL("inflate")
+  EXPORT SYMBOL("inflateEnd")
+  EXPORT SYMBOL("inflateSetDictionary")
+  EXPORT SYMBOL("inflateSync")
+  EXPORT SYMBOL("inflateReset")
+  EXPORT SYMBOL("inflateInit_")
+  EXPORT SYMBOL("inflateInit2_")
+  EXPORT SYMBOL("inflateSyncPoint")
+
+/********************************************************************/
+/*   *MODULE      UNCOMPR      ZLIB         01/02/01  00:15:09      */
+/********************************************************************/
+
+  EXPORT SYMBOL("uncompress")
+
+/********************************************************************/
+/*   *MODULE      ZUTIL        ZLIB         01/02/01  00:15:09      */
+/********************************************************************/
+
+  EXPORT SYMBOL("zlibVersion")
+  EXPORT SYMBOL("zError")
+
+/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
+/*   Version 1.2.1 additional entry points.                         */
+/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
+
+/********************************************************************/
+/*   *MODULE      COMPRESS     ZLIB         01/02/01  00:15:09      */
+/********************************************************************/
+
+  EXPORT SYMBOL("compressBound")
+
+/********************************************************************/
+/*   *MODULE      DEFLATE      ZLIB         01/02/01  00:15:09      */
+/********************************************************************/
+
+  EXPORT SYMBOL("deflateBound")
+
+/********************************************************************/
+/*   *MODULE      GZIO         ZLIB         01/02/01  00:15:09      */
+/********************************************************************/
+
+  EXPORT SYMBOL("gzungetc")
+  EXPORT SYMBOL("gzclearerr")
+
+/********************************************************************/
+/*   *MODULE      INFBACK      ZLIB         01/02/01  00:15:09      */
+/********************************************************************/
+
+  EXPORT SYMBOL("inflateBack")
+  EXPORT SYMBOL("inflateBackEnd")
+  EXPORT SYMBOL("inflateBackInit_")
+
+/********************************************************************/
+/*   *MODULE      INFLATE      ZLIB         01/02/01  00:15:09      */
+/********************************************************************/
+
+  EXPORT SYMBOL("inflateCopy")
+
+/********************************************************************/
+/*   *MODULE      ZUTIL        ZLIB         01/02/01  00:15:09      */
+/********************************************************************/
+
+  EXPORT SYMBOL("zlibCompileFlags")
+
+/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
+/*   Version 1.2.5 additional entry points.                         */
+/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
+
+/********************************************************************/
+/*   *MODULE      ADLER32      ZLIB         01/02/01  00:15:09      */
+/********************************************************************/
+
+  EXPORT SYMBOL("adler32_combine")
+  EXPORT SYMBOL("adler32_combine64")
+
+/********************************************************************/
+/*   *MODULE      CRC32        ZLIB         01/02/01  00:15:09      */
+/********************************************************************/
+
+  EXPORT SYMBOL("crc32_combine")
+  EXPORT SYMBOL("crc32_combine64")
+
+/********************************************************************/
+/*   *MODULE      GZLIB        ZLIB         01/02/01  00:15:09      */
+/********************************************************************/
+
+  EXPORT SYMBOL("gzbuffer")
+  EXPORT SYMBOL("gzoffset")
+  EXPORT SYMBOL("gzoffset64")
+  EXPORT SYMBOL("gzopen64")
+  EXPORT SYMBOL("gzseek64")
+  EXPORT SYMBOL("gztell64")
+
+/********************************************************************/
+/*   *MODULE      GZREAD       ZLIB         01/02/01  00:15:09      */
+/********************************************************************/
+
+  EXPORT SYMBOL("gzclose_r")
+
+/********************************************************************/
+/*   *MODULE      GZWRITE      ZLIB         01/02/01  00:15:09      */
+/********************************************************************/
+
+  EXPORT SYMBOL("gzclose_w")
+
+/********************************************************************/
+/*   *MODULE      INFLATE      ZLIB         01/02/01  00:15:09      */
+/********************************************************************/
+
+  EXPORT SYMBOL("inflateMark")
+  EXPORT SYMBOL("inflatePrime")
+  EXPORT SYMBOL("inflateReset2")
+  EXPORT SYMBOL("inflateUndermine")
+
+ENDPGMEXP
diff --git a/as400/compile.clp b/as400/compile.clp
new file mode 100644 (file)
index 0000000..2f34936
--- /dev/null
@@ -0,0 +1,110 @@
+/******************************************************************************/
+/*                                                                            */
+/*  ZLIB                                                                      */
+/*                                                                            */
+/*    Compile sources into modules and link them into a service program.      */
+/*                                                                            */
+/******************************************************************************/
+
+             PGM
+
+/*      Configuration adjustable parameters.                                  */
+
+             DCL        VAR(&SRCLIB) TYPE(*CHAR) LEN(10) +
+                          VALUE('ZLIB')                         /* Source library. */
+             DCL        VAR(&SRCFILE) TYPE(*CHAR) LEN(10) +
+                          VALUE('SOURCES')                      /* Source member file. */
+             DCL        VAR(&CTLFILE) TYPE(*CHAR) LEN(10) +
+                          VALUE('TOOLS')                        /* Control member file. */
+
+             DCL        VAR(&MODLIB) TYPE(*CHAR) LEN(10) +
+                          VALUE('ZLIB')                         /* Module library. */
+
+             DCL        VAR(&SRVLIB) TYPE(*CHAR) LEN(10) +
+                          VALUE('LGPL')                         /* Service program library. */
+
+             DCL        VAR(&CFLAGS) TYPE(*CHAR) +
+                          VALUE('OPTIMIZE(40)')                 /* Compile options. */
+
+             DCL        VAR(&TGTRLS) TYPE(*CHAR) +
+                          VALUE('V5R3M0')                       /* Target release. */
+
+
+/*      Working storage.                                                      */
+
+             DCL        VAR(&CMDLEN) TYPE(*DEC) LEN(15 5) VALUE(300)    /* Command length. */
+             DCL        VAR(&CMD) TYPE(*CHAR) LEN(512)
+             DCL        VAR(&FIXDCMD) TYPE(*CHAR) LEN(512)
+
+
+/*      Compile sources into modules.                                         */
+
+             CHGVAR     VAR(&FIXDCMD) VALUE('CRTCMOD' *BCAT &CFLAGS *BCAT      +
+                        'SYSIFCOPT(*IFS64IO)' *BCAT                            +
+                        'DEFINE(''_LARGEFILE64_SOURCE''' *BCAT                 +
+                        '''_LFS64_LARGEFILE=1'') TGTRLS(' *TCAT &TGTRLS *TCAT  +
+                        ') SRCFILE(' *TCAT &SRCLIB *TCAT '/' *TCAT             +
+                        &SRCFILE *TCAT ') MODULE(' *TCAT &MODLIB *TCAT '/')
+
+
+             CHGVAR     VAR(&CMD) VALUE(&FIXDCMD *TCAT 'ADLER32)')
+             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
+
+             CHGVAR     VAR(&CMD) VALUE(&FIXDCMD *TCAT 'COMPRESS)')
+             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
+
+             CHGVAR     VAR(&CMD) VALUE(&FIXDCMD *TCAT 'CRC32)')
+             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
+
+             CHGVAR     VAR(&CMD) VALUE(&FIXDCMD *TCAT 'DEFLATE)')
+             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
+
+             CHGVAR     VAR(&CMD) VALUE(&FIXDCMD *TCAT 'GZCLOSE)')
+             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
+
+             CHGVAR     VAR(&CMD) VALUE(&FIXDCMD *TCAT 'GZLIB)')
+             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
+
+             CHGVAR     VAR(&CMD) VALUE(&FIXDCMD *TCAT 'GZREAD)')
+             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
+
+             CHGVAR     VAR(&CMD) VALUE(&FIXDCMD *TCAT 'GZWRITE)')
+             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
+
+             CHGVAR     VAR(&CMD) VALUE(&FIXDCMD *TCAT 'INFBACK)')
+             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
+
+             CHGVAR     VAR(&CMD) VALUE(&FIXDCMD *TCAT 'INFFAST)')
+             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
+
+             CHGVAR     VAR(&CMD) VALUE(&FIXDCMD *TCAT 'INFLATE)')
+             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
+
+             CHGVAR     VAR(&CMD) VALUE(&FIXDCMD *TCAT 'INFTREES)')
+             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
+
+             CHGVAR     VAR(&CMD) VALUE(&FIXDCMD *TCAT 'TREES)')
+             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
+
+             CHGVAR     VAR(&CMD) VALUE(&FIXDCMD *TCAT 'UNCOMPR)')
+             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
+
+             CHGVAR     VAR(&CMD) VALUE(&FIXDCMD *TCAT 'ZUTIL)')
+             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
+
+
+/*      Link modules into a service program.                                  */
+
+             CRTSRVPGM  SRVPGM(&SRVLIB/ZLIB) +
+                          MODULE(&MODLIB/ADLER32     &MODLIB/COMPRESS    +
+                                 &MODLIB/CRC32       &MODLIB/DEFLATE     +
+                                 &MODLIB/GZCLOSE     &MODLIB/GZLIB       +
+                                 &MODLIB/GZREAD      &MODLIB/GZWRITE     +
+                                 &MODLIB/INFBACK     &MODLIB/INFFAST     +
+                                 &MODLIB/INFLATE     &MODLIB/INFTREES    +
+                                 &MODLIB/TREES       &MODLIB/UNCOMPR     +
+                                 &MODLIB/ZUTIL)                          +
+                          SRCFILE(&SRCLIB/&CTLFILE) SRCMBR(BNDSRC)       +
+                          TEXT('ZLIB 1.2.5.1') TGTRLS(&TGTRLS)
+
+             ENDPGM
diff --git a/as400/readme.txt b/as400/readme.txt
new file mode 100644 (file)
index 0000000..5b96cec
--- /dev/null
@@ -0,0 +1,115 @@
+        ZLIB version 1.2.5.1 for AS400 installation instructions
+
+I) From an AS400 *SAVF file:
+
+1)      Unpacking archive to an AS400 save file
+
+On the AS400:
+
+_       Create the ZLIB AS400 library:
+
+        CRTLIB LIB(ZLIB) TYPE(PROD) TEXT('ZLIB compression API library')
+
+_       Create a work save file, for example:
+
+                CRTSAVF FILE(ZLIB/ZLIBSAVF)
+
+On a PC connected to the target AS400:
+
+_       Unpack the save file image to a PC file "ZLIBSAVF"
+_       Upload this file into the save file on the AS400, for example
+                using ftp in BINARY mode.
+
+
+2)      Populating the ZLIB AS400 source library
+
+On the AS400:
+
+_       Extract the saved objects into the ZLIB AS400 library using:
+
+RSTOBJ OBJ(*ALL) SAVLIB(ZLIB) DEV(*SAVF) SAVF(ZLIB/ZLIBSAVF) RSTLIB(ZLIB)
+
+
+3)      Customize installation:
+
+_       Edit CL member ZLIB/TOOLS(COMPILE) and change parameters if needed,
+                according to the comments.
+
+_       Compile this member with:
+
+        CRTCLPGM PGM(ZLIB/COMPILE) SRCFILE(ZLIB/TOOLS) SRCMBR(COMPILE)
+
+
+4)      Compile and generate the service program:
+
+_       This can now be done by executing:
+
+        CALL PGM(ZLIB/COMPILE)
+
+
+
+II) From the original source distribution:
+
+1)      On the AS400, create the source library:
+
+        CRTLIB LIB(ZLIB) TYPE(PROD) TEXT('ZLIB compression API library')
+
+2)      Create the source files:
+
+        CRTSRCPF FILE(ZLIB/SOURCES) RCDLEN(112) TEXT('ZLIB library modules')
+        CRTSRCPF FILE(ZLIB/H)       RCDLEN(112) TEXT('ZLIB library includes')
+        CRTSRCPF FILE(ZLIB/TOOLS)   RCDLEN(112) TEXT('ZLIB library control utilities')
+
+3)      From the machine hosting the distribution files, upload them (with
+                FTP in text mode, for example) according to the following table:
+
+    Original    AS400   AS400    AS400 AS400
+    file        file    member   type  description
+                SOURCES                Original ZLIB C subprogram sources
+    adler32.c           ADLER32  C     ZLIB - Compute the Adler-32 checksum of a dta strm
+    compress.c          COMPRESS C     ZLIB - Compress a memory buffer
+    crc32.c             CRC32    C     ZLIB - Compute the CRC-32 of a data stream
+    deflate.c           DEFLATE  C     ZLIB - Compress data using the deflation algorithm
+    gzclose.c           GZCLOSE  C     ZLIB - Close .gz files
+    gzlib.c             GZLIB    C     ZLIB - Miscellaneous .gz files IO support
+    gzread.c            GZREAD   C     ZLIB - Read .gz files
+    gzwrite.c           GZWRITE  C     ZLIB - Write .gz files
+    infback.c           INFBACK  C     ZLIB - Inflate using a callback interface
+    inffast.c           INFFAST  C     ZLIB - Fast proc. literals & length/distance pairs
+    inflate.c           INFLATE  C     ZLIB - Interface to inflate modules
+    inftrees.c          INFTREES C     ZLIB - Generate Huffman trees for efficient decode
+    trees.c             TREES    C     ZLIB - Output deflated data using Huffman coding
+    uncompr.c           UNCOMPR  C     ZLIB - Decompress a memory buffer
+    zutil.c             ZUTIL    C     ZLIB - Target dependent utility functions
+                H                      Original ZLIB C and ILE/RPG include files
+    crc32.h             CRC32    C     ZLIB - CRC32 tables
+    deflate.h           DEFLATE  C     ZLIB - Internal compression state
+    gzguts.h            GZGUTS   C     ZLIB - Definitions for the gzclose module
+    inffast.h           INFFAST  C     ZLIB - Header to use inffast.c
+    inffixed.h          INFFIXED C     ZLIB - Table for decoding fixed codes
+    inflate.h           INFLATE  C     ZLIB - Internal inflate state definitions
+    inftrees.h          INFTREES C     ZLIB - Header to use inftrees.c
+    trees.h             TREES    C     ZLIB - Created automatically with -DGEN_TREES_H
+    zconf.h             ZCONF    C     ZLIB - Compression library configuration
+    zlib.h              ZLIB     C     ZLIB - Compression library C user interface
+    as400/zlib.inc      ZLIB.INC RPGLE ZLIB - Compression library ILE RPG user interface
+    zutil.h             ZUTIL    C     ZLIB - Internal interface and configuration
+                TOOLS                  Building source software & AS/400 README
+    as400/bndsrc        BNDSRC         Entry point exportation list
+    as400/compile.clp   COMPILE  CLP   Compile sources & generate service program
+    as400/readme.txt    README   TXT   Installation instructions
+
+4)      Continue as in I)3).
+
+
+
+
+Notes:  For AS400 ILE RPG programmers, a /copy member defining the ZLIB
+                API prototypes for ILE RPG can be found in ZLIB/H(ZLIB.INC).
+                Please read comments in this member for more information.
+
+        Remember that most foreign textual data are ASCII coded: this
+                implementation does not handle conversion from/to ASCII, so
+                text data code conversions must be done explicitely.
+
+        Mainly for the reason above, always open zipped files in binary mode.
diff --git a/as400/zlib.inc b/as400/zlib.inc
new file mode 100644 (file)
index 0000000..d492ef3
--- /dev/null
@@ -0,0 +1,423 @@
+      *  ZLIB.INC - Interface to the general purpose compression library
+      *
+      *  ILE RPG400 version by Patrick Monnerat, DATASPHERE.
+      *  Version 1.2.5.1
+      *
+      *
+      *  WARNING:
+      *     Procedures inflateInit(), inflateInit2(), deflateInit(),
+      *         deflateInit2() and inflateBackInit() need to be called with
+      *         two additional arguments:
+      *         the package version string and the stream control structure.
+      *         size. This is needed because RPG lacks some macro feature.
+      *         Call these procedures as:
+      *             inflateInit(...: ZLIB_VERSION: %size(z_stream))
+      *
+      /if not defined(ZLIB_H_)
+      /define ZLIB_H_
+      *
+      **************************************************************************
+      *                               Constants
+      **************************************************************************
+      *
+      *  Versioning information.
+      *
+     D ZLIB_VERSION    C                   '1.2.5.1'
+     D ZLIB_VERNUM     C                   X'1251'
+     D ZLIB_VER_MAJOR  C                   1
+     D ZLIB_VER_MINOR  C                   2
+     D ZLIB_VER_REVISION...
+     D                 C                   5
+     D ZLIB_VER_SUBREVISION...
+     D                 C                   0
+      *
+      *  Other equates.
+      *
+     D Z_NO_FLUSH      C                   0
+     D Z_PARTIAL_FLUSH...
+     D                 C                   1
+     D Z_SYNC_FLUSH    C                   2
+     D Z_FULL_FLUSH    C                   3
+     D Z_FINISH        C                   4
+     D Z_BLOCK         C                   5
+     D Z_TREES         C                   6
+      *
+     D Z_OK            C                   0
+     D Z_STREAM_END    C                   1
+     D Z_NEED_DICT     C                   2
+     D Z_ERRNO         C                   -1
+     D Z_STREAM_ERROR  C                   -2
+     D Z_DATA_ERROR    C                   -3
+     D Z_MEM_ERROR     C                   -4
+     D Z_BUF_ERROR     C                   -5
+     DZ_VERSION_ERROR  C                   -6
+      *
+     D Z_NO_COMPRESSION...
+     D                 C                   0
+     D Z_BEST_SPEED    C                   1
+     D Z_BEST_COMPRESSION...
+     D                 C                   9
+     D Z_DEFAULT_COMPRESSION...
+     D                 C                   -1
+      *
+     D Z_FILTERED      C                   1
+     D Z_HUFFMAN_ONLY  C                   2
+     D Z_RLE           C                   3
+     D Z_DEFAULT_STRATEGY...
+     D                 C                   0
+      *
+     D Z_BINARY        C                   0
+     D Z_ASCII         C                   1
+     D Z_UNKNOWN       C                   2
+      *
+     D Z_DEFLATED      C                   8
+      *
+     D Z_NULL          C                   0
+      *
+      **************************************************************************
+      *                                 Types
+      **************************************************************************
+      *
+     D z_streamp       S               *                                        Stream struct ptr
+     D gzFile          S               *                                        File pointer
+     D z_off_t         S             10i 0                                      Stream offsets
+     D z_off64_t       S             20i 0                                      Stream offsets
+      *
+      **************************************************************************
+      *                               Structures
+      **************************************************************************
+      *
+      *  The GZIP encode/decode stream support structure.
+      *
+     D z_stream        DS                  align based(z_streamp)
+     D  zs_next_in                     *                                        Next input byte
+     D  zs_avail_in                  10U 0                                      Byte cnt at next_in
+     D  zs_total_in                  10U 0                                      Total bytes read
+     D  zs_next_out                    *                                        Output buffer ptr
+     D  zs_avail_out                 10U 0                                      Room left @ next_out
+     D  zs_total_out                 10U 0                                      Total bytes written
+     D  zs_msg                         *                                        Last errmsg or null
+     D  zs_state                       *                                        Internal state
+     D  zs_zalloc                      *   procptr                              Int. state allocator
+     D  zs_free                        *   procptr                              Int. state dealloc.
+     D  zs_opaque                      *                                        Private alloc. data
+     D  zs_data_type                 10i 0                                      ASC/BIN best guess
+     D  zs_adler                     10u 0                                      Uncompr. adler32 val
+     D                               10U 0                                      Reserved
+     D                               10U 0                                      Ptr. alignment
+      *
+      **************************************************************************
+      *                     Utility function prototypes
+      **************************************************************************
+      *
+     D compress        PR            10I 0 extproc('compress')
+     D  dest                      32767    options(*varsize)                    Destination buffer
+     D  destLen                      10U 0                                      Destination length
+     D  source                    32767    const options(*varsize)              Source buffer
+     D  sourceLen                    10u 0 value                                Source length
+      *
+     D compress2       PR            10I 0 extproc('compress2')
+     D  dest                      32767    options(*varsize)                    Destination buffer
+     D  destLen                      10U 0                                      Destination length
+     D  source                    32767    const options(*varsize)              Source buffer
+     D  sourceLen                    10U 0 value                                Source length
+     D  level                        10I 0 value                                Compression level
+      *
+     D compressBound   PR            10U 0 extproc('compressBound')
+     D  sourceLen                    10U 0 value
+      *
+     D uncompress      PR            10I 0 extproc('uncompress')
+     D  dest                      32767    options(*varsize)                    Destination buffer
+     D  destLen                      10U 0                                      Destination length
+     D  source                    32767    const options(*varsize)              Source buffer
+     D  sourceLen                    10U 0 value                                Source length
+      *
+      /if not defined(LARGE_FILES)
+     D gzopen          PR                  extproc('gzopen')
+     D                                     like(gzFile)
+     D  path                           *   value options(*string)               File pathname
+     D  mode                           *   value options(*string)               Open mode
+      /else
+     D gzopen          PR                  extproc('gzopen64')
+     D                                     like(gzFile)
+     D  path                           *   value options(*string)               File pathname
+     D  mode                           *   value options(*string)               Open mode
+      *
+     D gzopen64        PR                  extproc('gzopen64')
+     D                                     like(gzFile)
+     D  path                           *   value options(*string)               File pathname
+     D  mode                           *   value options(*string)               Open mode
+      /endif
+      *
+     D gzdopen         PR                  extproc('gzdopen')
+     D                                     like(gzFile)
+     D  fd                           10I 0 value                                File descriptor
+     D  mode                           *   value options(*string)               Open mode
+      *
+     D gzbuffer        PR            10I 0 extproc('gzbuffer')
+     D  file                               value like(gzFile)                   File pointer
+     D  size                         10U 0 value
+      *
+     D gzsetparams     PR            10I 0 extproc('gzsetparams')
+     D  file                               value like(gzFile)                   File pointer
+     D  level                        10I 0 value
+     D  strategy                     10I 0 value
+      *
+     D gzread          PR            10I 0 extproc('gzread')
+     D  file                               value like(gzFile)                   File pointer
+     D  buf                       32767    options(*varsize)                    Buffer
+     D  len                          10u 0 value                                Buffer length
+      *
+     D gzwrite         PR            10I 0 extproc('gzwrite')
+     D  file                               value like(gzFile)                   File pointer
+     D  buf                       32767    const options(*varsize)              Buffer
+     D  len                          10u 0 value                                Buffer length
+      *
+     D gzputs          PR            10I 0 extproc('gzputs')
+     D  file                               value like(gzFile)                   File pointer
+     D  s                              *   value options(*string)               String to output
+      *
+     D gzgets          PR              *   extproc('gzgets')
+     D  file                               value like(gzFile)                   File pointer
+     D  buf                       32767    options(*varsize)                    Read buffer
+     D  len                          10i 0 value                                Buffer length
+      *
+     D gzflush         PR            10i 0 extproc('gzflush')
+     D  file                               value like(gzFile)                   File pointer
+     D  flush                        10I 0 value                                Type of flush
+      *
+      /if not defined(LARGE_FILES)
+     D gzseek          PR                  extproc('gzseek')
+     D                                     like(z_off_t)
+     D  file                               value like(gzFile)                   File pointer
+     D  offset                             value like(z_off_t)                  Offset
+     D  whence                       10i 0 value                                Origin
+      /else
+     D gzseek          PR                  extproc('gzseek64')
+     D                                     like(z_off_t)
+     D  file                               value like(gzFile)                   File pointer
+     D  offset                             value like(z_off_t)                  Offset
+     D  whence                       10i 0 value                                Origin
+      *
+     D gzseek64        PR                  extproc('gzseek64')
+     D                                     like(z_off64_t)
+     D  file                               value like(gzFile)                   File pointer
+     D  offset                             value like(z_off64_t)                Offset
+     D  whence                       10i 0 value                                Origin
+      /endif
+      *
+     D gzrewind        PR            10i 0 extproc('gzrewind')
+     D  file                               value like(gzFile)                   File pointer
+      *
+      /if not defined(LARGE_FILES)
+     D gztell          PR                  extproc('gztell')
+     D                                     like(z_off_t)
+     D  file                               value like(gzFile)                   File pointer
+      /else
+     D gztell          PR                  extproc('gztell64')
+     D                                     like(z_off_t)
+     D  file                               value like(gzFile)                   File pointer
+      *
+     D gztell64        PR                  extproc('gztell64')
+     D                                     like(z_off64_t)
+     D  file                               value like(gzFile)                   File pointer
+      /endif
+      *
+      /if not defined(LARGE_FILES)
+     D gzoffset        PR                  extproc('gzoffset')
+     D                                     like(z_off_t)
+     D  file                               value like(gzFile)                   File pointer
+      /else
+     D gzoffset        PR                  extproc('gzoffset64')
+     D                                     like(z_off_t)
+     D  file                               value like(gzFile)                   File pointer
+      *
+     D gzoffset64      PR                  extproc('gzoffset64')
+     D                                     like(z_off64_t)
+     D  file                               value like(gzFile)                   File pointer
+      /endif
+      *
+     D gzeof           PR            10i 0 extproc('gzeof')
+     D  file                               value like(gzFile)                   File pointer
+      *
+     D gzclose_r       PR            10i 0 extproc('gzclose_r')
+     D  file                               value like(gzFile)                   File pointer
+      *
+     D gzclose_w       PR            10i 0 extproc('gzclose_w')
+     D  file                               value like(gzFile)                   File pointer
+      *
+     D gzclose         PR            10i 0 extproc('gzclose')
+     D  file                               value like(gzFile)                   File pointer
+      *
+     D gzerror         PR              *   extproc('gzerror')                   Error string
+     D  file                               value like(gzFile)                   File pointer
+     D  errnum                       10I 0                                      Error code
+      *
+     D gzclearerr      PR                  extproc('gzclearerr')
+     D  file                               value like(gzFile)                   File pointer
+      *
+      **************************************************************************
+      *                        Basic function prototypes
+      **************************************************************************
+      *
+     D zlibVersion     PR              *   extproc('zlibVersion')               Version string
+      *
+     D deflateInit     PR            10I 0 extproc('deflateInit_')              Init. compression
+     D  strm                               like(z_stream)                       Compression stream
+     D  level                        10I 0 value                                Compression level
+     D  version                        *   value options(*string)               Version string
+     D  stream_size                  10i 0 value                                Stream struct. size
+      *
+     D deflate         PR            10I 0 extproc('deflate')                   Compress data
+     D  strm                               like(z_stream)                       Compression stream
+     D  flush                        10I 0 value                                Flush type required
+      *
+     D deflateEnd      PR            10I 0 extproc('deflateEnd')                Termin. compression
+     D  strm                               like(z_stream)                       Compression stream
+      *
+     D inflateInit     PR            10I 0 extproc('inflateInit_')              Init. expansion
+     D  strm                               like(z_stream)                       Expansion stream
+     D  version                        *   value options(*string)               Version string
+     D  stream_size                  10i 0 value                                Stream struct. size
+      *
+     D inflate         PR            10I 0 extproc('inflate')                   Expand data
+     D  strm                               like(z_stream)                       Expansion stream
+     D  flush                        10I 0 value                                Flush type required
+      *
+     D inflateEnd      PR            10I 0 extproc('inflateEnd')                Termin. expansion
+     D  strm                               like(z_stream)                       Expansion stream
+      *
+      **************************************************************************
+      *                        Advanced function prototypes
+      **************************************************************************
+      *
+     D deflateInit2    PR            10I 0 extproc('deflateInit2_')             Init. compression
+     D  strm                               like(z_stream)                       Compression stream
+     D  level                        10I 0 value                                Compression level
+     D  method                       10I 0 value                                Compression method
+     D  windowBits                   10I 0 value                                log2(window size)
+     D  memLevel                     10I 0 value                                Mem/cmpress tradeoff
+     D  strategy                     10I 0 value                                Compression stategy
+     D  version                        *   value options(*string)               Version string
+     D  stream_size                  10i 0 value                                Stream struct. size
+      *
+     D deflateSetDictionary...
+     D                 PR            10I 0 extproc('deflateSetDictionary')      Init. dictionary
+     D  strm                               like(z_stream)                       Compression stream
+     D  dictionary                32767    const options(*varsize)              Dictionary bytes
+     D  dictLength                   10U 0 value                                Dictionary length
+      *
+     D deflateCopy     PR            10I 0 extproc('deflateCopy')               Compress strm 2 strm
+     D  dest                               like(z_stream)                       Destination stream
+     D  source                             like(z_stream)                       Source stream
+      *
+     D deflateReset    PR            10I 0 extproc('deflateReset')              End and init. stream
+     D  strm                               like(z_stream)                       Compression stream
+      *
+     D deflateParams   PR            10I 0 extproc('deflateParams')             Change level & strat
+     D  strm                               like(z_stream)                       Compression stream
+     D  level                        10I 0 value                                Compression level
+     D  strategy                     10I 0 value                                Compression stategy
+      *
+     D deflateBound    PR            10U 0 extproc('deflateBound')              Change level & strat
+     D  strm                               like(z_stream)                       Compression stream
+     D  sourcelen                    10U 0 value                                Compression level
+      *
+     D deflatePending  PR            10I 0 extproc('deflatePending')            Change level & strat
+     D  strm                               like(z_stream)                       Compression stream
+     D  pending                      10U 0                                      Pending bytes
+     D  bits                         10I 0                                      Pending bits
+      *
+     D deflatePrime    PR            10I 0 extproc('deflatePrime')              Change level & strat
+     D  strm                               like(z_stream)                       Compression stream
+     D  bits                         10I 0 value                                Number of bits to insert
+     D  value                        10I 0 value                                Bits to insert
+      *
+     D inflateInit2    PR            10I 0 extproc('inflateInit2_')             Init. expansion
+     D  strm                               like(z_stream)                       Expansion stream
+     D  windowBits                   10I 0 value                                log2(window size)
+     D  version                        *   value options(*string)               Version string
+     D  stream_size                  10i 0 value                                Stream struct. size
+      *
+     D inflateSetDictionary...
+     D                 PR            10I 0 extproc('inflateSetDictionary')      Init. dictionary
+     D  strm                               like(z_stream)                       Expansion stream
+     D  dictionary                32767    const options(*varsize)              Dictionary bytes
+     D  dictLength                   10U 0 value                                Dictionary length
+      *
+     D inflateSync     PR            10I 0 extproc('inflateSync')               Sync. expansion
+     D  strm                               like(z_stream)                       Expansion stream
+      *
+     D inflateCopy     PR            10I 0 extproc('inflateCopy')
+     D  dest                               like(z_stream)                       Destination stream
+     D  source                             like(z_stream)                       Source stream
+      *
+     D inflateReset    PR            10I 0 extproc('inflateReset')              End and init. stream
+     D  strm                               like(z_stream)                       Expansion stream
+      *
+     D inflateReset2   PR            10I 0 extproc('inflateReset2')             End and init. stream
+     D  strm                               like(z_stream)                       Expansion stream
+     D  windowBits                   10I 0 value                                Log2(buffer size)
+      *
+     D inflatePrime    PR            10I 0 extproc('inflatePrime')              Insert bits
+     D  strm                               like(z_stream)                       Expansion stream
+     D  bits                         10I 0 value                                Bit count
+     D  value                        10I 0 value                                Bits to insert
+      *
+     D inflateMark     PR            10I 0 extproc('inflateMark')               Get inflate info
+     D  strm                               like(z_stream)                       Expansion stream
+      *
+     D inflateBackInit...
+     D                 PR            10I 0 extproc('inflateBackInit_')
+     D  strm                               like(z_stream)                       Expansion stream
+     D  windowBits                   10I 0 value                                Log2(buffer size)
+     D  window                    32767    options(*varsize)                    Buffer
+     D  version                        *   value options(*string)               Version string
+     D  stream_size                  10i 0 value                                Stream struct. size
+      *
+     D inflateBack     PR            10I 0 extproc('inflateBack')
+     D  strm                               like(z_stream)                       Expansion stream
+     D  in                             *   value procptr                        Input function
+     D  in_desc                        *   value                                Input descriptor
+     D  out                            *   value procptr                        Output function
+     D  out_desc                       *   value                                Output descriptor
+      *
+     D inflateBackEnd  PR            10I 0 extproc('inflateBackEnd')
+     D  strm                               like(z_stream)                       Expansion stream
+      *
+     D zlibCompileFlags...
+     D                 PR            10U 0 extproc('zlibCompileFlags')
+      *
+      **************************************************************************
+      *                        Checksum function prototypes
+      **************************************************************************
+      *
+     D adler32         PR            10U 0 extproc('adler32')                   New checksum
+     D  adler                        10U 0 value                                Old checksum
+     D  buf                       32767    const options(*varsize)              Bytes to accumulate
+     D  len                          10U 0 value                                Buffer length
+      *
+     D crc32           PR            10U 0 extproc('crc32')                     New checksum
+     D  crc                          10U 0 value                                Old checksum
+     D  buf                       32767    const options(*varsize)              Bytes to accumulate
+     D  len                          10U 0 value                                Buffer length
+      *
+      **************************************************************************
+      *                     Miscellaneous function prototypes
+      **************************************************************************
+      *
+     D zError          PR              *   extproc('zError')                    Error string
+     D  err                          10I 0 value                                Error code
+      *
+     D inflateSyncPoint...
+     D                 PR            10I 0 extproc('inflateSyncPoint')
+     D  strm                               like(z_stream)                       Expansion stream
+      *
+     D get_crc_table   PR              *   extproc('get_crc_table')             Ptr to ulongs
+      *
+     D inflateUndermine...
+     D                 PR            10I 0 extproc('inflateUndermine')
+     D  strm                               like(z_stream)                       Expansion stream
+     D  arg                          10I 0 value                                Error code
+      *
+      /endif
index bd9edd26cdd77f46fc84268c212963b3ec38826c..1838846cde5f72b4c4b156282e7e4ccb34a7b91a 100755 (executable)
--- a/configure
+++ b/configure
 # an error.
 
 if [ -n "${CHOST}" ]; then
-    uname="$(echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/')"
+    uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`"
     CROSS_PREFIX="${CHOST}-"
 fi
 
 STATICLIB=libz.a
-LDFLAGS="${LDFLAGS} -L. ${STATICLIB}"
 VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
 VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < zlib.h`
 VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h`
@@ -46,6 +45,7 @@ else
 fi
 LDCONFIG=${LDCONFIG-"ldconfig"}
 LDSHAREDLIBC="${LDSHAREDLIBC--lc}"
+ARCHS=
 prefix=${prefix-/usr/local}
 exec_prefix=${exec_prefix-'${prefix}'}
 libdir=${libdir-'${exec_prefix}/lib'}
@@ -67,7 +67,7 @@ case "$1" in
       echo 'usage:'
       echo '  configure [--zprefix] [--prefix=PREFIX]  [--eprefix=EXPREFIX]'
       echo '    [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]'
-      echo '    [--includedir=INCLUDEDIR]'
+      echo '    [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]'
         exit 0 ;;
     -p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;;
     -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;;
@@ -83,6 +83,7 @@ case "$1" in
     -t | --static) shared=0; shift ;;
     -z* | --zprefix) zprefix=1; shift ;;
     -6* | --64) build64=1; shift ;;
+    -a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;;
     --sysconfdir=*) echo "ignored option: --sysconfdir"; shift ;;
     --localstatedir=*) echo "ignored option: --localstatedir"; shift ;;
     *) echo "unknown option: $1"; echo "$0 --help for help"; exit 1 ;;
@@ -102,11 +103,15 @@ cflags=${CFLAGS-"-O3"}
 case "$cc" in
   *gcc*) gcc=1 ;;
 esac
+case `$cc -v 2>&1` in
+  *gcc*) gcc=1 ;;
+esac
 
 if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
   CC="$cc"
+  CFLAGS="${CFLAGS--O3} ${ARCHS}"
   SFLAGS="${CFLAGS--O3} -fPIC"
-  CFLAGS="${CFLAGS--O3}"
+  LDFLAGS="${LDFLAGS} ${ARCHS}"
   if test $build64 -eq 1; then
     CFLAGS="${CFLAGS} -m64"
     SFLAGS="${SFLAGS} -m64"
@@ -118,10 +123,11 @@ if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
     uname=`(uname -s || echo unknown) 2>/dev/null`
   fi
   case "$uname" in
-  Linux* | linux* | GNU | GNU/* | *BSD | DragonFly) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} ;;
+  Linux* | linux* | GNU | GNU/* | *BSD | *bsd* | DragonFly | solaris*)
+        LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} ;;
   CYGWIN* | Cygwin* | cygwin* | OS/2*)
         EXE='.exe' ;;
-  MINGW*|mingw*)
+  MINGW* | mingw*)
 # temporary bypass
         rm -f $test.[co] $test $test$shared_ext
         echo "Please use win32/Makefile.gcc instead."
@@ -142,11 +148,14 @@ if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
                  shared_ext='.sl'
                  SHAREDLIB='libz.sl' ;;
          esac ;;
-  Darwin*)   shared_ext='.dylib'
+  Darwin* | darwin*)
+             shared_ext='.dylib'
              SHAREDLIB=libz$shared_ext
              SHAREDLIBV=libz.$VER$shared_ext
              SHAREDLIBM=libz.$VER1$shared_ext
-             LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"} ;;
+             LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"}
+             AR="libtool"
+             AR_RC="${AR} -o" ;;
   *)             LDSHARED=${LDSHARED-"$cc -shared"} ;;
   esac
 else
@@ -187,7 +196,8 @@ else
   SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "}
              CFLAGS=${CFLAGS-"-O3"}
              LDSHARED=${LDSHARED-"cc -dy -KPIC -G"} ;;
-  SunOS\ 5*) LDSHARED=${LDSHARED-"cc -G"}
+  SunOS\ 5* | solaris*)
+         LDSHARED=${LDSHARED-"cc -G"}
          case `(uname -m || echo unknown) 2>/dev/null` in
          i86*)
              SFLAGS=${CFLAGS-"-xpentium -fast -KPIC -R."}
@@ -303,6 +313,18 @@ else
   echo "Checking for unistd.h... No."
 fi
 
+cat > $test.c <<EOF
+#include <stdarg.h>
+int main() { return 0; }
+EOF
+if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
+  sed < zconf.h "/^#ifdef HAVE_STDARG_H.* may be/s/def HAVE_STDARG_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
+  mv zconf.temp.h zconf.h
+  echo "Checking for stdarg.h... Yes."
+else
+  echo "Checking for stdarg.h... No."
+fi
+
 if test $zprefix -eq 1; then
   sed < zconf.h "/#ifdef Z_PREFIX.* may be/s/def Z_PREFIX\(.*\) may be/ 1\1 was/" > zconf.temp.h
   mv zconf.temp.h zconf.h
@@ -347,7 +369,6 @@ int main()
   return (mytest("Hello%d\n", 1));
 }
 EOF
-
   if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then
     echo "Checking for vsnprintf() in stdio.h... Yes."
 
index 06817e1dd08bd102bcf6a813632533a7372302cb..fa421092785d4ca295de262f3a2c6dffa4137f1b 100644 (file)
 .text
 
 /* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */
+.cfi_sections  .debug_frame
 
 longest_match:
 
+.cfi_startproc
 /* Save registers that the compiler may be using, and adjust %esp to   */
 /* make room for our stack frame.                                      */
 
                pushl   %ebp
+               .cfi_def_cfa_offset 8
+               .cfi_offset ebp, -8
                pushl   %edi
+               .cfi_def_cfa_offset 12
                pushl   %esi
+               .cfi_def_cfa_offset 16
                pushl   %ebx
+               .cfi_def_cfa_offset 20
                subl    $LocalVarsSize, %esp
+               .cfi_def_cfa_offset LocalVarsSize+20
 
 /* Retrieve the function arguments. %ecx will hold cur_match           */
 /* throughout the entire function. %edx will hold the pointer to the   */
@@ -108,7 +116,7 @@ longest_match:
 /* if (s->prev_length >= s->good_match) {                              */
 /*     chain_length >>= 2;                                             */
 /* }                                                                   */
-
                movl    dsPrevLen(%edx), %eax
                movl    dsGoodMatch(%edx), %ebx
                cmpl    %ebx, %eax
@@ -336,8 +344,14 @@ LookaheadRet:
 /* Restore the stack and return from whence we came.                   */
 
                addl    $LocalVarsSize, %esp
+               .cfi_def_cfa_offset 20
                popl    %ebx
+               .cfi_def_cfa_offset 16
                popl    %esi
+               .cfi_def_cfa_offset 12
                popl    %edi
+               .cfi_def_cfa_offset 8
                popl    %ebp
+               .cfi_def_cfa_offset 4
+.cfi_endproc
 match_init:    ret
index 0d86fb52fcf9a0d940adb6245e7718cea5aad416..8690594d273f925a0baf031bd3c6d31985a39733 100644 (file)
@@ -152,7 +152,7 @@ procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer;
   const OutBuf: Pointer; BufSize: Integer);
 
 const
-  zlib_version = '1.2.5';
+  zlib_version = '1.2.5.1';
 
 type
   EZlibError = class(Exception);
index 3bbcc8cee6e355e71d824095a9b4620c7540d174..e004833a3d212ad7cee025c02ec567b243315f2c 100644 (file)
@@ -156,7 +156,7 @@ namespace DotZLibTests
         public void Info_Version()\r
         {\r
             Info info = new Info();\r
-            Assert.AreEqual("1.2.5", Info.Version);\r
+            Assert.AreEqual("1.2.5.1", Info.Version);\r
             Assert.AreEqual(32, info.SizeOfUInt);\r
             Assert.AreEqual(32, info.SizeOfULong);\r
             Assert.AreEqual(32, info.SizeOfPointer);\r
index 306c5f1b19e07928d98467f04272ac094b8f9f9e..dfd003026e7b4b0209bba4519a1585764a82462c 100644 (file)
@@ -9,7 +9,7 @@
 #define MAXBITS 15
 
 const char inflate9_copyright[] =
-   " inflate9 1.2.5 Copyright 1995-2010 Mark Adler ";
+   " inflate9 1.2.5.1 Copyright 1995-2010 Mark Adler ";
 /*
   If you use the zlib library in a product, an acknowledgment is welcome
   in the documentation of your product. If for some reason you cannot
@@ -64,7 +64,7 @@ unsigned short FAR *work;
     static const unsigned short lext[31] = { /* Length codes 257..285 extra */
         128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
         130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
-        133, 133, 133, 133, 144, 73, 195};
+        133, 133, 133, 133, 144, 205, 203};
     static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
         1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
         65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,
index 92ac22ad9d904b5328adf6f00d9da9a2ff4bdf7f..03d20f838bfbb0b73a6d2fb35f4363add2af74ad 100644 (file)
@@ -73,11 +73,6 @@ inflate_fast_use_mmx:
 \r
 \r
 _TEXT                  segment\r
-PUBLIC _inflate_fast\r
-\r
-ALIGN 4\r
-_inflate_fast:\r
-       jmp inflate_fast_entry\r
 \r
 \r
 \r
@@ -163,7 +158,8 @@ distbits_state       equ    (76+4+zlib1222sup)      ;/* state->distbits */
 ;SECTION .text\r
 \r
 ALIGN 4\r
-inflate_fast_entry:\r
+_inflate_fast proc near\r
+.FPO (16, 4, 0, 0, 1, 0)\r
        push  edi\r
        push  esi\r
        push  ebp\r
@@ -1078,6 +1074,7 @@ L_done:
        pop  esi\r
        pop  edi\r
        ret\r
+_inflate_fast endp\r
 \r
 _TEXT  ends\r
 end\r
index 1eaf555026f8ead0c1d1d3fbb4a44f48e96cbc2b..3b09212f8a29916959be48a7cc920d423794c60c 100644 (file)
@@ -195,6 +195,7 @@ dsNiceMatch equ 136+zlib1222add
     ELSE\r
     _longest_match      proc near\r
     ENDIF\r
+.FPO (9, 4, 0, 0, 1, 0)\r
 \r
 ;;; Save registers that the compiler may be using, and adjust esp to\r
 ;;; make room for our stack frame.\r
index 49958f61ffd660c96031aa49dbcffd08b127ea45..d4bc020c502fbede68103d3235c10085ce704ac3 100644 (file)
         #define _CRT_SECURE_NO_WARNINGS
 #endif
 
+#ifdef __APPLE__
+// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
+#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
+#define FTELLO_FUNC(stream) ftello(stream)
+#define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)
+#else
+#define FOPEN_FUNC(filename, mode) fopen64(filename, mode)
+#define FTELLO_FUNC(stream) ftello64(stream)
+#define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin)
+#endif
+
+
 #include "ioapi.h"
 
 voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)
@@ -112,7 +124,7 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename,
         mode_fopen = "wb";
 
     if ((filename!=NULL) && (mode_fopen != NULL))
-        file = fopen64((const char*)filename, mode_fopen);
+        file = FOPEN_FUNC((const char*)filename, mode_fopen);
     return file;
 }
 
@@ -142,7 +154,7 @@ static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
 static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
 {
     ZPOS64_T ret;
-    ret = ftello64((FILE *)stream);
+    ret = FTELLO_FUNC((FILE *)stream);
     return ret;
 }
 
@@ -188,7 +200,7 @@ static long ZCALLBACK fseek64_file_func (voidpf  opaque, voidpf stream, ZPOS64_T
     }
     ret = 0;
 
-    if(fseeko64((FILE *)stream, offset, fseek_origin) != 0)
+    if(FSEEKO_FUNC((FILE *)stream, offset, fseek_origin) != 0)
                         ret = -1;
 
     return ret;
index 8309c4cf8f4b512b144568a6d5b662343f35b3fc..f6dce266ac3320cb73c17933677a53a8823a205f 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef _ZLIBIOAPI64_H
 #define _ZLIBIOAPI64_H
 
-#if (!defined(_WIN32)) && (!defined(WIN32))
+#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
 
   // Linux needs this to support file operation on files larger then 4+GB
   // But might need better if/def to select just the platforms that needs them.
@@ -38,6 +38,7 @@
         #ifndef _FILE_OFFSET_BIT
                 #define _FILE_OFFSET_BIT 64
         #endif
+
 #endif
 
 #include <stdio.h>
index 9ed009fbd9947b39212123c072c489983079dc36..3d65401be5cdd7b58c57d681e28347278942917b 100644 (file)
@@ -12,7 +12,7 @@
          Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
 */
 
-#ifndef _WIN32
+#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
         #ifndef __USE_FILE_OFFSET64
                 #define __USE_FILE_OFFSET64
         #endif
         #endif
 #endif
 
+#ifdef __APPLE__
+// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
+#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
+#define FTELLO_FUNC(stream) ftello(stream)
+#define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)
+#else
+#define FOPEN_FUNC(filename, mode) fopen64(filename, mode)
+#define FTELLO_FUNC(stream) ftello64(stream)
+#define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin)
+#endif
+
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
 #include <fcntl.h>
 
-#ifdef unix
-# include <unistd.h>
-# include <utime.h>
-#else
+#ifdef _WIN32
 # include <direct.h>
 # include <io.h>
+#else
+# include <unistd.h>
+# include <utime.h>
 #endif
 
+
 #include "unzip.h"
 
 #define CASESENSITIVITY (0)
@@ -84,7 +97,7 @@ void change_file_date(filename,dosdate,tmu_date)
   SetFileTime(hFile,&ftm,&ftLastAcc,&ftm);
   CloseHandle(hFile);
 #else
-#ifdef unix
+#ifdef unix || __APPLE__
   struct utimbuf ut;
   struct tm newdate;
   newdate.tm_sec = tmu_date.tm_sec;
@@ -114,10 +127,10 @@ int mymkdir(dirname)
     int ret=0;
 #ifdef _WIN32
     ret = _mkdir(dirname);
-#else
-#ifdef unix
+#elif unix
+    ret = mkdir (dirname,0775);
+#elif __APPLE__
     ret = mkdir (dirname,0775);
-#endif
 #endif
     return ret;
 }
@@ -364,7 +377,7 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
         {
             char rep=0;
             FILE* ftestexist;
-            ftestexist = fopen64(write_filename,"rb");
+            ftestexist = FOPEN_FUNC(write_filename,"rb");
             if (ftestexist!=NULL)
             {
                 fclose(ftestexist);
@@ -395,8 +408,7 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
 
         if ((skip==0) && (err==UNZ_OK))
         {
-            fout=fopen64(write_filename,"wb");
-
+            fout=FOPEN_FUNC(write_filename,"wb");
             /* some zipfile don't contain directory alone before file */
             if ((fout==NULL) && ((*popt_extract_without_path)==0) &&
                                 (filename_withoutpath!=(char*)filename_inzip))
@@ -405,7 +417,7 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
                 *(filename_withoutpath-1)='\0';
                 makedir(write_filename);
                 *(filename_withoutpath-1)=c;
-                fout=fopen64(write_filename,"wb");
+                fout=FOPEN_FUNC(write_filename,"wb");
             }
 
             if (fout==NULL)
index 7a4fa5a643ebf9ca484cc0654eb10071d16ea885..de63e37ce250b60600589cbf9fa476effd50c882 100644 (file)
@@ -13,7 +13,7 @@
 */
 
 
-#ifndef _WIN32
+#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
         #ifndef __USE_FILE_OFFSET64
                 #define __USE_FILE_OFFSET64
         #endif
         #endif
 #endif
 
+#ifdef __APPLE__
+// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
+#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
+#define FTELLO_FUNC(stream) ftello(stream)
+#define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)
+#else
+#define FOPEN_FUNC(filename, mode) fopen64(filename, mode)
+#define FTELLO_FUNC(stream) ftello64(stream)
+#define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin)
+#endif
+
+
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
 #include <fcntl.h>
 
-#ifdef unix
+#ifdef _WIN32
+# include <direct.h>
+# include <io.h>
+#else
 # include <unistd.h>
 # include <utime.h>
 # include <sys/types.h>
 # include <sys/stat.h>
-#else
-# include <direct.h>
-# include <io.h>
 #endif
 
 #include "zip.h"
@@ -81,7 +94,7 @@ uLong filetime(f, tmzip, dt)
   return ret;
 }
 #else
-#ifdef unix
+#ifdef unix || __APPLE__
 uLong filetime(f, tmzip, dt)
     char *f;               /* name of file to get info on */
     tm_zip *tmzip;         /* return value: access, modific. and creation times */
@@ -142,7 +155,7 @@ int check_exist_file(filename)
 {
     FILE* ftestexist;
     int ret = 1;
-    ftestexist = fopen64(filename,"rb");
+    ftestexist = FOPEN_FUNC(filename,"rb");
     if (ftestexist==NULL)
         ret = 0;
     else
@@ -173,7 +186,8 @@ int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigne
 {
    unsigned long calculate_crc=0;
    int err=ZIP_OK;
-   FILE * fin = fopen64(filenameinzip,"rb");
+   FILE * fin = FOPEN_FUNC(filenameinzip,"rb");
+   
    unsigned long size_read = 0;
    unsigned long total_read = 0;
    if (fin==NULL)
@@ -211,13 +225,12 @@ int isLargeFile(const char* filename)
 {
   int largeFile = 0;
   ZPOS64_T pos = 0;
-  FILE* pFile = fopen64(filename, "rb");
+  FILE* pFile = FOPEN_FUNC(filename, "rb");
 
   if(pFile != NULL)
   {
-    int n = fseeko64(pFile, 0, SEEK_END);
-
-    pos = ftello64(pFile);
+    int n = FSEEKO_FUNC(pFile, 0, SEEK_END);
+    pos = FTELLO_FUNC(pFile);
 
                 printf("File : %s is %lld bytes\n", filename, pos);
 
@@ -447,7 +460,7 @@ int main(argc,argv)
                     printf("error in opening %s in zipfile\n",filenameinzip);
                 else
                 {
-                    fin = fopen64(filenameinzip,"rb");
+                    fin = FOPEN_FUNC(filenameinzip,"rb");
                     if (fin==NULL)
                     {
                         err=ZIP_ERRNO;
index 7617f41f1ccf9c54ad8e002a956c1b42a5e63b24..587a2a112b57d3ef46c92f682255f17adcbed943 100644 (file)
@@ -1145,7 +1145,7 @@ extern int ZEXPORT unzGetCurrentFileInfo (unzFile file,
                                                 szFileName,fileNameBufferSize,
                                                 extraField,extraFieldBufferSize,
                                                 szComment,commentBufferSize);
-    if (err==UNZ_OK)
+    if ((err==UNZ_OK) && (pfile_info != NULL))
     {
         pfile_info->version = file_info64.version;
         pfile_info->version_needed = file_info64.version_needed;
index 637ae3a3f8e0b5fbf40fa7deeb79be05895b7b7c..6f494828fdb95cfe806a53dd42254d057d3c3563 100644 (file)
@@ -10,7 +10,7 @@ unit zlibpas;
 interface
 
 const
-  ZLIB_VERSION = '1.2.5';
+  ZLIB_VERSION = '1.2.5.1';
 
 type
   alloc_func = function(opaque: Pointer; items, size: Integer): Pointer;
@@ -97,6 +97,7 @@ function deflateCopy(var dest, source: z_stream): Integer;
 function deflateReset(var strm: z_stream): Integer;
 function deflateParams(var strm: z_stream; level, strategy: Integer): Integer;
 function deflateBound(var strm: z_stream; sourceLen: LongInt): LongInt;
+function deflatePending(var strm: z_stream; var pending: Integer; var bits: Integer): Integer;
 function deflatePrime(var strm: z_stream; bits, value: Integer): Integer;
 function inflateInit2(var strm: z_stream; windowBits: Integer): Integer;
 function inflateSetDictionary(var strm: z_stream; const dictionary: PChar;
@@ -166,6 +167,7 @@ function deflateEnd; external;
 function deflateInit_; external;
 function deflateInit2_; external;
 function deflateParams; external;
+function deflatePending; external;
 function deflatePrime; external;
 function deflateReset; external;
 function deflateSetDictionary; external;
index b6b69404c7453bd3707f1c258ac238fe93dac867..0e2594c80885c0dbea13c6d22b2e60e9fb82b51f 100644 (file)
@@ -1,8 +1,42 @@
-puff: puff.c puff.h
-       cc -DTEST -o puff puff.c
+CFLAGS=-O
+
+puff: puff.o pufftest.o
+
+puff.o: puff.h
+
+pufftest.o: puff.h
 
 test: puff
        puff zeros.raw
 
+puft: puff.c puff.h pufftest.o
+       cc -fprofile-arcs -ftest-coverage -o puft puff.c pufftest.o
+
+# puff full coverage test (should say 100%)
+cov: puft
+       @rm -f *.gcov *.gcda
+       @puft -w zeros.raw 2>&1 | cat > /dev/null
+       @echo '04' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
+       @echo '00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
+       @echo '00 00 00 00 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 254
+       @echo '00 01 00 fe ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
+       @echo '01 01 00 fe ff 0a' | xxd -r -p | puft -f 2>&1 | cat > /dev/null
+       @echo '02 7e ff ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 246
+       @echo '02' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
+       @echo '04 80 49 92 24 49 92 24 0f b4 ff ff c3 04' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
+       @echo '04 80 49 92 24 49 92 24 71 ff ff 93 11 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 249
+       @echo '04 c0 81 08 00 00 00 00 20 7f eb 0b 00 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 246
+       @echo '0b 00 00' | xxd -r -p | puft -f 2>&1 | cat > /dev/null
+       @echo '1a 07' | xxd -r -p | puft 2> /dev/null || test $$? -eq 246
+       @echo '0c c0 81 00 00 00 00 00 90 ff 6b 04' | xxd -r -p | puft 2> /dev/null || test $$? -eq 245
+       @puft -f zeros.raw 2>&1 | cat > /dev/null
+       @echo 'fc 00 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 253
+       @echo '04 00 fe ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 252
+       @echo '04 00 24 49' | xxd -r -p | puft 2> /dev/null || test $$? -eq 251
+       @echo '04 80 49 92 24 49 92 24 0f b4 ff ff c3 84' | xxd -r -p | puft 2> /dev/null || test $$? -eq 248
+       @echo '04 00 24 e9 ff ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 250
+       @echo '04 00 24 e9 ff 6d' | xxd -r -p | puft 2> /dev/null || test $$? -eq 247
+       @gcov -n puff.c
+
 clean:
-       rm -f puff puff.o
+       rm -f puff puft *.o *.gc*
index 650694e9ed823fc457eacf92dfbc172a7fccd6c9..df8470c937351db3f04d7edcd399ff5182d538ad 100644 (file)
@@ -2,7 +2,7 @@
  * puff.c
  * Copyright (C) 2002-2010 Mark Adler
  * For conditions of distribution and use, see copyright notice in puff.h
- * version 2.1, 4 Apr 2010
+ * version 2.2, 25 Apr 2010
  *
  * puff.c is a simple inflate written to be an unambiguous way to specify the
  * deflate format.  It is not written for speed but rather simplicity.  As a
@@ -49,9 +49,9 @@
  *                      - Fix fixed codes table error
  *                      - Provide a scanning mode for determining size of
  *                        uncompressed data
- * 1.3  20 Mar 2002     - Go back to lengths for puff() parameters [Jean-loup]
+ * 1.3  20 Mar 2002     - Go back to lengths for puff() parameters [Gailly]
  *                      - Add a puff.h file for the interface
- *                      - Add braces in puff() for else do [Jean-loup]
+ *                      - Add braces in puff() for else do [Gailly]
  *                      - Use indexes instead of pointers for readability
  * 1.4  31 Mar 2002     - Simplify construct() code set check
  *                      - Fix some comments
  *                      - Allow TEST code to read from piped stdin
  * 2.1   4 Apr 2010     - Avoid variable initialization for happier compilers
  *                      - Avoid unsigned comparisons for even happier compilers
+ * 2.2  25 Apr 2010     - Fix bug in variable initializations [Oberhumer]
+ *                      - Add const where appropriate [Oberhumer]
+ *                      - Split if's and ?'s for coverage testing
+ *                      - Break out test code to separate file
+ *                      - Move NIL to puff.h
+ *                      - Allow incomplete code only if single code length is 1
+ *                      - Add full code coverage test to Makefile
  */
 
 #include <setjmp.h>             /* for setjmp(), longjmp(), and jmp_buf */
 #include "puff.h"               /* prototype for puff() */
 
 #define local static            /* for local function definitions */
-#define NIL ((unsigned char *)0)        /* for no output option */
 
 /*
  * Maximums for allocations and loops.  It is not useful to change these --
@@ -95,7 +101,7 @@ struct state {
     unsigned long outcnt;       /* bytes written to out so far */
 
     /* input state */
-    unsigned char *in;          /* input buffer */
+    const unsigned char *in;    /* input buffer */
     unsigned long inlen;        /* available input at in */
     unsigned long incnt;        /* bytes read so far */
     int bitbuf;                 /* bit buffer */
@@ -123,7 +129,8 @@ local int bits(struct state *s, int need)
     /* load at least need bits into val */
     val = s->bitbuf;
     while (s->bitcnt < need) {
-        if (s->incnt == s->inlen) longjmp(s->env, 1);   /* out of input */
+        if (s->incnt == s->inlen)
+            longjmp(s->env, 1);         /* out of input */
         val |= (long)(s->in[s->incnt++]) << s->bitcnt;  /* load eight bits */
         s->bitcnt += 8;
     }
@@ -162,7 +169,8 @@ local int stored(struct state *s)
     s->bitcnt = 0;
 
     /* get length and check against its one's complement */
-    if (s->incnt + 4 > s->inlen) return 2;      /* not enough input */
+    if (s->incnt + 4 > s->inlen)
+        return 2;                               /* not enough input */
     len = s->in[s->incnt++];
     len |= s->in[s->incnt++] << 8;
     if (s->in[s->incnt++] != (~len & 0xff) ||
@@ -170,7 +178,8 @@ local int stored(struct state *s)
         return -2;                              /* didn't match complement! */
 
     /* copy len bytes from in to out */
-    if (s->incnt + len > s->inlen) return 2;    /* not enough input */
+    if (s->incnt + len > s->inlen)
+        return 2;                               /* not enough input */
     if (s->out != NIL) {
         if (s->outcnt + len > s->outlen)
             return 1;                           /* not enough output space */
@@ -222,7 +231,7 @@ struct huffman {
  *   in the deflate format.  See the format notes for fixed() and dynamic().
  */
 #ifdef SLOW
-local int decode(struct state *s, struct huffman *h)
+local int decode(struct state *s, const struct huffman *h)
 {
     int len;            /* current number of bits in code */
     int code;           /* len bits being decoded */
@@ -250,7 +259,7 @@ local int decode(struct state *s, struct huffman *h)
  * a few percent larger.
  */
 #else /* !SLOW */
-local int decode(struct state *s, struct huffman *h)
+local int decode(struct state *s, const struct huffman *h)
 {
     int len;            /* current number of bits in code */
     int code;           /* len bits being decoded */
@@ -283,10 +292,13 @@ local int decode(struct state *s, struct huffman *h)
             len++;
         }
         left = (MAXBITS+1) - len;
-        if (left == 0) break;
-        if (s->incnt == s->inlen) longjmp(s->env, 1);   /* out of input */
+        if (left == 0)
+            break;
+        if (s->incnt == s->inlen)
+            longjmp(s->env, 1);         /* out of input */
         bitbuf = s->in[s->incnt++];
-        if (left > 8) left = 8;
+        if (left > 8)
+            left = 8;
     }
     return -10;                         /* ran out of codes */
 }
@@ -324,7 +336,7 @@ local int decode(struct state *s, struct huffman *h)
  * - Within a given code length, the symbols are kept in ascending order for
  *   the code bits definition.
  */
-local int construct(struct huffman *h, short *length, int n)
+local int construct(struct huffman *h, const short *length, int n)
 {
     int symbol;         /* current symbol when stepping through length[] */
     int len;            /* current length when stepping through h->count[] */
@@ -344,7 +356,8 @@ local int construct(struct huffman *h, short *length, int n)
     for (len = 1; len <= MAXBITS; len++) {
         left <<= 1;                     /* one more bit, double codes left */
         left -= h->count[len];          /* deduct count from possible codes */
-        if (left < 0) return left;      /* over-subscribed--return negative */
+        if (left < 0)
+            return left;                /* over-subscribed--return negative */
     }                                   /* left > 0 means incomplete */
 
     /* generate offsets into symbol table for each length for sorting */
@@ -420,8 +433,8 @@ local int construct(struct huffman *h, short *length, int n)
  *   defined to do the wrong thing in this case.
  */
 local int codes(struct state *s,
-                struct huffman *lencode,
-                struct huffman *distcode)
+                const struct huffman *lencode,
+                const struct huffman *distcode)
 {
     int symbol;         /* decoded symbol */
     int len;            /* length for copy */
@@ -444,11 +457,13 @@ local int codes(struct state *s,
     /* decode literals and length/distance pairs */
     do {
         symbol = decode(s, lencode);
-        if (symbol < 0) return symbol;  /* invalid symbol */
+        if (symbol < 0)
+            return symbol;              /* invalid symbol */
         if (symbol < 256) {             /* literal: symbol is the byte */
             /* write out the literal */
             if (s->out != NIL) {
-                if (s->outcnt == s->outlen) return 1;
+                if (s->outcnt == s->outlen)
+                    return 1;
                 s->out[s->outcnt] = symbol;
             }
             s->outcnt++;
@@ -456,12 +471,14 @@ local int codes(struct state *s,
         else if (symbol > 256) {        /* length */
             /* get and compute length */
             symbol -= 257;
-            if (symbol >= 29) return -10;       /* invalid fixed code */
+            if (symbol >= 29)
+                return -10;             /* invalid fixed code */
             len = lens[symbol] + bits(s, lext[symbol]);
 
             /* get and check distance */
             symbol = decode(s, distcode);
-            if (symbol < 0) return symbol;      /* invalid symbol */
+            if (symbol < 0)
+                return symbol;          /* invalid symbol */
             dist = dists[symbol] + bits(s, dext[symbol]);
 #ifndef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
             if (dist > s->outcnt)
@@ -470,13 +487,15 @@ local int codes(struct state *s,
 
             /* copy length bytes from distance bytes back */
             if (s->out != NIL) {
-                if (s->outcnt + len > s->outlen) return 1;
+                if (s->outcnt + len > s->outlen)
+                    return 1;
                 while (len--) {
                     s->out[s->outcnt] =
 #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
-                        dist > s->outcnt ? 0 :
+                        dist > s->outcnt ?
+                            0 :
 #endif
-                        s->out[s->outcnt - dist];
+                            s->out[s->outcnt - dist];
                     s->outcnt++;
                 }
             }
@@ -525,6 +544,12 @@ local int fixed(struct state *s)
         int symbol;
         short lengths[FIXLCODES];
 
+        /* construct lencode and distcode */
+        lencode.count = lencnt;
+        lencode.symbol = lensym;
+        distcode.count = distcnt;
+        distcode.symbol = distsym;
+
         /* literal/length table */
         for (symbol = 0; symbol < 144; symbol++)
             lengths[symbol] = 8;
@@ -541,12 +566,6 @@ local int fixed(struct state *s)
             lengths[symbol] = 5;
         construct(&distcode, lengths, MAXDCODES);
 
-        /* construct lencode and distcode */
-        lencode.count = lencnt;
-        lencode.symbol = lensym;
-        distcode.count = distcnt;
-        distcode.symbol = distsym;
-
         /* do this just once */
         virgin = 0;
     }
@@ -675,7 +694,8 @@ local int dynamic(struct state *s)
 
     /* build huffman table for code lengths codes (use lencode temporarily) */
     err = construct(&lencode, lengths, 19);
-    if (err != 0) return -4;            /* require complete code set here */
+    if (err != 0)               /* require complete code set here */
+        return -4;
 
     /* read length/literal and distance code length tables */
     index = 0;
@@ -689,7 +709,8 @@ local int dynamic(struct state *s)
         else {                          /* repeat instruction */
             len = 0;                    /* assume repeating zeros */
             if (symbol == 16) {         /* repeat last length 3..6 times */
-                if (index == 0) return -5;      /* no last length! */
+                if (index == 0)
+                    return -5;          /* no last length! */
                 len = lengths[index - 1];       /* last length */
                 symbol = 3 + bits(s, 2);
             }
@@ -710,13 +731,13 @@ local int dynamic(struct state *s)
 
     /* build huffman table for literal/length codes */
     err = construct(&lencode, lengths, nlen);
-    if (err < 0 || (err > 0 && nlen - lencode.count[0] != 1))
-        return -7;      /* only allow incomplete codes if just one code */
+    if (err && (err < 0 || nlen != lencode.count[0] + lencode.count[1]))
+        return -7;      /* incomplete code ok only for single length 1 code */
 
     /* build huffman table for distance codes */
     err = construct(&distcode, lengths + nlen, ndist);
-    if (err < 0 || (err > 0 && ndist - distcode.count[0] != 1))
-        return -8;      /* only allow incomplete codes if just one code */
+    if (err && (err < 0 || ndist != distcode.count[0] + distcode.count[1]))
+        return -8;      /* incomplete code ok only for single length 1 code */
 
     /* decode data until end-of-block code */
     return codes(s, &lencode, &distcode);
@@ -768,7 +789,7 @@ local int dynamic(struct state *s)
  */
 int puff(unsigned char *dest,           /* pointer to destination pointer */
          unsigned long *destlen,        /* amount of output space */
-         unsigned char *source,         /* pointer to source data pointer */
+         const unsigned char *source,   /* pointer to source data pointer */
          unsigned long *sourcelen)      /* amount of input available */
 {
     struct state s;             /* input/output state */
@@ -795,11 +816,15 @@ int puff(unsigned char *dest,           /* pointer to destination pointer */
         do {
             last = bits(&s, 1);         /* one if last block */
             type = bits(&s, 2);         /* block type 0..3 */
-            err = type == 0 ? stored(&s) :
-                  (type == 1 ? fixed(&s) :
-                   (type == 2 ? dynamic(&s) :
-                    -1));               /* type == 3, invalid */
-            if (err != 0) break;        /* return with error */
+            err = type == 0 ?
+                    stored(&s) :
+                    (type == 1 ?
+                        fixed(&s) :
+                        (type == 2 ?
+                            dynamic(&s) :
+                            -1));       /* type == 3, invalid */
+            if (err != 0)
+                break;                  /* return with error */
         } while (!last);
     }
 
@@ -810,146 +835,3 @@ int puff(unsigned char *dest,           /* pointer to destination pointer */
     }
     return err;
 }
-
-#ifdef TEST
-/* Examples of how to use puff().
-
-   Usage: puff [-w] [-nnn] file
-          ... | puff [-w] [-nnn]
-
-   where file is the input file with deflate data, nnn is the number of bytes
-   of input to skip before inflating (e.g. to skip a zlib or gzip header), and
-   -w is used to write the decompressed data to stdout */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-/* Return size times approximately the cube root of 2, keeping the result as 1,
-   3, or 5 times a power of 2 -- the result is always > size, until the result
-   is the maximum value of an unsigned long, where it remains.  This is useful
-   to keep reallocations less than ~33% over the actual data. */
-local size_t bythirds(size_t size)
-{
-    int n;
-    size_t m;
-
-    m = size;
-    for (n = 0; m; n++)
-        m >>= 1;
-    if (n < 3)
-        return size + 1;
-    n -= 3;
-    m = size >> n;
-    m += m == 6 ? 2 : 1;
-    m <<= n;
-    return m > size ? m : (size_t)(-1);
-}
-
-/* Read the input file *name, or stdin if name is NULL, into allocated memory.
-   Reallocate to larger buffers until the entire file is read in.  Return a
-   pointer to the allocated data, or NULL if there was a memory allocation
-   failure.  *len is the number of bytes of data read from the input file (even
-   if load() returns NULL).  If the input file was empty or could not be opened
-   or read, *len is zero. */
-local void *load(char *name, size_t *len)
-{
-    size_t size;
-    void *buf, *swap;
-    FILE *in;
-
-    *len = 0;
-    buf = malloc(size = 4096);
-    if (buf == NULL)
-        return NULL;
-    in = name == NULL ? stdin : fopen(name, "rb");
-    if (in != NULL) {
-        for (;;) {
-            *len += fread((char *)buf + *len, 1, size - *len, in);
-            if (*len < size) break;
-            size = bythirds(size);
-            if (size == *len || (swap = realloc(buf, size)) == NULL) {
-                free(buf);
-                buf = NULL;
-                break;
-            }
-            buf = swap;
-        }
-        fclose(in);
-    }
-    return buf;
-}
-
-int main(int argc, char **argv)
-{
-    int ret, put = 0;
-    unsigned skip = 0;
-    char *arg, *name = NULL;
-    unsigned char *source = NULL, *dest;
-    size_t len = 0;
-    unsigned long sourcelen, destlen;
-
-    /* process arguments */
-    while (arg = *++argv, --argc)
-        if (arg[0] == '-') {
-            if (arg[1] == 'w' && arg[2] == 0)
-                put = 1;
-            else if (arg[1] >= '0' && arg[1] <= '9')
-                skip = (unsigned)atoi(arg + 1);
-            else {
-                fprintf(stderr, "invalid option %s\n", arg);
-                return 3;
-            }
-        }
-        else if (name != NULL) {
-            fprintf(stderr, "only one file name allowed\n");
-            return 3;
-        }
-        else
-            name = arg;
-    source = load(name, &len);
-    if (source == NULL) {
-        fprintf(stderr, "memory allocation failure\n");
-        return 4;
-    }
-    if (len == 0) {
-        fprintf(stderr, "could not read %s, or it was empty\n",
-                name == NULL ? "<stdin>" : name);
-        free(source);
-        return 3;
-    }
-    if (skip >= len) {
-        fprintf(stderr, "skip request of %d leaves no input\n", skip);
-        free(source);
-        return 3;
-    }
-
-    /* test inflate data with offset skip */
-    len -= skip;
-    sourcelen = (unsigned long)len;
-    ret = puff(NIL, &destlen, source + skip, &sourcelen);
-    if (ret)
-        fprintf(stderr, "puff() failed with return code %d\n", ret);
-    else {
-        fprintf(stderr, "puff() succeeded uncompressing %lu bytes\n", destlen);
-        if (sourcelen < len) fprintf(stderr, "%lu compressed bytes unused\n",
-                                     len - sourcelen);
-    }
-
-    /* if requested, inflate again and write decompressd data to stdout */
-    if (put) {
-        dest = malloc(destlen);
-        if (dest == NULL) {
-            fprintf(stderr, "memory allocation failure\n");
-            free(source);
-            return 4;
-        }
-        puff(dest, &destlen, source + skip, &sourcelen);
-        fwrite(dest, 1, destlen, stdout);
-        free(dest);
-    }
-
-    /* clean up */
-    free(source);
-    return ret;
-}
-#endif
index 88d1b3844fff544a0dd346d7d10d865a026e5eee..6a0080ae1a7074a543425b5286da2b71a19257a8 100644 (file)
@@ -1,6 +1,6 @@
 /* puff.h
   Copyright (C) 2002-2010 Mark Adler, all rights reserved
-  version 2.1, 4 Apr 2010
+  version 2.2, 25 Apr 2010
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the author be held liable for any damages
 /*
  * See puff.c for purpose and usage.
  */
+#ifndef NIL
+#  define NIL ((unsigned char *)0)      /* for no output option */
+#endif
+
 int puff(unsigned char *dest,           /* pointer to destination pointer */
          unsigned long *destlen,        /* amount of output space */
-         unsigned char *source,         /* pointer to source data pointer */
+         const unsigned char *source,   /* pointer to source data pointer */
          unsigned long *sourcelen);     /* amount of input available */
diff --git a/contrib/puff/pufftest.c b/contrib/puff/pufftest.c
new file mode 100644 (file)
index 0000000..76e35f6
--- /dev/null
@@ -0,0 +1,165 @@
+/*
+ * pufftest.c
+ * Copyright (C) 2002-2010 Mark Adler
+ * For conditions of distribution and use, see copyright notice in puff.h
+ * version 2.2, 25 Apr 2010
+ */
+
+/* Example of how to use puff().
+
+   Usage: puff [-w] [-f] [-nnn] file
+          ... | puff [-w] [-f] [-nnn]
+
+   where file is the input file with deflate data, nnn is the number of bytes
+   of input to skip before inflating (e.g. to skip a zlib or gzip header), and
+   -w is used to write the decompressed data to stdout.  -f is for coverage
+   testing, and causes pufftest to fail with not enough output space (-f does
+   a write like -w, so -w is not required). */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "puff.h"
+
+#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
+#  include <fcntl.h>
+#  include <io.h>
+#  define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
+#else
+#  define SET_BINARY_MODE(file)
+#endif
+
+#define local static
+
+/* Return size times approximately the cube root of 2, keeping the result as 1,
+   3, or 5 times a power of 2 -- the result is always > size, until the result
+   is the maximum value of an unsigned long, where it remains.  This is useful
+   to keep reallocations less than ~33% over the actual data. */
+local size_t bythirds(size_t size)
+{
+    int n;
+    size_t m;
+
+    m = size;
+    for (n = 0; m; n++)
+        m >>= 1;
+    if (n < 3)
+        return size + 1;
+    n -= 3;
+    m = size >> n;
+    m += m == 6 ? 2 : 1;
+    m <<= n;
+    return m > size ? m : (size_t)(-1);
+}
+
+/* Read the input file *name, or stdin if name is NULL, into allocated memory.
+   Reallocate to larger buffers until the entire file is read in.  Return a
+   pointer to the allocated data, or NULL if there was a memory allocation
+   failure.  *len is the number of bytes of data read from the input file (even
+   if load() returns NULL).  If the input file was empty or could not be opened
+   or read, *len is zero. */
+local void *load(const char *name, size_t *len)
+{
+    size_t size;
+    void *buf, *swap;
+    FILE *in;
+
+    *len = 0;
+    buf = malloc(size = 4096);
+    if (buf == NULL)
+        return NULL;
+    in = name == NULL ? stdin : fopen(name, "rb");
+    if (in != NULL) {
+        for (;;) {
+            *len += fread((char *)buf + *len, 1, size - *len, in);
+            if (*len < size) break;
+            size = bythirds(size);
+            if (size == *len || (swap = realloc(buf, size)) == NULL) {
+                free(buf);
+                buf = NULL;
+                break;
+            }
+            buf = swap;
+        }
+        fclose(in);
+    }
+    return buf;
+}
+
+int main(int argc, char **argv)
+{
+    int ret, put = 0, fail = 0;
+    unsigned skip = 0;
+    char *arg, *name = NULL;
+    unsigned char *source = NULL, *dest;
+    size_t len = 0;
+    unsigned long sourcelen, destlen;
+
+    /* process arguments */
+    while (arg = *++argv, --argc)
+        if (arg[0] == '-') {
+            if (arg[1] == 'w' && arg[2] == 0)
+                put = 1;
+            else if (arg[1] == 'f' && arg[2] == 0)
+                fail = 1, put = 1;
+            else if (arg[1] >= '0' && arg[1] <= '9')
+                skip = (unsigned)atoi(arg + 1);
+            else {
+                fprintf(stderr, "invalid option %s\n", arg);
+                return 3;
+            }
+        }
+        else if (name != NULL) {
+            fprintf(stderr, "only one file name allowed\n");
+            return 3;
+        }
+        else
+            name = arg;
+    source = load(name, &len);
+    if (source == NULL) {
+        fprintf(stderr, "memory allocation failure\n");
+        return 4;
+    }
+    if (len == 0) {
+        fprintf(stderr, "could not read %s, or it was empty\n",
+                name == NULL ? "<stdin>" : name);
+        free(source);
+        return 3;
+    }
+    if (skip >= len) {
+        fprintf(stderr, "skip request of %d leaves no input\n", skip);
+        free(source);
+        return 3;
+    }
+
+    /* test inflate data with offset skip */
+    len -= skip;
+    sourcelen = (unsigned long)len;
+    ret = puff(NIL, &destlen, source + skip, &sourcelen);
+    if (ret)
+        fprintf(stderr, "puff() failed with return code %d\n", ret);
+    else {
+        fprintf(stderr, "puff() succeeded uncompressing %lu bytes\n", destlen);
+        if (sourcelen < len) fprintf(stderr, "%lu compressed bytes unused\n",
+                                     len - sourcelen);
+    }
+
+    /* if requested, inflate again and write decompressd data to stdout */
+    if (put && ret == 0) {
+        if (fail)
+            destlen >>= 1;
+        dest = malloc(destlen);
+        if (dest == NULL) {
+            fprintf(stderr, "memory allocation failure\n");
+            free(source);
+            return 4;
+        }
+        puff(dest, &destlen, source + skip, &sourcelen);
+        SET_BINARY_MODE(stdout);
+        fwrite(dest, 1, destlen, stdout);
+        free(dest);
+    }
+
+    /* clean up */
+    free(source);
+    return ret;
+}
index 637b7be6f5bfd577cec5537aaad160cc5fc0a7c7..0a90e76b300205a44a0ecbf613e64aaaef2e51e7 100644 (file)
Binary files a/contrib/puff/zeros.raw and b/contrib/puff/zeros.raw differ
index f82245087ddcff4bf3bea6ff6a4b84de28adbbfb..00034ea4e79caf1b3dc033c1ebfaa9c346725c64 100644 (file)
@@ -2,8 +2,8 @@
 \r
 #define IDR_VERSION1  1\r
 IDR_VERSION1   VERSIONINFO     MOVEABLE IMPURE LOADONCALL DISCARDABLE\r
-  FILEVERSION   1,2,5,0\r
-  PRODUCTVERSION 1,2,5,0\r
+  FILEVERSION   1.2.5.1,1\r
+  PRODUCTVERSION 1.2.5.1,1\r
   FILEFLAGSMASK        VS_FFI_FILEFLAGSMASK\r
   FILEFLAGS    0\r
   FILEOS       VOS_DOS_WINDOWS32\r
@@ -17,7 +17,7 @@ BEGIN
 \r
     BEGIN\r
       VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"\r
-      VALUE "FileVersion",     "1.2.5\0"\r
+      VALUE "FileVersion",     "1.2.5.1\0"\r
       VALUE "InternalName",    "zlib\0"\r
       VALUE "OriginalFilename",        "zlib.dll\0"\r
       VALUE "ProductName",     "ZLib.DLL\0"\r
index 0269ef722c1ce3a9422168a9b99e64466600111f..ad8b4afabd5245c8ae821ae22c0ccac8c4b7150d 100644 (file)
@@ -55,6 +55,7 @@ EXPORTS
         gzungetc                                 @49\r
         zlibCompileFlags                         @50\r
         deflatePrime                             @51\r
+        deflatePending                           @52\r
 \r
         unzOpen                                  @61\r
         unzClose                                 @62\r
index f82245087ddcff4bf3bea6ff6a4b84de28adbbfb..00034ea4e79caf1b3dc033c1ebfaa9c346725c64 100644 (file)
@@ -2,8 +2,8 @@
 \r
 #define IDR_VERSION1  1\r
 IDR_VERSION1   VERSIONINFO     MOVEABLE IMPURE LOADONCALL DISCARDABLE\r
-  FILEVERSION   1,2,5,0\r
-  PRODUCTVERSION 1,2,5,0\r
+  FILEVERSION   1.2.5.1,1\r
+  PRODUCTVERSION 1.2.5.1,1\r
   FILEFLAGSMASK        VS_FFI_FILEFLAGSMASK\r
   FILEFLAGS    0\r
   FILEOS       VOS_DOS_WINDOWS32\r
@@ -17,7 +17,7 @@ BEGIN
 \r
     BEGIN\r
       VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"\r
-      VALUE "FileVersion",     "1.2.5\0"\r
+      VALUE "FileVersion",     "1.2.5.1\0"\r
       VALUE "InternalName",    "zlib\0"\r
       VALUE "OriginalFilename",        "zlib.dll\0"\r
       VALUE "ProductName",     "ZLib.DLL\0"\r
index 0269ef722c1ce3a9422168a9b99e64466600111f..ad8b4afabd5245c8ae821ae22c0ccac8c4b7150d 100644 (file)
@@ -55,6 +55,7 @@ EXPORTS
         gzungetc                                 @49\r
         zlibCompileFlags                         @50\r
         deflatePrime                             @51\r
+        deflatePending                           @52\r
 \r
         unzOpen                                  @61\r
         unzClose                                 @62\r
diff --git a/crc32.c b/crc32.c
index 91be372d224da6833c03bd24d7158ff622ece35f..c12471e6171594a691ab26a1a790e5eaf3fea63c 100644 (file)
--- a/crc32.c
+++ b/crc32.c
@@ -1,5 +1,5 @@
 /* crc32.c -- compute the CRC-32 of a data stream
- * Copyright (C) 1995-2006, 2010 Mark Adler
+ * Copyright (C) 1995-2006, 2010, 2011 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  *
  * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
@@ -17,6 +17,8 @@
   of the crc tables.  Therefore, if you #define DYNAMIC_CRC_TABLE, you should
   first call get_crc_table() to initialize the tables before allowing more than
   one thread to use crc32().
+
+  DYNAMIC_CRC_TABLE and MAKECRCH can be #defined to write out crc32.h.
  */
 
 #ifdef MAKECRCH
@@ -53,6 +55,7 @@
 
 /* Definitions for doing the crc four data bytes at a time. */
 #ifdef BYFOUR
+   typedef u4 crc_table_t;
 #  define REV(w) ((((w)>>24)&0xff)+(((w)>>8)&0xff00)+ \
                 (((w)&0xff00)<<8)+(((w)&0xff)<<24))
    local unsigned long crc32_little OF((unsigned long,
@@ -61,6 +64,7 @@
                         const unsigned char FAR *, unsigned));
 #  define TBLS 8
 #else
+   typedef unsigned long crc_table_t;
 #  define TBLS 1
 #endif /* BYFOUR */
 
 local unsigned long gf2_matrix_times OF((unsigned long *mat,
                                          unsigned long vec));
 local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
-local uLong crc32_combine_(uLong crc1, uLong crc2, z_off64_t len2);
+local uLong crc32_combine_ OF((uLong crc1, uLong crc2, z_off64_t len2));
 
 
 #ifdef DYNAMIC_CRC_TABLE
 
 local volatile int crc_table_empty = 1;
-local unsigned long FAR crc_table[TBLS][256];
+local crc_table_t FAR crc_table[TBLS][256];
 local void make_crc_table OF((void));
 #ifdef MAKECRCH
-   local void write_table OF((FILE *, const unsigned long FAR *));
+   local void write_table OF((FILE *, const crc_table_t FAR *));
 #endif /* MAKECRCH */
 /*
   Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
@@ -107,9 +111,9 @@ local void make_crc_table OF((void));
 */
 local void make_crc_table()
 {
-    unsigned long c;
+    crc_table_t c;
     int n, k;
-    unsigned long poly;                 /* polynomial exclusive-or pattern */
+    crc_table_t poly;                   /* polynomial exclusive-or pattern */
     /* terms of polynomial defining this crc (except x^32): */
     static volatile int first = 1;      /* flag to limit concurrent making */
     static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
@@ -121,13 +125,13 @@ local void make_crc_table()
         first = 0;
 
         /* make exclusive-or pattern from polynomial (0xedb88320UL) */
-        poly = 0UL;
-        for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++)
-            poly |= 1UL << (31 - p[n]);
+        poly = 0;
+        for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++)
+            poly |= (crc_table_t)1 << (31 - p[n]);
 
         /* generate a crc for every 8-bit value */
         for (n = 0; n < 256; n++) {
-            c = (unsigned long)n;
+            c = (crc_table_t)n;
             for (k = 0; k < 8; k++)
                 c = c & 1 ? poly ^ (c >> 1) : c >> 1;
             crc_table[0][n] = c;
@@ -164,7 +168,7 @@ local void make_crc_table()
         if (out == NULL) return;
         fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
         fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
-        fprintf(out, "local const unsigned long FAR ");
+        fprintf(out, "local const crc_table_t FAR ");
         fprintf(out, "crc_table[TBLS][256] =\n{\n  {\n");
         write_table(out, crc_table[0]);
 #  ifdef BYFOUR
@@ -184,12 +188,13 @@ local void make_crc_table()
 #ifdef MAKECRCH
 local void write_table(out, table)
     FILE *out;
-    const unsigned long FAR *table;
+    const crc_table_t FAR *table;
 {
     int n;
 
     for (n = 0; n < 256; n++)
-        fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : "    ", table[n],
+        fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : "    ",
+                (unsigned long)(table[n]),
                 n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", "));
 }
 #endif /* MAKECRCH */
diff --git a/crc32.h b/crc32.h
index 8053b6117c023f64554ea783b23fa06985acff7b..c3e7171c5015b16cb4954d0e425b1d832b60c29e 100644 (file)
--- a/crc32.h
+++ b/crc32.h
@@ -2,7 +2,7 @@
  * Generated automatically by crc32.c
  */
 
-local const unsigned long FAR crc_table[TBLS][256] =
+local const crc_table_t FAR crc_table[TBLS][256] =
 {
   {
     0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
index 5c4022f3d4774b98bb22104890b04a7d3f7f4aec..01d094e4c4f235ba179fa1e8b0aba57eaba52e04 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -1,5 +1,5 @@
 /* deflate.c -- compress data using the deflation algorithm
- * Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
+ * Copyright (C) 1995-2011 Jean-loup Gailly and Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
@@ -37,7 +37,7 @@
  *  REFERENCES
  *
  *      Deutsch, L.P.,"DEFLATE Compressed Data Format Specification".
- *      Available in http://www.ietf.org/rfc/rfc1951.txt
+ *      Available in http://tools.ietf.org/html/rfc1951
  *
  *      A description of the Rabin and Karp algorithm is given in the book
  *         "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
@@ -52,7 +52,7 @@
 #include "deflate.h"
 
 const char deflate_copyright[] =
-   " deflate 1.2.5 Copyright 1995-2010 Jean-loup Gailly and Mark Adler ";
+   " deflate 1.2.5.1 Copyright 1995-2010 Jean-loup Gailly and 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
@@ -396,6 +396,18 @@ int ZEXPORT deflateSetHeader (strm, head)
     return Z_OK;
 }
 
+/* ========================================================================= */
+int ZEXPORT deflatePending (strm, pending, bits)
+    unsigned *pending;
+    int *bits;
+    z_streamp strm;
+{
+    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+    *pending = strm->state->pending;
+    *bits = strm->state->bi_valid;
+    return Z_OK;
+}
+
 /* ========================================================================= */
 int ZEXPORT deflatePrime (strm, bits, value)
     z_streamp strm;
@@ -1001,15 +1013,15 @@ local int read_buf(strm, buf, size)
 
     strm->avail_in  -= len;
 
+    zmemcpy(buf, strm->next_in, len);
     if (strm->state->wrap == 1) {
-        strm->adler = adler32(strm->adler, strm->next_in, len);
+        strm->adler = adler32(strm->adler, buf, len);
     }
 #ifdef GZIP
     else if (strm->state->wrap == 2) {
-        strm->adler = crc32(strm->adler, strm->next_in, len);
+        strm->adler = crc32(strm->adler, buf, len);
     }
 #endif
-    zmemcpy(buf, strm->next_in, len);
     strm->next_in  += len;
     strm->total_in += len;
 
index cbf0d1ea5d966e572c4d3ae24d334c1ff1789169..442e14a21445f705d355c99495367f2fa8c0df53 100644 (file)
--- a/deflate.h
+++ b/deflate.h
@@ -188,7 +188,7 @@ typedef struct internal_state {
     int nice_match; /* Stop searching when current match exceeds this */
 
                 /* used by trees.c: */
-    /* Didn't use ct_data typedef below to supress compiler warning */
+    /* Didn't use ct_data typedef below to suppress compiler warning */
     struct ct_data_s dyn_ltree[HEAP_SIZE];   /* literal and length tree */
     struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
     struct ct_data_s bl_tree[2*BL_CODES+1];  /* Huffman tree for bit lengths */
index 34960bddaccdb7ab4cf0a8a0f4370137c8a110e5..c97f495020b4293ee09994143ed6cd9d1bd0a2bf 100644 (file)
@@ -206,4 +206,4 @@ Compression,'' IEEE Transactions on Information Theory, Vol. 23, No. 3,
 pp. 337-343.
 
 ``DEFLATE Compressed Data Format Specification'' available in
-http://www.ietf.org/rfc/rfc1951.txt
+http://tools.ietf.org/html/rfc1951
index 604736f15f67ba668f20c17c7ac41c27d06c9bf0..c15cc030b06134c9ea43376ec151f870644275c1 100644 (file)
--- a/example.c
+++ b/example.c
@@ -1,5 +1,5 @@
 /* example.c -- usage example of the zlib compression library
- * Copyright (C) 1995-2006 Jean-loup Gailly.
+ * Copyright (C) 1995-2006, 2011 Jean-loup Gailly.
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
@@ -438,7 +438,7 @@ void test_dict_deflate(compr, comprLen)
     CHECK_ERR(err, "deflateInit");
 
     err = deflateSetDictionary(&c_stream,
-                               (const Bytef*)dictionary, sizeof(dictionary));
+                (const Bytef*)dictionary, (int)sizeof(dictionary));
     CHECK_ERR(err, "deflateSetDictionary");
 
     dictId = c_stream.adler;
@@ -491,7 +491,7 @@ void test_dict_inflate(compr, comprLen, uncompr, uncomprLen)
                 exit(1);
             }
             err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary,
-                                       sizeof(dictionary));
+                                       (int)sizeof(dictionary));
         }
         CHECK_ERR(err, "inflate with dict");
     }
diff --git a/gzlib.c b/gzlib.c
index 603e60ed5444e0e7a2ed9590a9d9a73ce7cc97bf..d16b2497e0edbf89801262fc063de6b39fbd1b28 100644 (file)
--- a/gzlib.c
+++ b/gzlib.c
@@ -91,6 +91,10 @@ local gzFile gz_open(path, fd, mode)
 {
     gz_statep state;
 
+    /* check input */
+    if (path == NULL)
+        return NULL;
+
     /* allocate gzFile structure to return */
     state = malloc(sizeof(gz_state));
     if (state == NULL)
index e8defc6887a186055f17597968c4fc5791332811..0ea2994bd03b9f6c376cae7c05cf3055d78adea6 100644 (file)
--- a/gzwrite.c
+++ b/gzwrite.c
@@ -1,5 +1,5 @@
 /* gzwrite.c -- zlib functions for writing gzip files
- * Copyright (C) 2004, 2005, 2010 Mark Adler
+ * Copyright (C) 2004, 2005, 2010, 2011 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
@@ -274,7 +274,7 @@ int ZEXPORT gzputs(file, str)
     return ret == 0 && len != 0 ? -1 : ret;
 }
 
-#ifdef STDC
+#if defined(STDC) || defined(Z_HAVE_STDARG_H)
 #include <stdarg.h>
 
 /* -- see zlib.h -- */
@@ -346,7 +346,7 @@ int ZEXPORTVA gzprintf (gzFile file, const char *format, ...)
     return len;
 }
 
-#else /* !STDC */
+#else /* !STDC && !Z_HAVE_STDARG_H */
 
 /* -- see zlib.h -- */
 int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
@@ -366,6 +366,10 @@ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
     state = (gz_statep)file;
     strm = &(state->strm);
 
+    /* check that can really pass pointer in ints */
+    if (sizeof(int) != sizeof(void *))
+        return 0;
+
     /* check that we're writing and that there's no error */
     if (state->mode != GZ_WRITE || state->err != Z_OK)
         return 0;
index 11e9c52accbe8e2cf4e502f88ce89ccfa4f992e5..2022e96428c5205eedfbfc7c2bbbfe16bad6eead 100644 (file)
@@ -9,7 +9,7 @@
 #define MAXBITS 15
 
 const char inflate_copyright[] =
-   " inflate 1.2.5 Copyright 1995-2010 Mark Adler ";
+   " inflate 1.2.5.1 Copyright 1995-2010 Mark Adler ";
 /*
   If you use the zlib library in a product, an acknowledgment is welcome
   in the documentation of your product. If for some reason you cannot
@@ -62,7 +62,7 @@ unsigned short FAR *work;
         35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
     static const unsigned short lext[31] = { /* Length codes 257..285 extra */
         16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
-        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 73, 195};
+        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 205, 203};
     static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
         1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
         257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
diff --git a/old/as400/bndsrc b/old/as400/bndsrc
deleted file mode 100644 (file)
index 9cf94bb..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('ZLIB')
-
-/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
-/*   Version 1.1.3 entry points.                                    */
-/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
-
-/********************************************************************/
-/*   *MODULE      ADLER32      ZLIB         01/02/01  00:15:09      */
-/********************************************************************/
-
-  EXPORT SYMBOL("adler32")
-
-/********************************************************************/
-/*   *MODULE      COMPRESS     ZLIB         01/02/01  00:15:09      */
-/********************************************************************/
-
-  EXPORT SYMBOL("compress")
-  EXPORT SYMBOL("compress2")
-
-/********************************************************************/
-/*   *MODULE      CRC32        ZLIB         01/02/01  00:15:09      */
-/********************************************************************/
-
-  EXPORT SYMBOL("crc32")
-  EXPORT SYMBOL("get_crc_table")
-
-/********************************************************************/
-/*   *MODULE      DEFLATE      ZLIB         01/02/01  00:15:09      */
-/********************************************************************/
-
-  EXPORT SYMBOL("deflate")
-  EXPORT SYMBOL("deflateEnd")
-  EXPORT SYMBOL("deflateSetDictionary")
-  EXPORT SYMBOL("deflateCopy")
-  EXPORT SYMBOL("deflateReset")
-  EXPORT SYMBOL("deflateParams")
-  EXPORT SYMBOL("deflatePrime")
-  EXPORT SYMBOL("deflateInit_")
-  EXPORT SYMBOL("deflateInit2_")
-
-/********************************************************************/
-/*   *MODULE      GZIO         ZLIB         01/02/01  00:15:09      */
-/********************************************************************/
-
-  EXPORT SYMBOL("gzopen")
-  EXPORT SYMBOL("gzdopen")
-  EXPORT SYMBOL("gzsetparams")
-  EXPORT SYMBOL("gzread")
-  EXPORT SYMBOL("gzwrite")
-  EXPORT SYMBOL("gzprintf")
-  EXPORT SYMBOL("gzputs")
-  EXPORT SYMBOL("gzgets")
-  EXPORT SYMBOL("gzputc")
-  EXPORT SYMBOL("gzgetc")
-  EXPORT SYMBOL("gzflush")
-  EXPORT SYMBOL("gzseek")
-  EXPORT SYMBOL("gzrewind")
-  EXPORT SYMBOL("gztell")
-  EXPORT SYMBOL("gzeof")
-  EXPORT SYMBOL("gzclose")
-  EXPORT SYMBOL("gzerror")
-
-/********************************************************************/
-/*   *MODULE      INFLATE      ZLIB         01/02/01  00:15:09      */
-/********************************************************************/
-
-  EXPORT SYMBOL("inflate")
-  EXPORT SYMBOL("inflateEnd")
-  EXPORT SYMBOL("inflateSetDictionary")
-  EXPORT SYMBOL("inflateSync")
-  EXPORT SYMBOL("inflateReset")
-  EXPORT SYMBOL("inflateInit_")
-  EXPORT SYMBOL("inflateInit2_")
-  EXPORT SYMBOL("inflateSyncPoint")
-
-/********************************************************************/
-/*   *MODULE      UNCOMPR      ZLIB         01/02/01  00:15:09      */
-/********************************************************************/
-
-  EXPORT SYMBOL("uncompress")
-
-/********************************************************************/
-/*   *MODULE      ZUTIL        ZLIB         01/02/01  00:15:09      */
-/********************************************************************/
-
-  EXPORT SYMBOL("zlibVersion")
-  EXPORT SYMBOL("zError")
-
-/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
-/*   Version 1.2.1 additional entry points.                         */
-/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
-
-/********************************************************************/
-/*   *MODULE      COMPRESS     ZLIB         01/02/01  00:15:09      */
-/********************************************************************/
-
-  EXPORT SYMBOL("compressBound")
-
-/********************************************************************/
-/*   *MODULE      DEFLATE      ZLIB         01/02/01  00:15:09      */
-/********************************************************************/
-
-  EXPORT SYMBOL("deflateBound")
-
-/********************************************************************/
-/*   *MODULE      GZIO         ZLIB         01/02/01  00:15:09      */
-/********************************************************************/
-
-  EXPORT SYMBOL("gzungetc")
-  EXPORT SYMBOL("gzclearerr")
-
-/********************************************************************/
-/*   *MODULE      INFBACK      ZLIB         01/02/01  00:15:09      */
-/********************************************************************/
-
-  EXPORT SYMBOL("inflateBack")
-  EXPORT SYMBOL("inflateBackEnd")
-  EXPORT SYMBOL("inflateBackInit_")
-
-/********************************************************************/
-/*   *MODULE      INFLATE      ZLIB         01/02/01  00:15:09      */
-/********************************************************************/
-
-  EXPORT SYMBOL("inflateCopy")
-
-/********************************************************************/
-/*   *MODULE      ZUTIL        ZLIB         01/02/01  00:15:09      */
-/********************************************************************/
-
-  EXPORT SYMBOL("zlibCompileFlags")
-
-ENDPGMEXP
diff --git a/old/as400/compile.clp b/old/as400/compile.clp
deleted file mode 100644 (file)
index 8554951..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-/******************************************************************************/
-/*                                                                            */
-/*  ZLIB                                                                      */
-/*                                                                            */
-/*    Compile sources into modules and link them into a service program.      */
-/*                                                                            */
-/******************************************************************************/
-
-             PGM
-
-/*      Configuration adjustable parameters.                                  */
-
-             DCL        VAR(&SRCLIB) TYPE(*CHAR) LEN(10) +
-                          VALUE('ZLIB')                         /* Source library. */
-             DCL        VAR(&SRCFILE) TYPE(*CHAR) LEN(10) +
-                          VALUE('SOURCES')                      /* Source member file. */
-             DCL        VAR(&CTLFILE) TYPE(*CHAR) LEN(10) +
-                          VALUE('TOOLS')                        /* Control member file. */
-
-             DCL        VAR(&MODLIB) TYPE(*CHAR) LEN(10) +
-                          VALUE('ZLIB')                         /* Module library. */
-
-             DCL        VAR(&SRVLIB) TYPE(*CHAR) LEN(10) +
-                          VALUE('LGPL')                         /* Service program library. */
-
-             DCL        VAR(&CFLAGS) TYPE(*CHAR) +
-                          VALUE('OPTIMIZE(40)')                 /* Compile options. */
-
-
-/*      Working storage.                                                      */
-
-             DCL        VAR(&CMDLEN) TYPE(*DEC) LEN(15 5) VALUE(300)    /* Command length. */
-             DCL        VAR(&CMD) TYPE(*CHAR) LEN(512)
-
-
-/*      Compile sources into modules.                                         */
-
-             CHGVAR     VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT  +
-                        '/ADLER32)               SRCFILE(' *TCAT               +
-                        &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT                 +
-                        ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
-             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
-             CHGVAR     VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT  +
-                        '/COMPRESS)              SRCFILE(' *TCAT               +
-                        &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT                 +
-                        ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
-             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
-             CHGVAR     VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT  +
-                        '/CRC32)                 SRCFILE(' *TCAT               +
-                        &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT                 +
-                        ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
-             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
-             CHGVAR     VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT  +
-                        '/DEFLATE)               SRCFILE(' *TCAT               +
-                        &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT                 +
-                        ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
-             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
-             CHGVAR     VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT  +
-                        '/GZIO)                  SRCFILE(' *TCAT               +
-                        &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT                 +
-                        ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
-             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
-             CHGVAR     VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT  +
-                        '/INFBACK)               SRCFILE(' *TCAT               +
-                        &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT                 +
-                        ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
-             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
-             CHGVAR     VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT  +
-                        '/INFFAST)               SRCFILE(' *TCAT               +
-                        &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT                 +
-                        ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
-             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
-             CHGVAR     VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT  +
-                        '/INFLATE)               SRCFILE(' *TCAT               +
-                        &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT                 +
-                        ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
-             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
-             CHGVAR     VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT  +
-                        '/INFTREES)              SRCFILE(' *TCAT               +
-                        &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT                 +
-                        ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
-             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
-             CHGVAR     VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT  +
-                        '/TREES)                 SRCFILE(' *TCAT               +
-                        &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT                 +
-                        ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
-             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
-             CHGVAR     VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT  +
-                        '/UNCOMPR)               SRCFILE(' *TCAT               +
-                        &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT                 +
-                        ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
-             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
-             CHGVAR     VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT  +
-                        '/ZUTIL)                 SRCFILE(' *TCAT               +
-                        &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT                 +
-                        ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
-             CALL       PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
-
-/*      Link modules into a service program.                                  */
-
-             CRTSRVPGM  SRVPGM(&SRVLIB/ZLIB) +
-                          MODULE(&MODLIB/ADLER32     &MODLIB/COMPRESS    +
-                                 &MODLIB/CRC32       &MODLIB/DEFLATE     +
-                                 &MODLIB/GZIO        &MODLIB/INFBACK     +
-                                 &MODLIB/INFFAST     &MODLIB/INFLATE     +
-                                 &MODLIB/INFTREES    &MODLIB/TREES       +
-                                 &MODLIB/UNCOMPR     &MODLIB/ZUTIL)      +
-                          SRCFILE(&SRCLIB/&CTLFILE) SRCMBR(BNDSRC) +
-                          TEXT('ZLIB 1.2.3') TGTRLS(V4R4M0)
-
-             ENDPGM
diff --git a/old/as400/readme.txt b/old/as400/readme.txt
deleted file mode 100644 (file)
index beae13f..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-        ZLIB version 1.2.3 for AS400 installation instructions
-
-I) From an AS400 *SAVF file:
-
-1)      Unpacking archive to an AS400 save file
-
-On the AS400:
-
-_       Create the ZLIB AS400 library:
-
-        CRTLIB LIB(ZLIB) TYPE(PROD) TEXT('ZLIB compression API library')
-
-_       Create a work save file, for example:
-
-                CRTSAVF FILE(ZLIB/ZLIBSAVF)
-
-On a PC connected to the target AS400:
-
-_       Unpack the save file image to a PC file "ZLIBSAVF"
-_       Upload this file into the save file on the AS400, for example
-                using ftp in BINARY mode.
-
-
-2)      Populating the ZLIB AS400 source library
-
-On the AS400:
-
-_       Extract the saved objects into the ZLIB AS400 library using:
-
-RSTOBJ OBJ(*ALL) SAVLIB(ZLIB) DEV(*SAVF) SAVF(ZLIB/ZLIBSAVF) RSTLIB(ZLIB)
-
-
-3)      Customize installation:
-
-_       Edit CL member ZLIB/TOOLS(COMPILE) and change parameters if needed,
-                according to the comments.
-
-_       Compile this member with:
-
-        CRTCLPGM PGM(ZLIB/COMPILE) SRCFILE(ZLIB/TOOLS) SRCMBR(COMPILE)
-
-
-4)      Compile and generate the service program:
-
-_       This can now be done by executing:
-
-        CALL PGM(ZLIB/COMPILE)
-
-
-
-II) From the original source distribution:
-
-1)      On the AS400, create the source library:
-
-        CRTLIB LIB(ZLIB) TYPE(PROD) TEXT('ZLIB compression API library')
-
-2)      Create the source files:
-
-        CRTSRCPF FILE(ZLIB/SOURCES) RCDLEN(112) TEXT('ZLIB library modules')
-        CRTSRCPF FILE(ZLIB/H)       RCDLEN(112) TEXT('ZLIB library includes')
-        CRTSRCPF FILE(ZLIB/TOOLS)   RCDLEN(112) TEXT('ZLIB library control utilities')
-
-3)      From the machine hosting the distribution files, upload them (with
-                FTP in text mode, for example) according to the following table:
-
-    Original    AS400   AS400    AS400 AS400
-    file        file    member   type  description
-                SOURCES                Original ZLIB C subprogram sources
-    adler32.c           ADLER32  C     ZLIB - Compute the Adler-32 checksum of a dta strm
-    compress.c          COMPRESS C     ZLIB - Compress a memory buffer
-    crc32.c             CRC32    C     ZLIB - Compute the CRC-32 of a data stream
-    deflate.c           DEFLATE  C     ZLIB - Compress data using the deflation algorithm
-    gzio.c              GZIO     C     ZLIB - IO on .gz files
-    infback.c           INFBACK  C     ZLIB - Inflate using a callback interface
-    inffast.c           INFFAST  C     ZLIB - Fast proc. literals & length/distance pairs
-    inflate.c           INFLATE  C     ZLIB - Interface to inflate modules
-    inftrees.c          INFTREES C     ZLIB - Generate Huffman trees for efficient decode
-    trees.c             TREES    C     ZLIB - Output deflated data using Huffman coding
-    uncompr.c           UNCOMPR  C     ZLIB - Decompress a memory buffer
-    zutil.c             ZUTIL    C     ZLIB - Target dependent utility functions
-                H                      Original ZLIB C and ILE/RPG include files
-    crc32.h             CRC32    C     ZLIB - CRC32 tables
-    deflate.h           DEFLATE  C     ZLIB - Internal compression state
-    inffast.h           INFFAST  C     ZLIB - Header to use inffast.c
-    inffixed.h          INFFIXED C     ZLIB - Table for decoding fixed codes
-    inflate.h           INFLATE  C     ZLIB - Internal inflate state definitions
-    inftrees.h          INFTREES C     ZLIB - Header to use inftrees.c
-    trees.h             TREES    C     ZLIB - Created automatically with -DGEN_TREES_H
-    zconf.h             ZCONF    C     ZLIB - Compression library configuration
-    zlib.h              ZLIB     C     ZLIB - Compression library C user interface
-    as400/zlib.inc      ZLIB.INC RPGLE ZLIB - Compression library ILE RPG user interface
-    zutil.h             ZUTIL    C     ZLIB - Internal interface and configuration
-                TOOLS                  Building source software & AS/400 README
-    as400/bndsrc        BNDSRC         Entry point exportation list
-    as400/compile.clp   COMPILE  CLP   Compile sources & generate service program
-    as400/readme.txt    README   TXT   Installation instructions
-
-4)      Continue as in I)3).
-
-
-
-
-Notes:  For AS400 ILE RPG programmers, a /copy member defining the ZLIB
-                API prototypes for ILE RPG can be found in ZLIB/H(ZLIB.INC).
-                Please read comments in this member for more information.
-
-        Remember that most foreign textual data are ASCII coded: this
-                implementation does not handle conversion from/to ASCII, so
-                text data code conversions must be done explicitely.
-
-        Always open zipped files in binary mode.
diff --git a/old/as400/zlib.inc b/old/as400/zlib.inc
deleted file mode 100644 (file)
index a9a4f5c..0000000
+++ /dev/null
@@ -1,331 +0,0 @@
-      *  ZLIB.INC - Interface to the general purpose compression library
-      *
-      *  ILE RPG400 version by Patrick Monnerat, DATASPHERE.
-      *  Version 1.2.3.9
-      *
-      *
-      *  WARNING:
-      *     Procedures inflateInit(), inflateInit2(), deflateInit(),
-      *         deflateInit2() and inflateBackInit() need to be called with
-      *         two additional arguments:
-      *         the package version string and the stream control structure.
-      *         size. This is needed because RPG lacks some macro feature.
-      *         Call these procedures as:
-      *             inflateInit(...: ZLIB_VERSION: %size(z_stream))
-      *
-      /if not defined(ZLIB_H_)
-      /define ZLIB_H_
-      *
-      **************************************************************************
-      *                               Constants
-      **************************************************************************
-      *
-      *  Versioning information.
-      *
-     D ZLIB_VERSION    C                   '1.2.3.9'
-     D ZLIB_VERNUM     C                   X'1239'
-      *
-      *  Other equates.
-      *
-     D Z_NO_FLUSH      C                   0
-     D Z_SYNC_FLUSH    C                   2
-     D Z_FULL_FLUSH    C                   3
-     D Z_FINISH        C                   4
-     D Z_BLOCK         C                   5
-      *
-     D Z_OK            C                   0
-     D Z_STREAM_END    C                   1
-     D Z_NEED_DICT     C                   2
-     D Z_ERRNO         C                   -1
-     D Z_STREAM_ERROR  C                   -2
-     D Z_DATA_ERROR    C                   -3
-     D Z_MEM_ERROR     C                   -4
-     D Z_BUF_ERROR     C                   -5
-     DZ_VERSION_ERROR  C                   -6
-      *
-     D Z_NO_COMPRESSION...
-     D                 C                   0
-     D Z_BEST_SPEED    C                   1
-     D Z_BEST_COMPRESSION...
-     D                 C                   9
-     D Z_DEFAULT_COMPRESSION...
-     D                 C                   -1
-      *
-     D Z_FILTERED      C                   1
-     D Z_HUFFMAN_ONLY  C                   2
-     D Z_RLE           C                   3
-     D Z_DEFAULT_STRATEGY...
-     D                 C                   0
-      *
-     D Z_BINARY        C                   0
-     D Z_ASCII         C                   1
-     D Z_UNKNOWN       C                   2
-      *
-     D Z_DEFLATED      C                   8
-      *
-     D Z_NULL          C                   0
-      *
-      **************************************************************************
-      *                                 Types
-      **************************************************************************
-      *
-     D z_streamp       S               *                                        Stream struct ptr
-     D gzFile          S               *                                        File pointer
-     D z_off_t         S             10i 0                                      Stream offsets
-      *
-      **************************************************************************
-      *                               Structures
-      **************************************************************************
-      *
-      *  The GZIP encode/decode stream support structure.
-      *
-     D z_stream        DS                  align based(z_streamp)
-     D  zs_next_in                     *                                        Next input byte
-     D  zs_avail_in                  10U 0                                      Byte cnt at next_in
-     D  zs_total_in                  10U 0                                      Total bytes read
-     D  zs_next_out                    *                                        Output buffer ptr
-     D  zs_avail_out                 10U 0                                      Room left @ next_out
-     D  zs_total_out                 10U 0                                      Total bytes written
-     D  zs_msg                         *                                        Last errmsg or null
-     D  zs_state                       *                                        Internal state
-     D  zs_zalloc                      *   procptr                              Int. state allocator
-     D  zs_free                        *   procptr                              Int. state dealloc.
-     D  zs_opaque                      *                                        Private alloc. data
-     D  zs_data_type                 10i 0                                      ASC/BIN best guess
-     D  zs_adler                     10u 0                                      Uncompr. adler32 val
-     D                               10U 0                                      Reserved
-     D                               10U 0                                      Ptr. alignment
-      *
-      **************************************************************************
-      *                     Utility function prototypes
-      **************************************************************************
-      *
-     D compress        PR            10I 0 extproc('compress')
-     D  dest                      32767    options(*varsize)                    Destination buffer
-     D  destLen                      10U 0                                      Destination length
-     D  source                    32767    const options(*varsize)              Source buffer
-     D  sourceLen                    10u 0 value                                Source length
-      *
-     D compress2       PR            10I 0 extproc('compress2')
-     D  dest                      32767    options(*varsize)                    Destination buffer
-     D  destLen                      10U 0                                      Destination length
-     D  source                    32767    const options(*varsize)              Source buffer
-     D  sourceLen                    10U 0 value                                Source length
-     D  level                        10I 0 value                                Compression level
-      *
-     D compressBound   PR            10U 0 extproc('compressBound')
-     D  sourceLen                    10U 0 value
-      *
-     D uncompress      PR            10I 0 extproc('uncompress')
-     D  dest                      32767    options(*varsize)                    Destination buffer
-     D  destLen                      10U 0                                      Destination length
-     D  source                    32767    const options(*varsize)              Source buffer
-     D  sourceLen                    10U 0 value                                Source length
-      *
-     D gzopen          PR                  extproc('gzopen')
-     D                                     like(gzFile)
-     D  path                           *   value options(*string)               File pathname
-     D  mode                           *   value options(*string)               Open mode
-      *
-     D gzdopen         PR                  extproc('gzdopen')
-     D                                     like(gzFile)
-     D  fd                           10i 0 value                                File descriptor
-     D  mode                           *   value options(*string)               Open mode
-      *
-     D gzsetparams     PR            10I 0 extproc('gzsetparams')
-     D  file                               value like(gzFile)                   File pointer
-     D  level                        10I 0 value
-     D  strategy                     10i 0 value
-      *
-     D gzread          PR            10I 0 extproc('gzread')
-     D  file                               value like(gzFile)                   File pointer
-     D  buf                       32767    options(*varsize)                    Buffer
-     D  len                          10u 0 value                                Buffer length
-      *
-     D gzwrite         PR            10I 0 extproc('gzwrite')
-     D  file                               value like(gzFile)                   File pointer
-     D  buf                       32767    const options(*varsize)              Buffer
-     D  len                          10u 0 value                                Buffer length
-      *
-     D gzputs          PR            10I 0 extproc('gzputs')
-     D  file                               value like(gzFile)                   File pointer
-     D  s                              *   value options(*string)               String to output
-      *
-     D gzgets          PR              *   extproc('gzgets')
-     D  file                               value like(gzFile)                   File pointer
-     D  buf                       32767    options(*varsize)                    Read buffer
-     D  len                          10i 0 value                                Buffer length
-      *
-     D gzflush         PR            10i 0 extproc('gzflush')
-     D  file                               value like(gzFile)                   File pointer
-     D  flush                        10I 0 value                                Type of flush
-      *
-     D gzseek          PR                  extproc('gzseek')
-     D                                     like(z_off_t)
-     D  file                               value like(gzFile)                   File pointer
-     D  offset                             value like(z_off_t)                  Offset
-     D  whence                       10i 0 value                                Origin
-      *
-     D gzrewind        PR            10i 0 extproc('gzrewind')
-     D  file                               value like(gzFile)                   File pointer
-      *
-     D gztell          PR                  extproc('gztell')
-     D                                     like(z_off_t)
-     D  file                               value like(gzFile)                   File pointer
-      *
-     D gzeof           PR            10i 0 extproc('gzeof')
-     D  file                               value like(gzFile)                   File pointer
-      *
-     D gzclose         PR            10i 0 extproc('gzclose')
-     D  file                               value like(gzFile)                   File pointer
-      *
-     D gzerror         PR              *   extproc('gzerror')                   Error string
-     D  file                               value like(gzFile)                   File pointer
-     D  errnum                       10I 0                                      Error code
-      *
-     D gzclearerr      PR                  extproc('gzclearerr')
-     D  file                               value like(gzFile)                   File pointer
-      *
-      **************************************************************************
-      *                        Basic function prototypes
-      **************************************************************************
-      *
-     D zlibVersion     PR              *   extproc('zlibVersion')               Version string
-      *
-     D deflateInit     PR            10I 0 extproc('deflateInit_')              Init. compression
-     D  strm                               like(z_stream)                       Compression stream
-     D  level                        10I 0 value                                Compression level
-     D  version                        *   value options(*string)               Version string
-     D  stream_size                  10i 0 value                                Stream struct. size
-      *
-     D deflate         PR            10I 0 extproc('deflate')                   Compress data
-     D  strm                               like(z_stream)                       Compression stream
-     D  flush                        10I 0 value                                Flush type required
-      *
-     D deflateEnd      PR            10I 0 extproc('deflateEnd')                Termin. compression
-     D  strm                               like(z_stream)                       Compression stream
-      *
-     D inflateInit     PR            10I 0 extproc('inflateInit_')              Init. expansion
-     D  strm                               like(z_stream)                       Expansion stream
-     D  version                        *   value options(*string)               Version string
-     D  stream_size                  10i 0 value                                Stream struct. size
-      *
-     D inflate         PR            10I 0 extproc('inflate')                   Expand data
-     D  strm                               like(z_stream)                       Expansion stream
-     D  flush                        10I 0 value                                Flush type required
-      *
-     D inflateEnd      PR            10I 0 extproc('inflateEnd')                Termin. expansion
-     D  strm                               like(z_stream)                       Expansion stream
-      *
-      **************************************************************************
-      *                        Advanced function prototypes
-      **************************************************************************
-      *
-     D deflateInit2    PR            10I 0 extproc('deflateInit2_')             Init. compression
-     D  strm                               like(z_stream)                       Compression stream
-     D  level                        10I 0 value                                Compression level
-     D  method                       10I 0 value                                Compression method
-     D  windowBits                   10I 0 value                                log2(window size)
-     D  memLevel                     10I 0 value                                Mem/cmpress tradeoff
-     D  strategy                     10I 0 value                                Compression stategy
-     D  version                        *   value options(*string)               Version string
-     D  stream_size                  10i 0 value                                Stream struct. size
-      *
-     D deflateSetDictionary...
-     D                 PR            10I 0 extproc('deflateSetDictionary')      Init. dictionary
-     D  strm                               like(z_stream)                       Compression stream
-     D  dictionary                32767    const options(*varsize)              Dictionary bytes
-     D  dictLength                   10U 0 value                                Dictionary length
-      *
-     D deflateCopy     PR            10I 0 extproc('deflateCopy')               Compress strm 2 strm
-     D  dest                               like(z_stream)                       Destination stream
-     D  source                             like(z_stream)                       Source stream
-      *
-     D deflateReset    PR            10I 0 extproc('deflateReset')              End and init. stream
-     D  strm                               like(z_stream)                       Compression stream
-      *
-     D deflateParams   PR            10I 0 extproc('deflateParams')             Change level & strat
-     D  strm                               like(z_stream)                       Compression stream
-     D  level                        10I 0 value                                Compression level
-     D  strategy                     10I 0 value                                Compression stategy
-      *
-     D deflateBound    PR            10U 0 extproc('deflateBound')              Change level & strat
-     D  strm                               like(z_stream)                       Compression stream
-     D  sourcelen                    10U 0 value                                Compression level
-      *
-     D deflatePrime    PR            10I 0 extproc('deflatePrime')              Change level & strat
-     D  strm                               like(z_stream)                       Compression stream
-     D  bits                         10I 0 value                                Number of bits to insert
-     D  value                        10I 0 value                                Bits to insert
-      *
-     D inflateInit2    PR            10I 0 extproc('inflateInit2_')             Init. expansion
-     D  strm                               like(z_stream)                       Expansion stream
-     D  windowBits                   10I 0 value                                log2(window size)
-     D  version                        *   value options(*string)               Version string
-     D  stream_size                  10i 0 value                                Stream struct. size
-      *
-     D inflateSetDictionary...
-     D                 PR            10I 0 extproc('inflateSetDictionary')      Init. dictionary
-     D  strm                               like(z_stream)                       Expansion stream
-     D  dictionary                32767    const options(*varsize)              Dictionary bytes
-     D  dictLength                   10U 0 value                                Dictionary length
-      *
-     D inflateSync     PR            10I 0 extproc('inflateSync')               Sync. expansion
-     D  strm                               like(z_stream)                       Expansion stream
-      *
-     D inflateCopy     PR            10I 0 extproc('inflateCopy')
-     D  dest                               like(z_stream)                       Destination stream
-     D  source                             like(z_stream)                       Source stream
-      *
-     D inflateReset    PR            10I 0 extproc('inflateReset')              End and init. stream
-     D  strm                               like(z_stream)                       Expansion stream
-      *
-     D inflateBackInit...
-     D                 PR            10I 0 extproc('inflateBackInit_')
-     D  strm                               like(z_stream)                       Expansion stream
-     D  windowBits                   10I 0 value                                Log2(buffer size)
-     D  window                    32767    options(*varsize)                    Buffer
-     D  version                        *   value options(*string)               Version string
-     D  stream_size                  10i 0 value                                Stream struct. size
-      *
-     D inflateBack     PR            10I 0 extproc('inflateBack')
-     D  strm                               like(z_stream)                       Expansion stream
-     D  in                             *   value procptr                        Input function
-     D  in_desc                        *   value                                Input descriptor
-     D  out                            *   value procptr                        Output function
-     D  out_desc                       *   value                                Output descriptor
-      *
-     D inflateBackEnd  PR            10I 0 extproc('inflateBackEnd')
-     D  strm                               like(z_stream)                       Expansion stream
-      *
-     D zlibCompileFlags...
-     D                 PR            10U 0 extproc('zlibCompileFlags')
-      *
-      **************************************************************************
-      *                        Checksum function prototypes
-      **************************************************************************
-      *
-     D adler32         PR            10U 0 extproc('adler32')                   New checksum
-     D  adler                        10U 0 value                                Old checksum
-     D  buf                       32767    const options(*varsize)              Bytes to accumulate
-     D  len                          10U 0 value                                Buffer length
-      *
-     D crc32           PR            10U 0 extproc('crc32')                     New checksum
-     D  crc                          10U 0 value                                Old checksum
-     D  buf                       32767    const options(*varsize)              Bytes to accumulate
-     D  len                          10U 0 value                                Buffer length
-      *
-      **************************************************************************
-      *                     Miscellaneous function prototypes
-      **************************************************************************
-      *
-     D zError          PR              *   extproc('zError')                    Error string
-     D  err                          10I 0 value                                Error code
-      *
-     D inflateSyncPoint...
-     D                 PR            10I 0 extproc('inflateSyncPoint')
-     D  strm                               like(z_stream)                       Expansion stream
-      *
-     D get_crc_table   PR              *   extproc('get_crc_table')             Ptr to ulongs
-      *
-      /endif
index 2bc63b21ace314939b9e5f049b63427c05d0eae9..c75c4b3a5826547a8fe178a871d1fa3784deb288 100644 (file)
       <QPG:Files>
          <QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/>
          <QPG:Add file="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/>
-         <QPG:Add file="../libz.so.1.2.5" install="/opt/lib/" user="root:bin" permission="644"/>
-         <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.5"/>
-         <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.5"/>
-         <QPG:Add file="../libz.so.1.2.5" install="/opt/lib/" component="slib"/>
+         <QPG:Add file="../libz.so.1.2.5.1" install="/opt/lib/" user="root:bin" permission="644"/>
+         <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.5.1"/>
+         <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.5.1"/>
+         <QPG:Add file="../libz.so.1.2.5.1" install="/opt/lib/" component="slib"/>
       </QPG:Files>
 
       <QPG:PackageFilter>
@@ -63,7 +63,7 @@
             </QPM:ProductDescription>
 
             <QPM:ReleaseDescription>
-               <QPM:ReleaseVersion>1.2.5</QPM:ReleaseVersion>
+               <QPM:ReleaseVersion>1.2.5.1</QPM:ReleaseVersion>
                <QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
                <QPM:ReleaseStability>Stable</QPM:ReleaseStability>
                <QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor>
index 6b8f5428d44b2b427469ec7468771f12462f114c..b966b2bb12268b9419df2d24a913f728a7ab4cde 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" ?>
-<package name="zlib" version="1.2.5">
-    <library name="zlib" dlversion="1.2.5" dlname="z">
+<package name="zlib" version="1.2.5.1">
+    <library name="zlib" dlversion="1.2.5.1" dlname="z">
        <property name="description"> zip compression library </property>
        <property name="include-target-dir" value="$(@PACKAGE/install-includedir)" />
 
index 0a33bf6a704acbff20500a730b43f0ad38db793d..43825c0160c72849c45004963a9df1b8e25e8e2a 100644 (file)
@@ -25,7 +25,7 @@
 
 STATICLIB = libz.a
 SHAREDLIB = zlib1.dll
-IMPLIB    = libzdll.a
+IMPLIB    = libz.dll.a
 
 #
 # Set to 1 if shared object needs to be installed
@@ -59,7 +59,7 @@ CP = cp -fp
 INSTALL = $(CP)
 RM = rm -f
 
-prefix = /usr/local
+prefix ?= /usr/local
 exec_prefix = $(prefix)
 
 OBJS = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \
@@ -118,7 +118,7 @@ zlibrc.o: win32/zlib1.rc
 
 install: zlib.h zconf.h $(STATICLIB) $(IMPLIB)
        -@mkdir -p $(INCLUDE_PATH)
-       -@mkdir -p $(LIBRARY_PATH)
+       -@mkdir -p $(LIBRARY_PATH) $(LIBRARY_PATH)/pkgconfig
        -if [ "$(SHARED_MODE)" = "1" ]; then \
                mkdir -p $(BINARY_PATH); \
                $(INSTALL) $(SHAREDLIB) $(BINARY_PATH); \
@@ -127,6 +127,14 @@ install: zlib.h zconf.h $(STATICLIB) $(IMPLIB)
        -$(INSTALL) zlib.h $(INCLUDE_PATH)
        -$(INSTALL) zconf.h $(INCLUDE_PATH)
        -$(INSTALL) $(STATICLIB) $(LIBRARY_PATH)
+       sed \
+               -e 's|@prefix@|${prefix}|g' \
+               -e 's|@exec_prefix@|${exec_prefix}|g' \
+               -e 's|@libdir@|$(LIBRARY_PATH)|g' \
+               -e 's|@sharedlibdir@|$(LIBRARY_PATH)|g' \
+               -e 's|@includedir@|$(INCLUDE_PATH)|g' \
+               -e 's|@VERSION@|'`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' zlib.h`'|g' \
+               zlib.pc.in > $(LIBRARY_PATH)/pkgconfig/zlib.pc
 
 uninstall:
        -if [ "$(SHARED_MODE)" = "1" ]; then \
index fa10a1aa5f1118baded1163cf041ecc3cf937749..2714b45f9c024514d4c1543b6cd2bf367240eb31 100644 (file)
@@ -30,7 +30,7 @@ ARFLAGS = -nologo
 RCFLAGS = /dWIN32 /r
 
 OBJS = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj \
-       gzwrite.obj infback.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
+       gzwrite.obj infback.obj inflate.obj inftrees.obj inffast.obj trees.obj uncompr.obj zutil.obj
 OBJA =
 
 
index 03df8bf822aa1508de20b085e2893cbff99cab38..d2e09f214431c50b533948c0d6b0ff3e00b2a43a 100644 (file)
@@ -15,6 +15,7 @@ EXPORTS
     deflateParams
     deflateTune
     deflateBound
+    deflatePending
     deflatePrime
     deflateSetHeader
     inflateSetDictionary
diff --git a/zconf.h b/zconf.h
index 02ce56c4313b7e7490c0416ed52bfd9c65694553..1c06556ef6e6031858a1d81c50354f776436c3d9 100644 (file)
--- a/zconf.h
+++ b/zconf.h
@@ -1,5 +1,5 @@
 /* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-2010 Jean-loup Gailly.
+ * Copyright (C) 1995-2011 Jean-loup Gailly.
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
@@ -15,6 +15,7 @@
  * this permanently in zconf.h using "./configure --zprefix".
  */
 #ifdef Z_PREFIX     /* may be set to #if 1 by ./configure */
+#  define Z_PREFIX_SET
 
 /* all linked symbols */
 #  define _dist_code            z__dist_code
@@ -40,6 +41,7 @@
 #  define deflateInit2_         z_deflateInit2_
 #  define deflateInit_          z_deflateInit_
 #  define deflateParams         z_deflateParams
+#  define deflatePending        z_deflatePending
 #  define deflatePrime          z_deflatePrime
 #  define deflateReset          z_deflateReset
 #  define deflateSetDictionary  z_deflateSetDictionary
 #  endif
 #endif
 
+#ifndef ON /* function prototypes for stdarg */
+#  if defined(STDC) || defined(Z_HAVE_STDARG_H)
+#    define ON(args)  args
+#  else
+#    define ON(args)  ()
+#  endif
+#endif
+
 /* The following definitions for FAR are needed only for MSDOS mixed
  * model programming (small or medium model with some far allocations).
  * This was tested only with MSC; for other MSDOS compilers you may have
@@ -360,6 +370,10 @@ typedef uLong FAR uLongf;
 #  define Z_HAVE_UNISTD_H
 #endif
 
+#ifdef HAVE_STDARG_H    /* may be set to #if 1 by ./configure */
+#  define Z_HAVE_STDARG_H
+#endif
+
 #ifdef STDC
 #  include <sys/types.h>    /* for off_t */
 #endif
@@ -374,7 +388,11 @@ typedef uLong FAR uLongf;
 #  undef _LARGEFILE64_SOURCE
 #endif
 
-#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
+#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
+#  define Z_LARGE
+#endif
+
+#if defined(Z_HAVE_UNISTD_H) || defined(Z_LARGE)
 #  include <unistd.h>       /* for SEEK_* and off_t */
 #  ifdef VMS
 #    include <unixio.h>     /* for off_t */
index a2f71b1f32e20339cc4ff1e22256bc18d57c172b..4a5d9eace96878902f163e37e174361b6a51c3e0 100644 (file)
@@ -1,5 +1,5 @@
 /* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-2010 Jean-loup Gailly.
+ * Copyright (C) 1995-2011 Jean-loup Gailly.
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
@@ -17,6 +17,7 @@
  * this permanently in zconf.h using "./configure --zprefix".
  */
 #ifdef Z_PREFIX     /* may be set to #if 1 by ./configure */
+#  define Z_PREFIX_SET
 
 /* all linked symbols */
 #  define _dist_code            z__dist_code
@@ -42,6 +43,7 @@
 #  define deflateInit2_         z_deflateInit2_
 #  define deflateInit_          z_deflateInit_
 #  define deflateParams         z_deflateParams
+#  define deflatePending        z_deflatePending
 #  define deflatePrime          z_deflatePrime
 #  define deflateReset          z_deflateReset
 #  define deflateSetDictionary  z_deflateSetDictionary
 #  endif
 #endif
 
+#ifndef ON /* function prototypes for stdarg */
+#  if defined(STDC) || defined(Z_HAVE_STDARG_H)
+#    define ON(args)  args
+#  else
+#    define ON(args)  ()
+#  endif
+#endif
+
 /* The following definitions for FAR are needed only for MSDOS mixed
  * model programming (small or medium model with some far allocations).
  * This was tested only with MSC; for other MSDOS compilers you may have
@@ -362,6 +372,10 @@ typedef uLong FAR uLongf;
 #  define Z_HAVE_UNISTD_H
 #endif
 
+#ifdef HAVE_STDARG_H    /* may be set to #if 1 by ./configure */
+#  define Z_HAVE_STDARG_H
+#endif
+
 #ifdef STDC
 #  include <sys/types.h>    /* for off_t */
 #endif
@@ -376,7 +390,11 @@ typedef uLong FAR uLongf;
 #  undef _LARGEFILE64_SOURCE
 #endif
 
-#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
+#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
+#  define Z_LARGE
+#endif
+
+#if defined(Z_HAVE_UNISTD_H) || defined(Z_LARGE)
 #  include <unistd.h>       /* for SEEK_* and off_t */
 #  ifdef VMS
 #    include <unixio.h>     /* for off_t */
index 02ce56c4313b7e7490c0416ed52bfd9c65694553..1c06556ef6e6031858a1d81c50354f776436c3d9 100644 (file)
@@ -1,5 +1,5 @@
 /* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-2010 Jean-loup Gailly.
+ * Copyright (C) 1995-2011 Jean-loup Gailly.
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
@@ -15,6 +15,7 @@
  * this permanently in zconf.h using "./configure --zprefix".
  */
 #ifdef Z_PREFIX     /* may be set to #if 1 by ./configure */
+#  define Z_PREFIX_SET
 
 /* all linked symbols */
 #  define _dist_code            z__dist_code
@@ -40,6 +41,7 @@
 #  define deflateInit2_         z_deflateInit2_
 #  define deflateInit_          z_deflateInit_
 #  define deflateParams         z_deflateParams
+#  define deflatePending        z_deflatePending
 #  define deflatePrime          z_deflatePrime
 #  define deflateReset          z_deflateReset
 #  define deflateSetDictionary  z_deflateSetDictionary
 #  endif
 #endif
 
+#ifndef ON /* function prototypes for stdarg */
+#  if defined(STDC) || defined(Z_HAVE_STDARG_H)
+#    define ON(args)  args
+#  else
+#    define ON(args)  ()
+#  endif
+#endif
+
 /* The following definitions for FAR are needed only for MSDOS mixed
  * model programming (small or medium model with some far allocations).
  * This was tested only with MSC; for other MSDOS compilers you may have
@@ -360,6 +370,10 @@ typedef uLong FAR uLongf;
 #  define Z_HAVE_UNISTD_H
 #endif
 
+#ifdef HAVE_STDARG_H    /* may be set to #if 1 by ./configure */
+#  define Z_HAVE_STDARG_H
+#endif
+
 #ifdef STDC
 #  include <sys/types.h>    /* for off_t */
 #endif
@@ -374,7 +388,11 @@ typedef uLong FAR uLongf;
 #  undef _LARGEFILE64_SOURCE
 #endif
 
-#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
+#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
+#  define Z_LARGE
+#endif
+
+#if defined(Z_HAVE_UNISTD_H) || defined(Z_LARGE)
 #  include <unistd.h>       /* for SEEK_* and off_t */
 #  ifdef VMS
 #    include <unixio.h>     /* for off_t */
diff --git a/zlib.3 b/zlib.3
index 27adc4cd10a35713943497e5c4c91b09e70e74ef..66100beee287331377b7f34da37a4fde0795e1cb 100644 (file)
--- a/zlib.3
+++ b/zlib.3
@@ -1,4 +1,4 @@
-.TH ZLIB 3 "19 Apr 2010"
+.TH ZLIB 3 "10 Sep 2011"
 .SH NAME
 zlib \- compression/decompression library
 .SH SYNOPSIS
@@ -95,11 +95,11 @@ http://zlib.net/
 The data format used by the zlib library is described by RFC
 (Request for Comments) 1950 to 1952 in the files:
 .IP
-http://www.ietf.org/rfc/rfc1950.txt (for the zlib header and trailer format)
+http://tools.ietf.org/html/rfc1950 (for the zlib header and trailer format)
 .br
-http://www.ietf.org/rfc/rfc1951.txt (for the deflate compressed data format)
+http://tools.ietf.org/html/rfc1951 (for the deflate compressed data format)
 .br
-http://www.ietf.org/rfc/rfc1952.txt (for the gzip header and trailer format)
+http://tools.ietf.org/html/rfc1952 (for the gzip header and trailer format)
 .LP
 Mark Nelson wrote an article about
 .I zlib
@@ -125,8 +125,8 @@ before asking for help.
 Send questions and/or comments to zlib@gzip.org,
 or (for the Windows DLL version) to Gilles Vollant (info@winimage.com).
 .SH AUTHORS
-Version 1.2.5
-Copyright (C) 1995-2010 Jean-loup Gailly (jloup@gzip.org)
+Version 1.2.5.1
+Copyright (C) 1995-2011 Jean-loup Gailly (jloup@gzip.org)
 and Mark Adler (madler@alumni.caltech.edu).
 .LP
 This software is provided "as-is,"
index 9f8a2c399992acaf8cd368a52cd2bb98058bbe20..b25379797b2a3eb2a70b91467763cf334bb41e3d 100644 (file)
Binary files a/zlib.3.pdf and b/zlib.3.pdf differ
diff --git a/zlib.h b/zlib.h
index bfbba83e8ee0902abe8bcbfab8bdebbbc07dca69..7c0a2d887daa7d0000f7893b1e09e0f0b0bd3354 100644 (file)
--- a/zlib.h
+++ b/zlib.h
@@ -1,7 +1,7 @@
 /* zlib.h -- interface of the 'zlib' general purpose compression library
-  version 1.2.5, April 19th, 2010
+  version 1.2.5.1, September 10th, 2011
 
-  Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
+  Copyright (C) 1995-2011 Jean-loup Gailly and Mark Adler
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -24,8 +24,8 @@
 
 
   The data format used by the zlib library is described by RFCs (Request for
-  Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
-  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
+  Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950
+  (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
 */
 
 #ifndef ZLIB_H
 extern "C" {
 #endif
 
-#define ZLIB_VERSION "1.2.5"
-#define ZLIB_VERNUM 0x1250
+#define ZLIB_VERSION "1.2.5.1"
+#define ZLIB_VERNUM 0x1251
 #define ZLIB_VER_MAJOR 1
 #define ZLIB_VER_MINOR 2
 #define ZLIB_VER_REVISION 5
-#define ZLIB_VER_SUBREVISION 0
+#define ZLIB_VER_SUBREVISION 1
 
 /*
     The 'zlib' compression library provides in-memory compression and
@@ -85,11 +85,11 @@ struct internal_state;
 typedef struct z_stream_s {
     Bytef    *next_in;  /* next input byte */
     uInt     avail_in;  /* number of bytes available at next_in */
-    uLong    total_in;  /* total nb of input bytes read so far */
+    uLong    total_in;  /* total number of input bytes read so far */
 
     Bytef    *next_out; /* next output byte should be put there */
     uInt     avail_out; /* remaining free space at next_out */
-    uLong    total_out; /* total nb of bytes output so far */
+    uLong    total_out; /* total number of bytes output so far */
 
     char     *msg;      /* last error message, NULL if no error */
     struct internal_state FAR *state; /* not visible by applications */
@@ -327,8 +327,9 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
 
     Z_FINISH can be used immediately after deflateInit if all the compression
   is to be done in a single step.  In this case, avail_out must be at least the
-  value returned by deflateBound (see below).  If deflate does not return
-  Z_STREAM_END, then it must be called again as described above.
+  value returned by deflateBound (see below).  Then deflate is guaranteed to
+  return Z_STREAM_END.  If not enough output space is provided, deflate will
+  not return Z_STREAM_END, and it must be called again as described above.
 
     deflate() sets strm->adler to the adler32 checksum of all input read
   so far (that is, total_in bytes).
@@ -688,8 +689,27 @@ ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
    deflation of sourceLen bytes.  It must be called after deflateInit() or
    deflateInit2(), and after deflateSetHeader(), if used.  This would be used
    to allocate an output buffer for deflation in a single pass, and so would be
-   called before deflate().
-*/
+   called before deflate().  If that first deflate() call is provided the
+   sourceLen input bytes, an output buffer allocated to the size returned by
+   deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed
+   to return Z_STREAM_END.  Note that it is possible for the compressed size to
+   be larger than the value returned by deflateBound() if flush options other
+   than Z_FINISH or Z_NO_FLUSH are used.
+*/
+    
+ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm,
+                                       unsigned *pending,
+                                       int *bits));
+/*
+     deflatePending() returns the number of bytes and bits of output that have
+   been generated, but not yet provided in the available output.  The bytes not
+   provided would be due to the available output space having being consumed.
+   The number of bits of output not provided are between 0 and 7, where they
+   await more bits to join them in order to fill out a full byte.
+     deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent.
+ */
 
 ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
                                      int bits,
@@ -805,17 +825,21 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
 
 ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
 /*
-     Skips invalid compressed data until a full flush point (see above the
-   description of deflate with Z_FULL_FLUSH) can be found, or until all
+     Skips invalid compressed data until a possible full flush point (see above
+   for the description of deflate with Z_FULL_FLUSH) can be found, or until all
    available input is skipped.  No output is provided.
 
-     inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
-   if no more input was provided, Z_DATA_ERROR if no flush point has been
-   found, or Z_STREAM_ERROR if the stream structure was inconsistent.  In the
-   success case, the application may save the current current value of total_in
-   which indicates where valid compressed data was found.  In the error case,
-   the application may repeatedly call inflateSync, providing more input each
-   time, until success or end of the input data.
+     inflateSync searches for a 00 00 FF FF pattern in the compressed data.
+   All full flush points have this pattern, but not all occurences of this
+   pattern are full flush points.
+
+     inflateSync returns Z_OK if a possible full flush point has been found,
+   Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point
+   has been found, or Z_STREAM_ERROR if the stream structure was inconsistent.
+   In the success case, the application may save the current current value of
+   total_in which indicates where valid compressed data was found.  In the
+   error case, the application may repeatedly call inflateSync, providing more
+   input each time, until success or end of the input data.
 */
 
 ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
@@ -962,7 +986,7 @@ ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
      See inflateBack() for the usage of these routines.
 
      inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
-   the paramaters are invalid, Z_MEM_ERROR if the internal state could not be
+   the parameters are invalid, Z_MEM_ERROR if the internal state could not be
    allocated, or Z_VERSION_ERROR if the version of the library does not match
    the version of the header file.
 */
@@ -1256,7 +1280,7 @@ ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
    error.
 */
 
-ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
+ZEXTERN int ZEXPORTVA gzprintf ON((gzFile file, const char *format, ...));
 /*
      Converts, formats, and writes the arguments to the compressed file under
    control of the format string, as in fprintf.  gzprintf returns the number of
@@ -1492,7 +1516,9 @@ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
      Combine two Adler-32 checksums into one.  For two sequences of bytes, seq1
    and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
    each, adler1 and adler2.  adler32_combine() returns the Adler-32 checksum of
-   seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.
+   seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.  Note
+   that the z_off_t type (like off_t) is a signed integer.  If len2 is
+   negative, the result has no meaning or utility.
 */
 
 ZEXTERN uLong ZEXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));
@@ -1544,17 +1570,18 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
                                          const char *version,
                                          int stream_size));
 #define deflateInit(strm, level) \
-        deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))
+        deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
 #define inflateInit(strm) \
-        inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))
+        inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
 #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
         deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
-                      (strategy),           ZLIB_VERSION, sizeof(z_stream))
+                      (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
 #define inflateInit2(strm, windowBits) \
-        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
+        inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
+                      (int)sizeof(z_stream))
 #define inflateBackInit(strm, windowBits, window) \
         inflateBackInit_((strm), (windowBits), (window), \
-                                            ZLIB_VERSION, sizeof(z_stream))
+                      ZLIB_VERSION, (int)sizeof(z_stream))
 
 /* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
  * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
@@ -1572,13 +1599,22 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
 #endif
 
 #if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0
-#  define gzopen gzopen64
-#  define gzseek gzseek64
-#  define gztell gztell64
-#  define gzoffset gzoffset64
-#  define adler32_combine adler32_combine64
-#  define crc32_combine crc32_combine64
-#  ifdef _LARGEFILE64_SOURCE
+#  ifdef Z_PREFIX_SET
+#    define z_gzopen z_gzopen64
+#    define z_gzseek z_gzseek64
+#    define z_gztell z_gztell64
+#    define z_gzoffset z_gzoffset64
+#    define z_adler32_combine z_adler32_combine64
+#    define z_crc32_combine z_crc32_combine64
+#  else
+#    define gzopen gzopen64
+#    define gzseek gzseek64
+#    define gztell gztell64
+#    define gzoffset gzoffset64
+#    define adler32_combine adler32_combine64
+#    define crc32_combine crc32_combine64
+#  endif
+#  ifndef _LARGEFILE64_SOURCE
      ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
      ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
      ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
index f282d3624a5128921937e3f8cc197ad1f5a0c5a1..65bcf1703347be4563623dcbb91dfc165aeed66e 100644 (file)
--- a/zlib.map
+++ b/zlib.map
@@ -66,3 +66,7 @@ ZLIB_1.2.3.5 {
     gzclose_r;
     gzclose_w;
 } ZLIB_1.2.3.4;
+
+ZLIB_1.2.5.1 {
+    deflatePending;
+} ZLIB_1.2.5;
diff --git a/zutil.c b/zutil.c
index 898ed345b0e3ef23ce5aaba1eb6307b5b113d6b1..2ccee8118554703723fe8dfde87b91b026eedd88 100644 (file)
--- a/zutil.c
+++ b/zutil.c
@@ -1,5 +1,5 @@
 /* zutil.c -- target dependent utility functions for the compression library
- * Copyright (C) 1995-2005, 2010 Jean-loup Gailly.
+ * Copyright (C) 1995-2005, 2010, 2011 Jean-loup Gailly.
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
@@ -85,7 +85,7 @@ uLong ZEXPORT zlibCompileFlags()
 #ifdef FASTEST
     flags += 1L << 21;
 #endif
-#ifdef STDC
+#if defined(STDC) || defined(Z_HAVE_STDARG_H)
 #  ifdef NO_vsnprintf
         flags += 1L << 25;
 #    ifdef HAS_vsprintf_void