diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:23:14 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:23:14 -0700 |
commit | a2506218cd8c32416d0d15260834f3c23d910fc8 (patch) | |
tree | 25bbd63d92473c8ae02a27cce3fc7c04a6aba64a | |
parent | b97ec631c6f7dd9cff2e3caf3b38e70b006e1b2d (diff) | |
download | zlib-1.2.0.8.tar.gz zlib-1.2.0.8.tar.bz2 zlib-1.2.0.8.zip |
zlib 1.2.0.8v1.2.0.8
-rw-r--r-- | ChangeLog | 21 | ||||
-rw-r--r-- | Makefile | 20 | ||||
-rw-r--r-- | Makefile.in | 20 | ||||
-rw-r--r-- | README | 7 | ||||
-rw-r--r-- | adler32.c | 31 | ||||
-rw-r--r-- | as400/bndsrc | 132 | ||||
-rw-r--r-- | as400/compile.clp | 123 | ||||
-rw-r--r-- | as400/readme.txt | 111 | ||||
-rw-r--r-- | as400/zlib.inc | 327 | ||||
-rwxr-xr-x | configure | 48 | ||||
-rw-r--r-- | contrib/README.contrib | 50 | ||||
-rw-r--r-- | contrib/ada/zlib-thin.ads | 13 | ||||
-rw-r--r-- | contrib/delphi/ZLib.pas | 2 | ||||
-rw-r--r-- | contrib/gzappend/gzappend.c | 500 | ||||
-rw-r--r-- | contrib/infback9/inftree9.c | 4 | ||||
-rw-r--r-- | contrib/pascal/zlibpas.pas | 3 | ||||
-rw-r--r-- | contrib/visual-basic.txt | 91 | ||||
-rw-r--r-- | contrib/vstudio/vc7/zlibvc.def | 3 | ||||
-rw-r--r-- | deflate.c | 14 | ||||
-rw-r--r-- | gzio.c | 8 | ||||
-rw-r--r-- | inflate.c | 6 | ||||
-rw-r--r-- | inftrees.c | 4 | ||||
-rw-r--r-- | minigzip.c | 2 | ||||
-rw-r--r-- | qnx/package.qpg | 10 | ||||
-rw-r--r-- | win32/DLL_FAQ.txt | 21 | ||||
-rw-r--r-- | win32/zlib.def | 1 | ||||
-rw-r--r-- | win32/zlib1.rc | 8 | ||||
-rw-r--r-- | zconf.h | 15 | ||||
-rw-r--r-- | zconf.in.h | 15 | ||||
-rw-r--r-- | zlib.3 | 4 | ||||
-rw-r--r-- | zlib.h | 35 |
31 files changed, 1530 insertions, 119 deletions
@@ -1,6 +1,25 @@ | |||
1 | 1 | ||
2 | ChangeLog file for zlib | 2 | ChangeLog file for zlib |
3 | 3 | ||
4 | Changes in 1.2.0.8 (4 November 2003) | ||
5 | - Update version in contrib/delphi/ZLib.pas and contrib/pascal/zlibpas.pas | ||
6 | - Add experimental NO_DIVIDE #define in adler32.c | ||
7 | - Possibly faster on some processors (let me know if it is) | ||
8 | - Correct Z_BLOCK to not return on first inflate call if no wrap | ||
9 | - Fix strm->data_type on inflate() return to correctly indicate EOB | ||
10 | - Add deflatePrime() function for appending in the middle of a byte | ||
11 | - Add contrib/gzappend for an example of appending to a stream | ||
12 | - Update win32/DLL_FAQ.txt [Truta] | ||
13 | - Delete Turbo C comment in README [Truta] | ||
14 | - Improve some indentation in zconf.h [Truta] | ||
15 | - Fix infinite loop on bad input in configure script [Church] | ||
16 | - Fix gzeof() for concatenated gzip files [Johnson] | ||
17 | - Add example to contrib/visual-basic.txt [Michael B.] | ||
18 | - Add -p to mkdir's in Makefile.in [vda] | ||
19 | - Fix configure to properly detect presence or lack of printf functions | ||
20 | - Add AS400 support [Monnerat] | ||
21 | - Added a little Cygwin support [Wilson] | ||
22 | |||
4 | Changes in 1.2.0.7 (21 September 2003) | 23 | Changes in 1.2.0.7 (21 September 2003) |
5 | - Correct some debug formats in contrib/infback9 | 24 | - Correct some debug formats in contrib/infback9 |
6 | - Cast a type in a debug statement in trees.c | 25 | - Cast a type in a debug statement in trees.c |
@@ -10,7 +29,7 @@ Changes in 1.2.0.7 (21 September 2003) | |||
10 | - Remove some directories in old that have been updated to 1.2 | 29 | - Remove some directories in old that have been updated to 1.2 |
11 | - Add dylib building for Mac OS X in configure and Makefile.in | 30 | - Add dylib building for Mac OS X in configure and Makefile.in |
12 | - Remove old distribution stuff from Makefile | 31 | - Remove old distribution stuff from Makefile |
13 | - Update README to point for DLL_FAQ.txt, and add comment on Mac OS X | 32 | - Update README to point to DLL_FAQ.txt, and add comment on Mac OS X |
14 | - Update links in README | 33 | - Update links in README |
15 | 34 | ||
16 | Changes in 1.2.0.6 (13 September 2003) | 35 | Changes in 1.2.0.6 (13 September 2003) |
@@ -30,13 +30,14 @@ CPP=$(CC) -E | |||
30 | 30 | ||
31 | LIBS=libz.a | 31 | LIBS=libz.a |
32 | SHAREDLIB=libz.so | 32 | SHAREDLIB=libz.so |
33 | SHAREDLIBV=libz.so.1.2.0.7 | 33 | SHAREDLIBV=libz.so.1.2.0.8 |
34 | SHAREDLIBM=libz.so.1 | 34 | SHAREDLIBM=libz.so.1 |
35 | 35 | ||
36 | AR=ar rc | 36 | AR=ar rc |
37 | RANLIB=ranlib | 37 | RANLIB=ranlib |
38 | TAR=tar | 38 | TAR=tar |
39 | SHELL=/bin/sh | 39 | SHELL=/bin/sh |
40 | EXE= | ||
40 | 41 | ||
41 | prefix = /usr/local | 42 | prefix = /usr/local |
42 | exec_prefix = ${prefix} | 43 | exec_prefix = ${prefix} |
@@ -53,7 +54,7 @@ OBJA = | |||
53 | 54 | ||
54 | TEST_OBJS = example.o minigzip.o | 55 | TEST_OBJS = example.o minigzip.o |
55 | 56 | ||
56 | all: example minigzip | 57 | all: example$(EXE) minigzip$(EXE) |
57 | 58 | ||
58 | check: test | 59 | check: test |
59 | test: all | 60 | test: all |
@@ -82,17 +83,17 @@ $(SHAREDLIBV): $(OBJS) | |||
82 | ln -s $@ $(SHAREDLIB) | 83 | ln -s $@ $(SHAREDLIB) |
83 | ln -s $@ $(SHAREDLIBM) | 84 | ln -s $@ $(SHAREDLIBM) |
84 | 85 | ||
85 | example: example.o $(LIBS) | 86 | example$(EXE): example.o $(LIBS) |
86 | $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) | 87 | $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) |
87 | 88 | ||
88 | minigzip: minigzip.o $(LIBS) | 89 | minigzip$(EXE): minigzip.o $(LIBS) |
89 | $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) | 90 | $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) |
90 | 91 | ||
91 | install: $(LIBS) | 92 | install: $(LIBS) |
92 | -@if [ ! -d $(exec_prefix) ]; then mkdir $(exec_prefix); fi | 93 | -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi |
93 | -@if [ ! -d $(includedir) ]; then mkdir $(includedir); fi | 94 | -@if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi |
94 | -@if [ ! -d $(libdir) ]; then mkdir $(libdir); fi | 95 | -@if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi |
95 | -@if [ ! -d $(man3dir) ]; then mkdir $(man3dir); fi | 96 | -@if [ ! -d $(man3dir) ]; then mkdir -p $(man3dir); fi |
96 | cp zlib.h zconf.h $(includedir) | 97 | cp zlib.h zconf.h $(includedir) |
97 | chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h | 98 | chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h |
98 | cp $(LIBS) $(libdir) | 99 | cp $(LIBS) $(libdir) |
@@ -119,7 +120,8 @@ uninstall: | |||
119 | 120 | ||
120 | mostlyclean: clean | 121 | mostlyclean: clean |
121 | clean: | 122 | clean: |
122 | rm -f *.o *~ example minigzip libz.* foo.gz so_locations \ | 123 | rm -f *.o *~ example$(EXE) minigzip$(EXE) \ |
124 | libz.* foo.gz so_locations \ | ||
123 | _match.s maketree contrib/infback9/*.o | 125 | _match.s maketree contrib/infback9/*.o |
124 | 126 | ||
125 | maintainer-clean: distclean | 127 | maintainer-clean: distclean |
diff --git a/Makefile.in b/Makefile.in index 039280d..fa4f588 100644 --- a/Makefile.in +++ b/Makefile.in | |||
@@ -30,13 +30,14 @@ CPP=$(CC) -E | |||
30 | 30 | ||
31 | LIBS=libz.a | 31 | LIBS=libz.a |
32 | SHAREDLIB=libz.so | 32 | SHAREDLIB=libz.so |
33 | SHAREDLIBV=libz.so.1.2.0.7 | 33 | SHAREDLIBV=libz.so.1.2.0.8 |
34 | SHAREDLIBM=libz.so.1 | 34 | SHAREDLIBM=libz.so.1 |
35 | 35 | ||
36 | AR=ar rc | 36 | AR=ar rc |
37 | RANLIB=ranlib | 37 | RANLIB=ranlib |
38 | TAR=tar | 38 | TAR=tar |
39 | SHELL=/bin/sh | 39 | SHELL=/bin/sh |
40 | EXE= | ||
40 | 41 | ||
41 | prefix = /usr/local | 42 | prefix = /usr/local |
42 | exec_prefix = ${prefix} | 43 | exec_prefix = ${prefix} |
@@ -53,7 +54,7 @@ OBJA = | |||
53 | 54 | ||
54 | TEST_OBJS = example.o minigzip.o | 55 | TEST_OBJS = example.o minigzip.o |
55 | 56 | ||
56 | all: example minigzip | 57 | all: example$(EXE) minigzip$(EXE) |
57 | 58 | ||
58 | check: test | 59 | check: test |
59 | test: all | 60 | test: all |
@@ -82,17 +83,17 @@ $(SHAREDLIBV): $(OBJS) | |||
82 | ln -s $@ $(SHAREDLIB) | 83 | ln -s $@ $(SHAREDLIB) |
83 | ln -s $@ $(SHAREDLIBM) | 84 | ln -s $@ $(SHAREDLIBM) |
84 | 85 | ||
85 | example: example.o $(LIBS) | 86 | example$(EXE): example.o $(LIBS) |
86 | $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) | 87 | $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) |
87 | 88 | ||
88 | minigzip: minigzip.o $(LIBS) | 89 | minigzip$(EXE): minigzip.o $(LIBS) |
89 | $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) | 90 | $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) |
90 | 91 | ||
91 | install: $(LIBS) | 92 | install: $(LIBS) |
92 | -@if [ ! -d $(exec_prefix) ]; then mkdir $(exec_prefix); fi | 93 | -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi |
93 | -@if [ ! -d $(includedir) ]; then mkdir $(includedir); fi | 94 | -@if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi |
94 | -@if [ ! -d $(libdir) ]; then mkdir $(libdir); fi | 95 | -@if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi |
95 | -@if [ ! -d $(man3dir) ]; then mkdir $(man3dir); fi | 96 | -@if [ ! -d $(man3dir) ]; then mkdir -p $(man3dir); fi |
96 | cp zlib.h zconf.h $(includedir) | 97 | cp zlib.h zconf.h $(includedir) |
97 | chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h | 98 | chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h |
98 | cp $(LIBS) $(libdir) | 99 | cp $(LIBS) $(libdir) |
@@ -119,7 +120,8 @@ uninstall: | |||
119 | 120 | ||
120 | mostlyclean: clean | 121 | mostlyclean: clean |
121 | clean: | 122 | clean: |
122 | rm -f *.o *~ example minigzip libz.* foo.gz so_locations \ | 123 | rm -f *.o *~ example$(EXE) minigzip$(EXE) \ |
124 | libz.* foo.gz so_locations \ | ||
123 | _match.s maketree contrib/infback9/*.o | 125 | _match.s maketree contrib/infback9/*.o |
124 | 126 | ||
125 | maintainer-clean: distclean | 127 | maintainer-clean: distclean |
@@ -1,6 +1,6 @@ | |||
1 | ZLIB DATA COMPRESSION LIBRARY | 1 | ZLIB DATA COMPRESSION LIBRARY |
2 | 2 | ||
3 | zlib 1.2.0.7 is a general purpose data compression library. All the code is | 3 | zlib 1.2.0.8 is a general purpose data compression library. All the code is |
4 | thread safe. The data format used by the zlib library is described by RFCs | 4 | thread safe. The data format used by the zlib library is described by RFCs |
5 | (Request for Comments) 1950 to 1952 in the files | 5 | (Request for Comments) 1950 to 1952 in the files |
6 | http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) | 6 | http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) |
@@ -34,7 +34,7 @@ Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997 | |||
34 | issue of Dr. Dobb's Journal; a copy of the article is available in | 34 | issue of Dr. Dobb's Journal; a copy of the article is available in |
35 | http://dogma.net/markn/articles/zlibtool/zlibtool.htm | 35 | http://dogma.net/markn/articles/zlibtool/zlibtool.htm |
36 | 36 | ||
37 | The changes made in version 1.2.0.7 are documented in the file ChangeLog. | 37 | The changes made in version 1.2.0.8 are documented in the file ChangeLog. |
38 | 38 | ||
39 | Unsupported third party contributions are provided in directory "contrib". | 39 | Unsupported third party contributions are provided in directory "contrib". |
40 | 40 | ||
@@ -77,9 +77,6 @@ Notes for some targets: | |||
77 | 77 | ||
78 | - gzdopen is not supported on RISCOS, BEOS and by some Mac compilers. | 78 | - gzdopen is not supported on RISCOS, BEOS and by some Mac compilers. |
79 | 79 | ||
80 | - For Turbo C the small model is supported only with reduced performance to | ||
81 | avoid any far allocation; it was tested with -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3 | ||
82 | |||
83 | - For PalmOs, see http://palmzlib.sourceforge.net/ | 80 | - For PalmOs, see http://palmzlib.sourceforge.net/ |
84 | 81 | ||
85 | - When building a shared, i.e. dynamic library on Mac OS X, the library must be | 82 | - When building a shared, i.e. dynamic library on Mac OS X, the library must be |
@@ -8,7 +8,7 @@ | |||
8 | #define ZLIB_INTERNAL | 8 | #define ZLIB_INTERNAL |
9 | #include "zlib.h" | 9 | #include "zlib.h" |
10 | 10 | ||
11 | #define BASE 65521L /* largest prime smaller than 65536 */ | 11 | #define BASE 65521UL /* largest prime smaller than 65536 */ |
12 | #define NMAX 5552 | 12 | #define NMAX 5552 |
13 | /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ | 13 | /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ |
14 | 14 | ||
@@ -18,6 +18,31 @@ | |||
18 | #define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); | 18 | #define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); |
19 | #define DO16(buf) DO8(buf,0); DO8(buf,8); | 19 | #define DO16(buf) DO8(buf,0); DO8(buf,8); |
20 | 20 | ||
21 | #ifdef NO_DIVIDE | ||
22 | # define MOD(a) \ | ||
23 | do { \ | ||
24 | if (a > (BASE << 16)) a -= (BASE << 16); \ | ||
25 | if (a > (BASE << 15)) a -= (BASE << 15); \ | ||
26 | if (a > (BASE << 14)) a -= (BASE << 14); \ | ||
27 | if (a > (BASE << 13)) a -= (BASE << 13); \ | ||
28 | if (a > (BASE << 12)) a -= (BASE << 12); \ | ||
29 | if (a > (BASE << 11)) a -= (BASE << 11); \ | ||
30 | if (a > (BASE << 10)) a -= (BASE << 10); \ | ||
31 | if (a > (BASE << 9)) a -= (BASE << 9); \ | ||
32 | if (a > (BASE << 8)) a -= (BASE << 8); \ | ||
33 | if (a > (BASE << 7)) a -= (BASE << 7); \ | ||
34 | if (a > (BASE << 6)) a -= (BASE << 6); \ | ||
35 | if (a > (BASE << 5)) a -= (BASE << 5); \ | ||
36 | if (a > (BASE << 4)) a -= (BASE << 4); \ | ||
37 | if (a > (BASE << 3)) a -= (BASE << 3); \ | ||
38 | if (a > (BASE << 2)) a -= (BASE << 2); \ | ||
39 | if (a > (BASE << 1)) a -= (BASE << 1); \ | ||
40 | if (a > BASE) a -= BASE; \ | ||
41 | } while (0) | ||
42 | #else | ||
43 | # define MOD(a) a %= BASE | ||
44 | #endif | ||
45 | |||
21 | /* ========================================================================= */ | 46 | /* ========================================================================= */ |
22 | uLong ZEXPORT adler32(adler, buf, len) | 47 | uLong ZEXPORT adler32(adler, buf, len) |
23 | uLong adler; | 48 | uLong adler; |
@@ -42,8 +67,8 @@ uLong ZEXPORT adler32(adler, buf, len) | |||
42 | s1 += *buf++; | 67 | s1 += *buf++; |
43 | s2 += s1; | 68 | s2 += s1; |
44 | } while (--k); | 69 | } while (--k); |
45 | s1 %= BASE; | 70 | MOD(s1); |
46 | s2 %= BASE; | 71 | MOD(s2); |
47 | } | 72 | } |
48 | return (s2 << 16) | s1; | 73 | return (s2 << 16) | s1; |
49 | } | 74 | } |
diff --git a/as400/bndsrc b/as400/bndsrc new file mode 100644 index 0000000..a963e3a --- /dev/null +++ b/as400/bndsrc | |||
@@ -0,0 +1,132 @@ | |||
1 | STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('ZLIB') | ||
2 | |||
3 | /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ | ||
4 | /* Version 1.1.3 entry points. */ | ||
5 | /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ | ||
6 | |||
7 | /********************************************************************/ | ||
8 | /* *MODULE ADLER32 ZLIB 01/02/01 00:15:09 */ | ||
9 | /********************************************************************/ | ||
10 | |||
11 | EXPORT SYMBOL("adler32") | ||
12 | |||
13 | /********************************************************************/ | ||
14 | /* *MODULE COMPRESS ZLIB 01/02/01 00:15:09 */ | ||
15 | /********************************************************************/ | ||
16 | |||
17 | EXPORT SYMBOL("compress") | ||
18 | EXPORT SYMBOL("compress2") | ||
19 | |||
20 | /********************************************************************/ | ||
21 | /* *MODULE CRC32 ZLIB 01/02/01 00:15:09 */ | ||
22 | /********************************************************************/ | ||
23 | |||
24 | EXPORT SYMBOL("crc32") | ||
25 | EXPORT SYMBOL("get_crc_table") | ||
26 | |||
27 | /********************************************************************/ | ||
28 | /* *MODULE DEFLATE ZLIB 01/02/01 00:15:09 */ | ||
29 | /********************************************************************/ | ||
30 | |||
31 | EXPORT SYMBOL("deflate") | ||
32 | EXPORT SYMBOL("deflateEnd") | ||
33 | EXPORT SYMBOL("deflateSetDictionary") | ||
34 | EXPORT SYMBOL("deflateCopy") | ||
35 | EXPORT SYMBOL("deflateReset") | ||
36 | EXPORT SYMBOL("deflateParams") | ||
37 | EXPORT SYMBOL("deflatePrime") | ||
38 | EXPORT SYMBOL("deflateInit_") | ||
39 | EXPORT SYMBOL("deflateInit2_") | ||
40 | |||
41 | /********************************************************************/ | ||
42 | /* *MODULE GZIO ZLIB 01/02/01 00:15:09 */ | ||
43 | /********************************************************************/ | ||
44 | |||
45 | EXPORT SYMBOL("gzopen") | ||
46 | EXPORT SYMBOL("gzdopen") | ||
47 | EXPORT SYMBOL("gzsetparams") | ||
48 | EXPORT SYMBOL("gzread") | ||
49 | EXPORT SYMBOL("gzwrite") | ||
50 | EXPORT SYMBOL("gzprintf") | ||
51 | EXPORT SYMBOL("gzputs") | ||
52 | EXPORT SYMBOL("gzgets") | ||
53 | EXPORT SYMBOL("gzputc") | ||
54 | EXPORT SYMBOL("gzgetc") | ||
55 | EXPORT SYMBOL("gzflush") | ||
56 | EXPORT SYMBOL("gzseek") | ||
57 | EXPORT SYMBOL("gzrewind") | ||
58 | EXPORT SYMBOL("gztell") | ||
59 | EXPORT SYMBOL("gzeof") | ||
60 | EXPORT SYMBOL("gzclose") | ||
61 | EXPORT SYMBOL("gzerror") | ||
62 | |||
63 | /********************************************************************/ | ||
64 | /* *MODULE INFLATE ZLIB 01/02/01 00:15:09 */ | ||
65 | /********************************************************************/ | ||
66 | |||
67 | EXPORT SYMBOL("inflate") | ||
68 | EXPORT SYMBOL("inflateEnd") | ||
69 | EXPORT SYMBOL("inflateSetDictionary") | ||
70 | EXPORT SYMBOL("inflateSync") | ||
71 | EXPORT SYMBOL("inflateReset") | ||
72 | EXPORT SYMBOL("inflateInit_") | ||
73 | EXPORT SYMBOL("inflateInit2_") | ||
74 | EXPORT SYMBOL("inflateSyncPoint") | ||
75 | |||
76 | /********************************************************************/ | ||
77 | /* *MODULE UNCOMPR ZLIB 01/02/01 00:15:09 */ | ||
78 | /********************************************************************/ | ||
79 | |||
80 | EXPORT SYMBOL("uncompress") | ||
81 | |||
82 | /********************************************************************/ | ||
83 | /* *MODULE ZUTIL ZLIB 01/02/01 00:15:09 */ | ||
84 | /********************************************************************/ | ||
85 | |||
86 | EXPORT SYMBOL("zlibVersion") | ||
87 | EXPORT SYMBOL("zError") | ||
88 | |||
89 | /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ | ||
90 | /* Version 1.2.0.7 additional entry points. */ | ||
91 | /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ | ||
92 | |||
93 | /********************************************************************/ | ||
94 | /* *MODULE COMPRESS ZLIB 01/02/01 00:15:09 */ | ||
95 | /********************************************************************/ | ||
96 | |||
97 | EXPORT SYMBOL("compressBound") | ||
98 | |||
99 | /********************************************************************/ | ||
100 | /* *MODULE DEFLATE ZLIB 01/02/01 00:15:09 */ | ||
101 | /********************************************************************/ | ||
102 | |||
103 | EXPORT SYMBOL("deflateBound") | ||
104 | |||
105 | /********************************************************************/ | ||
106 | /* *MODULE GZIO ZLIB 01/02/01 00:15:09 */ | ||
107 | /********************************************************************/ | ||
108 | |||
109 | EXPORT SYMBOL("gzungetc") | ||
110 | EXPORT SYMBOL("gzclearerr") | ||
111 | |||
112 | /********************************************************************/ | ||
113 | /* *MODULE INFBACK ZLIB 01/02/01 00:15:09 */ | ||
114 | /********************************************************************/ | ||
115 | |||
116 | EXPORT SYMBOL("inflateBack") | ||
117 | EXPORT SYMBOL("inflateBackEnd") | ||
118 | EXPORT SYMBOL("inflateBackInit_") | ||
119 | |||
120 | /********************************************************************/ | ||
121 | /* *MODULE INFLATE ZLIB 01/02/01 00:15:09 */ | ||
122 | /********************************************************************/ | ||
123 | |||
124 | EXPORT SYMBOL("inflateCopy") | ||
125 | |||
126 | /********************************************************************/ | ||
127 | /* *MODULE ZUTIL ZLIB 01/02/01 00:15:09 */ | ||
128 | /********************************************************************/ | ||
129 | |||
130 | EXPORT SYMBOL("zlibCompileFlags") | ||
131 | |||
132 | ENDPGMEXP | ||
diff --git a/as400/compile.clp b/as400/compile.clp new file mode 100644 index 0000000..4f8700c --- /dev/null +++ b/as400/compile.clp | |||
@@ -0,0 +1,123 @@ | |||
1 | /******************************************************************************/ | ||
2 | /* */ | ||
3 | /* ZLIB */ | ||
4 | /* */ | ||
5 | /* Compile sources into modules and link them into a service program. */ | ||
6 | /* */ | ||
7 | /******************************************************************************/ | ||
8 | |||
9 | PGM | ||
10 | |||
11 | /* Configuration adjustable parameters. */ | ||
12 | |||
13 | DCL VAR(&SRCLIB) TYPE(*CHAR) LEN(10) + | ||
14 | VALUE('ZLIB') /* Source library. */ | ||
15 | DCL VAR(&SRCFILE) TYPE(*CHAR) LEN(10) + | ||
16 | VALUE('SOURCES') /* Source member file. */ | ||
17 | DCL VAR(&CTLFILE) TYPE(*CHAR) LEN(10) + | ||
18 | VALUE('TOOLS') /* Control member file. */ | ||
19 | |||
20 | DCL VAR(&MODLIB) TYPE(*CHAR) LEN(10) + | ||
21 | VALUE('ZLIB') /* Module library. */ | ||
22 | |||
23 | DCL VAR(&SRVLIB) TYPE(*CHAR) LEN(10) + | ||
24 | VALUE('LGPL') /* Service program library. */ | ||
25 | |||
26 | DCL VAR(&CFLAGS) TYPE(*CHAR) + | ||
27 | VALUE('OPTIMIZE(40)') /* Compile options. */ | ||
28 | |||
29 | |||
30 | /* Working storage. */ | ||
31 | |||
32 | DCL VAR(&CMDLEN) TYPE(*DEC) LEN(15 5) VALUE(300) /* Command length. */ | ||
33 | DCL VAR(&CMD) TYPE(*CHAR) LEN(512) | ||
34 | |||
35 | |||
36 | /* Compile sources into modules. */ | ||
37 | |||
38 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
39 | '/ADLER32) SRCFILE(' *TCAT + | ||
40 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
41 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
42 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
43 | |||
44 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
45 | '/COMPRESS) SRCFILE(' *TCAT + | ||
46 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
47 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
48 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
49 | |||
50 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
51 | '/CRC32) SRCFILE(' *TCAT + | ||
52 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
53 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
54 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
55 | |||
56 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
57 | '/DEFLATE) SRCFILE(' *TCAT + | ||
58 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
59 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
60 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
61 | |||
62 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
63 | '/GZIO) SRCFILE(' *TCAT + | ||
64 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
65 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
66 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
67 | |||
68 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
69 | '/INFBACK) SRCFILE(' *TCAT + | ||
70 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
71 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
72 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
73 | |||
74 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
75 | '/INFFAST) SRCFILE(' *TCAT + | ||
76 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
77 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
78 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
79 | |||
80 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
81 | '/INFLATE) SRCFILE(' *TCAT + | ||
82 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
83 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
84 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
85 | |||
86 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
87 | '/INFTREES) SRCFILE(' *TCAT + | ||
88 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
89 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
90 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
91 | |||
92 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
93 | '/TREES) SRCFILE(' *TCAT + | ||
94 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
95 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
96 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
97 | |||
98 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
99 | '/UNCOMPR) SRCFILE(' *TCAT + | ||
100 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
101 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
102 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
103 | |||
104 | CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT + | ||
105 | '/ZUTIL) SRCFILE(' *TCAT + | ||
106 | &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT + | ||
107 | ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS) | ||
108 | CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN) | ||
109 | |||
110 | |||
111 | /* Link modules into a service program. */ | ||
112 | |||
113 | CRTSRVPGM SRVPGM(&SRVLIB/ZLIB) + | ||
114 | MODULE(&MODLIB/ADLER32 &MODLIB/COMPRESS + | ||
115 | &MODLIB/CRC32 &MODLIB/DEFLATE + | ||
116 | &MODLIB/GZIO &MODLIB/INFBACK + | ||
117 | &MODLIB/INFFAST &MODLIB/INFLATE + | ||
118 | &MODLIB/INFTREES &MODLIB/TREES + | ||
119 | &MODLIB/UNCOMPR &MODLIB/ZUTIL) + | ||
120 | SRCFILE(&SRCLIB/&CTLFILE) SRCMBR(BNDSRC) + | ||
121 | TEXT('ZLIB 1.2.0.7') TGTRLS(V4R4M0) | ||
122 | |||
123 | ENDPGM | ||
diff --git a/as400/readme.txt b/as400/readme.txt new file mode 100644 index 0000000..7ce5ed1 --- /dev/null +++ b/as400/readme.txt | |||
@@ -0,0 +1,111 @@ | |||
1 | ZLIB version 1.2.0.7 for AS400 installation instructions | ||
2 | |||
3 | I) From an AS400 *SAVF file: | ||
4 | |||
5 | 1) Unpacking archive to an AS400 save file | ||
6 | |||
7 | On the AS400: | ||
8 | |||
9 | _ Create the ZLIB AS400 library: | ||
10 | |||
11 | CRTLIB LIB(ZLIB) TYPE(PROD) TEXT('ZLIB compression API library') | ||
12 | |||
13 | _ Create a work save file, for example: | ||
14 | |||
15 | CRTSAVF FILE(ZLIB/ZLIBSAVF) | ||
16 | |||
17 | On a PC connected to the target AS400: | ||
18 | |||
19 | _ Unpack the save file image to a PC file "ZLIBSAVF" | ||
20 | _ Upload this file into the save file on the AS400, for example | ||
21 | using ftp in BINARY mode. | ||
22 | |||
23 | |||
24 | 2) Populating the ZLIB AS400 source library | ||
25 | |||
26 | On the AS400: | ||
27 | |||
28 | _ Extract the saved objects into the ZLIB AS400 library using: | ||
29 | |||
30 | RSTOBJ OBJ(*ALL) SAVLIB(ZLIB) DEV(*SAVF) SAVF(ZLIB/ZLIBSAVF) RSTLIB(ZLIB) | ||
31 | |||
32 | |||
33 | 3) Customize installation: | ||
34 | |||
35 | _ Edit CL member ZLIB/TOOLS(COMPILE) and change parameters if needed, | ||
36 | according to the comments. | ||
37 | |||
38 | _ Compile this member with: | ||
39 | |||
40 | CRTCLPGM PGM(ZLIB/COMPILE) SRCFILE(ZLIB/TOOLS) SRCMBR(COMPILE) | ||
41 | |||
42 | |||
43 | 4) Compile and generate the service program: | ||
44 | |||
45 | _ This can now be done by executing: | ||
46 | |||
47 | CALL PGM(ZLIB/COMPILE) | ||
48 | |||
49 | |||
50 | |||
51 | II) From the original source distribution: | ||
52 | |||
53 | 1) On the AS400, create the source library: | ||
54 | |||
55 | CRTLIB LIB(ZLIB) TYPE(PROD) TEXT('ZLIB compression API library') | ||
56 | |||
57 | 2) Create the source files: | ||
58 | |||
59 | CRTSRCPF FILE(ZLIB/SOURCES) RCDLEN(112) TEXT('ZLIB library modules') | ||
60 | CRTSRCPF FILE(ZLIB/H) RCDLEN(112) TEXT('ZLIB library includes') | ||
61 | CRTSRCPF FILE(ZLIB/TOOLS) RCDLEN(112) TEXT('ZLIB library control utilities') | ||
62 | |||
63 | 3) From the machine hosting the distribution files, upload them (with | ||
64 | FTP in text mode, for example) according to the following table: | ||
65 | |||
66 | Original AS400 AS400 AS400 AS400 | ||
67 | file file member type description | ||
68 | SOURCES Original ZLIB C subprogram sources | ||
69 | adler32.c ADLER32 C ZLIB - Compute the Adler-32 checksum of a dta strm | ||
70 | compress.c COMPRESS C ZLIB - Compress a memory buffer | ||
71 | crc32.c CRC32 C ZLIB - Compute the CRC-32 of a data stream | ||
72 | deflate.c DEFLATE C ZLIB - Compress data using the deflation algorithm | ||
73 | gzio.c GZIO C ZLIB - IO on .gz files | ||
74 | infback.c INFBACK C ZLIB - Inflate using a callback interface | ||
75 | inffast.c INFFAST C ZLIB - Fast proc. literals & length/distance pairs | ||
76 | inflate.c INFLATE C ZLIB - Interface to inflate modules | ||
77 | inftrees.c INFTREES C ZLIB - Generate Huffman trees for efficient decode | ||
78 | trees.c TREES C ZLIB - Output deflated data using Huffman coding | ||
79 | uncompr.c UNCOMPR C ZLIB - Decompress a memory buffer | ||
80 | zutil.c ZUTIL C ZLIB - Target dependent utility functions | ||
81 | H Original ZLIB C and ILE/RPG include files | ||
82 | crc32.h CRC32 C ZLIB - CRC32 tables | ||
83 | deflate.h DEFLATE C ZLIB - Internal compression state | ||
84 | inffast.h INFFAST C ZLIB - Header to use inffast.c | ||
85 | inffixed.h INFFIXED C ZLIB - Table for decoding fixed codes | ||
86 | inflate.h INFLATE C ZLIB - Internal inflate state definitions | ||
87 | inftrees.h INFTREES C ZLIB - Header to use inftrees.c | ||
88 | trees.h TREES C ZLIB - Created automatically with -DGEN_TREES_H | ||
89 | zconf.h ZCONF C ZLIB - Compression library configuration | ||
90 | zlib.h ZLIB C ZLIB - Compression library C user interface | ||
91 | as400/zlib.inc ZLIB.INC RPGLE ZLIB - Compression library ILE RPG user interface | ||
92 | zutil.h ZUTIL C ZLIB - Internal interface and configuration | ||
93 | TOOLS Building source software & AS/400 README | ||
94 | as400/bndsrc BNDSRC Entry point exportation list | ||
95 | as400/compile.clp COMPILE CLP Compile sources & generate service program | ||
96 | as400/readme.txt README TXT Installation instructions | ||
97 | |||
98 | 4) Continue as in I)3). | ||
99 | |||
100 | |||
101 | |||
102 | |||
103 | Notes: For AS400 ILE RPG programmers, a /copy member defining the ZLIB | ||
104 | API prototypes for ILE RPG can be found in ZLIB/H(ZLIB.INC). | ||
105 | Please read comments in this member for more information. | ||
106 | |||
107 | Remember that most foreign textual data are ASCII coded: this | ||
108 | implementation does not handle conversion from/to ASCII, so | ||
109 | text data code conversions must be done explicitely. | ||
110 | |||
111 | Always open zipped files in binary mode. | ||
diff --git a/as400/zlib.inc b/as400/zlib.inc new file mode 100644 index 0000000..9a0fc54 --- /dev/null +++ b/as400/zlib.inc | |||
@@ -0,0 +1,327 @@ | |||
1 | * ZLIB.INC - Interface to the general purpose compression library | ||
2 | * | ||
3 | * ILE RPG400 version by Patrick Monnerat, DATASPHERE. | ||
4 | * Version 1.2.0.7 | ||
5 | * | ||
6 | * | ||
7 | * WARNING: | ||
8 | * Procedures inflateInit(), inflateInit2(), deflateInit(), | ||
9 | * deflateInit2() and inflateBackInit() need to be called with | ||
10 | * two additional arguments: | ||
11 | * the package version string and the stream control structure. | ||
12 | * size. This is needed because RPG lacks some macro feature. | ||
13 | * Call these procedures as: | ||
14 | * inflateInit(...: ZLIB_VERSION: %size(z_stream)) | ||
15 | * | ||
16 | /if not defined(ZLIB_H_) | ||
17 | /define ZLIB_H_ | ||
18 | * | ||
19 | ************************************************************************** | ||
20 | * Constants | ||
21 | ************************************************************************** | ||
22 | * | ||
23 | D ZLIB_VERSION C '1.2.0.8' Header's version | ||
24 | D ZLIB_VERNUM C X'1208' | ||
25 | * | ||
26 | D Z_NO_FLUSH C 0 | ||
27 | D Z_SYNC_FLUSH C 2 | ||
28 | D Z_FULL_FLUSH C 3 | ||
29 | D Z_FINISH C 4 | ||
30 | D Z_BLOCK C 5 | ||
31 | * | ||
32 | D Z_OK C 0 | ||
33 | D Z_STREAM_END C 1 | ||
34 | D Z_NEED_DICT C 2 | ||
35 | D Z_ERRNO C -1 | ||
36 | D Z_STREAM_ERROR C -2 | ||
37 | D Z_DATA_ERROR C -3 | ||
38 | D Z_MEM_ERROR C -4 | ||
39 | D Z_BUF_ERROR C -5 | ||
40 | DZ_VERSION_ERROR C -6 | ||
41 | * | ||
42 | D Z_NO_COMPRESSION... | ||
43 | D C 0 | ||
44 | D Z_BEST_SPEED C 1 | ||
45 | D Z_BEST_COMPRESSION... | ||
46 | D C 9 | ||
47 | D Z_DEFAULT_COMPRESSION... | ||
48 | D C -1 | ||
49 | * | ||
50 | D Z_FILTERED C 1 | ||
51 | D Z_HUFFMAN_ONLY C 2 | ||
52 | D Z_RLE C 3 | ||
53 | D Z_DEFAULT_STRATEGY... | ||
54 | D C 0 | ||
55 | * | ||
56 | D Z_BINARY C 0 | ||
57 | D Z_ASCII C 1 | ||
58 | D Z_UNKNOWN C 2 | ||
59 | * | ||
60 | D Z_DEFLATED C 8 | ||
61 | * | ||
62 | D Z_NULL C 0 | ||
63 | * | ||
64 | ************************************************************************** | ||
65 | * Types | ||
66 | ************************************************************************** | ||
67 | * | ||
68 | D z_streamp S * Stream struct ptr | ||
69 | D gzFile S * File pointer | ||
70 | D z_off_t S 10i 0 Stream offsets | ||
71 | * | ||
72 | ************************************************************************** | ||
73 | * Structures | ||
74 | ************************************************************************** | ||
75 | * | ||
76 | * The GZIP encode/decode stream support structure. | ||
77 | * | ||
78 | D z_stream DS align based(z_streamp) | ||
79 | D zs_next_in * Next input byte | ||
80 | D zs_avail_in 10U 0 Byte cnt at next_in | ||
81 | D zs_total_in 10U 0 Total bytes read | ||
82 | D zs_next_out * Output buffer ptr | ||
83 | D zs_avail_out 10U 0 Room left @ next_out | ||
84 | D zs_total_out 10U 0 Total bytes written | ||
85 | D zs_msg * Last errmsg or null | ||
86 | D zs_state * Internal state | ||
87 | D zs_zalloc * procptr Int. state allocator | ||
88 | D zs_free * procptr Int. state dealloc. | ||
89 | D zs_opaque * Private alloc. data | ||
90 | D zs_data_type 10i 0 ASC/BIN best guess | ||
91 | D zs_adler 10u 0 Uncompr. adler32 val | ||
92 | D 10U 0 Reserved | ||
93 | D 10U 0 Ptr. alignment | ||
94 | * | ||
95 | ************************************************************************** | ||
96 | * Utility function prototypes | ||
97 | ************************************************************************** | ||
98 | * | ||
99 | D compress PR 10I 0 extproc('compress') | ||
100 | D dest 32767 options(*varsize) Destination buffer | ||
101 | D destLen 10U 0 Destination length | ||
102 | D source 32767 const options(*varsize) Source buffer | ||
103 | D sourceLen 10u 0 value Source length | ||
104 | * | ||
105 | D compress2 PR 10I 0 extproc('compress2') | ||
106 | D dest 32767 options(*varsize) Destination buffer | ||
107 | D destLen 10U 0 Destination length | ||
108 | D source 32767 const options(*varsize) Source buffer | ||
109 | D sourceLen 10U 0 value Source length | ||
110 | D level 10I 0 value Compression level | ||
111 | * | ||
112 | D compressBound PR 10U 0 extproc('compressBound') | ||
113 | D sourceLen 10U 0 value | ||
114 | * | ||
115 | D uncompress PR 10I 0 extproc('uncompress') | ||
116 | D dest 32767 options(*varsize) Destination buffer | ||
117 | D destLen 10U 0 Destination length | ||
118 | D source 32767 const options(*varsize) Source buffer | ||
119 | D sourceLen 10U 0 value Source length | ||
120 | * | ||
121 | D gzopen PR extproc('gzopen') | ||
122 | D like(gzFile) | ||
123 | D path * value options(*string) File pathname | ||
124 | D mode * value options(*string) Open mode | ||
125 | * | ||
126 | D gzdopen PR extproc('gzdopen') | ||
127 | D like(gzFile) | ||
128 | D fd 10i 0 value File descriptor | ||
129 | D mode * value options(*string) Open mode | ||
130 | * | ||
131 | D gzsetparams PR 10I 0 extproc('gzsetparams') | ||
132 | D file value like(gzFile) File pointer | ||
133 | D level 10I 0 value | ||
134 | D strategy 10i 0 value | ||
135 | * | ||
136 | D gzread PR 10I 0 extproc('gzread') | ||
137 | D file value like(gzFile) File pointer | ||
138 | D buf 32767 options(*varsize) Buffer | ||
139 | D len 10u 0 value Buffer length | ||
140 | * | ||
141 | D gzwrite PR 10I 0 extproc('gzwrite') | ||
142 | D file value like(gzFile) File pointer | ||
143 | D buf 32767 const options(*varsize) Buffer | ||
144 | D len 10u 0 value Buffer length | ||
145 | * | ||
146 | D gzputs PR 10I 0 extproc('gzputs') | ||
147 | D file value like(gzFile) File pointer | ||
148 | D s * value options(*string) String to output | ||
149 | * | ||
150 | D gzgets PR * extproc('gzgets') | ||
151 | D file value like(gzFile) File pointer | ||
152 | D buf 32767 options(*varsize) Read buffer | ||
153 | D len 10i 0 value Buffer length | ||
154 | * | ||
155 | D gzflush PR 10i 0 extproc('gzflush') | ||
156 | D file value like(gzFile) File pointer | ||
157 | D flush 10I 0 value Type of flush | ||
158 | * | ||
159 | D gzseek PR extproc('gzseek') | ||
160 | D like(z_off_t) | ||
161 | D file value like(gzFile) File pointer | ||
162 | D offset value like(z_off_t) Offset | ||
163 | D whence 10i 0 value Origin | ||
164 | * | ||
165 | D gzrewind PR 10i 0 extproc('gzrewind') | ||
166 | D file value like(gzFile) File pointer | ||
167 | * | ||
168 | D gztell PR extproc('gztell') | ||
169 | D like(z_off_t) | ||
170 | D file value like(gzFile) File pointer | ||
171 | * | ||
172 | D gzeof PR 10i 0 extproc('gzeof') | ||
173 | D file value like(gzFile) File pointer | ||
174 | * | ||
175 | D gzclose PR 10i 0 extproc('gzclose') | ||
176 | D file value like(gzFile) File pointer | ||
177 | * | ||
178 | D gzerror PR * extproc('gzerror') Error string | ||
179 | D file value like(gzFile) File pointer | ||
180 | D errnum 10I 0 Error code | ||
181 | * | ||
182 | D gzclearerr PR extproc('gzclearerr') | ||
183 | D file value like(gzFile) File pointer | ||
184 | * | ||
185 | ************************************************************************** | ||
186 | * Basic function prototypes | ||
187 | ************************************************************************** | ||
188 | * | ||
189 | D zlibVersion PR * extproc('zlibVersion') Version string | ||
190 | * | ||
191 | D deflateInit PR 10I 0 extproc('deflateInit_') Init. compression | ||
192 | D strm like(z_stream) Compression stream | ||
193 | D level 10I 0 value Compression level | ||
194 | D version * value options(*string) Version string | ||
195 | D stream_size 10i 0 value Stream struct. size | ||
196 | * | ||
197 | D deflate PR 10I 0 extproc('deflate') Compress data | ||
198 | D strm like(z_stream) Compression stream | ||
199 | D flush 10I 0 value Flush type required | ||
200 | * | ||
201 | D deflateEnd PR 10I 0 extproc('deflateEnd') Termin. compression | ||
202 | D strm like(z_stream) Compression stream | ||
203 | * | ||
204 | D inflateInit PR 10I 0 extproc('inflateInit_') Init. expansion | ||
205 | D strm like(z_stream) Expansion stream | ||
206 | D version * value options(*string) Version string | ||
207 | D stream_size 10i 0 value Stream struct. size | ||
208 | * | ||
209 | D inflate PR 10I 0 extproc('inflate') Expand data | ||
210 | D strm like(z_stream) Expansion stream | ||
211 | D flush 10I 0 value Flush type required | ||
212 | * | ||
213 | D inflateEnd PR 10I 0 extproc('inflateEnd') Termin. expansion | ||
214 | D strm like(z_stream) Expansion stream | ||
215 | * | ||
216 | ************************************************************************** | ||
217 | * Advanced function prototypes | ||
218 | ************************************************************************** | ||
219 | * | ||
220 | D deflateInit2 PR 10I 0 extproc('deflateInit2_') Init. compression | ||
221 | D strm like(z_stream) Compression stream | ||
222 | D level 10I 0 value Compression level | ||
223 | D method 10I 0 value Compression method | ||
224 | D windowBits 10I 0 value log2(window size) | ||
225 | D memLevel 10I 0 value Mem/cmpress tradeoff | ||
226 | D strategy 10I 0 value Compression stategy | ||
227 | D version * value options(*string) Version string | ||
228 | D stream_size 10i 0 value Stream struct. size | ||
229 | * | ||
230 | D deflateSetDictionary... | ||
231 | D PR 10I 0 extproc('deflateSetDictionary') Init. dictionary | ||
232 | D strm like(z_stream) Compression stream | ||
233 | D dictionary 32767 const options(*varsize) Dictionary bytes | ||
234 | D dictLength 10U 0 value Dictionary length | ||
235 | * | ||
236 | D deflateCopy PR 10I 0 extproc('deflateCopy') Compress strm 2 strm | ||
237 | D dest like(z_stream) Destination stream | ||
238 | D source like(z_stream) Source stream | ||
239 | * | ||
240 | D deflateReset PR 10I 0 extproc('deflateReset') End and init. stream | ||
241 | D strm like(z_stream) Compression stream | ||
242 | * | ||
243 | D deflateParams PR 10I 0 extproc('deflateParams') Change level & strat | ||
244 | D strm like(z_stream) Compression stream | ||
245 | D level 10I 0 value Compression level | ||
246 | D strategy 10I 0 value Compression stategy | ||
247 | * | ||
248 | D deflateBound PR 10U 0 extproc('deflateBound') Change level & strat | ||
249 | D strm like(z_stream) Compression stream | ||
250 | D sourcelen 10U 0 value Compression level | ||
251 | * | ||
252 | D deflatePrime PR 10I 0 extproc('deflatePrime') Change level & strat | ||
253 | D strm like(z_stream) Compression stream | ||
254 | D bits 10I 0 value Number of bits to insert | ||
255 | D value 10I 0 value Bits to insert | ||
256 | * | ||
257 | D inflateInit2 PR 10I 0 extproc('inflateInit2_') Init. expansion | ||
258 | D strm like(z_stream) Expansion stream | ||
259 | D windowBits 10I 0 value log2(window size) | ||
260 | D version * value options(*string) Version string | ||
261 | D stream_size 10i 0 value Stream struct. size | ||
262 | * | ||
263 | D inflateSetDictionary... | ||
264 | D PR 10I 0 extproc('inflateSetDictionary') Init. dictionary | ||
265 | D strm like(z_stream) Expansion stream | ||
266 | D dictionary 32767 const options(*varsize) Dictionary bytes | ||
267 | D dictLength 10U 0 value Dictionary length | ||
268 | * | ||
269 | D inflateSync PR 10I 0 extproc('inflateSync') Sync. expansion | ||
270 | D strm like(z_stream) Expansion stream | ||
271 | * | ||
272 | D inflateCopy PR 10I 0 extproc('inflateCopy') | ||
273 | D dest like(z_stream) Destination stream | ||
274 | D source like(z_stream) Source stream | ||
275 | * | ||
276 | D inflateReset PR 10I 0 extproc('inflateReset') End and init. stream | ||
277 | D strm like(z_stream) Expansion stream | ||
278 | * | ||
279 | D inflateBackInit... | ||
280 | D PR 10I 0 extproc('inflateBackInit_') | ||
281 | D strm like(z_stream) Expansion stream | ||
282 | D windowBits 10I 0 value Log2(buffer size) | ||
283 | D window 32767 options(*varsize) Buffer | ||
284 | D version * value options(*string) Version string | ||
285 | D stream_size 10i 0 value Stream struct. size | ||
286 | * | ||
287 | D inflateBack PR 10I 0 extproc('inflateBack') | ||
288 | D strm like(z_stream) Expansion stream | ||
289 | D in * value procptr Input function | ||
290 | D in_desc * value Input descriptor | ||
291 | D out * value procptr Output function | ||
292 | D out_desc * value Output descriptor | ||
293 | * | ||
294 | D inflateBackEnd PR 10I 0 extproc('inflateBackEnd') | ||
295 | D strm like(z_stream) Expansion stream | ||
296 | * | ||
297 | D zlibCompileFlags... | ||
298 | D PR 10U 0 extproc('zlibCompileFlags') | ||
299 | * | ||
300 | ************************************************************************** | ||
301 | * Checksum function prototypes | ||
302 | ************************************************************************** | ||
303 | * | ||
304 | D adler32 PR 10U 0 extproc('adler32') New checksum | ||
305 | D adler 10U 0 value Old checksum | ||
306 | D buf 32767 const options(*varsize) Bytes to accumulate | ||
307 | D len 10U 0 value Buffer length | ||
308 | * | ||
309 | D crc32 PR 10U 0 extproc('crc32') New checksum | ||
310 | D crc 10U 0 value Old checksum | ||
311 | D buf 32767 const options(*varsize) Bytes to accumulate | ||
312 | D len 10U 0 value Buffer length | ||
313 | * | ||
314 | ************************************************************************** | ||
315 | * Miscellaneous function prototypes | ||
316 | ************************************************************************** | ||
317 | * | ||
318 | D zError PR * extproc('zError') Error string | ||
319 | D err 10I 0 value Error code | ||
320 | * | ||
321 | D inflateSyncPoint... | ||
322 | D PR 10I 0 extproc('inflateSyncPoint') | ||
323 | D strm like(z_stream) Expansion stream | ||
324 | * | ||
325 | D get_crc_table PR * extproc('get_crc_table') Ptr to ulongs | ||
326 | * | ||
327 | /endif | ||
@@ -53,6 +53,7 @@ case "$1" in | |||
53 | -l* | --l*) libdir="$2"; shift; shift;; | 53 | -l* | --l*) libdir="$2"; shift; shift;; |
54 | -i* | --i*) includedir="$2"; shift; shift;; | 54 | -i* | --i*) includedir="$2"; shift; shift;; |
55 | -s* | --s*) shared=1; shift;; | 55 | -s* | --s*) shared=1; shift;; |
56 | *) echo "unknown option: $1"; echo "$0 --help for help"; exit 1;; | ||
56 | esac | 57 | esac |
57 | done | 58 | done |
58 | 59 | ||
@@ -76,6 +77,8 @@ if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then | |||
76 | CFLAGS="$cflags" | 77 | CFLAGS="$cflags" |
77 | case `(uname -s || echo unknown) 2>/dev/null` in | 78 | case `(uname -s || echo unknown) 2>/dev/null` in |
78 | Linux | linux) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};; | 79 | Linux | linux) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};; |
80 | CYGWIN* | Cygwin* | cygwin* ) | ||
81 | EXE='.exe';; | ||
79 | QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4 | 82 | QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4 |
80 | # (alain.bonnefoy@icbt.com) | 83 | # (alain.bonnefoy@icbt.com) |
81 | LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"};; | 84 | LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"};; |
@@ -188,11 +191,8 @@ fi | |||
188 | 191 | ||
189 | cat > $test.c <<EOF | 192 | cat > $test.c <<EOF |
190 | #include <stdio.h> | 193 | #include <stdio.h> |
191 | #include <stdlib.h> | 194 | #include <stdarg.h> |
192 | 195 | #include "zconf.h" | |
193 | #if (defined(__MSDOS__) || defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__STDC__) || defined(__cplusplus) || defined(__OS2__)) && !defined(STDC) | ||
194 | # define STDC | ||
195 | #endif | ||
196 | 196 | ||
197 | int main() | 197 | int main() |
198 | { | 198 | { |
@@ -205,7 +205,7 @@ int main() | |||
205 | EOF | 205 | EOF |
206 | 206 | ||
207 | if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then | 207 | if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then |
208 | echo "Checking whether to use vsnprintf() or snprintf()... using vsnprintf()" | 208 | echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()" |
209 | 209 | ||
210 | cat > $test.c <<EOF | 210 | cat > $test.c <<EOF |
211 | #include <stdio.h> | 211 | #include <stdio.h> |
@@ -228,7 +228,7 @@ int main() | |||
228 | } | 228 | } |
229 | EOF | 229 | EOF |
230 | 230 | ||
231 | if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then | 231 | if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then |
232 | echo "Checking for vsnprintf() in stdio.h... Yes." | 232 | echo "Checking for vsnprintf() in stdio.h... Yes." |
233 | 233 | ||
234 | cat >$test.c <<EOF | 234 | cat >$test.c <<EOF |
@@ -237,14 +237,14 @@ EOF | |||
237 | 237 | ||
238 | int mytest(char *fmt, ...) | 238 | int mytest(char *fmt, ...) |
239 | { | 239 | { |
240 | int i; | 240 | int n; |
241 | char buf[20]; | 241 | char buf[20]; |
242 | va_list ap; | 242 | va_list ap; |
243 | 243 | ||
244 | va_start(ap, fmt); | 244 | va_start(ap, fmt); |
245 | i = vsnprintf(buf, sizeof(buf), fmt, ap); | 245 | n = vsnprintf(buf, sizeof(buf), fmt, ap); |
246 | va_end(ap); | 246 | va_end(ap); |
247 | return 0; | 247 | return n; |
248 | } | 248 | } |
249 | 249 | ||
250 | int main() | 250 | int main() |
@@ -275,14 +275,14 @@ EOF | |||
275 | 275 | ||
276 | int mytest(char *fmt, ...) | 276 | int mytest(char *fmt, ...) |
277 | { | 277 | { |
278 | int i; | 278 | int n; |
279 | char buf[20]; | 279 | char buf[20]; |
280 | va_list ap; | 280 | va_list ap; |
281 | 281 | ||
282 | va_start(ap, fmt); | 282 | va_start(ap, fmt); |
283 | i = vsprintf(buf, fmt, ap); | 283 | n = vsprintf(buf, fmt, ap); |
284 | va_end(ap); | 284 | va_end(ap); |
285 | return 0; | 285 | return n; |
286 | } | 286 | } |
287 | 287 | ||
288 | int main() | 288 | int main() |
@@ -302,11 +302,10 @@ EOF | |||
302 | fi | 302 | fi |
303 | fi | 303 | fi |
304 | else | 304 | else |
305 | echo "Checking whether to use vsnprintf() or snprintf()... using snprintf()" | 305 | echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()" |
306 | 306 | ||
307 | cat >$test.c <<EOF | 307 | cat >$test.c <<EOF |
308 | #include <stdio.h> | 308 | #include <stdio.h> |
309 | #include <stdarg.h> | ||
310 | 309 | ||
311 | int mytest() | 310 | int mytest() |
312 | { | 311 | { |
@@ -322,20 +321,17 @@ int main() | |||
322 | } | 321 | } |
323 | EOF | 322 | EOF |
324 | 323 | ||
325 | if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then | 324 | if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then |
326 | echo "Checking for snprintf() in stdio.h... Yes." | 325 | echo "Checking for snprintf() in stdio.h... Yes." |
327 | 326 | ||
328 | cat >$test.c <<EOF | 327 | cat >$test.c <<EOF |
329 | #include <stdio.h> | 328 | #include <stdio.h> |
330 | #include <stdarg.h> | ||
331 | 329 | ||
332 | int mytest(char *fmt, ...) | 330 | int mytest() |
333 | { | 331 | { |
334 | int i; | ||
335 | char buf[20]; | 332 | char buf[20]; |
336 | 333 | ||
337 | i = snprintf(buf, sizeof(buf), "%s", "foo"); | 334 | return snprintf(buf, sizeof(buf), "%s", "foo"); |
338 | return 0; | ||
339 | } | 335 | } |
340 | 336 | ||
341 | int main() | 337 | int main() |
@@ -362,15 +358,12 @@ EOF | |||
362 | 358 | ||
363 | cat >$test.c <<EOF | 359 | cat >$test.c <<EOF |
364 | #include <stdio.h> | 360 | #include <stdio.h> |
365 | #include <stdarg.h> | ||
366 | 361 | ||
367 | int mytest(char *fmt, ...) | 362 | int mytest() |
368 | { | 363 | { |
369 | int i; | ||
370 | char buf[20]; | 364 | char buf[20]; |
371 | 365 | ||
372 | i = sprintf(buf, "%s", "foo"); | 366 | return sprintf(buf, "%s", "foo"); |
373 | return 0; | ||
374 | } | 367 | } |
375 | 368 | ||
376 | int main() | 369 | int main() |
@@ -428,7 +421,7 @@ case $CFLAGS in | |||
428 | fi;; | 421 | fi;; |
429 | esac | 422 | esac |
430 | 423 | ||
431 | rm -f $test.[co] $test$shared_ext | 424 | rm -f $test.[co] $test $test$shared_ext |
432 | 425 | ||
433 | # udpate Makefile | 426 | # udpate Makefile |
434 | sed < Makefile.in " | 427 | sed < Makefile.in " |
@@ -442,6 +435,7 @@ sed < Makefile.in " | |||
442 | /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM# | 435 | /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM# |
443 | /^AR *=/s#=.*#=$AR# | 436 | /^AR *=/s#=.*#=$AR# |
444 | /^RANLIB *=/s#=.*#=$RANLIB# | 437 | /^RANLIB *=/s#=.*#=$RANLIB# |
438 | /^EXE *=/s#=.*#=$EXE# | ||
445 | /^prefix *=/s#=.*#=$prefix# | 439 | /^prefix *=/s#=.*#=$prefix# |
446 | /^exec_prefix *=/s#=.*#=$exec_prefix# | 440 | /^exec_prefix *=/s#=.*#=$exec_prefix# |
447 | /^libdir *=/s#=.*#=$libdir# | 441 | /^libdir *=/s#=.*#=$libdir# |
diff --git a/contrib/README.contrib b/contrib/README.contrib index 96f2c43..8860f31 100644 --- a/contrib/README.contrib +++ b/contrib/README.contrib | |||
@@ -5,62 +5,66 @@ for help about these, not the zlib authors. Thanks. | |||
5 | 5 | ||
6 | 6 | ||
7 | ada/ by Dmitriy Anisimkov <anisimkov@yahoo.com> | 7 | ada/ by Dmitriy Anisimkov <anisimkov@yahoo.com> |
8 | Support for Ada | 8 | Support for Ada |
9 | See http://zlib-ada.sourceforge.net/ | 9 | See http://zlib-ada.sourceforge.net/ |
10 | 10 | ||
11 | asm586/ and asm686/ by Brian Raiter <breadbox@muppetlabs.com> | 11 | asm586/ |
12 | asm code for Pentium and PPro/PII, using the AT&T (GNU as) syntax | 12 | asm686/ by Brian Raiter <breadbox@muppetlabs.com> |
13 | See http://www.muppetlabs.com/~breadbox/software/assembly.html | 13 | asm code for Pentium and PPro/PII, using the AT&T (GNU as) syntax |
14 | See http://www.muppetlabs.com/~breadbox/software/assembly.html | ||
14 | 15 | ||
15 | blast/ by Mark Adler <madler@alumni.caltech.edu> | 16 | blast/ by Mark Adler <madler@alumni.caltech.edu> |
16 | Decompressor for output of PKWare Data Compression Library (DCL) | 17 | Decompressor for output of PKWare Data Compression Library (DCL) |
17 | 18 | ||
18 | delphi/ by Cosmin Truta <cosmint@cs.ubbcluj.ro> | 19 | delphi/ by Cosmin Truta <cosmint@cs.ubbcluj.ro> |
19 | Support for Delphi and C++ Builder | 20 | Support for Delphi and C++ Builder |
21 | |||
22 | gzappend/ by Mark Adler <madler@alumni.caltech.edu> | ||
23 | append to a gzip file -- illustrates the use of Z_BLOCK | ||
20 | 24 | ||
21 | infback9/ by Mark Adler <madler@alumni.caltech.edu> | 25 | infback9/ by Mark Adler <madler@alumni.caltech.edu> |
22 | Unsupported diffs to infback to decode the deflate64 format | 26 | Unsupported diffs to infback to decode the deflate64 format |
23 | 27 | ||
24 | inflate86/ by Chris Anderson <christop@charm.net> | 28 | inflate86/ by Chris Anderson <christop@charm.net> |
25 | Tuned x86 gcc asm code to replace inflate_fast() | 29 | Tuned x86 gcc asm code to replace inflate_fast() |
26 | 30 | ||
27 | iostream/ by Kevin Ruland <kevin@rodin.wustl.edu> | 31 | iostream/ by Kevin Ruland <kevin@rodin.wustl.edu> |
28 | A C++ I/O streams interface to the zlib gz* functions | 32 | A C++ I/O streams interface to the zlib gz* functions |
29 | 33 | ||
30 | iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no> | 34 | iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no> |
31 | Another C++ I/O streams interface | 35 | Another C++ I/O streams interface |
32 | 36 | ||
33 | iostream3/ by Ludwig Schwardt <schwardt@sun.ac.za> | 37 | iostream3/ by Ludwig Schwardt <schwardt@sun.ac.za> |
34 | and Kevin Ruland <kevin@rodin.wustl.edu> | 38 | and Kevin Ruland <kevin@rodin.wustl.edu> |
35 | Yet another C++ I/O streams interface | 39 | Yet another C++ I/O streams interface |
36 | 40 | ||
37 | masm686/ by Dan Higdon <hdan@kinesoft.com> | 41 | masm686/ by Dan Higdon <hdan@kinesoft.com> |
38 | and Chuck Walbourn <chuckw@kinesoft.com> | 42 | and Chuck Walbourn <chuckw@kinesoft.com> |
39 | asm code for Pentium Pro/PII, using the MASM syntax | 43 | asm code for Pentium Pro/PII, using the MASM syntax |
40 | 44 | ||
41 | masmx86/ by Gilles Vollant <info@winimage.com> | 45 | masmx86/ by Gilles Vollant <info@winimage.com> |
42 | x86 asm code to replace longest_match() and inflate_fast(), | 46 | x86 asm code to replace longest_match() and inflate_fast(), |
43 | for Visual C++ and MASM | 47 | for Visual C++ and MASM |
44 | 48 | ||
45 | minizip/ by Gilles Vollant <info@winimage.com> | 49 | minizip/ by Gilles Vollant <info@winimage.com> |
46 | Mini zip and unzip based on zlib | 50 | Mini zip and unzip based on zlib |
47 | See http://www.winimage.com/zLibDll/unzip.html | 51 | See http://www.winimage.com/zLibDll/unzip.html |
48 | 52 | ||
49 | pascal/ by Bob Dellaca <bobdl@xtra.co.nz> et al. | 53 | pascal/ by Bob Dellaca <bobdl@xtra.co.nz> et al. |
50 | Support for Pascal | 54 | Support for Pascal |
51 | 55 | ||
52 | puff/ by Mark Adler <madler@alumni.caltech.edu> | 56 | puff/ by Mark Adler <madler@alumni.caltech.edu> |
53 | Small, low memory usage inflate. Also serves to provide an | 57 | Small, low memory usage inflate. Also serves to provide an |
54 | unambiguous description of the deflate format. | 58 | unambiguous description of the deflate format. |
55 | 59 | ||
56 | testzlib/ by Gilles Vollant <info@winimage.com> | 60 | testzlib/ by Gilles Vollant <info@winimage.com> |
57 | Example of the use of zlib | 61 | Example of the use of zlib |
58 | 62 | ||
59 | untgz/ by "Pedro A. Aranda Guti\irrez" <paag@tid.es> | 63 | untgz/ by "Pedro A. Aranda Guti\irrez" <paag@tid.es> |
60 | A very simple tar.gz file extractor using zlib | 64 | A very simple tar.gz file extractor using zlib |
61 | 65 | ||
62 | visual-basic.txt by Carlos Rios <c_rios@sonda.cl> | 66 | visual-basic.txt by Carlos Rios <c_rios@sonda.cl> |
63 | How to use compress(), uncompress() and the gz* functions from VB | 67 | How to use compress(), uncompress() and the gz* functions from VB |
64 | 68 | ||
65 | vstudio/ by Gilles Vollant <info@winimage.com> | 69 | vstudio/ by Gilles Vollant <info@winimage.com> |
66 | Building zlib with Visual Studio .NET | 70 | Building zlib with Visual Studio .NET |
diff --git a/contrib/ada/zlib-thin.ads b/contrib/ada/zlib-thin.ads index 19cbb96..af1287a 100644 --- a/contrib/ada/zlib-thin.ads +++ b/contrib/ada/zlib-thin.ads | |||
@@ -146,6 +146,17 @@ private package ZLib.Thin is | |||
146 | strategy : Int) | 146 | strategy : Int) |
147 | return Int; -- zlib.h:506 | 147 | return Int; -- zlib.h:506 |
148 | 148 | ||
149 | function deflateBound | ||
150 | (strm : Z_Streamp; | ||
151 | sourceLen : ULong) | ||
152 | return Int; -- zlib.h:595 | ||
153 | |||
154 | function deflatePrime | ||
155 | (strm : Z_Streamp; | ||
156 | bits : Int; | ||
157 | value : Int) | ||
158 | return Int; -- zlib.h:604 | ||
159 | |||
149 | function inflateSetDictionary | 160 | function inflateSetDictionary |
150 | (strm : Z_Streamp; | 161 | (strm : Z_Streamp; |
151 | dictionary : Byte_Access; | 162 | dictionary : Byte_Access; |
@@ -421,6 +432,8 @@ private | |||
421 | pragma Import (C, deflateCopy, "deflateCopy"); | 432 | pragma Import (C, deflateCopy, "deflateCopy"); |
422 | pragma Import (C, deflateReset, "deflateReset"); | 433 | pragma Import (C, deflateReset, "deflateReset"); |
423 | pragma Import (C, deflateParams, "deflateParams"); | 434 | pragma Import (C, deflateParams, "deflateParams"); |
435 | pragma Import (C, deflateBound, "deflateBound"); | ||
436 | pragma Import (C, deflatePrime, "deflatePrime"); | ||
424 | pragma Import (C, inflateSetDictionary, "inflateSetDictionary"); | 437 | pragma Import (C, inflateSetDictionary, "inflateSetDictionary"); |
425 | pragma Import (C, inflateSync, "inflateSync"); | 438 | pragma Import (C, inflateSync, "inflateSync"); |
426 | pragma Import (C, inflateReset, "inflateReset"); | 439 | pragma Import (C, inflateReset, "inflateReset"); |
diff --git a/contrib/delphi/ZLib.pas b/contrib/delphi/ZLib.pas index ea9a17f..61ffd08 100644 --- a/contrib/delphi/ZLib.pas +++ b/contrib/delphi/ZLib.pas | |||
@@ -152,7 +152,7 @@ procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer; | |||
152 | const OutBuf: Pointer; BufSize: Integer); | 152 | const OutBuf: Pointer; BufSize: Integer); |
153 | 153 | ||
154 | const | 154 | const |
155 | zlib_version = '1.2.0'; | 155 | zlib_version = '1.2.1'; |
156 | 156 | ||
157 | type | 157 | type |
158 | EZlibError = class(Exception); | 158 | EZlibError = class(Exception); |
diff --git a/contrib/gzappend/gzappend.c b/contrib/gzappend/gzappend.c new file mode 100644 index 0000000..f051864 --- /dev/null +++ b/contrib/gzappend/gzappend.c | |||
@@ -0,0 +1,500 @@ | |||
1 | /* gzappend -- command to append to a gzip file | ||
2 | |||
3 | Copyright (C) 2003 Mark Adler, all rights reserved | ||
4 | version 1.1, 4 Nov 2003 | ||
5 | |||
6 | This software is provided 'as-is', without any express or implied | ||
7 | warranty. In no event will the author be held liable for any damages | ||
8 | arising from the use of this software. | ||
9 | |||
10 | Permission is granted to anyone to use this software for any purpose, | ||
11 | including commercial applications, and to alter it and redistribute it | ||
12 | freely, subject to the following restrictions: | ||
13 | |||
14 | 1. The origin of this software must not be misrepresented; you must not | ||
15 | claim that you wrote the original software. If you use this software | ||
16 | in a product, an acknowledgment in the product documentation would be | ||
17 | appreciated but is not required. | ||
18 | 2. Altered source versions must be plainly marked as such, and must not be | ||
19 | misrepresented as being the original software. | ||
20 | 3. This notice may not be removed or altered from any source distribution. | ||
21 | |||
22 | Mark Adler madler@alumni.caltech.edu | ||
23 | */ | ||
24 | |||
25 | /* | ||
26 | * Change history: | ||
27 | * | ||
28 | * 1.0 19 Oct 2003 - First version | ||
29 | * 1.1 4 Nov 2003 - Expand and clarify some comments and notes | ||
30 | * - Add version and copyright to help | ||
31 | * - Send help to stdout instead of stderr | ||
32 | * - Add some preemptive typecasts | ||
33 | * - Add L to constants in lseek() calls | ||
34 | * - Remove some debugging information in error messages | ||
35 | * - Use new data_type definition for zlib 1.2.1 | ||
36 | * - Simplfy and unify file operations | ||
37 | * - Finish off gzip file in gztack() | ||
38 | * - Use deflatePrime() instead of adding empty blocks | ||
39 | * - Keep gzip file clean on appended file read errors | ||
40 | * - Use in-place rotate instead of auxiliary buffer | ||
41 | * (Why you ask? Because it was fun to write!) | ||
42 | */ | ||
43 | |||
44 | /* | ||
45 | gzappend takes a gzip file and appends to it, compressing files from the | ||
46 | command line or data from stdin. The gzip file is written to directly, to | ||
47 | avoid copying that file, in case it's large. Note that this results in the | ||
48 | unfriendly behavior that if gzappend fails, the gzip file is corrupted. | ||
49 | |||
50 | This program was written to illustrate the use of the new Z_BLOCK option of | ||
51 | zlib 1.2.1's inflate() function. This option returns from inflate() at each | ||
52 | block boundary to facilitate locating and modifying the last block bit at | ||
53 | the start of the final deflate block. Also whether using Z_BLOCK or not, | ||
54 | another required feature of zlib 1.2.1 is that inflate() now provides the | ||
55 | number of unusued bits in the last input byte used. gzappend will not work | ||
56 | with versions of zlib earlier than 1.2.1. | ||
57 | |||
58 | gzappend first decompresses the gzip file internally, discarding all but | ||
59 | the last 32K of uncompressed data, and noting the location of the last block | ||
60 | bit and the number of unused bits in the last byte of the compressed data. | ||
61 | The gzip trailer containing the CRC-32 and length of the uncompressed data | ||
62 | is verified. This trailer will be later overwritten. | ||
63 | |||
64 | Then the last block bit is cleared by seeking back in the file and rewriting | ||
65 | the byte that contains it. Seeking forward, the last byte of the compressed | ||
66 | data is saved along with the number of unused bits to initialize deflate. | ||
67 | |||
68 | A deflate process is initialized, using the last 32K of the uncompressed | ||
69 | data from the gzip file to initialize the dictionary. If the total | ||
70 | uncompressed data was less than 32K, then all of it is used to initialize | ||
71 | the dictionary. The deflate output bit buffer is also initialized with the | ||
72 | last bits from the original deflate stream. From here on, the data to | ||
73 | append is simply compressed using deflate, and written to the gzip file. | ||
74 | When that is complete, the new CRC-32 and uncompressed length are written | ||
75 | as the trailer of the gzip file. | ||
76 | */ | ||
77 | |||
78 | #include <stdio.h> | ||
79 | #include <stdlib.h> | ||
80 | #include <string.h> | ||
81 | #include <fcntl.h> | ||
82 | #include <unistd.h> | ||
83 | #include "zlib.h" | ||
84 | |||
85 | #define local static | ||
86 | #define LGCHUNK 14 | ||
87 | #define CHUNK (1U << LGCHUNK) | ||
88 | #define DSIZE 32768U | ||
89 | |||
90 | /* print an error message and terminate with extreme prejudice */ | ||
91 | local void bye(char *msg1, char *msg2) | ||
92 | { | ||
93 | fprintf(stderr, "gzappend error: %s%s\n", msg1, msg2); | ||
94 | exit(1); | ||
95 | } | ||
96 | |||
97 | /* return the greatest common divisor of a and b using Euclid's algorithm, | ||
98 | modified to be fast when one argument much greater than the other, and | ||
99 | coded to avoid unnecessary swapping */ | ||
100 | local unsigned gcd(unsigned a, unsigned b) | ||
101 | { | ||
102 | unsigned c; | ||
103 | |||
104 | while (a && b) | ||
105 | if (a > b) { | ||
106 | c = b; | ||
107 | while (a - c >= c) | ||
108 | c <<= 1; | ||
109 | a -= c; | ||
110 | } | ||
111 | else { | ||
112 | c = a; | ||
113 | while (b - c >= c) | ||
114 | c <<= 1; | ||
115 | b -= c; | ||
116 | } | ||
117 | return a + b; | ||
118 | } | ||
119 | |||
120 | /* rotate list[0..len-1] left by rot positions, in place */ | ||
121 | local void rotate(unsigned char *list, unsigned len, unsigned rot) | ||
122 | { | ||
123 | unsigned char tmp; | ||
124 | unsigned cycles; | ||
125 | unsigned char *start, *last, *to, *from; | ||
126 | |||
127 | /* normalize rot and handle degenerate cases */ | ||
128 | if (len < 2) return; | ||
129 | if (rot >= len) rot %= len; | ||
130 | if (rot == 0) return; | ||
131 | |||
132 | /* pointer to last entry in list */ | ||
133 | last = list + (len - 1); | ||
134 | |||
135 | /* do simple left shift by one */ | ||
136 | if (rot == 1) { | ||
137 | tmp = *list; | ||
138 | memcpy(list, list + 1, len - 1); | ||
139 | *last = tmp; | ||
140 | return; | ||
141 | } | ||
142 | |||
143 | /* do simple right shift by one */ | ||
144 | if (rot == len - 1) { | ||
145 | tmp = *last; | ||
146 | memmove(list + 1, list, len - 1); | ||
147 | *list = tmp; | ||
148 | return; | ||
149 | } | ||
150 | |||
151 | /* otherwise do rotate as a set of cycles in place */ | ||
152 | cycles = gcd(len, rot); /* number of cycles */ | ||
153 | do { | ||
154 | start = from = list + cycles; /* start index is arbitrary */ | ||
155 | tmp = *from; /* save entry to be overwritten */ | ||
156 | for (;;) { | ||
157 | to = from; /* next step in cycle */ | ||
158 | from += rot; /* go right rot positions */ | ||
159 | if (from > last) from -= len; /* (pointer better not wrap) */ | ||
160 | if (from == start) break; /* all but one shifted */ | ||
161 | *to = *from; /* shift left */ | ||
162 | } | ||
163 | *to = tmp; /* complete the circle */ | ||
164 | } while (--cycles); | ||
165 | } | ||
166 | |||
167 | /* structure for gzip file read operations */ | ||
168 | typedef struct { | ||
169 | int fd; /* file descriptor */ | ||
170 | int size; /* 1 << size is bytes in buf */ | ||
171 | unsigned left; /* bytes available at next */ | ||
172 | unsigned char *buf; /* buffer */ | ||
173 | unsigned char *next; /* next byte in buffer */ | ||
174 | char *name; /* file name for error messages */ | ||
175 | } file; | ||
176 | |||
177 | /* reload buffer */ | ||
178 | local int readin(file *in) | ||
179 | { | ||
180 | int len; | ||
181 | |||
182 | len = read(in->fd, in->buf, 1 << in->size); | ||
183 | if (len == -1) bye("error reading ", in->name); | ||
184 | in->left = (unsigned)len; | ||
185 | in->next = in->buf; | ||
186 | return len; | ||
187 | } | ||
188 | |||
189 | /* read from file in, exit if end-of-file */ | ||
190 | local int readmore(file *in) | ||
191 | { | ||
192 | if (readin(in) == 0) bye("unexpected end of ", in->name); | ||
193 | return 0; | ||
194 | } | ||
195 | |||
196 | #define read1(in) (in->left == 0 ? readmore(in) : 0, \ | ||
197 | in->left--, *(in->next)++) | ||
198 | |||
199 | /* skip over n bytes of in */ | ||
200 | local void skip(file *in, unsigned n) | ||
201 | { | ||
202 | unsigned bypass; | ||
203 | |||
204 | if (n > in->left) { | ||
205 | n -= in->left; | ||
206 | bypass = n & ~((1U << in->size) - 1); | ||
207 | if (bypass) { | ||
208 | if (lseek(in->fd, (off_t)bypass, SEEK_CUR) == -1) | ||
209 | bye("seeking ", in->name); | ||
210 | n -= bypass; | ||
211 | } | ||
212 | readmore(in); | ||
213 | if (n > in->left) | ||
214 | bye("unexpected end of ", in->name); | ||
215 | } | ||
216 | in->left -= n; | ||
217 | in->next += n; | ||
218 | } | ||
219 | |||
220 | /* read a four-byte unsigned integer, little-endian, from in */ | ||
221 | unsigned long read4(file *in) | ||
222 | { | ||
223 | unsigned long val; | ||
224 | |||
225 | val = read1(in); | ||
226 | val += (unsigned)read1(in) << 8; | ||
227 | val += (unsigned long)read1(in) << 16; | ||
228 | val += (unsigned long)read1(in) << 24; | ||
229 | return val; | ||
230 | } | ||
231 | |||
232 | /* skip over gzip header */ | ||
233 | local void gzheader(file *in) | ||
234 | { | ||
235 | int flags; | ||
236 | unsigned n; | ||
237 | |||
238 | if (read1(in) != 31 || read1(in) != 139) bye(in->name, " not a gzip file"); | ||
239 | if (read1(in) != 8) bye("unknown compression method in", in->name); | ||
240 | flags = read1(in); | ||
241 | if (flags & 0xe0) bye("unknown header flags set in", in->name); | ||
242 | skip(in, 6); | ||
243 | if (flags & 4) { | ||
244 | n = read1(in); | ||
245 | n += (unsigned)(read1(in)) << 8; | ||
246 | skip(in, n); | ||
247 | } | ||
248 | if (flags & 8) while (read1(in) != 0) ; | ||
249 | if (flags & 16) while (read1(in) != 0) ; | ||
250 | if (flags & 2) skip(in, 2); | ||
251 | } | ||
252 | |||
253 | /* decompress gzip file "name", return strm with a deflate stream ready to | ||
254 | continue compression of the data in the gzip file, and return a file | ||
255 | descriptor pointing to where to write the compressed data -- the deflate | ||
256 | stream is initialized to compress using level "level" */ | ||
257 | local int gzscan(char *name, z_stream *strm, int level) | ||
258 | { | ||
259 | int ret, lastbit, left, full; | ||
260 | unsigned have; | ||
261 | unsigned long crc, tot; | ||
262 | unsigned char *window; | ||
263 | off_t lastoff, end; | ||
264 | file gz; | ||
265 | |||
266 | /* open gzip file */ | ||
267 | gz.name = name; | ||
268 | gz.fd = open(name, O_RDWR, 0); | ||
269 | if (gz.fd == -1) bye("cannot open ", name); | ||
270 | gz.buf = malloc(CHUNK); | ||
271 | if (gz.buf == NULL) bye("out of memory", ""); | ||
272 | gz.size = LGCHUNK; | ||
273 | gz.left = 0; | ||
274 | |||
275 | /* skip gzip header */ | ||
276 | gzheader(&gz); | ||
277 | |||
278 | /* prepare to decompress */ | ||
279 | window = malloc(DSIZE); | ||
280 | if (window == NULL) bye("out of memory", ""); | ||
281 | strm->zalloc = Z_NULL; | ||
282 | strm->zfree = Z_NULL; | ||
283 | strm->opaque = Z_NULL; | ||
284 | ret = inflateInit2(strm, -15); | ||
285 | if (ret != Z_OK) bye("out of memory", " or library mismatch"); | ||
286 | |||
287 | /* decompress the deflate stream, saving append information */ | ||
288 | lastbit = 0; | ||
289 | lastoff = lseek(gz.fd, 0L, SEEK_CUR) - gz.left; | ||
290 | left = 0; | ||
291 | strm->avail_in = gz.left; | ||
292 | strm->next_in = gz.next; | ||
293 | crc = crc32(0L, Z_NULL, 0); | ||
294 | have = full = 0; | ||
295 | do { | ||
296 | /* if needed, get more input */ | ||
297 | if (strm->avail_in == 0) { | ||
298 | readmore(&gz); | ||
299 | strm->avail_in = gz.left; | ||
300 | strm->next_in = gz.next; | ||
301 | } | ||
302 | |||
303 | /* set up output to next available section of sliding window */ | ||
304 | strm->avail_out = DSIZE - have; | ||
305 | strm->next_out = window + have; | ||
306 | |||
307 | /* inflate and check for errors */ | ||
308 | ret = inflate(strm, Z_BLOCK); | ||
309 | if (ret == Z_STREAM_ERROR) bye("internal stream error!", ""); | ||
310 | if (ret == Z_MEM_ERROR) bye("out of memory", ""); | ||
311 | if (ret == Z_DATA_ERROR) | ||
312 | bye("invalid compressed data--format violated in", name); | ||
313 | |||
314 | /* update crc and sliding window pointer */ | ||
315 | crc = crc32(crc, window + have, DSIZE - have - strm->avail_out); | ||
316 | if (strm->avail_out) | ||
317 | have = DSIZE - strm->avail_out; | ||
318 | else { | ||
319 | have = 0; | ||
320 | full = 1; | ||
321 | } | ||
322 | |||
323 | /* process end of block */ | ||
324 | if (strm->data_type & 128) { | ||
325 | if (strm->data_type & 64) | ||
326 | left = strm->data_type & 0x1f; | ||
327 | else { | ||
328 | lastbit = strm->data_type & 0x1f; | ||
329 | lastoff = lseek(gz.fd, 0L, SEEK_CUR) - strm->avail_in; | ||
330 | } | ||
331 | } | ||
332 | } while (ret != Z_STREAM_END); | ||
333 | inflateEnd(strm); | ||
334 | gz.left = strm->avail_in; | ||
335 | gz.next = strm->next_in; | ||
336 | |||
337 | /* save the location of the end of the compressed data */ | ||
338 | end = lseek(gz.fd, 0L, SEEK_CUR) - gz.left; | ||
339 | |||
340 | /* check gzip trailer and save total for deflate */ | ||
341 | if (crc != read4(&gz)) | ||
342 | bye("invalid compressed data--crc mismatch in ", name); | ||
343 | tot = strm->total_out; | ||
344 | if ((tot & 0xffffffffUL) != read4(&gz)) | ||
345 | bye("invalid compressed data--length mismatch in", name); | ||
346 | |||
347 | /* if not at end of file, warn */ | ||
348 | if (gz.left || readin(&gz)) | ||
349 | fprintf(stderr, | ||
350 | "gzappend warning: junk at end of gzip file overwritten\n"); | ||
351 | |||
352 | /* clear last block bit */ | ||
353 | lseek(gz.fd, lastoff - (lastbit != 0), SEEK_SET); | ||
354 | if (read(gz.fd, gz.buf, 1) != 1) bye("reading after seek on ", name); | ||
355 | *gz.buf = (unsigned char)(*gz.buf ^ (1 << ((8 - lastbit) & 7))); | ||
356 | lseek(gz.fd, -1L, SEEK_CUR); | ||
357 | if (write(gz.fd, gz.buf, 1) != 1) bye("writing after seek to ", name); | ||
358 | |||
359 | /* if window wrapped, build dictionary from window by rotating */ | ||
360 | if (full) { | ||
361 | rotate(window, DSIZE, have); | ||
362 | have = DSIZE; | ||
363 | } | ||
364 | |||
365 | /* set up deflate stream with window, crc, total_in, and leftover bits */ | ||
366 | ret = deflateInit2(strm, level, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY); | ||
367 | if (ret != Z_OK) bye("out of memory", ""); | ||
368 | deflateSetDictionary(strm, window, have); | ||
369 | strm->adler = crc; | ||
370 | strm->total_in = tot; | ||
371 | if (left) { | ||
372 | lseek(gz.fd, --end, SEEK_SET); | ||
373 | if (read(gz.fd, gz.buf, 1) != 1) bye("reading after seek on ", name); | ||
374 | deflatePrime(strm, 8 - left, *gz.buf); | ||
375 | } | ||
376 | lseek(gz.fd, end, SEEK_SET); | ||
377 | |||
378 | /* clean up and return */ | ||
379 | free(window); | ||
380 | free(gz.buf); | ||
381 | return gz.fd; | ||
382 | } | ||
383 | |||
384 | /* append file "name" to gzip file gd using deflate stream strm -- if last | ||
385 | is true, then finish off the deflate stream at the end */ | ||
386 | local void gztack(char *name, int gd, z_stream *strm, int last) | ||
387 | { | ||
388 | int fd, len, ret; | ||
389 | unsigned left; | ||
390 | unsigned char *in, *out; | ||
391 | |||
392 | /* open file to compress and append */ | ||
393 | fd = 0; | ||
394 | if (name != NULL) { | ||
395 | fd = open(name, O_RDONLY, 0); | ||
396 | if (fd == -1) | ||
397 | fprintf(stderr, "gzappend warning: %s not found, skipping ...\n", | ||
398 | name); | ||
399 | } | ||
400 | |||
401 | /* allocate buffers */ | ||
402 | in = fd == -1 ? NULL : malloc(CHUNK); | ||
403 | out = malloc(CHUNK); | ||
404 | if (out == NULL) bye("out of memory", ""); | ||
405 | |||
406 | /* compress input file and append to gzip file */ | ||
407 | do { | ||
408 | /* get more input */ | ||
409 | len = fd == -1 ? 0 : read(fd, in, CHUNK); | ||
410 | if (len == -1) { | ||
411 | fprintf(stderr, | ||
412 | "gzappend warning: error reading %s, skipping rest ...\n", | ||
413 | name); | ||
414 | len = 0; | ||
415 | } | ||
416 | strm->avail_in = (unsigned)len; | ||
417 | strm->next_in = in; | ||
418 | if (len) strm->adler = crc32(strm->adler, in, (unsigned)len); | ||
419 | |||
420 | /* compress and write all available output */ | ||
421 | do { | ||
422 | strm->avail_out = CHUNK; | ||
423 | strm->next_out = out; | ||
424 | ret = deflate(strm, last && len == 0 ? Z_FINISH : Z_NO_FLUSH); | ||
425 | left = CHUNK - strm->avail_out; | ||
426 | while (left) { | ||
427 | len = write(gd, out + CHUNK - strm->avail_out - left, left); | ||
428 | if (len == -1) bye("writing gzip file", ""); | ||
429 | left -= (unsigned)len; | ||
430 | } | ||
431 | } while (strm->avail_out == 0 && ret != Z_STREAM_END); | ||
432 | } while (len != 0); | ||
433 | |||
434 | /* write trailer after last entry */ | ||
435 | if (last) { | ||
436 | deflateEnd(strm); | ||
437 | out[0] = (unsigned char)(strm->adler); | ||
438 | out[1] = (unsigned char)(strm->adler >> 8); | ||
439 | out[2] = (unsigned char)(strm->adler >> 16); | ||
440 | out[3] = (unsigned char)(strm->adler >> 24); | ||
441 | out[4] = (unsigned char)(strm->total_in); | ||
442 | out[5] = (unsigned char)(strm->total_in >> 8); | ||
443 | out[6] = (unsigned char)(strm->total_in >> 16); | ||
444 | out[7] = (unsigned char)(strm->total_in >> 24); | ||
445 | len = 8; | ||
446 | do { | ||
447 | ret = write(gd, out + 8 - len, len); | ||
448 | if (ret == -1) bye("writing gzip file", ""); | ||
449 | len -= ret; | ||
450 | } while (len); | ||
451 | close(gd); | ||
452 | } | ||
453 | |||
454 | /* clean up and return */ | ||
455 | free(out); | ||
456 | if (in != NULL) free(in); | ||
457 | if (fd > 0) close(fd); | ||
458 | } | ||
459 | |||
460 | /* process the compression level option if present, scan the gzip file, and | ||
461 | append the specified files, or append the data from stdin if no other file | ||
462 | names are provided on the command line -- the gzip file must be writable | ||
463 | and seekable */ | ||
464 | int main(int argc, char **argv) | ||
465 | { | ||
466 | int gd, level; | ||
467 | z_stream strm; | ||
468 | |||
469 | /* ignore command name */ | ||
470 | argv++; | ||
471 | |||
472 | /* provide usage if no arguments */ | ||
473 | if (*argv == NULL) { | ||
474 | printf("gzappend 1.1 (4 Nov 2003) Copyright (C) 2003 Mark Adler\n"); | ||
475 | printf( | ||
476 | "usage: gzappend [-level] file.gz [ addthis [ andthis ... ]]\n"); | ||
477 | return 0; | ||
478 | } | ||
479 | |||
480 | /* set compression level */ | ||
481 | level = Z_DEFAULT_COMPRESSION; | ||
482 | if (argv[0][0] == '-') { | ||
483 | if (argv[0][1] < '0' || argv[0][1] > '9' || argv[0][2] != 0) | ||
484 | bye("invalid compression level", ""); | ||
485 | level = argv[0][1] - '0'; | ||
486 | if (*++argv == NULL) bye("no gzip file name after options", ""); | ||
487 | } | ||
488 | |||
489 | /* prepare to append to gzip file */ | ||
490 | gd = gzscan(*argv++, &strm, level); | ||
491 | |||
492 | /* append files on command line, or from stdin if none */ | ||
493 | if (*argv == NULL) | ||
494 | gztack(NULL, gd, &strm, 1); | ||
495 | else | ||
496 | do { | ||
497 | gztack(*argv, gd, &strm, argv[1] == NULL); | ||
498 | } while (*++argv != NULL); | ||
499 | return 0; | ||
500 | } | ||
diff --git a/contrib/infback9/inftree9.c b/contrib/infback9/inftree9.c index 2829a84..44ff721 100644 --- a/contrib/infback9/inftree9.c +++ b/contrib/infback9/inftree9.c | |||
@@ -9,7 +9,7 @@ | |||
9 | #define MAXBITS 15 | 9 | #define MAXBITS 15 |
10 | 10 | ||
11 | const char inflate9_copyright[] = | 11 | const char inflate9_copyright[] = |
12 | " inflate9 1.2.0.7 Copyright 1995-2003 Mark Adler "; | 12 | " inflate9 1.2.0.8 Copyright 1995-2003 Mark Adler "; |
13 | /* | 13 | /* |
14 | If you use the zlib library in a product, an acknowledgment is welcome | 14 | If you use the zlib library in a product, an acknowledgment is welcome |
15 | in the documentation of your product. If for some reason you cannot | 15 | in the documentation of your product. If for some reason you cannot |
@@ -64,7 +64,7 @@ unsigned short FAR *work; | |||
64 | static const unsigned short lext[31] = { /* Length codes 257..285 extra */ | 64 | static const unsigned short lext[31] = { /* Length codes 257..285 extra */ |
65 | 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, | 65 | 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, |
66 | 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132, | 66 | 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132, |
67 | 133, 133, 133, 133, 144, 71, 69}; | 67 | 133, 133, 133, 133, 144, 76, 203}; |
68 | static const unsigned short dbase[32] = { /* Distance codes 0..31 base */ | 68 | static const unsigned short dbase[32] = { /* Distance codes 0..31 base */ |
69 | 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, | 69 | 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, |
70 | 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, | 70 | 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, |
diff --git a/contrib/pascal/zlibpas.pas b/contrib/pascal/zlibpas.pas index f81893f..9361914 100644 --- a/contrib/pascal/zlibpas.pas +++ b/contrib/pascal/zlibpas.pas | |||
@@ -10,7 +10,7 @@ unit zlibpas; | |||
10 | interface | 10 | interface |
11 | 11 | ||
12 | const | 12 | const |
13 | ZLIB_VERSION = '1.2.0'; | 13 | ZLIB_VERSION = '1.2.1'; |
14 | 14 | ||
15 | type | 15 | type |
16 | alloc_func = function(opaque: Pointer; items, size: Integer): Pointer; | 16 | alloc_func = function(opaque: Pointer; items, size: Integer): Pointer; |
@@ -97,6 +97,7 @@ function deflateCopy(var dest, source: z_stream): Integer; | |||
97 | function deflateReset(var strm: z_stream): Integer; | 97 | function deflateReset(var strm: z_stream): Integer; |
98 | function deflateParams(var strm: z_stream; level, strategy: Integer): Integer; | 98 | function deflateParams(var strm: z_stream; level, strategy: Integer): Integer; |
99 | function deflateBound(var strm: z_stream; sourceLen: LongInt): LongInt; | 99 | function deflateBound(var strm: z_stream; sourceLen: LongInt): LongInt; |
100 | function deflatePrime(var strm: z_stream; bits, value: Integer): Integer; | ||
100 | function inflateInit2(var strm: z_stream; windowBits: Integer): Integer; | 101 | function inflateInit2(var strm: z_stream; windowBits: Integer): Integer; |
101 | function inflateSetDictionary(var strm: z_stream; const dictionary: PChar; | 102 | function inflateSetDictionary(var strm: z_stream; const dictionary: PChar; |
102 | dictLength: Integer): Integer; | 103 | dictLength: Integer): Integer; |
diff --git a/contrib/visual-basic.txt b/contrib/visual-basic.txt index 10fb44b..57efe58 100644 --- a/contrib/visual-basic.txt +++ b/contrib/visual-basic.txt | |||
@@ -67,3 +67,94 @@ Declare Function gzclose Lib "ZLIB32.DLL" | |||
67 | -Jon Caruana | 67 | -Jon Caruana |
68 | jon-net@usa.net | 68 | jon-net@usa.net |
69 | Microsoft Sitebuilder Network Level 1 Member - HTML Writer's Guild Member | 69 | Microsoft Sitebuilder Network Level 1 Member - HTML Writer's Guild Member |
70 | |||
71 | |||
72 | Here is another example from Michael <michael_borgsys@hotmail.com> that he | ||
73 | says conforms to the VB guidelines, and that solves the problem of not | ||
74 | knowing the uncompressed size by storing it at the end of the file: | ||
75 | |||
76 | 'Calling the functions: | ||
77 | 'bracket meaning: <parameter> [optional] {Range of possible values} | ||
78 | 'Call subCompressFile(<path with filename to compress> [, <path with | ||
79 | filename to write to>, [level of compression {1..9}]]) | ||
80 | 'Call subUncompressFile(<path with filename to compress>) | ||
81 | |||
82 | Option Explicit | ||
83 | Private lngpvtPcnSml As Long 'Stores value for 'lngPercentSmaller' | ||
84 | Private Const SUCCESS As Long = 0 | ||
85 | Private Const strFilExt As String = ".cpr" | ||
86 | Private Declare Function lngfncCpr Lib "zlib.dll" Alias "compress2" (ByRef | ||
87 | dest As Any, ByRef destLen As Any, ByRef src As Any, ByVal srcLen As Long, | ||
88 | ByVal level As Integer) As Long | ||
89 | Private Declare Function lngfncUcp Lib "zlib.dll" Alias "uncompress" (ByRef | ||
90 | dest As Any, ByRef destLen As Any, ByRef src As Any, ByVal srcLen As Long) | ||
91 | As Long | ||
92 | |||
93 | Public Sub subCompressFile(ByVal strargOriFilPth As String, Optional ByVal | ||
94 | strargCprFilPth As String, Optional ByVal intLvl As Integer = 9) | ||
95 | Dim strCprPth As String | ||
96 | Dim lngOriSiz As Long | ||
97 | Dim lngCprSiz As Long | ||
98 | Dim bytaryOri() As Byte | ||
99 | Dim bytaryCpr() As Byte | ||
100 | lngOriSiz = FileLen(strargOriFilPth) | ||
101 | ReDim bytaryOri(lngOriSiz - 1) | ||
102 | Open strargOriFilPth For Binary Access Read As #1 | ||
103 | Get #1, , bytaryOri() | ||
104 | Close #1 | ||
105 | strCprPth = IIf(strargCprFilPth = "", strargOriFilPth, strargCprFilPth) | ||
106 | 'Select file path and name | ||
107 | strCprPth = strCprPth & IIf(Right(strCprPth, Len(strFilExt)) = | ||
108 | strFilExt, "", strFilExt) 'Add file extension if not exists | ||
109 | lngCprSiz = (lngOriSiz * 1.01) + 12 'Compression needs temporary a bit | ||
110 | more space then original file size | ||
111 | ReDim bytaryCpr(lngCprSiz - 1) | ||
112 | If lngfncCpr(bytaryCpr(0), lngCprSiz, bytaryOri(0), lngOriSiz, intLvl) = | ||
113 | SUCCESS Then | ||
114 | lngpvtPcnSml = (1# - (lngCprSiz / lngOriSiz)) * 100 | ||
115 | ReDim Preserve bytaryCpr(lngCprSiz - 1) | ||
116 | Open strCprPth For Binary Access Write As #1 | ||
117 | Put #1, , bytaryCpr() | ||
118 | Put #1, , lngOriSiz 'Add the the original size value to the end | ||
119 | (last 4 bytes) | ||
120 | Close #1 | ||
121 | Else | ||
122 | MsgBox "Compression error" | ||
123 | End If | ||
124 | Erase bytaryCpr | ||
125 | Erase bytaryOri | ||
126 | End Sub | ||
127 | |||
128 | Public Sub subUncompressFile(ByVal strargFilPth As String) | ||
129 | Dim bytaryCpr() As Byte | ||
130 | Dim bytaryOri() As Byte | ||
131 | Dim lngOriSiz As Long | ||
132 | Dim lngCprSiz As Long | ||
133 | Dim strOriPth As String | ||
134 | lngCprSiz = FileLen(strargFilPth) | ||
135 | ReDim bytaryCpr(lngCprSiz - 1) | ||
136 | Open strargFilPth For Binary Access Read As #1 | ||
137 | Get #1, , bytaryCpr() | ||
138 | Close #1 | ||
139 | 'Read the original file size value: | ||
140 | lngOriSiz = bytaryCpr(lngCprSiz - 1) * (2 ^ 24) _ | ||
141 | + bytaryCpr(lngCprSiz - 2) * (2 ^ 16) _ | ||
142 | + bytaryCpr(lngCprSiz - 3) * (2 ^ 8) _ | ||
143 | + bytaryCpr(lngCprSiz - 4) | ||
144 | ReDim Preserve bytaryCpr(lngCprSiz - 5) 'Cut of the original size value | ||
145 | ReDim bytaryOri(lngOriSiz - 1) | ||
146 | If lngfncUcp(bytaryOri(0), lngOriSiz, bytaryCpr(0), lngCprSiz) = SUCCESS | ||
147 | Then | ||
148 | strOriPth = Left(strargFilPth, Len(strargFilPth) - Len(strFilExt)) | ||
149 | Open strOriPth For Binary Access Write As #1 | ||
150 | Put #1, , bytaryOri() | ||
151 | Close #1 | ||
152 | Else | ||
153 | MsgBox "Uncompression error" | ||
154 | End If | ||
155 | Erase bytaryCpr | ||
156 | Erase bytaryOri | ||
157 | End Sub | ||
158 | Public Property Get lngPercentSmaller() As Long | ||
159 | lngPercentSmaller = lngpvtPcnSml | ||
160 | End Property | ||
diff --git a/contrib/vstudio/vc7/zlibvc.def b/contrib/vstudio/vc7/zlibvc.def index 63b3e6d..6bc26c4 100644 --- a/contrib/vstudio/vc7/zlibvc.def +++ b/contrib/vstudio/vc7/zlibvc.def | |||
@@ -53,7 +53,8 @@ EXPORTS | |||
53 | deflateBound @47 | 53 | deflateBound @47 |
54 | gzclearerr @48 | 54 | gzclearerr @48 |
55 | gzungetc @49 | 55 | gzungetc @49 |
56 | zlibCompileFlags @50 | 56 | zlibCompileFlags @50 |
57 | deflatePrime @51 | ||
57 | 58 | ||
58 | unzOpen @61 | 59 | unzOpen @61 |
59 | unzClose @62 | 60 | unzClose @62 |
@@ -52,7 +52,7 @@ | |||
52 | #include "deflate.h" | 52 | #include "deflate.h" |
53 | 53 | ||
54 | const char deflate_copyright[] = | 54 | const char deflate_copyright[] = |
55 | " deflate 1.2.0.7 Copyright 1995-2003 Jean-loup Gailly "; | 55 | " deflate 1.2.0.8 Copyright 1995-2003 Jean-loup Gailly "; |
56 | /* | 56 | /* |
57 | If you use the zlib library in a product, an acknowledgment is welcome | 57 | If you use the zlib library in a product, an acknowledgment is welcome |
58 | in the documentation of your product. If for some reason you cannot | 58 | in the documentation of your product. If for some reason you cannot |
@@ -391,6 +391,18 @@ int ZEXPORT deflateReset (strm) | |||
391 | } | 391 | } |
392 | 392 | ||
393 | /* ========================================================================= */ | 393 | /* ========================================================================= */ |
394 | int ZEXPORT deflatePrime (strm, bits, value) | ||
395 | z_streamp strm; | ||
396 | int bits; | ||
397 | int value; | ||
398 | { | ||
399 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | ||
400 | strm->state->bi_valid = bits; | ||
401 | strm->state->bi_buf = (ush)(value & ((1 << bits) - 1)); | ||
402 | return Z_OK; | ||
403 | } | ||
404 | |||
405 | /* ========================================================================= */ | ||
394 | int ZEXPORT deflateParams(strm, level, strategy) | 406 | int ZEXPORT deflateParams(strm, level, strategy) |
395 | z_streamp strm; | 407 | z_streamp strm; |
396 | int level; | 408 | int level; |
@@ -889,7 +889,13 @@ int ZEXPORT gzeof (file) | |||
889 | { | 889 | { |
890 | gz_stream *s = (gz_stream*)file; | 890 | gz_stream *s = (gz_stream*)file; |
891 | 891 | ||
892 | return (s == NULL || s->mode != 'r') ? 0 : s->z_eof; | 892 | /* With concatenated compressed files that can have embedded |
893 | * crc trailers, z_eof is no longer the only/best indicator of EOF | ||
894 | * on a gz_stream. Handle end-of-stream error explicitly here. | ||
895 | */ | ||
896 | if (s == NULL || s->mode != 'r') return 0; | ||
897 | if (s->z_eof) return 1; | ||
898 | return s->z_err == Z_STREAM_END; | ||
893 | } | 899 | } |
894 | 900 | ||
895 | /* =========================================================================== | 901 | /* =========================================================================== |
@@ -568,7 +568,7 @@ int flush; | |||
568 | switch (state->mode) { | 568 | switch (state->mode) { |
569 | case HEAD: | 569 | case HEAD: |
570 | if (state->wrap == 0) { | 570 | if (state->wrap == 0) { |
571 | state->mode = TYPE; | 571 | state->mode = TYPEDO; |
572 | break; | 572 | break; |
573 | } | 573 | } |
574 | NEEDBITS(16); | 574 | NEEDBITS(16); |
@@ -1074,8 +1074,8 @@ int flush; | |||
1074 | if (state->wrap && out) | 1074 | if (state->wrap && out) |
1075 | strm->adler = state->check = | 1075 | strm->adler = state->check = |
1076 | UPDATE(state->check, strm->next_out - out, out); | 1076 | UPDATE(state->check, strm->next_out - out, out); |
1077 | strm->data_type = state->bits + (state->last ? 8 : 0) + | 1077 | strm->data_type = state->bits + (state->last ? 64 : 0) + |
1078 | (state->mode == TYPE ? 16 : 0); | 1078 | (state->mode == TYPE ? 128 : 0); |
1079 | if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) | 1079 | if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) |
1080 | ret = Z_BUF_ERROR; | 1080 | ret = Z_BUF_ERROR; |
1081 | return ret; | 1081 | return ret; |
@@ -9,7 +9,7 @@ | |||
9 | #define MAXBITS 15 | 9 | #define MAXBITS 15 |
10 | 10 | ||
11 | const char inflate_copyright[] = | 11 | const char inflate_copyright[] = |
12 | " inflate 1.2.0.7 Copyright 1995-2003 Mark Adler "; | 12 | " inflate 1.2.0.8 Copyright 1995-2003 Mark Adler "; |
13 | /* | 13 | /* |
14 | If you use the zlib library in a product, an acknowledgment is welcome | 14 | If you use the zlib library in a product, an acknowledgment is welcome |
15 | in the documentation of your product. If for some reason you cannot | 15 | in the documentation of your product. If for some reason you cannot |
@@ -62,7 +62,7 @@ unsigned short FAR *work; | |||
62 | 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; | 62 | 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; |
63 | static const unsigned short lext[31] = { /* Length codes 257..285 extra */ | 63 | static const unsigned short lext[31] = { /* Length codes 257..285 extra */ |
64 | 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, | 64 | 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, |
65 | 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 71, 69}; | 65 | 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 76, 203}; |
66 | static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ | 66 | static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ |
67 | 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, | 67 | 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, |
68 | 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, | 68 | 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, |
@@ -31,7 +31,7 @@ | |||
31 | # include <sys/stat.h> | 31 | # include <sys/stat.h> |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | #if defined(MSDOS) || defined(OS2) || defined(WIN32) | 34 | #if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__) |
35 | # include <fcntl.h> | 35 | # include <fcntl.h> |
36 | # include <io.h> | 36 | # include <io.h> |
37 | # define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) | 37 | # define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) |
diff --git a/qnx/package.qpg b/qnx/package.qpg index f7c9e73..69336d9 100644 --- a/qnx/package.qpg +++ b/qnx/package.qpg | |||
@@ -25,10 +25,10 @@ | |||
25 | <QPG:Files> | 25 | <QPG:Files> |
26 | <QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/> | 26 | <QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/> |
27 | <QPG:Add file="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/> | 27 | <QPG:Add file="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/> |
28 | <QPG:Add file="../libz.so.1.2.0.7" install="/opt/lib/" user="root:bin" permission="644"/> | 28 | <QPG:Add file="../libz.so.1.2.0.8" install="/opt/lib/" user="root:bin" permission="644"/> |
29 | <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.0.7"/> | 29 | <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.0.8"/> |
30 | <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.0.7"/> | 30 | <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.0.8"/> |
31 | <QPG:Add file="../libz.so.1.2.0.7" install="/opt/lib/" component="slib"/> | 31 | <QPG:Add file="../libz.so.1.2.0.8" install="/opt/lib/" component="slib"/> |
32 | </QPG:Files> | 32 | </QPG:Files> |
33 | 33 | ||
34 | <QPG:PackageFilter> | 34 | <QPG:PackageFilter> |
@@ -63,7 +63,7 @@ | |||
63 | </QPM:ProductDescription> | 63 | </QPM:ProductDescription> |
64 | 64 | ||
65 | <QPM:ReleaseDescription> | 65 | <QPM:ReleaseDescription> |
66 | <QPM:ReleaseVersion>1.2.0.7</QPM:ReleaseVersion> | 66 | <QPM:ReleaseVersion>1.2.0.8</QPM:ReleaseVersion> |
67 | <QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency> | 67 | <QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency> |
68 | <QPM:ReleaseStability>Stable</QPM:ReleaseStability> | 68 | <QPM:ReleaseStability>Stable</QPM:ReleaseStability> |
69 | <QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor> | 69 | <QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor> |
diff --git a/win32/DLL_FAQ.txt b/win32/DLL_FAQ.txt index c44bce5..80b6b42 100644 --- a/win32/DLL_FAQ.txt +++ b/win32/DLL_FAQ.txt | |||
@@ -334,9 +334,9 @@ in the zlib distribution, or at the following location: | |||
334 | link them in ZLIB1.DLL, and export them? | 334 | link them in ZLIB1.DLL, and export them? |
335 | 335 | ||
336 | - No. A legitimate build of ZLIB1.DLL must not include code | 336 | - No. A legitimate build of ZLIB1.DLL must not include code |
337 | that does not originate from the official zlib sources. But | 337 | that does not originate from the official zlib source code. |
338 | you can make your own private build, and give it a different | 338 | But you can make your own private DLL build, under a different |
339 | name, as suggested in the previous answer. | 339 | file name, as suggested in the previous answer. |
340 | 340 | ||
341 | For example, in Borland Delphi and C++ Builder, zlib is a part | 341 | For example, in Borland Delphi and C++ Builder, zlib is a part |
342 | of the standard VCL library. If an application links to VCL | 342 | of the standard VCL library. If an application links to VCL |
@@ -345,7 +345,16 @@ in the zlib distribution, or at the following location: | |||
345 | incompatible ZLIB1.DLL. | 345 | incompatible ZLIB1.DLL. |
346 | 346 | ||
347 | 347 | ||
348 | 14. I made my own ZLIB1.DLL build. Can I test it for compliance? | 348 | 14. May I remove some functionality out of ZLIB1.DLL, by enabling |
349 | macros like NO_GZCOMPRESS or NO_GZIP at compile time? | ||
350 | |||
351 | - No. A legitimate build of ZLIB1.DLL must provide the complete | ||
352 | zlib functionality, as implemented in the official zlib source | ||
353 | code. But you can make your own private DLL build, under a | ||
354 | different file name, as suggested in the previous answer. | ||
355 | |||
356 | |||
357 | 15. I made my own ZLIB1.DLL build. Can I test it for compliance? | ||
349 | 358 | ||
350 | - We prefer that you download the official DLL from the zlib | 359 | - We prefer that you download the official DLL from the zlib |
351 | web site. If you need something peculiar from this DLL, you | 360 | web site. If you need something peculiar from this DLL, you |
@@ -356,3 +365,7 @@ in the zlib distribution, or at the following location: | |||
356 | Running these test programs is not a guarantee of compliance, | 365 | Running these test programs is not a guarantee of compliance, |
357 | but a failure can imply a detected problem. | 366 | but a failure can imply a detected problem. |
358 | 367 | ||
368 | ** | ||
369 | |||
370 | This document is written and maintained by | ||
371 | Cosmin Truta <cosmint@cs.ubbcluj.ro> | ||
diff --git a/win32/zlib.def b/win32/zlib.def index 5688a1c..a47cbc1 100644 --- a/win32/zlib.def +++ b/win32/zlib.def | |||
@@ -14,6 +14,7 @@ EXPORTS | |||
14 | deflateReset | 14 | deflateReset |
15 | deflateParams | 15 | deflateParams |
16 | deflateBound | 16 | deflateBound |
17 | deflatePrime | ||
17 | inflateSetDictionary | 18 | inflateSetDictionary |
18 | inflateSync | 19 | inflateSync |
19 | inflateCopy | 20 | inflateCopy |
diff --git a/win32/zlib1.rc b/win32/zlib1.rc index 9c26467..09a06f5 100644 --- a/win32/zlib1.rc +++ b/win32/zlib1.rc | |||
@@ -5,8 +5,8 @@ VS_VERSION_INFO VERSIONINFO | |||
5 | #else | 5 | #else |
6 | VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE | 6 | VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE |
7 | #endif | 7 | #endif |
8 | FILEVERSION 1,2,0,7 | 8 | FILEVERSION 1,2,0,8 |
9 | PRODUCTVERSION 1,2,0,7 | 9 | PRODUCTVERSION 1,2,0,8 |
10 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK | 10 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK |
11 | #ifdef _DEBUG | 11 | #ifdef _DEBUG |
12 | FILEFLAGS 1 | 12 | FILEFLAGS 1 |
@@ -23,12 +23,12 @@ BEGIN | |||
23 | //language ID = U.S. English, char set = Windows, Multilingual | 23 | //language ID = U.S. English, char set = Windows, Multilingual |
24 | BEGIN | 24 | BEGIN |
25 | VALUE "FileDescription", "zlib data compression library\0" | 25 | VALUE "FileDescription", "zlib data compression library\0" |
26 | VALUE "FileVersion", "1.2.0.7\0" | 26 | VALUE "FileVersion", "1.2.0.8\0" |
27 | VALUE "InternalName", "zlib1.dll\0" | 27 | VALUE "InternalName", "zlib1.dll\0" |
28 | VALUE "LegalCopyright", "(C) 1995-2003 Jean-loup Gailly & Mark Adler\0" | 28 | VALUE "LegalCopyright", "(C) 1995-2003 Jean-loup Gailly & Mark Adler\0" |
29 | VALUE "OriginalFilename", "zlib1.dll\0" | 29 | VALUE "OriginalFilename", "zlib1.dll\0" |
30 | VALUE "ProductName", "zlib\0" | 30 | VALUE "ProductName", "zlib\0" |
31 | VALUE "ProductVersion", "1.2.0.7\0" | 31 | VALUE "ProductVersion", "1.2.0.8\0" |
32 | VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" | 32 | VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" |
33 | END | 33 | END |
34 | END | 34 | END |
@@ -23,6 +23,7 @@ | |||
23 | # define deflateSetDictionary z_deflateSetDictionary | 23 | # define deflateSetDictionary z_deflateSetDictionary |
24 | # define deflateCopy z_deflateCopy | 24 | # define deflateCopy z_deflateCopy |
25 | # define deflateReset z_deflateReset | 25 | # define deflateReset z_deflateReset |
26 | # define deflatePrime z_deflatePrime | ||
26 | # define deflateParams z_deflateParams | 27 | # define deflateParams z_deflateParams |
27 | # define deflateBound z_deflateBound | 28 | # define deflateBound z_deflateBound |
28 | # define inflateInit2_ z_inflateInit2_ | 29 | # define inflateInit2_ z_inflateInit2_ |
@@ -105,6 +106,10 @@ | |||
105 | # define STDC | 106 | # define STDC |
106 | #endif | 107 | #endif |
107 | 108 | ||
109 | #if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ | ||
110 | # define STDC | ||
111 | #endif | ||
112 | |||
108 | #ifndef STDC | 113 | #ifndef STDC |
109 | # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ | 114 | # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ |
110 | # define const /* note: need a more gentle solution here */ | 115 | # define const /* note: need a more gentle solution here */ |
@@ -287,11 +292,15 @@ typedef uLong FAR uLongf; | |||
287 | # define z_off_t long | 292 | # define z_off_t long |
288 | #endif | 293 | #endif |
289 | 294 | ||
290 | #if defined(__MVS__) | 295 | #if defined(__OS400__) |
291 | #define NO_vsnprintf | 296 | #define NO_vsnprintf |
292 | #ifdef FAR | ||
293 | #undef FAR | ||
294 | #endif | 297 | #endif |
298 | |||
299 | #if defined(__MVS__) | ||
300 | # define NO_vsnprintf | ||
301 | # ifdef FAR | ||
302 | # undef FAR | ||
303 | # endif | ||
295 | #endif | 304 | #endif |
296 | 305 | ||
297 | /* MVS linker does not support external names larger than 8 bytes */ | 306 | /* MVS linker does not support external names larger than 8 bytes */ |
@@ -23,6 +23,7 @@ | |||
23 | # define deflateSetDictionary z_deflateSetDictionary | 23 | # define deflateSetDictionary z_deflateSetDictionary |
24 | # define deflateCopy z_deflateCopy | 24 | # define deflateCopy z_deflateCopy |
25 | # define deflateReset z_deflateReset | 25 | # define deflateReset z_deflateReset |
26 | # define deflatePrime z_deflatePrime | ||
26 | # define deflateParams z_deflateParams | 27 | # define deflateParams z_deflateParams |
27 | # define deflateBound z_deflateBound | 28 | # define deflateBound z_deflateBound |
28 | # define inflateInit2_ z_inflateInit2_ | 29 | # define inflateInit2_ z_inflateInit2_ |
@@ -105,6 +106,10 @@ | |||
105 | # define STDC | 106 | # define STDC |
106 | #endif | 107 | #endif |
107 | 108 | ||
109 | #if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ | ||
110 | # define STDC | ||
111 | #endif | ||
112 | |||
108 | #ifndef STDC | 113 | #ifndef STDC |
109 | # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ | 114 | # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ |
110 | # define const /* note: need a more gentle solution here */ | 115 | # define const /* note: need a more gentle solution here */ |
@@ -287,11 +292,15 @@ typedef uLong FAR uLongf; | |||
287 | # define z_off_t long | 292 | # define z_off_t long |
288 | #endif | 293 | #endif |
289 | 294 | ||
290 | #if defined(__MVS__) | 295 | #if defined(__OS400__) |
291 | #define NO_vsnprintf | 296 | #define NO_vsnprintf |
292 | #ifdef FAR | ||
293 | #undef FAR | ||
294 | #endif | 297 | #endif |
298 | |||
299 | #if defined(__MVS__) | ||
300 | # define NO_vsnprintf | ||
301 | # ifdef FAR | ||
302 | # undef FAR | ||
303 | # endif | ||
295 | #endif | 304 | #endif |
296 | 305 | ||
297 | /* MVS linker does not support external names larger than 8 bytes */ | 306 | /* MVS linker does not support external names larger than 8 bytes */ |
@@ -1,4 +1,4 @@ | |||
1 | .TH ZLIB 3 "21 September 2003" | 1 | .TH ZLIB 3 "4 November 2003" |
2 | .SH NAME | 2 | .SH NAME |
3 | zlib \- compression/decompression library | 3 | zlib \- compression/decompression library |
4 | .SH SYNOPSIS | 4 | .SH SYNOPSIS |
@@ -133,7 +133,7 @@ before asking for help. | |||
133 | Send questions and/or comments to zlib@gzip.org, | 133 | Send questions and/or comments to zlib@gzip.org, |
134 | or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). | 134 | or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). |
135 | .SH AUTHORS | 135 | .SH AUTHORS |
136 | Version 1.2.0.7 | 136 | Version 1.2.0.8 |
137 | Copyright (C) 1995-2003 Jean-loup Gailly (jloup@gzip.org) | 137 | Copyright (C) 1995-2003 Jean-loup Gailly (jloup@gzip.org) |
138 | and Mark Adler (madler@alumni.caltech.edu). | 138 | and Mark Adler (madler@alumni.caltech.edu). |
139 | .LP | 139 | .LP |
@@ -1,5 +1,5 @@ | |||
1 | /* zlib.h -- interface of the 'zlib' general purpose compression library | 1 | /* zlib.h -- interface of the 'zlib' general purpose compression library |
2 | version 1.2.0.7, September 21st, 2003 | 2 | version 1.2.0.8, November 4th, 2003 |
3 | 3 | ||
4 | Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler | 4 | Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler |
5 | 5 | ||
@@ -37,8 +37,8 @@ | |||
37 | extern "C" { | 37 | extern "C" { |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #define ZLIB_VERSION "1.2.0.7" | 40 | #define ZLIB_VERSION "1.2.0.8" |
41 | #define ZLIB_VERNUM 0x1207 | 41 | #define ZLIB_VERNUM 0x1208 |
42 | 42 | ||
43 | /* | 43 | /* |
44 | The 'zlib' compression library provides in-memory compression and | 44 | The 'zlib' compression library provides in-memory compression and |
@@ -174,7 +174,7 @@ typedef z_stream FAR *z_streamp; | |||
174 | #define Z_BINARY 0 | 174 | #define Z_BINARY 0 |
175 | #define Z_ASCII 1 | 175 | #define Z_ASCII 1 |
176 | #define Z_UNKNOWN 2 | 176 | #define Z_UNKNOWN 2 |
177 | /* Possible values of the data_type field */ | 177 | /* Possible values of the data_type field (though see inflate()) */ |
178 | 178 | ||
179 | #define Z_DEFLATED 8 | 179 | #define Z_DEFLATED 8 |
180 | /* The deflate compression method (the only one supported in this version) */ | 180 | /* The deflate compression method (the only one supported in this version) */ |
@@ -373,12 +373,15 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); | |||
373 | 373 | ||
374 | The Z_BLOCK option assists in appending to or combining deflate streams. | 374 | The Z_BLOCK option assists in appending to or combining deflate streams. |
375 | Also to assist in this, on return inflate() will set strm->data_type to the | 375 | Also to assist in this, on return inflate() will set strm->data_type to the |
376 | number of unused bits in the last byte taken from strm->next_in, plus eight | 376 | number of unused bits in the last byte taken from strm->next_in, plus 64 |
377 | if inflate() is currently decoding the last block in the deflate stream, | 377 | if inflate() is currently decoding the last block in the deflate stream, |
378 | plus 16 if inflate() returned immediately after decoding an end-of-block | 378 | plus 128 if inflate() returned immediately after decoding an end-of-block |
379 | code or decoding the complete header up just before the first byte of the | 379 | code or decoding the complete header up to just before the first byte of the |
380 | deflate stream. The end-of-block will not be indicated until all of the | 380 | deflate stream. The end-of-block will not be indicated until all of the |
381 | uncompressed data from that block has been written to strm->next_out. | 381 | uncompressed data from that block has been written to strm->next_out. The |
382 | number of unused bits may in general be greater than seven, except when | ||
383 | bit 7 of data_type is set, in which case the number of unused bits will be | ||
384 | less than eight. | ||
382 | 385 | ||
383 | inflate() should normally be called until it returns Z_STREAM_END or an | 386 | inflate() should normally be called until it returns Z_STREAM_END or an |
384 | error. However if all decompression is to be performed in a single step | 387 | error. However if all decompression is to be performed in a single step |
@@ -598,6 +601,22 @@ ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, | |||
598 | for deflation in a single pass, and so would be called before deflate(). | 601 | for deflation in a single pass, and so would be called before deflate(). |
599 | */ | 602 | */ |
600 | 603 | ||
604 | ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, | ||
605 | int bits, | ||
606 | int value)); | ||
607 | /* | ||
608 | deflatePrime() inserts bits in the deflate output stream. The intent | ||
609 | is that this function is used to start off the deflate output with the | ||
610 | bits leftover from a previous deflate stream when appending to it. As such, | ||
611 | this function can only be used for raw deflate, and must be used before the | ||
612 | first deflate() call after a deflateInit2() or deflateReset(). bits must be | ||
613 | less than or equal to 16, and that many of the least significant bits of | ||
614 | value will be inserted in the output. | ||
615 | |||
616 | deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source | ||
617 | stream state was inconsistent. | ||
618 | */ | ||
619 | |||
601 | /* | 620 | /* |
602 | ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, | 621 | ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, |
603 | int windowBits)); | 622 | int windowBits)); |