diff options
-rw-r--r-- | ChangeLog | 20 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | adler32.c | 24 | ||||
-rw-r--r-- | as400/zlib.inc | 6 | ||||
-rw-r--r-- | compress.c | 2 | ||||
-rw-r--r-- | contrib/infback9/inftree9.c | 4 | ||||
-rw-r--r-- | contrib/inflate86/inffas86.c | 798 | ||||
-rw-r--r-- | contrib/inflate86/inffast.S | 9 | ||||
-rw-r--r-- | contrib/vstudio/vc7/zlib.rc | 6 | ||||
-rw-r--r-- | crc32.c | 95 | ||||
-rw-r--r-- | deflate.c | 174 | ||||
-rw-r--r-- | deflate.h | 8 | ||||
-rw-r--r-- | example.c | 4 | ||||
-rw-r--r-- | gzio.c | 9 | ||||
-rw-r--r-- | infback.c | 8 | ||||
-rw-r--r-- | inflate.c | 75 | ||||
-rw-r--r-- | inflate.h | 7 | ||||
-rw-r--r-- | inftrees.c | 4 | ||||
-rw-r--r-- | minigzip.c | 4 | ||||
-rw-r--r-- | projects/README.projects | 27 | ||||
-rw-r--r-- | projects/visualc6/README.txt | 59 | ||||
-rw-r--r-- | projects/visualc6/example.dsp | 32 | ||||
-rw-r--r-- | projects/visualc6/minigzip.dsp | 32 | ||||
-rw-r--r-- | projects/visualc6/zlib.dsp | 16 | ||||
-rw-r--r-- | qnx/package.qpg | 10 | ||||
-rw-r--r-- | trees.c | 48 | ||||
-rw-r--r-- | win32/DLL_FAQ.txt | 97 | ||||
-rw-r--r-- | win32/zlib1.rc | 8 | ||||
-rw-r--r-- | zconf.h | 4 | ||||
-rw-r--r-- | zconf.in.h | 4 | ||||
-rw-r--r-- | zlib.3 | 4 | ||||
-rw-r--r-- | zlib.h | 157 | ||||
-rw-r--r-- | zutil.c | 6 | ||||
-rw-r--r-- | zutil.h | 2 |
36 files changed, 1338 insertions, 433 deletions
@@ -1,6 +1,26 @@ | |||
1 | 1 | ||
2 | ChangeLog file for zlib | 2 | ChangeLog file for zlib |
3 | 3 | ||
4 | Changes in 1.2.2.1 (31 October 2004) | ||
5 | - Allow inflateSetDictionary() call for raw inflate | ||
6 | - Fix inflate header crc check bug for file names and comments | ||
7 | - Add deflateSetHeader() and gz_header structure for custom gzip headers | ||
8 | - Add inflateGetheader() to retrieve gzip headers | ||
9 | - Add crc32_combine() and adler32_combine() functions | ||
10 | - Add alloc_func, free_func, in_func, out_func to Z_PREFIX list | ||
11 | - Use zstreamp consistently in zlib.h (inflate_back functions) | ||
12 | - Remove GUNZIP condition from definition of inflate_mode in inflate.h | ||
13 | and in contrib/inflate86/inffast.S [Truta, Anderson] | ||
14 | - Add support for AMD64 in contrib/inflate86/inffas86.c [Anderson] | ||
15 | - Update projects/README.projects and projects/visualc6 [Truta] | ||
16 | - Update win32/DLL_FAQ.txt [Truta] | ||
17 | - Avoid warning under NO_GZCOMPRESS in gzio.c; fix typo [Truta] | ||
18 | - Deprecate Z_ASCII; use Z_TEXT instead [Truta] | ||
19 | - Use a new algorithm for setting strm->data_type in trees.c [Truta] | ||
20 | - Do not define an exit() prototype in zutil.c unless DEBUG defined | ||
21 | - Remove prototype of exit() from zutil.c, example.c, minigzip.c [Truta] | ||
22 | - Add comment in zlib.h for Z_NO_FLUSH parameter to deflate() | ||
23 | |||
4 | Changes in 1.2.2 (3 October 2004) | 24 | Changes in 1.2.2 (3 October 2004) |
5 | - Update zlib.h comments on gzip in-memory processing | 25 | - Update zlib.h comments on gzip in-memory processing |
6 | - Set adler to 1 in inflateReset() to support Java test suite [Walles] | 26 | - Set adler to 1 in inflateReset() to support Java test suite [Walles] |
@@ -30,7 +30,7 @@ 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.2 | 33 | SHAREDLIBV=libz.so.1.2.2.1 |
34 | SHAREDLIBM=libz.so.1 | 34 | SHAREDLIBM=libz.so.1 |
35 | 35 | ||
36 | AR=ar rc | 36 | AR=ar rc |
diff --git a/Makefile.in b/Makefile.in index a29e9bc..7a6bd9a 100644 --- a/Makefile.in +++ b/Makefile.in | |||
@@ -30,7 +30,7 @@ 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.2 | 33 | SHAREDLIBV=libz.so.1.2.2.1 |
34 | SHAREDLIBM=libz.so.1 | 34 | SHAREDLIBM=libz.so.1 |
35 | 35 | ||
36 | AR=ar rc | 36 | AR=ar rc |
@@ -1,6 +1,6 @@ | |||
1 | ZLIB DATA COMPRESSION LIBRARY | 1 | ZLIB DATA COMPRESSION LIBRARY |
2 | 2 | ||
3 | zlib 1.2.2 is a general purpose data compression library. All the code is | 3 | zlib 1.2.2.1 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.2 are documented in the file ChangeLog. | 37 | The changes made in version 1.2.2.1 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 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* adler32.c -- compute the Adler-32 checksum of a data stream | 1 | /* adler32.c -- compute the Adler-32 checksum of a data stream |
2 | * Copyright (C) 1995-2003 Mark Adler | 2 | * Copyright (C) 1995-2004 Mark Adler |
3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -72,3 +72,25 @@ uLong ZEXPORT adler32(adler, buf, len) | |||
72 | } | 72 | } |
73 | return (s2 << 16) | s1; | 73 | return (s2 << 16) | s1; |
74 | } | 74 | } |
75 | |||
76 | /* ========================================================================= */ | ||
77 | uLong ZEXPORT adler32_combine(adler1, adler2, len2) | ||
78 | uLong adler1; | ||
79 | uLong adler2; | ||
80 | uLong len2; | ||
81 | { | ||
82 | unsigned long s1; | ||
83 | unsigned long s2; | ||
84 | |||
85 | len2 %= BASE; | ||
86 | s1 = adler1 & 0xffff; | ||
87 | s2 = len2 * s1; | ||
88 | MOD(s2); | ||
89 | s1 += (adler2 & 0xffff) + BASE - 1; | ||
90 | s2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - len2; | ||
91 | if (s1 > BASE) s1 -= BASE; | ||
92 | if (s1 > BASE) s1 -= BASE; | ||
93 | if (s2 > (BASE << 1)) s2 -= (BASE << 1); | ||
94 | if (s2 > BASE) s2 -= BASE; | ||
95 | return (s2 << 16) | s1; | ||
96 | } | ||
diff --git a/as400/zlib.inc b/as400/zlib.inc index e31e1a7..f85473e 100644 --- a/as400/zlib.inc +++ b/as400/zlib.inc | |||
@@ -1,7 +1,7 @@ | |||
1 | * ZLIB.INC - Interface to the general purpose compression library | 1 | * ZLIB.INC - Interface to the general purpose compression library |
2 | * | 2 | * |
3 | * ILE RPG400 version by Patrick Monnerat, DATASPHERE. | 3 | * ILE RPG400 version by Patrick Monnerat, DATASPHERE. |
4 | * Version 1.2.2 | 4 | * Version 1.2.2.1 |
5 | * | 5 | * |
6 | * | 6 | * |
7 | * WARNING: | 7 | * WARNING: |
@@ -20,8 +20,8 @@ | |||
20 | * Constants | 20 | * Constants |
21 | ************************************************************************** | 21 | ************************************************************************** |
22 | * | 22 | * |
23 | D ZLIB_VERSION C '1.2.2' Header's version | 23 | D ZLIB_VERSION C '1.2.2.1' Header's version |
24 | D ZLIB_VERNUM C X'1220' | 24 | D ZLIB_VERNUM C X'1221' |
25 | * | 25 | * |
26 | D Z_NO_FLUSH C 0 | 26 | D Z_NO_FLUSH C 0 |
27 | D Z_SYNC_FLUSH C 2 | 27 | D Z_SYNC_FLUSH C 2 |
@@ -1,5 +1,5 @@ | |||
1 | /* compress.c -- compress a memory buffer | 1 | /* compress.c -- compress a memory buffer |
2 | * Copyright (C) 1995-2002 Jean-loup Gailly. | 2 | * Copyright (C) 1995-2003 Jean-loup Gailly. |
3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | */ | 4 | */ |
5 | 5 | ||
diff --git a/contrib/infback9/inftree9.c b/contrib/infback9/inftree9.c index 9b48bc5..7325873 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.2 Copyright 1995-2004 Mark Adler "; | 12 | " inflate9 1.2.2.1 Copyright 1995-2004 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, 199, 198}; | 67 | 133, 133, 133, 133, 144, 77, 207}; |
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/inflate86/inffas86.c b/contrib/inflate86/inffas86.c index 4534693..6da7635 100644 --- a/contrib/inflate86/inffas86.c +++ b/contrib/inflate86/inffas86.c | |||
@@ -7,6 +7,15 @@ | |||
7 | * Copyright (C) 2003 Chris Anderson <christop@charm.net> | 7 | * Copyright (C) 2003 Chris Anderson <christop@charm.net> |
8 | * Please use the copyright conditions above. | 8 | * Please use the copyright conditions above. |
9 | * | 9 | * |
10 | * Dec-29-2003 -- I added AMD64 inflate asm support. This version is also | ||
11 | * slightly quicker on x86 systems because, instead of using rep movsb to copy | ||
12 | * data, it uses rep movsw, which moves data in 2-byte chunks instead of single | ||
13 | * bytes. I've tested the AMD64 code on a Fedora Core 1 + the x86_64 updates | ||
14 | * from http://fedora.linux.duke.edu/fc1_x86_64 | ||
15 | * which is running on an Athlon 64 3000+ / Gigabyte GA-K8VT800M system with | ||
16 | * 1GB ram. The 64-bit version is about 4% faster than the 32-bit version, | ||
17 | * when decompressing mozilla-source-1.3.tar.gz. | ||
18 | * | ||
10 | * Mar-13-2003 -- Most of this is derived from inffast.S which is derived from | 19 | * Mar-13-2003 -- Most of this is derived from inffast.S which is derived from |
11 | * the gcc -S output of zlib-1.2.0/inffast.c. Zlib-1.2.0 is in beta release at | 20 | * the gcc -S output of zlib-1.2.0/inffast.c. Zlib-1.2.0 is in beta release at |
12 | * the moment. I have successfully compiled and tested this code with gcc2.96, | 21 | * the moment. I have successfully compiled and tested this code with gcc2.96, |
@@ -65,33 +74,44 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ | |||
65 | { | 74 | { |
66 | struct inflate_state FAR *state; | 75 | struct inflate_state FAR *state; |
67 | struct inffast_ar { | 76 | struct inffast_ar { |
68 | void *esp; /* esp save */ | 77 | /* 64 32 x86 x86_64 */ |
69 | unsigned char FAR *in; /* local strm->next_in */ | 78 | /* ar offset register */ |
70 | unsigned char FAR *last; /* while in < last, enough input available */ | 79 | /* 0 0 */ void *esp; /* esp save */ |
71 | unsigned char FAR *out; /* local strm->next_out */ | 80 | /* 8 4 */ void *ebp; /* ebp save */ |
72 | unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ | 81 | /* 16 8 */ unsigned char FAR *in; /* esi rsi local strm->next_in */ |
73 | unsigned char FAR *end; /* while out < end, enough space available */ | 82 | /* 24 12 */ unsigned char FAR *last; /* r9 while in < last */ |
74 | unsigned wsize; /* window size or zero if not using window */ | 83 | /* 32 16 */ unsigned char FAR *out; /* edi rdi local strm->next_out */ |
75 | unsigned write; /* window write index */ | 84 | /* 40 20 */ unsigned char FAR *beg; /* inflate()'s init next_out */ |
76 | unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */ | 85 | /* 48 24 */ unsigned char FAR *end; /* r10 while out < end */ |
77 | unsigned long hold; /* local strm->hold */ | 86 | /* 56 28 */ unsigned char FAR *window;/* size of window, wsize!=0 */ |
78 | unsigned bits; /* local strm->bits */ | 87 | /* 64 32 */ code const FAR *lcode; /* ebp rbp local strm->lencode */ |
79 | code const FAR *lcode; /* local strm->lencode */ | 88 | /* 72 36 */ code const FAR *dcode; /* r11 local strm->distcode */ |
80 | code const FAR *dcode; /* local strm->distcode */ | 89 | /* 80 40 */ unsigned long hold; /* edx rdx local strm->hold */ |
81 | unsigned lmask; /* mask for first level of length codes */ | 90 | /* 88 44 */ unsigned bits; /* ebx rbx local strm->bits */ |
82 | unsigned dmask; /* mask for first level of distance codes */ | 91 | /* 92 48 */ unsigned wsize; /* window size */ |
83 | unsigned len; /* match length, unused bytes */ | 92 | /* 96 52 */ unsigned write; /* window write index */ |
84 | unsigned dist; /* match distance */ | 93 | /*100 56 */ unsigned lmask; /* r12 mask for lcode */ |
85 | unsigned status; /* this is set when state changes */ | 94 | /*104 60 */ unsigned dmask; /* r13 mask for dcode */ |
95 | /*108 64 */ unsigned len; /* r14 match length */ | ||
96 | /*112 68 */ unsigned dist; /* r15 match distance */ | ||
97 | /*116 72 */ unsigned status; /* set when state chng*/ | ||
86 | } ar; | 98 | } ar; |
87 | 99 | ||
100 | #if defined( __GNUC__ ) && defined( __amd64__ ) && ! defined( __i386 ) | ||
101 | #define PAD_AVAIL_IN 6 | ||
102 | #define PAD_AVAIL_OUT 258 | ||
103 | #else | ||
104 | #define PAD_AVAIL_IN 5 | ||
105 | #define PAD_AVAIL_OUT 257 | ||
106 | #endif | ||
107 | |||
88 | /* copy state to local variables */ | 108 | /* copy state to local variables */ |
89 | state = (struct inflate_state FAR *)strm->state; | 109 | state = (struct inflate_state FAR *)strm->state; |
90 | ar.in = strm->next_in; | 110 | ar.in = strm->next_in; |
91 | ar.last = ar.in + (strm->avail_in - 5); | 111 | ar.last = ar.in + (strm->avail_in - PAD_AVAIL_IN); |
92 | ar.out = strm->next_out; | 112 | ar.out = strm->next_out; |
93 | ar.beg = ar.out - (start - strm->avail_out); | 113 | ar.beg = ar.out - (start - strm->avail_out); |
94 | ar.end = ar.out + (strm->avail_out - 257); | 114 | ar.end = ar.out + (strm->avail_out - PAD_AVAIL_OUT); |
95 | ar.wsize = state->wsize; | 115 | ar.wsize = state->wsize; |
96 | ar.write = state->write; | 116 | ar.write = state->write; |
97 | ar.window = state->window; | 117 | ar.window = state->window; |
@@ -105,32 +125,368 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ | |||
105 | /* decode literals and length/distances until end-of-block or not enough | 125 | /* decode literals and length/distances until end-of-block or not enough |
106 | input data or output space */ | 126 | input data or output space */ |
107 | 127 | ||
108 | /* align in on 2 byte boundary */ | 128 | /* align in on 1/2 hold size boundary */ |
109 | if (((unsigned long)(void *)ar.in & 0x1) != 0) { | 129 | while (((unsigned long)(void *)ar.in & (sizeof(ar.hold) / 2 - 1)) != 0) { |
110 | ar.hold += (unsigned long)*ar.in++ << ar.bits; | 130 | ar.hold += (unsigned long)*ar.in++ << ar.bits; |
111 | ar.bits += 8; | 131 | ar.bits += 8; |
112 | } | 132 | } |
113 | 133 | ||
114 | #if defined( __GNUC__ ) || defined( __ICC ) | 134 | #if defined( __GNUC__ ) && defined( __amd64__ ) && ! defined( __i386 ) |
135 | __asm__ __volatile__ ( | ||
136 | " leaq %0, %%rax\n" | ||
137 | " movq %%rbp, 8(%%rax)\n" /* save regs rbp and rsp */ | ||
138 | " movq %%rsp, (%%rax)\n" | ||
139 | " movq %%rax, %%rsp\n" /* make rsp point to &ar */ | ||
140 | " movq 16(%%rsp), %%rsi\n" /* rsi = in */ | ||
141 | " movq 32(%%rsp), %%rdi\n" /* rdi = out */ | ||
142 | " movq 24(%%rsp), %%r9\n" /* r9 = last */ | ||
143 | " movq 48(%%rsp), %%r10\n" /* r10 = end */ | ||
144 | " movq 64(%%rsp), %%rbp\n" /* rbp = lcode */ | ||
145 | " movq 72(%%rsp), %%r11\n" /* r11 = dcode */ | ||
146 | " movq 80(%%rsp), %%rdx\n" /* rdx = hold */ | ||
147 | " movl 88(%%rsp), %%ebx\n" /* ebx = bits */ | ||
148 | " movl 100(%%rsp), %%r12d\n" /* r12d = lmask */ | ||
149 | " movl 104(%%rsp), %%r13d\n" /* r13d = dmask */ | ||
150 | /* r14d = len */ | ||
151 | /* r15d = dist */ | ||
152 | " cld\n" | ||
153 | " cmpq %%rdi, %%r10\n" | ||
154 | " je .L_one_time\n" /* if only one decode left */ | ||
155 | " cmpq %%rsi, %%r9\n" | ||
156 | " je .L_one_time\n" | ||
157 | " jmp .L_do_loop\n" | ||
158 | |||
159 | ".L_one_time:\n" | ||
160 | " movq %%r12, %%r8\n" /* r8 = lmask */ | ||
161 | " cmpb $32, %%bl\n" | ||
162 | " ja .L_get_length_code_one_time\n" | ||
163 | |||
164 | " lodsl\n" /* eax = *(uint *)in++ */ | ||
165 | " movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */ | ||
166 | " addb $32, %%bl\n" /* bits += 32 */ | ||
167 | " shlq %%cl, %%rax\n" | ||
168 | " orq %%rax, %%rdx\n" /* hold |= *((uint *)in)++ << bits */ | ||
169 | " jmp .L_get_length_code_one_time\n" | ||
170 | |||
171 | ".align 32,0x90\n" | ||
172 | ".L_while_test:\n" | ||
173 | " cmpq %%rdi, %%r10\n" | ||
174 | " jbe .L_break_loop\n" | ||
175 | " cmpq %%rsi, %%r9\n" | ||
176 | " jbe .L_break_loop\n" | ||
177 | |||
178 | ".L_do_loop:\n" | ||
179 | " movq %%r12, %%r8\n" /* r8 = lmask */ | ||
180 | " cmpb $32, %%bl\n" | ||
181 | " ja .L_get_length_code\n" /* if (32 < bits) */ | ||
182 | |||
183 | " lodsl\n" /* eax = *(uint *)in++ */ | ||
184 | " movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */ | ||
185 | " addb $32, %%bl\n" /* bits += 32 */ | ||
186 | " shlq %%cl, %%rax\n" | ||
187 | " orq %%rax, %%rdx\n" /* hold |= *((uint *)in)++ << bits */ | ||
188 | |||
189 | ".L_get_length_code:\n" | ||
190 | " andq %%rdx, %%r8\n" /* r8 &= hold */ | ||
191 | " movl (%%rbp,%%r8,4), %%eax\n" /* eax = lcode[hold & lmask] */ | ||
192 | |||
193 | " movb %%ah, %%cl\n" /* cl = this.bits */ | ||
194 | " subb %%ah, %%bl\n" /* bits -= this.bits */ | ||
195 | " shrq %%cl, %%rdx\n" /* hold >>= this.bits */ | ||
196 | |||
197 | " testb %%al, %%al\n" | ||
198 | " jnz .L_test_for_length_base\n" /* if (op != 0) 45.7% */ | ||
199 | |||
200 | " movq %%r12, %%r8\n" /* r8 = lmask */ | ||
201 | " shrl $16, %%eax\n" /* output this.val char */ | ||
202 | " stosb\n" | ||
203 | |||
204 | ".L_get_length_code_one_time:\n" | ||
205 | " andq %%rdx, %%r8\n" /* r8 &= hold */ | ||
206 | " movl (%%rbp,%%r8,4), %%eax\n" /* eax = lcode[hold & lmask] */ | ||
207 | |||
208 | ".L_dolen:\n" | ||
209 | " movb %%ah, %%cl\n" /* cl = this.bits */ | ||
210 | " subb %%ah, %%bl\n" /* bits -= this.bits */ | ||
211 | " shrq %%cl, %%rdx\n" /* hold >>= this.bits */ | ||
212 | |||
213 | " testb %%al, %%al\n" | ||
214 | " jnz .L_test_for_length_base\n" /* if (op != 0) 45.7% */ | ||
215 | |||
216 | " shrl $16, %%eax\n" /* output this.val char */ | ||
217 | " stosb\n" | ||
218 | " jmp .L_while_test\n" | ||
219 | |||
220 | ".align 32,0x90\n" | ||
221 | ".L_test_for_length_base:\n" | ||
222 | " movl %%eax, %%r14d\n" /* len = this */ | ||
223 | " shrl $16, %%r14d\n" /* len = this.val */ | ||
224 | " movb %%al, %%cl\n" | ||
225 | |||
226 | " testb $16, %%al\n" | ||
227 | " jz .L_test_for_second_level_length\n" /* if ((op & 16) == 0) 8% */ | ||
228 | " andb $15, %%cl\n" /* op &= 15 */ | ||
229 | " jz .L_decode_distance\n" /* if (!op) */ | ||
230 | |||
231 | ".L_add_bits_to_len:\n" | ||
232 | " subb %%cl, %%bl\n" | ||
233 | " xorl %%eax, %%eax\n" | ||
234 | " incl %%eax\n" | ||
235 | " shll %%cl, %%eax\n" | ||
236 | " decl %%eax\n" | ||
237 | " andl %%edx, %%eax\n" /* eax &= hold */ | ||
238 | " shrq %%cl, %%rdx\n" | ||
239 | " addl %%eax, %%r14d\n" /* len += hold & mask[op] */ | ||
240 | |||
241 | ".L_decode_distance:\n" | ||
242 | " movq %%r13, %%r8\n" /* r8 = dmask */ | ||
243 | " cmpb $32, %%bl\n" | ||
244 | " ja .L_get_distance_code\n" /* if (32 < bits) */ | ||
245 | |||
246 | " lodsl\n" /* eax = *(uint *)in++ */ | ||
247 | " movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */ | ||
248 | " addb $32, %%bl\n" /* bits += 32 */ | ||
249 | " shlq %%cl, %%rax\n" | ||
250 | " orq %%rax, %%rdx\n" /* hold |= *((uint *)in)++ << bits */ | ||
251 | |||
252 | ".L_get_distance_code:\n" | ||
253 | " andq %%rdx, %%r8\n" /* r8 &= hold */ | ||
254 | " movl (%%r11,%%r8,4), %%eax\n" /* eax = dcode[hold & dmask] */ | ||
255 | |||
256 | ".L_dodist:\n" | ||
257 | " movl %%eax, %%r15d\n" /* dist = this */ | ||
258 | " shrl $16, %%r15d\n" /* dist = this.val */ | ||
259 | " movb %%ah, %%cl\n" | ||
260 | " subb %%ah, %%bl\n" /* bits -= this.bits */ | ||
261 | " shrq %%cl, %%rdx\n" /* hold >>= this.bits */ | ||
262 | " movb %%al, %%cl\n" /* cl = this.op */ | ||
263 | |||
264 | " testb $16, %%al\n" /* if ((op & 16) == 0) */ | ||
265 | " jz .L_test_for_second_level_dist\n" | ||
266 | " andb $15, %%cl\n" /* op &= 15 */ | ||
267 | " jz .L_check_dist_one\n" | ||
268 | |||
269 | ".L_add_bits_to_dist:\n" | ||
270 | " subb %%cl, %%bl\n" | ||
271 | " xorl %%eax, %%eax\n" | ||
272 | " incl %%eax\n" | ||
273 | " shll %%cl, %%eax\n" | ||
274 | " decl %%eax\n" /* (1 << op) - 1 */ | ||
275 | " andl %%edx, %%eax\n" /* eax &= hold */ | ||
276 | " shrq %%cl, %%rdx\n" | ||
277 | " addl %%eax, %%r15d\n" /* dist += hold & ((1 << op) - 1) */ | ||
278 | |||
279 | ".L_check_window:\n" | ||
280 | " movq %%rsi, %%r8\n" /* save in so from can use it's reg */ | ||
281 | " movq %%rdi, %%rax\n" | ||
282 | " subq 40(%%rsp), %%rax\n" /* nbytes = out - beg */ | ||
283 | |||
284 | " cmpl %%r15d, %%eax\n" | ||
285 | " jb .L_clip_window\n" /* if (dist > nbytes) 4.2% */ | ||
286 | |||
287 | " movl %%r14d, %%ecx\n" /* ecx = len */ | ||
288 | " movq %%rdi, %%rsi\n" | ||
289 | " subq %%r15, %%rsi\n" /* from = out - dist */ | ||
290 | |||
291 | " sarl %%ecx\n" | ||
292 | " jnc .L_copy_two\n" /* if len % 2 == 0 */ | ||
293 | |||
294 | " rep movsw\n" | ||
295 | " movb (%%rsi), %%al\n" | ||
296 | " movb %%al, (%%rdi)\n" | ||
297 | " incq %%rdi\n" | ||
298 | |||
299 | " movq %%r8, %%rsi\n" /* move in back to %rsi, toss from */ | ||
300 | " jmp .L_while_test\n" | ||
301 | |||
302 | ".L_copy_two:\n" | ||
303 | " rep movsw\n" | ||
304 | " movq %%r8, %%rsi\n" /* move in back to %rsi, toss from */ | ||
305 | " jmp .L_while_test\n" | ||
306 | |||
307 | ".align 32,0x90\n" | ||
308 | ".L_check_dist_one:\n" | ||
309 | " cmpl $1, %%r15d\n" /* if dist 1, is a memset */ | ||
310 | " jne .L_check_window\n" | ||
311 | " cmpq %%rdi, 40(%%rsp)\n" /* if out == beg, outside window */ | ||
312 | " je .L_check_window\n" | ||
313 | |||
314 | " movl %%r14d, %%ecx\n" /* ecx = len */ | ||
315 | " movb -1(%%rdi), %%al\n" | ||
316 | " movb %%al, %%ah\n" | ||
317 | |||
318 | " sarl %%ecx\n" | ||
319 | " jnc .L_set_two\n" | ||
320 | " movb %%al, (%%rdi)\n" | ||
321 | " incq %%rdi\n" | ||
322 | |||
323 | ".L_set_two:\n" | ||
324 | " rep stosw\n" | ||
325 | " jmp .L_while_test\n" | ||
326 | |||
327 | ".align 32,0x90\n" | ||
328 | ".L_test_for_second_level_length:\n" | ||
329 | " testb $64, %%al\n" | ||
330 | " jnz .L_test_for_end_of_block\n" /* if ((op & 64) != 0) */ | ||
331 | |||
332 | " xorl %%eax, %%eax\n" | ||
333 | " incl %%eax\n" | ||
334 | " shll %%cl, %%eax\n" | ||
335 | " decl %%eax\n" | ||
336 | " andl %%edx, %%eax\n" /* eax &= hold */ | ||
337 | " addl %%r14d, %%eax\n" /* eax += len */ | ||
338 | " movl (%%rbp,%%rax,4), %%eax\n" /* eax = lcode[val+(hold&mask[op])]*/ | ||
339 | " jmp .L_dolen\n" | ||
340 | |||
341 | ".align 32,0x90\n" | ||
342 | ".L_test_for_second_level_dist:\n" | ||
343 | " testb $64, %%al\n" | ||
344 | " jnz .L_invalid_distance_code\n" /* if ((op & 64) != 0) */ | ||
345 | |||
346 | " xorl %%eax, %%eax\n" | ||
347 | " incl %%eax\n" | ||
348 | " shll %%cl, %%eax\n" | ||
349 | " decl %%eax\n" | ||
350 | " andl %%edx, %%eax\n" /* eax &= hold */ | ||
351 | " addl %%r15d, %%eax\n" /* eax += dist */ | ||
352 | " movl (%%r11,%%rax,4), %%eax\n" /* eax = dcode[val+(hold&mask[op])]*/ | ||
353 | " jmp .L_dodist\n" | ||
354 | |||
355 | ".align 32,0x90\n" | ||
356 | ".L_clip_window:\n" | ||
357 | " movl %%eax, %%ecx\n" /* ecx = nbytes */ | ||
358 | " movl 92(%%rsp), %%eax\n" /* eax = wsize, prepare for dist cmp */ | ||
359 | " negl %%ecx\n" /* nbytes = -nbytes */ | ||
360 | |||
361 | " cmpl %%r15d, %%eax\n" | ||
362 | " jb .L_invalid_distance_too_far\n" /* if (dist > wsize) */ | ||
363 | |||
364 | " addl %%r15d, %%ecx\n" /* nbytes = dist - nbytes */ | ||
365 | " cmpl $0, 96(%%rsp)\n" | ||
366 | " jne .L_wrap_around_window\n" /* if (write != 0) */ | ||
367 | |||
368 | " movq 56(%%rsp), %%rsi\n" /* from = window */ | ||
369 | " subl %%ecx, %%eax\n" /* eax -= nbytes */ | ||
370 | " addq %%rax, %%rsi\n" /* from += wsize - nbytes */ | ||
371 | |||
372 | " movl %%r14d, %%eax\n" /* eax = len */ | ||
373 | " cmpl %%ecx, %%r14d\n" | ||
374 | " jbe .L_do_copy\n" /* if (nbytes >= len) */ | ||
375 | |||
376 | " subl %%ecx, %%eax\n" /* eax -= nbytes */ | ||
377 | " rep movsb\n" | ||
378 | " movq %%rdi, %%rsi\n" | ||
379 | " subq %%r15, %%rsi\n" /* from = &out[ -dist ] */ | ||
380 | " jmp .L_do_copy\n" | ||
381 | |||
382 | ".align 32,0x90\n" | ||
383 | ".L_wrap_around_window:\n" | ||
384 | " movl 96(%%rsp), %%eax\n" /* eax = write */ | ||
385 | " cmpl %%eax, %%ecx\n" | ||
386 | " jbe .L_contiguous_in_window\n" /* if (write >= nbytes) */ | ||
387 | |||
388 | " movl 92(%%rsp), %%esi\n" /* from = wsize */ | ||
389 | " addq 56(%%rsp), %%rsi\n" /* from += window */ | ||
390 | " addq %%rax, %%rsi\n" /* from += write */ | ||
391 | " subq %%rcx, %%rsi\n" /* from -= nbytes */ | ||
392 | " subl %%eax, %%ecx\n" /* nbytes -= write */ | ||
393 | |||
394 | " movl %%r14d, %%eax\n" /* eax = len */ | ||
395 | " cmpl %%ecx, %%eax\n" | ||
396 | " jbe .L_do_copy\n" /* if (nbytes >= len) */ | ||
397 | |||
398 | " subl %%ecx, %%eax\n" /* len -= nbytes */ | ||
399 | " rep movsb\n" | ||
400 | " movq 56(%%rsp), %%rsi\n" /* from = window */ | ||
401 | " movl 96(%%rsp), %%ecx\n" /* nbytes = write */ | ||
402 | " cmpl %%ecx, %%eax\n" | ||
403 | " jbe .L_do_copy\n" /* if (nbytes >= len) */ | ||
404 | |||
405 | " subl %%ecx, %%eax\n" /* len -= nbytes */ | ||
406 | " rep movsb\n" | ||
407 | " movq %%rdi, %%rsi\n" | ||
408 | " subq %%r15, %%rsi\n" /* from = out - dist */ | ||
409 | " jmp .L_do_copy\n" | ||
410 | |||
411 | ".align 32,0x90\n" | ||
412 | ".L_contiguous_in_window:\n" | ||
413 | " movq 56(%%rsp), %%rsi\n" /* rsi = window */ | ||
414 | " addq %%rax, %%rsi\n" | ||
415 | " subq %%rcx, %%rsi\n" /* from += write - nbytes */ | ||
416 | |||
417 | " movl %%r14d, %%eax\n" /* eax = len */ | ||
418 | " cmpl %%ecx, %%eax\n" | ||
419 | " jbe .L_do_copy\n" /* if (nbytes >= len) */ | ||
420 | |||
421 | " subl %%ecx, %%eax\n" /* len -= nbytes */ | ||
422 | " rep movsb\n" | ||
423 | " movq %%rdi, %%rsi\n" | ||
424 | " subq %%r15, %%rsi\n" /* from = out - dist */ | ||
425 | " jmp .L_do_copy\n" /* if (nbytes >= len) */ | ||
426 | |||
427 | ".align 32,0x90\n" | ||
428 | ".L_do_copy:\n" | ||
429 | " movl %%eax, %%ecx\n" /* ecx = len */ | ||
430 | " rep movsb\n" | ||
431 | |||
432 | " movq %%r8, %%rsi\n" /* move in back to %esi, toss from */ | ||
433 | " jmp .L_while_test\n" | ||
434 | |||
435 | ".L_test_for_end_of_block:\n" | ||
436 | " testb $32, %%al\n" | ||
437 | " jz .L_invalid_literal_length_code\n" | ||
438 | " movl $1, 116(%%rsp)\n" | ||
439 | " jmp .L_break_loop_with_status\n" | ||
440 | |||
441 | ".L_invalid_literal_length_code:\n" | ||
442 | " movl $2, 116(%%rsp)\n" | ||
443 | " jmp .L_break_loop_with_status\n" | ||
444 | |||
445 | ".L_invalid_distance_code:\n" | ||
446 | " movl $3, 116(%%rsp)\n" | ||
447 | " jmp .L_break_loop_with_status\n" | ||
448 | |||
449 | ".L_invalid_distance_too_far:\n" | ||
450 | " movl $4, 116(%%rsp)\n" | ||
451 | " jmp .L_break_loop_with_status\n" | ||
452 | |||
453 | ".L_break_loop:\n" | ||
454 | " movl $0, 116(%%rsp)\n" | ||
455 | |||
456 | ".L_break_loop_with_status:\n" | ||
457 | /* put in, out, bits, and hold back into ar and pop esp */ | ||
458 | " movq %%rsi, 16(%%rsp)\n" /* in */ | ||
459 | " movq %%rdi, 32(%%rsp)\n" /* out */ | ||
460 | " movl %%ebx, 88(%%rsp)\n" /* bits */ | ||
461 | " movq %%rdx, 80(%%rsp)\n" /* hold */ | ||
462 | " movq (%%rsp), %%rax\n" /* restore rbp and rsp */ | ||
463 | " movq 8(%%rsp), %%rbp\n" | ||
464 | " movq %%rax, %%rsp\n" | ||
465 | : | ||
466 | : "m" (ar) | ||
467 | : "memory", "%rax", "%rbx", "%rcx", "%rdx", "%rsi", "%rdi", | ||
468 | "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15" | ||
469 | ); | ||
470 | #elif ( defined( __GNUC__ ) || defined( __ICC ) ) && defined( __i386 ) | ||
115 | __asm__ __volatile__ ( | 471 | __asm__ __volatile__ ( |
116 | " leal %0, %%eax\n" | 472 | " leal %0, %%eax\n" |
117 | " pushf\n" | 473 | " movl %%esp, (%%eax)\n" /* save esp, ebp */ |
118 | " pushl %%ebp\n" | 474 | " movl %%ebp, 4(%%eax)\n" |
119 | " movl %%esp, (%%eax)\n" | ||
120 | " movl %%eax, %%esp\n" | 475 | " movl %%eax, %%esp\n" |
121 | " movl 4(%%esp), %%esi\n" /* esi = in */ | 476 | " movl 8(%%esp), %%esi\n" /* esi = in */ |
122 | " movl 12(%%esp), %%edi\n" /* edi = out */ | 477 | " movl 16(%%esp), %%edi\n" /* edi = out */ |
123 | " movl 36(%%esp), %%edx\n" /* edx = hold */ | 478 | " movl 40(%%esp), %%edx\n" /* edx = hold */ |
124 | " movl 40(%%esp), %%ebx\n" /* ebx = bits */ | 479 | " movl 44(%%esp), %%ebx\n" /* ebx = bits */ |
125 | " movl 44(%%esp), %%ebp\n" /* ebp = lcode */ | 480 | " movl 32(%%esp), %%ebp\n" /* ebp = lcode */ |
126 | 481 | ||
127 | " cld\n" | 482 | " cld\n" |
128 | " jmp .L_do_loop\n" | 483 | " jmp .L_do_loop\n" |
129 | 484 | ||
485 | ".align 32,0x90\n" | ||
130 | ".L_while_test:\n" | 486 | ".L_while_test:\n" |
131 | " cmpl %%edi, 20(%%esp)\n" | 487 | " cmpl %%edi, 24(%%esp)\n" /* out < end */ |
132 | " jbe .L_break_loop\n" | 488 | " jbe .L_break_loop\n" |
133 | " cmpl %%esi, 8(%%esp)\n" | 489 | " cmpl %%esi, 12(%%esp)\n" /* in < last */ |
134 | " jbe .L_break_loop\n" | 490 | " jbe .L_break_loop\n" |
135 | 491 | ||
136 | ".L_do_loop:\n" | 492 | ".L_do_loop:\n" |
@@ -145,7 +501,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ | |||
145 | " orl %%eax, %%edx\n" /* hold |= *((ushort *)in)++ << bits */ | 501 | " orl %%eax, %%edx\n" /* hold |= *((ushort *)in)++ << bits */ |
146 | 502 | ||
147 | ".L_get_length_code:\n" | 503 | ".L_get_length_code:\n" |
148 | " movl 52(%%esp), %%eax\n" /* eax = lmask */ | 504 | " movl 56(%%esp), %%eax\n" /* eax = lmask */ |
149 | " andl %%edx, %%eax\n" /* eax &= hold */ | 505 | " andl %%edx, %%eax\n" /* eax &= hold */ |
150 | " movl (%%ebp,%%eax,4), %%eax\n" /* eax = lcode[hold & lmask] */ | 506 | " movl (%%ebp,%%eax,4), %%eax\n" /* eax = lcode[hold & lmask] */ |
151 | 507 | ||
@@ -161,10 +517,11 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ | |||
161 | " stosb\n" | 517 | " stosb\n" |
162 | " jmp .L_while_test\n" | 518 | " jmp .L_while_test\n" |
163 | 519 | ||
520 | ".align 32,0x90\n" | ||
164 | ".L_test_for_length_base:\n" | 521 | ".L_test_for_length_base:\n" |
165 | " movl %%eax, %%ecx\n" /* len = this */ | 522 | " movl %%eax, %%ecx\n" /* len = this */ |
166 | " shrl $16, %%ecx\n" /* len = this.val */ | 523 | " shrl $16, %%ecx\n" /* len = this.val */ |
167 | " movl %%ecx, 60(%%esp)\n" /* len = this */ | 524 | " movl %%ecx, 64(%%esp)\n" /* save len */ |
168 | " movb %%al, %%cl\n" | 525 | " movb %%al, %%cl\n" |
169 | 526 | ||
170 | " testb $16, %%al\n" | 527 | " testb $16, %%al\n" |
@@ -184,13 +541,14 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ | |||
184 | " movb %%ch, %%cl\n" /* move op back to ecx */ | 541 | " movb %%ch, %%cl\n" /* move op back to ecx */ |
185 | 542 | ||
186 | ".L_add_bits_to_len:\n" | 543 | ".L_add_bits_to_len:\n" |
187 | " movl $1, %%eax\n" | 544 | " subb %%cl, %%bl\n" |
545 | " xorl %%eax, %%eax\n" | ||
546 | " incl %%eax\n" | ||
188 | " shll %%cl, %%eax\n" | 547 | " shll %%cl, %%eax\n" |
189 | " decl %%eax\n" | 548 | " decl %%eax\n" |
190 | " subb %%cl, %%bl\n" | ||
191 | " andl %%edx, %%eax\n" /* eax &= hold */ | 549 | " andl %%edx, %%eax\n" /* eax &= hold */ |
192 | " shrl %%cl, %%edx\n" | 550 | " shrl %%cl, %%edx\n" |
193 | " addl %%eax, 60(%%esp)\n" /* len += hold & mask[op] */ | 551 | " addl %%eax, 64(%%esp)\n" /* len += hold & mask[op] */ |
194 | 552 | ||
195 | ".L_decode_distance:\n" | 553 | ".L_decode_distance:\n" |
196 | " cmpb $15, %%bl\n" | 554 | " cmpb $15, %%bl\n" |
@@ -204,8 +562,8 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ | |||
204 | " orl %%eax, %%edx\n" /* hold |= *((ushort *)in)++ << bits */ | 562 | " orl %%eax, %%edx\n" /* hold |= *((ushort *)in)++ << bits */ |
205 | 563 | ||
206 | ".L_get_distance_code:\n" | 564 | ".L_get_distance_code:\n" |
207 | " movl 56(%%esp), %%eax\n" /* eax = dmask */ | 565 | " movl 60(%%esp), %%eax\n" /* eax = dmask */ |
208 | " movl 48(%%esp), %%ecx\n" /* ecx = dcode */ | 566 | " movl 36(%%esp), %%ecx\n" /* ecx = dcode */ |
209 | " andl %%edx, %%eax\n" /* eax &= hold */ | 567 | " andl %%edx, %%eax\n" /* eax &= hold */ |
210 | " movl (%%ecx,%%eax,4), %%eax\n"/* eax = dcode[hold & dmask] */ | 568 | " movl (%%ecx,%%eax,4), %%eax\n"/* eax = dcode[hold & dmask] */ |
211 | 569 | ||
@@ -234,223 +592,228 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ | |||
234 | " movb %%ch, %%cl\n" /* move op back to ecx */ | 592 | " movb %%ch, %%cl\n" /* move op back to ecx */ |
235 | 593 | ||
236 | ".L_add_bits_to_dist:\n" | 594 | ".L_add_bits_to_dist:\n" |
237 | " movl $1, %%eax\n" | 595 | " subb %%cl, %%bl\n" |
596 | " xorl %%eax, %%eax\n" | ||
597 | " incl %%eax\n" | ||
238 | " shll %%cl, %%eax\n" | 598 | " shll %%cl, %%eax\n" |
239 | " decl %%eax\n" /* (1 << op) - 1 */ | 599 | " decl %%eax\n" /* (1 << op) - 1 */ |
240 | " subb %%cl, %%bl\n" | ||
241 | " andl %%edx, %%eax\n" /* eax &= hold */ | 600 | " andl %%edx, %%eax\n" /* eax &= hold */ |
242 | " shrl %%cl, %%edx\n" | 601 | " shrl %%cl, %%edx\n" |
243 | " addl %%eax, %%ebp\n" /* dist += hold & ((1 << op) - 1) */ | 602 | " addl %%eax, %%ebp\n" /* dist += hold & ((1 << op) - 1) */ |
244 | 603 | ||
245 | ".L_check_window:\n" | 604 | ".L_check_window:\n" |
246 | " movl %%esi, 4(%%esp)\n" /* save in so from can use it's reg */ | 605 | " movl %%esi, 8(%%esp)\n" /* save in so from can use it's reg */ |
247 | " movl %%edi, %%eax\n" | 606 | " movl %%edi, %%eax\n" |
248 | " subl 16(%%esp), %%eax\n" /* nbytes = out - beg */ | 607 | " subl 20(%%esp), %%eax\n" /* nbytes = out - beg */ |
249 | 608 | ||
250 | " cmpl %%ebp, %%eax\n" | 609 | " cmpl %%ebp, %%eax\n" |
251 | " jb .L_clip_window\n" /* if (dist > nbytes) 4.2% */ | 610 | " jb .L_clip_window\n" /* if (dist > nbytes) 4.2% */ |
252 | 611 | ||
253 | " movl 60(%%esp), %%ecx\n" | 612 | " movl 64(%%esp), %%ecx\n" /* ecx = len */ |
254 | " movl %%edi, %%esi\n" | 613 | " movl %%edi, %%esi\n" |
255 | " subl %%ebp, %%esi\n" /* from = out - dist */ | 614 | " subl %%ebp, %%esi\n" /* from = out - dist */ |
256 | 615 | ||
257 | " subl $3, %%ecx\n" /* copy from to out */ | 616 | " sarl %%ecx\n" |
617 | " jnc .L_copy_two\n" /* if len % 2 == 0 */ | ||
618 | |||
619 | " rep movsw\n" | ||
258 | " movb (%%esi), %%al\n" | 620 | " movb (%%esi), %%al\n" |
259 | " movb %%al, (%%edi)\n" | 621 | " movb %%al, (%%edi)\n" |
260 | " movb 1(%%esi), %%al\n" | 622 | " incl %%edi\n" |
261 | " movb 2(%%esi), %%ah\n" | ||
262 | " addl $3, %%esi\n" | ||
263 | " movb %%al, 1(%%edi)\n" | ||
264 | " movb %%ah, 2(%%edi)\n" | ||
265 | " addl $3, %%edi\n" | ||
266 | " rep movsb\n" | ||
267 | 623 | ||
268 | " movl 4(%%esp), %%esi\n" /* move in back to %esi, toss from */ | 624 | " movl 8(%%esp), %%esi\n" /* move in back to %esi, toss from */ |
269 | " movl 44(%%esp), %%ebp\n" /* ebp = lcode */ | 625 | " movl 32(%%esp), %%ebp\n" /* ebp = lcode */ |
270 | " jmp .L_while_test\n" | 626 | " jmp .L_while_test\n" |
271 | 627 | ||
628 | ".L_copy_two:\n" | ||
629 | " rep movsw\n" | ||
630 | " movl 8(%%esp), %%esi\n" /* move in back to %esi, toss from */ | ||
631 | " movl 32(%%esp), %%ebp\n" /* ebp = lcode */ | ||
632 | " jmp .L_while_test\n" | ||
633 | |||
634 | ".align 32,0x90\n" | ||
272 | ".L_check_dist_one:\n" | 635 | ".L_check_dist_one:\n" |
273 | " cmpl $1, %%ebp\n" /* if dist 1, is a memset */ | 636 | " cmpl $1, %%ebp\n" /* if dist 1, is a memset */ |
274 | " jne .L_check_window\n" | 637 | " jne .L_check_window\n" |
275 | " cmpl %%edi, 16(%%esp)\n" | 638 | " cmpl %%edi, 20(%%esp)\n" |
276 | " je .L_check_window\n" | 639 | " je .L_check_window\n" /* out == beg, if outside window */ |
640 | |||
641 | " movl 64(%%esp), %%ecx\n" /* ecx = len */ | ||
642 | " movb -1(%%edi), %%al\n" | ||
643 | " movb %%al, %%ah\n" | ||
644 | |||
645 | " sarl %%ecx\n" | ||
646 | " jnc .L_set_two\n" | ||
647 | " movb %%al, (%%edi)\n" | ||
648 | " incl %%edi\n" | ||
277 | 649 | ||
278 | " decl %%edi\n" | 650 | ".L_set_two:\n" |
279 | " movl 60(%%esp), %%ecx\n" | 651 | " rep stosw\n" |
280 | " movb (%%edi), %%al\n" | 652 | " movl 32(%%esp), %%ebp\n" /* ebp = lcode */ |
281 | " subl $3, %%ecx\n" | ||
282 | |||
283 | " movb %%al, 1(%%edi)\n" /* memset out with from[-1] */ | ||
284 | " movb %%al, 2(%%edi)\n" | ||
285 | " movb %%al, 3(%%edi)\n" | ||
286 | " addl $4, %%edi\n" | ||
287 | " rep stosb\n" | ||
288 | " movl 44(%%esp), %%ebp\n" /* ebp = lcode */ | ||
289 | " jmp .L_while_test\n" | 653 | " jmp .L_while_test\n" |
290 | 654 | ||
655 | ".align 32,0x90\n" | ||
291 | ".L_test_for_second_level_length:\n" | 656 | ".L_test_for_second_level_length:\n" |
292 | " testb $64, %%al\n" | 657 | " testb $64, %%al\n" |
293 | " jnz .L_test_for_end_of_block\n" /* if ((op & 64) != 0) */ | 658 | " jnz .L_test_for_end_of_block\n" /* if ((op & 64) != 0) */ |
294 | 659 | ||
295 | " movl $1, %%eax\n" | 660 | " xorl %%eax, %%eax\n" |
661 | " incl %%eax\n" | ||
296 | " shll %%cl, %%eax\n" | 662 | " shll %%cl, %%eax\n" |
297 | " decl %%eax\n" | 663 | " decl %%eax\n" |
298 | " andl %%edx, %%eax\n" /* eax &= hold */ | 664 | " andl %%edx, %%eax\n" /* eax &= hold */ |
299 | " addl 60(%%esp), %%eax\n" /* eax += this.val */ | 665 | " addl 64(%%esp), %%eax\n" /* eax += len */ |
300 | " movl (%%ebp,%%eax,4), %%eax\n" /* eax = lcode[val+(hold&mask[op])]*/ | 666 | " movl (%%ebp,%%eax,4), %%eax\n" /* eax = lcode[val+(hold&mask[op])]*/ |
301 | " jmp .L_dolen\n" | 667 | " jmp .L_dolen\n" |
302 | 668 | ||
669 | ".align 32,0x90\n" | ||
303 | ".L_test_for_second_level_dist:\n" | 670 | ".L_test_for_second_level_dist:\n" |
304 | " testb $64, %%al\n" | 671 | " testb $64, %%al\n" |
305 | " jnz .L_invalid_distance_code\n" /* if ((op & 64) != 0) */ | 672 | " jnz .L_invalid_distance_code\n" /* if ((op & 64) != 0) */ |
306 | 673 | ||
307 | " movl $1, %%eax\n" | 674 | " xorl %%eax, %%eax\n" |
675 | " incl %%eax\n" | ||
308 | " shll %%cl, %%eax\n" | 676 | " shll %%cl, %%eax\n" |
309 | " decl %%eax\n" | 677 | " decl %%eax\n" |
310 | " andl %%edx, %%eax\n" /* eax &= hold */ | 678 | " andl %%edx, %%eax\n" /* eax &= hold */ |
311 | " addl %%ebp, %%eax\n" /* eax += this.val */ | 679 | " addl %%ebp, %%eax\n" /* eax += dist */ |
312 | " movl 48(%%esp), %%ecx\n" /* ecx = dcode */ | 680 | " movl 36(%%esp), %%ecx\n" /* ecx = dcode */ |
313 | " movl (%%ecx,%%eax,4), %%eax\n" /* eax = dcode[val+(hold&mask[op])]*/ | 681 | " movl (%%ecx,%%eax,4), %%eax\n" /* eax = dcode[val+(hold&mask[op])]*/ |
314 | " jmp .L_dodist\n" | 682 | " jmp .L_dodist\n" |
315 | 683 | ||
684 | ".align 32,0x90\n" | ||
316 | ".L_clip_window:\n" | 685 | ".L_clip_window:\n" |
317 | " movl %%eax, %%ecx\n" | 686 | " movl %%eax, %%ecx\n" |
318 | " movl 24(%%esp), %%eax\n" /* prepare for dist compare */ | 687 | " movl 48(%%esp), %%eax\n" /* eax = wsize */ |
319 | " negl %%ecx\n" /* nbytes = -nbytes */ | 688 | " negl %%ecx\n" /* nbytes = -nbytes */ |
320 | " movl 32(%%esp), %%esi\n" /* from = window */ | 689 | " movl 28(%%esp), %%esi\n" /* from = window */ |
321 | 690 | ||
322 | " cmpl %%ebp, %%eax\n" | 691 | " cmpl %%ebp, %%eax\n" |
323 | " jb .L_invalid_distance_too_far\n" /* if (dist > wsize) */ | 692 | " jb .L_invalid_distance_too_far\n" /* if (dist > wsize) */ |
324 | 693 | ||
325 | " addl %%ebp, %%ecx\n" /* nbytes = dist - nbytes */ | 694 | " addl %%ebp, %%ecx\n" /* nbytes = dist - nbytes */ |
326 | " cmpl $0, 28(%%esp)\n" | 695 | " cmpl $0, 52(%%esp)\n" |
327 | " jne .L_wrap_around_window\n" /* if (write != 0) */ | 696 | " jne .L_wrap_around_window\n" /* if (write != 0) */ |
328 | 697 | ||
329 | " subl %%ecx, %%eax\n" | 698 | " subl %%ecx, %%eax\n" |
330 | " addl %%eax, %%esi\n" /* from += wsize - nbytes */ | 699 | " addl %%eax, %%esi\n" /* from += wsize - nbytes */ |
331 | 700 | ||
332 | " movl 60(%%esp), %%eax\n" | 701 | " movl 64(%%esp), %%eax\n" /* eax = len */ |
333 | " cmpl %%ecx, %%eax\n" | ||
334 | " jbe .L_do_copy1\n" /* if (nbytes >= len) */ | ||
335 | |||
336 | " subl %%ecx, %%eax\n" /* len -= nbytes */ | ||
337 | " rep movsb\n" | ||
338 | " movl %%edi, %%esi\n" | ||
339 | " subl %%ebp, %%esi\n" /* from = out - dist */ | ||
340 | " jmp .L_do_copy1\n" | ||
341 | |||
342 | " cmpl %%ecx, %%eax\n" | 702 | " cmpl %%ecx, %%eax\n" |
343 | " jbe .L_do_copy1\n" /* if (nbytes >= len) */ | 703 | " jbe .L_do_copy\n" /* if (nbytes >= len) */ |
344 | 704 | ||
345 | " subl %%ecx, %%eax\n" /* len -= nbytes */ | 705 | " subl %%ecx, %%eax\n" /* len -= nbytes */ |
346 | " rep movsb\n" | 706 | " rep movsb\n" |
347 | " movl %%edi, %%esi\n" | 707 | " movl %%edi, %%esi\n" |
348 | " subl %%ebp, %%esi\n" /* from = out - dist */ | 708 | " subl %%ebp, %%esi\n" /* from = out - dist */ |
349 | " jmp .L_do_copy1\n" | 709 | " jmp .L_do_copy\n" |
350 | 710 | ||
711 | ".align 32,0x90\n" | ||
351 | ".L_wrap_around_window:\n" | 712 | ".L_wrap_around_window:\n" |
352 | " movl 28(%%esp), %%eax\n" | 713 | " movl 52(%%esp), %%eax\n" /* eax = write */ |
353 | " cmpl %%eax, %%ecx\n" | 714 | " cmpl %%eax, %%ecx\n" |
354 | " jbe .L_contiguous_in_window\n" /* if (write >= nbytes) */ | 715 | " jbe .L_contiguous_in_window\n" /* if (write >= nbytes) */ |
355 | 716 | ||
356 | " addl 24(%%esp), %%esi\n" | 717 | " addl 48(%%esp), %%esi\n" /* from += wsize */ |
357 | " addl %%eax, %%esi\n" | 718 | " addl %%eax, %%esi\n" /* from += write */ |
358 | " subl %%ecx, %%esi\n" /* from += wsize + write - nbytes */ | 719 | " subl %%ecx, %%esi\n" /* from -= nbytes */ |
359 | " subl %%eax, %%ecx\n" /* nbytes -= write */ | 720 | " subl %%eax, %%ecx\n" /* nbytes -= write */ |
360 | 721 | ||
361 | " movl 60(%%esp), %%eax\n" | 722 | " movl 64(%%esp), %%eax\n" /* eax = len */ |
362 | " cmpl %%ecx, %%eax\n" | 723 | " cmpl %%ecx, %%eax\n" |
363 | " jbe .L_do_copy1\n" /* if (nbytes >= len) */ | 724 | " jbe .L_do_copy\n" /* if (nbytes >= len) */ |
364 | 725 | ||
365 | " subl %%ecx, %%eax\n" /* len -= nbytes */ | 726 | " subl %%ecx, %%eax\n" /* len -= nbytes */ |
366 | " rep movsb\n" | 727 | " rep movsb\n" |
367 | " movl 32(%%esp), %%esi\n" /* from = window */ | 728 | " movl 28(%%esp), %%esi\n" /* from = window */ |
368 | " movl 28(%%esp), %%ecx\n" /* nbytes = write */ | 729 | " movl 52(%%esp), %%ecx\n" /* nbytes = write */ |
369 | " cmpl %%ecx, %%eax\n" | 730 | " cmpl %%ecx, %%eax\n" |
370 | " jbe .L_do_copy1\n" /* if (nbytes >= len) */ | 731 | " jbe .L_do_copy\n" /* if (nbytes >= len) */ |
371 | 732 | ||
372 | " subl %%ecx, %%eax\n" /* len -= nbytes */ | 733 | " subl %%ecx, %%eax\n" /* len -= nbytes */ |
373 | " rep movsb\n" | 734 | " rep movsb\n" |
374 | " movl %%edi, %%esi\n" | 735 | " movl %%edi, %%esi\n" |
375 | " subl %%ebp, %%esi\n" /* from = out - dist */ | 736 | " subl %%ebp, %%esi\n" /* from = out - dist */ |
376 | " jmp .L_do_copy1\n" | 737 | " jmp .L_do_copy\n" |
377 | 738 | ||
739 | ".align 32,0x90\n" | ||
378 | ".L_contiguous_in_window:\n" | 740 | ".L_contiguous_in_window:\n" |
379 | " addl %%eax, %%esi\n" | 741 | " addl %%eax, %%esi\n" |
380 | " subl %%ecx, %%esi\n" /* from += write - nbytes */ | 742 | " subl %%ecx, %%esi\n" /* from += write - nbytes */ |
381 | 743 | ||
382 | " movl 60(%%esp), %%eax\n" | 744 | " movl 64(%%esp), %%eax\n" /* eax = len */ |
383 | " cmpl %%ecx, %%eax\n" | 745 | " cmpl %%ecx, %%eax\n" |
384 | " jbe .L_do_copy1\n" /* if (nbytes >= len) */ | 746 | " jbe .L_do_copy\n" /* if (nbytes >= len) */ |
385 | 747 | ||
386 | " subl %%ecx, %%eax\n" /* len -= nbytes */ | 748 | " subl %%ecx, %%eax\n" /* len -= nbytes */ |
387 | " rep movsb\n" | 749 | " rep movsb\n" |
388 | " movl %%edi, %%esi\n" | 750 | " movl %%edi, %%esi\n" |
389 | " subl %%ebp, %%esi\n" /* from = out - dist */ | 751 | " subl %%ebp, %%esi\n" /* from = out - dist */ |
752 | " jmp .L_do_copy\n" /* if (nbytes >= len) */ | ||
390 | 753 | ||
391 | ".L_do_copy1:\n" | 754 | ".align 32,0x90\n" |
755 | ".L_do_copy:\n" | ||
392 | " movl %%eax, %%ecx\n" | 756 | " movl %%eax, %%ecx\n" |
393 | " rep movsb\n" | 757 | " rep movsb\n" |
394 | 758 | ||
395 | " movl 4(%%esp), %%esi\n" /* move in back to %esi, toss from */ | 759 | " movl 8(%%esp), %%esi\n" /* move in back to %esi, toss from */ |
396 | " movl 44(%%esp), %%ebp\n" /* ebp = lcode */ | 760 | " movl 32(%%esp), %%ebp\n" /* ebp = lcode */ |
397 | " jmp .L_while_test\n" | 761 | " jmp .L_while_test\n" |
398 | 762 | ||
399 | ".L_test_for_end_of_block:\n" | 763 | ".L_test_for_end_of_block:\n" |
400 | " testb $32, %%al\n" | 764 | " testb $32, %%al\n" |
401 | " jz .L_invalid_literal_length_code\n" | 765 | " jz .L_invalid_literal_length_code\n" |
402 | " movl $1, 68(%%esp)\n" | 766 | " movl $1, 72(%%esp)\n" |
403 | " jmp .L_break_loop_with_status\n" | 767 | " jmp .L_break_loop_with_status\n" |
404 | 768 | ||
405 | ".L_invalid_literal_length_code:\n" | 769 | ".L_invalid_literal_length_code:\n" |
406 | " movl $2, 68(%%esp)\n" | 770 | " movl $2, 72(%%esp)\n" |
407 | " jmp .L_break_loop_with_status\n" | 771 | " jmp .L_break_loop_with_status\n" |
408 | 772 | ||
409 | ".L_invalid_distance_code:\n" | 773 | ".L_invalid_distance_code:\n" |
410 | " movl $3, 68(%%esp)\n" | 774 | " movl $3, 72(%%esp)\n" |
411 | " jmp .L_break_loop_with_status\n" | 775 | " jmp .L_break_loop_with_status\n" |
412 | 776 | ||
413 | ".L_invalid_distance_too_far:\n" | 777 | ".L_invalid_distance_too_far:\n" |
414 | " movl 4(%%esp), %%esi\n" | 778 | " movl 8(%%esp), %%esi\n" |
415 | " movl $4, 68(%%esp)\n" | 779 | " movl $4, 72(%%esp)\n" |
416 | " jmp .L_break_loop_with_status\n" | 780 | " jmp .L_break_loop_with_status\n" |
417 | 781 | ||
418 | ".L_break_loop:\n" | 782 | ".L_break_loop:\n" |
419 | " movl $0, 68(%%esp)\n" | 783 | " movl $0, 72(%%esp)\n" |
420 | 784 | ||
421 | ".L_break_loop_with_status:\n" | 785 | ".L_break_loop_with_status:\n" |
422 | /* put in, out, bits, and hold back into ar and pop esp */ | 786 | /* put in, out, bits, and hold back into ar and pop esp */ |
423 | " movl %%esi, 4(%%esp)\n" | 787 | " movl %%esi, 8(%%esp)\n" /* save in */ |
424 | " movl %%edi, 12(%%esp)\n" | 788 | " movl %%edi, 16(%%esp)\n" /* save out */ |
425 | " movl %%ebx, 40(%%esp)\n" | 789 | " movl %%ebx, 44(%%esp)\n" /* save bits */ |
426 | " movl %%edx, 36(%%esp)\n" | 790 | " movl %%edx, 40(%%esp)\n" /* save hold */ |
791 | " movl 4(%%esp), %%ebp\n" /* restore esp, ebp */ | ||
427 | " movl (%%esp), %%esp\n" | 792 | " movl (%%esp), %%esp\n" |
428 | " popl %%ebp\n" | ||
429 | " popf\n" | ||
430 | : | 793 | : |
431 | : "m" (ar) | 794 | : "m" (ar) |
432 | : "memory", "%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi" | 795 | : "memory", "%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi" |
433 | ); | 796 | ); |
434 | #elif defined( _MSC_VER ) | 797 | #elif defined( _MSC_VER ) && ! defined( _M_AMD64 ) |
435 | __asm { | 798 | __asm { |
436 | lea eax, ar | 799 | lea eax, ar |
437 | pushfd | 800 | mov [eax], esp /* save esp, ebp */ |
438 | push ebp | 801 | mov [eax+4], ebp |
439 | mov [eax], esp | ||
440 | mov esp, eax | 802 | mov esp, eax |
441 | mov esi, [esp+4] /* esi = in */ | 803 | mov esi, [esp+8] /* esi = in */ |
442 | mov edi, [esp+12] /* edi = out */ | 804 | mov edi, [esp+16] /* edi = out */ |
443 | mov edx, [esp+36] /* edx = hold */ | 805 | mov edx, [esp+40] /* edx = hold */ |
444 | mov ebx, [esp+40] /* ebx = bits */ | 806 | mov ebx, [esp+44] /* ebx = bits */ |
445 | mov ebp, [esp+44] /* ebp = lcode */ | 807 | mov ebp, [esp+32] /* ebp = lcode */ |
446 | 808 | ||
447 | cld | 809 | cld |
448 | jmp L_do_loop | 810 | jmp L_do_loop |
449 | 811 | ||
812 | ALIGN 4 | ||
450 | L_while_test: | 813 | L_while_test: |
451 | cmp [esp+20], edi | 814 | cmp [esp+24], edi |
452 | jbe L_break_loop | 815 | jbe L_break_loop |
453 | cmp [esp+8], esi | 816 | cmp [esp+12], esi |
454 | jbe L_break_loop | 817 | jbe L_break_loop |
455 | 818 | ||
456 | L_do_loop: | 819 | L_do_loop: |
@@ -465,7 +828,7 @@ L_do_loop: | |||
465 | or edx, eax /* hold |= *((ushort *)in)++ << bits */ | 828 | or edx, eax /* hold |= *((ushort *)in)++ << bits */ |
466 | 829 | ||
467 | L_get_length_code: | 830 | L_get_length_code: |
468 | mov eax, [esp+52] /* eax = lmask */ | 831 | mov eax, [esp+56] /* eax = lmask */ |
469 | and eax, edx /* eax &= hold */ | 832 | and eax, edx /* eax &= hold */ |
470 | mov eax, [ebp+eax*4] /* eax = lcode[hold & lmask] */ | 833 | mov eax, [ebp+eax*4] /* eax = lcode[hold & lmask] */ |
471 | 834 | ||
@@ -481,10 +844,11 @@ L_dolen: | |||
481 | stosb | 844 | stosb |
482 | jmp L_while_test | 845 | jmp L_while_test |
483 | 846 | ||
847 | ALIGN 4 | ||
484 | L_test_for_length_base: | 848 | L_test_for_length_base: |
485 | mov ecx, eax /* len = this */ | 849 | mov ecx, eax /* len = this */ |
486 | shr ecx, 16 /* len = this.val */ | 850 | shr ecx, 16 /* len = this.val */ |
487 | mov [esp+60], ecx /* len = this */ | 851 | mov [esp+64], ecx /* save len */ |
488 | mov cl, al | 852 | mov cl, al |
489 | 853 | ||
490 | test al, 16 | 854 | test al, 16 |
@@ -504,13 +868,14 @@ L_test_for_length_base: | |||
504 | mov cl, ch /* move op back to ecx */ | 868 | mov cl, ch /* move op back to ecx */ |
505 | 869 | ||
506 | L_add_bits_to_len: | 870 | L_add_bits_to_len: |
507 | mov eax, 1 | 871 | sub bl, cl |
872 | xor eax, eax | ||
873 | inc eax | ||
508 | shl eax, cl | 874 | shl eax, cl |
509 | dec eax | 875 | dec eax |
510 | sub bl, cl | ||
511 | and eax, edx /* eax &= hold */ | 876 | and eax, edx /* eax &= hold */ |
512 | shr edx, cl | 877 | shr edx, cl |
513 | add [esp+60], eax /* len += hold & mask[op] */ | 878 | add [esp+64], eax /* len += hold & mask[op] */ |
514 | 879 | ||
515 | L_decode_distance: | 880 | L_decode_distance: |
516 | cmp bl, 15 | 881 | cmp bl, 15 |
@@ -524,8 +889,8 @@ L_decode_distance: | |||
524 | or edx, eax /* hold |= *((ushort *)in)++ << bits */ | 889 | or edx, eax /* hold |= *((ushort *)in)++ << bits */ |
525 | 890 | ||
526 | L_get_distance_code: | 891 | L_get_distance_code: |
527 | mov eax, [esp+56] /* eax = dmask */ | 892 | mov eax, [esp+60] /* eax = dmask */ |
528 | mov ecx, [esp+48] /* ecx = dcode */ | 893 | mov ecx, [esp+36] /* ecx = dcode */ |
529 | and eax, edx /* eax &= hold */ | 894 | and eax, edx /* eax &= hold */ |
530 | mov eax, [ecx+eax*4]/* eax = dcode[hold & dmask] */ | 895 | mov eax, [ecx+eax*4]/* eax = dcode[hold & dmask] */ |
531 | 896 | ||
@@ -554,200 +919,207 @@ L_dodist: | |||
554 | mov cl, ch /* move op back to ecx */ | 919 | mov cl, ch /* move op back to ecx */ |
555 | 920 | ||
556 | L_add_bits_to_dist: | 921 | L_add_bits_to_dist: |
557 | mov eax, 1 | 922 | sub bl, cl |
923 | xor eax, eax | ||
924 | inc eax | ||
558 | shl eax, cl | 925 | shl eax, cl |
559 | dec eax /* (1 << op) - 1 */ | 926 | dec eax /* (1 << op) - 1 */ |
560 | sub bl, cl | ||
561 | and eax, edx /* eax &= hold */ | 927 | and eax, edx /* eax &= hold */ |
562 | shr edx, cl | 928 | shr edx, cl |
563 | add ebp, eax /* dist += hold & ((1 << op) - 1) */ | 929 | add ebp, eax /* dist += hold & ((1 << op) - 1) */ |
564 | 930 | ||
565 | L_check_window: | 931 | L_check_window: |
566 | mov [esp+4], esi /* save in so from can use it's reg */ | 932 | mov [esp+8], esi /* save in so from can use it's reg */ |
567 | mov eax, edi | 933 | mov eax, edi |
568 | sub eax, [esp+16] /* nbytes = out - beg */ | 934 | sub eax, [esp+20] /* nbytes = out - beg */ |
569 | 935 | ||
570 | cmp eax, ebp | 936 | cmp eax, ebp |
571 | jb L_clip_window /* if (dist > nbytes) 4.2% */ | 937 | jb L_clip_window /* if (dist > nbytes) 4.2% */ |
572 | 938 | ||
573 | mov ecx, [esp+60] | 939 | mov ecx, [esp+64] /* ecx = len */ |
574 | mov esi, edi | 940 | mov esi, edi |
575 | sub esi, ebp /* from = out - dist */ | 941 | sub esi, ebp /* from = out - dist */ |
576 | 942 | ||
577 | sub ecx, 3 /* copy from to out */ | 943 | sar ecx, 1 |
944 | jnc L_copy_two | ||
945 | |||
946 | rep movsw | ||
578 | mov al, [esi] | 947 | mov al, [esi] |
579 | mov [edi], al | 948 | mov [edi], al |
580 | mov al, [esi+1] | 949 | inc edi |
581 | mov ah, [esi+2] | 950 | |
582 | add esi, 3 | 951 | mov esi, [esp+8] /* move in back to %esi, toss from */ |
583 | mov [edi+1], al | 952 | mov ebp, [esp+32] /* ebp = lcode */ |
584 | mov [edi+2], ah | 953 | jmp L_while_test |
585 | add edi, 3 | ||
586 | rep movsb | ||
587 | 954 | ||
588 | mov esi, [esp+4] /* move in back to %esi, toss from */ | 955 | L_copy_two: |
589 | mov ebp, [esp+44] /* ebp = lcode */ | 956 | rep movsw |
957 | mov esi, [esp+8] /* move in back to %esi, toss from */ | ||
958 | mov ebp, [esp+32] /* ebp = lcode */ | ||
590 | jmp L_while_test | 959 | jmp L_while_test |
591 | 960 | ||
961 | ALIGN 4 | ||
592 | L_check_dist_one: | 962 | L_check_dist_one: |
593 | cmp ebp, 1 /* if dist 1, is a memset */ | 963 | cmp ebp, 1 /* if dist 1, is a memset */ |
594 | jne L_check_window | 964 | jne L_check_window |
595 | cmp [esp+16], edi | 965 | cmp [esp+20], edi |
596 | je L_check_window | 966 | je L_check_window /* out == beg, if outside window */ |
597 | 967 | ||
598 | dec edi | 968 | mov ecx, [esp+64] /* ecx = len */ |
599 | mov ecx, [esp+60] | 969 | mov al, [edi-1] |
600 | mov al, [edi] | 970 | mov ah, al |
601 | sub ecx, 3 | 971 | |
602 | 972 | sar ecx, 1 | |
603 | mov [edi+1], al /* memset out with from[-1] */ | 973 | jnc L_set_two |
604 | mov [edi+2], al | 974 | mov [edi], al /* memset out with from[-1] */ |
605 | mov [edi+3], al | 975 | inc edi |
606 | add edi, 4 | 976 | |
607 | rep stosb | 977 | L_set_two: |
608 | mov ebp, [esp+44] /* ebp = lcode */ | 978 | rep stosw |
979 | mov ebp, [esp+32] /* ebp = lcode */ | ||
609 | jmp L_while_test | 980 | jmp L_while_test |
610 | 981 | ||
982 | ALIGN 4 | ||
611 | L_test_for_second_level_length: | 983 | L_test_for_second_level_length: |
612 | test al, 64 | 984 | test al, 64 |
613 | jnz L_test_for_end_of_block /* if ((op & 64) != 0) */ | 985 | jnz L_test_for_end_of_block /* if ((op & 64) != 0) */ |
614 | 986 | ||
615 | mov eax, 1 | 987 | xor eax, eax |
988 | inc eax | ||
616 | shl eax, cl | 989 | shl eax, cl |
617 | dec eax | 990 | dec eax |
618 | and eax, edx /* eax &= hold */ | 991 | and eax, edx /* eax &= hold */ |
619 | add eax, [esp+60] /* eax += this.val */ | 992 | add eax, [esp+64] /* eax += len */ |
620 | mov eax, [ebp+eax*4] /* eax = lcode[val+(hold&mask[op])]*/ | 993 | mov eax, [ebp+eax*4] /* eax = lcode[val+(hold&mask[op])]*/ |
621 | jmp L_dolen | 994 | jmp L_dolen |
622 | 995 | ||
996 | ALIGN 4 | ||
623 | L_test_for_second_level_dist: | 997 | L_test_for_second_level_dist: |
624 | test al, 64 | 998 | test al, 64 |
625 | jnz L_invalid_distance_code /* if ((op & 64) != 0) */ | 999 | jnz L_invalid_distance_code /* if ((op & 64) != 0) */ |
626 | 1000 | ||
627 | mov eax, 1 | 1001 | xor eax, eax |
1002 | inc eax | ||
628 | shl eax, cl | 1003 | shl eax, cl |
629 | dec eax | 1004 | dec eax |
630 | and eax, edx /* eax &= hold */ | 1005 | and eax, edx /* eax &= hold */ |
631 | add eax, ebp /* eax += this.val */ | 1006 | add eax, ebp /* eax += dist */ |
632 | mov ecx, [esp+48] /* ecx = dcode */ | 1007 | mov ecx, [esp+36] /* ecx = dcode */ |
633 | mov eax, [ecx+eax*4] /* eax = dcode[val+(hold&mask[op])]*/ | 1008 | mov eax, [ecx+eax*4] /* eax = dcode[val+(hold&mask[op])]*/ |
634 | jmp L_dodist | 1009 | jmp L_dodist |
635 | 1010 | ||
1011 | ALIGN 4 | ||
636 | L_clip_window: | 1012 | L_clip_window: |
637 | mov ecx, eax | 1013 | mov ecx, eax |
638 | mov eax, [esp+24] /* prepare for dist compare */ | 1014 | mov eax, [esp+48] /* eax = wsize */ |
639 | neg ecx /* nbytes = -nbytes */ | 1015 | neg ecx /* nbytes = -nbytes */ |
640 | mov esi, [esp+32] /* from = window */ | 1016 | mov esi, [esp+28] /* from = window */ |
641 | 1017 | ||
642 | cmp eax, ebp | 1018 | cmp eax, ebp |
643 | jb L_invalid_distance_too_far /* if (dist > wsize) */ | 1019 | jb L_invalid_distance_too_far /* if (dist > wsize) */ |
644 | 1020 | ||
645 | add ecx, ebp /* nbytes = dist - nbytes */ | 1021 | add ecx, ebp /* nbytes = dist - nbytes */ |
646 | cmp dword ptr [esp+28], 0 | 1022 | cmp dword ptr [esp+52], 0 |
647 | jne L_wrap_around_window /* if (write != 0) */ | 1023 | jne L_wrap_around_window /* if (write != 0) */ |
648 | 1024 | ||
649 | sub eax, ecx | 1025 | sub eax, ecx |
650 | add esi, eax /* from += wsize - nbytes */ | 1026 | add esi, eax /* from += wsize - nbytes */ |
651 | 1027 | ||
652 | mov eax, [esp+60] | 1028 | mov eax, [esp+64] /* eax = len */ |
653 | cmp eax, ecx | ||
654 | jbe L_do_copy1 /* if (nbytes >= len) */ | ||
655 | |||
656 | sub eax, ecx /* len -= nbytes */ | ||
657 | rep movsb | ||
658 | mov esi, edi | ||
659 | sub esi, ebp /* from = out - dist */ | ||
660 | jmp L_do_copy1 | ||
661 | |||
662 | cmp eax, ecx | 1029 | cmp eax, ecx |
663 | jbe L_do_copy1 /* if (nbytes >= len) */ | 1030 | jbe L_do_copy /* if (nbytes >= len) */ |
664 | 1031 | ||
665 | sub eax, ecx /* len -= nbytes */ | 1032 | sub eax, ecx /* len -= nbytes */ |
666 | rep movsb | 1033 | rep movsb |
667 | mov esi, edi | 1034 | mov esi, edi |
668 | sub esi, ebp /* from = out - dist */ | 1035 | sub esi, ebp /* from = out - dist */ |
669 | jmp L_do_copy1 | 1036 | jmp L_do_copy |
670 | 1037 | ||
1038 | ALIGN 4 | ||
671 | L_wrap_around_window: | 1039 | L_wrap_around_window: |
672 | mov eax, [esp+28] | 1040 | mov eax, [esp+52] /* eax = write */ |
673 | cmp ecx, eax | 1041 | cmp ecx, eax |
674 | jbe L_contiguous_in_window /* if (write >= nbytes) */ | 1042 | jbe L_contiguous_in_window /* if (write >= nbytes) */ |
675 | 1043 | ||
676 | add esi, [esp+24] | 1044 | add esi, [esp+48] /* from += wsize */ |
677 | add esi, eax | 1045 | add esi, eax /* from += write */ |
678 | sub esi, ecx /* from += wsize + write - nbytes */ | 1046 | sub esi, ecx /* from -= nbytes */ |
679 | sub ecx, eax /* nbytes -= write */ | 1047 | sub ecx, eax /* nbytes -= write */ |
680 | 1048 | ||
681 | mov eax, [esp+60] | 1049 | mov eax, [esp+64] /* eax = len */ |
682 | cmp eax, ecx | 1050 | cmp eax, ecx |
683 | jbe L_do_copy1 /* if (nbytes >= len) */ | 1051 | jbe L_do_copy /* if (nbytes >= len) */ |
684 | 1052 | ||
685 | sub eax, ecx /* len -= nbytes */ | 1053 | sub eax, ecx /* len -= nbytes */ |
686 | rep movsb | 1054 | rep movsb |
687 | mov esi, [esp+32] /* from = window */ | 1055 | mov esi, [esp+28] /* from = window */ |
688 | mov ecx, [esp+28] /* nbytes = write */ | 1056 | mov ecx, [esp+52] /* nbytes = write */ |
689 | cmp eax, ecx | 1057 | cmp eax, ecx |
690 | jbe L_do_copy1 /* if (nbytes >= len) */ | 1058 | jbe L_do_copy /* if (nbytes >= len) */ |
691 | 1059 | ||
692 | sub eax, ecx /* len -= nbytes */ | 1060 | sub eax, ecx /* len -= nbytes */ |
693 | rep movsb | 1061 | rep movsb |
694 | mov esi, edi | 1062 | mov esi, edi |
695 | sub esi, ebp /* from = out - dist */ | 1063 | sub esi, ebp /* from = out - dist */ |
696 | jmp L_do_copy1 | 1064 | jmp L_do_copy |
697 | 1065 | ||
1066 | ALIGN 4 | ||
698 | L_contiguous_in_window: | 1067 | L_contiguous_in_window: |
699 | add esi, eax | 1068 | add esi, eax |
700 | sub esi, ecx /* from += write - nbytes */ | 1069 | sub esi, ecx /* from += write - nbytes */ |
701 | 1070 | ||
702 | mov eax, [esp+60] | 1071 | mov eax, [esp+64] /* eax = len */ |
703 | cmp eax, ecx | 1072 | cmp eax, ecx |
704 | jbe L_do_copy1 /* if (nbytes >= len) */ | 1073 | jbe L_do_copy /* if (nbytes >= len) */ |
705 | 1074 | ||
706 | sub eax, ecx /* len -= nbytes */ | 1075 | sub eax, ecx /* len -= nbytes */ |
707 | rep movsb | 1076 | rep movsb |
708 | mov esi, edi | 1077 | mov esi, edi |
709 | sub esi, ebp /* from = out - dist */ | 1078 | sub esi, ebp /* from = out - dist */ |
1079 | jmp L_do_copy | ||
710 | 1080 | ||
711 | L_do_copy1: | 1081 | ALIGN 4 |
1082 | L_do_copy: | ||
712 | mov ecx, eax | 1083 | mov ecx, eax |
713 | rep movsb | 1084 | rep movsb |
714 | 1085 | ||
715 | mov esi, [esp+4] /* move in back to %esi, toss from */ | 1086 | mov esi, [esp+8] /* move in back to %esi, toss from */ |
716 | mov ebp, [esp+44] /* ebp = lcode */ | 1087 | mov ebp, [esp+32] /* ebp = lcode */ |
717 | jmp L_while_test | 1088 | jmp L_while_test |
718 | 1089 | ||
719 | L_test_for_end_of_block: | 1090 | L_test_for_end_of_block: |
720 | test al, 32 | 1091 | test al, 32 |
721 | jz L_invalid_literal_length_code | 1092 | jz L_invalid_literal_length_code |
722 | mov dword ptr [esp+68], 1 | 1093 | mov dword ptr [esp+72], 1 |
723 | jmp L_break_loop_with_status | 1094 | jmp L_break_loop_with_status |
724 | 1095 | ||
725 | L_invalid_literal_length_code: | 1096 | L_invalid_literal_length_code: |
726 | mov dword ptr [esp+68], 2 | 1097 | mov dword ptr [esp+72], 2 |
727 | jmp L_break_loop_with_status | 1098 | jmp L_break_loop_with_status |
728 | 1099 | ||
729 | L_invalid_distance_code: | 1100 | L_invalid_distance_code: |
730 | mov dword ptr [esp+68], 3 | 1101 | mov dword ptr [esp+72], 3 |
731 | jmp L_break_loop_with_status | 1102 | jmp L_break_loop_with_status |
732 | 1103 | ||
733 | L_invalid_distance_too_far: | 1104 | L_invalid_distance_too_far: |
734 | mov esi, [esp+4] | 1105 | mov esi, [esp+4] |
735 | mov dword ptr [esp+68], 4 | 1106 | mov dword ptr [esp+72], 4 |
736 | jmp L_break_loop_with_status | 1107 | jmp L_break_loop_with_status |
737 | 1108 | ||
738 | L_break_loop: | 1109 | L_break_loop: |
739 | mov dword ptr [esp+68], 0 | 1110 | mov dword ptr [esp+72], 0 |
740 | 1111 | ||
741 | L_break_loop_with_status: | 1112 | L_break_loop_with_status: |
742 | /* put in, out, bits, and hold back into ar and pop esp */ | 1113 | /* put in, out, bits, and hold back into ar and pop esp */ |
743 | mov [esp+4], esi | 1114 | mov [esp+8], esi /* save in */ |
744 | mov [esp+12], edi | 1115 | mov [esp+16], edi /* save out */ |
745 | mov [esp+40], ebx | 1116 | mov [esp+44], ebx /* save bits */ |
746 | mov [esp+36], edx | 1117 | mov [esp+40], edx /* save hold */ |
1118 | mov ebp, [esp+4] /* restore esp, ebp */ | ||
747 | mov esp, [esp] | 1119 | mov esp, [esp] |
748 | pop ebp | ||
749 | popfd | ||
750 | } | 1120 | } |
1121 | #else | ||
1122 | #error "x86 architecture not defined" | ||
751 | #endif | 1123 | #endif |
752 | 1124 | ||
753 | if (ar.status > 1) { | 1125 | if (ar.status > 1) { |
@@ -772,10 +1144,12 @@ L_break_loop_with_status: | |||
772 | /* update state and return */ | 1144 | /* update state and return */ |
773 | strm->next_in = ar.in; | 1145 | strm->next_in = ar.in; |
774 | strm->next_out = ar.out; | 1146 | strm->next_out = ar.out; |
775 | strm->avail_in = (unsigned)(ar.in < ar.last ? 5 + (ar.last - ar.in) : | 1147 | strm->avail_in = (unsigned)(ar.in < ar.last ? |
776 | 5 - (ar.in - ar.last)); | 1148 | PAD_AVAIL_IN + (ar.last - ar.in) : |
777 | strm->avail_out = (unsigned)(ar.out < ar.end ? 257 + (ar.end - ar.out) : | 1149 | PAD_AVAIL_IN - (ar.in - ar.last)); |
778 | 257 - (ar.out - ar.end)); | 1150 | strm->avail_out = (unsigned)(ar.out < ar.end ? |
1151 | PAD_AVAIL_OUT + (ar.end - ar.out) : | ||
1152 | PAD_AVAIL_OUT - (ar.out - ar.end)); | ||
779 | state->hold = ar.hold; | 1153 | state->hold = ar.hold; |
780 | state->bits = ar.bits; | 1154 | state->bits = ar.bits; |
781 | return; | 1155 | return; |
diff --git a/contrib/inflate86/inffast.S b/contrib/inflate86/inffast.S index f9bffd5..2245a29 100644 --- a/contrib/inflate86/inffast.S +++ b/contrib/inflate86/inffast.S | |||
@@ -188,17 +188,8 @@ | |||
188 | /* | 188 | /* |
189 | * typedef enum inflate_mode consts, in inflate.h | 189 | * typedef enum inflate_mode consts, in inflate.h |
190 | */ | 190 | */ |
191 | #ifndef NO_GUNZIP | ||
192 | #define GUNZIP | ||
193 | #endif | ||
194 | |||
195 | #ifdef GUNZIP | ||
196 | #define INFLATE_MODE_TYPE 11 /* state->mode flags enum-ed in inflate.h */ | 191 | #define INFLATE_MODE_TYPE 11 /* state->mode flags enum-ed in inflate.h */ |
197 | #define INFLATE_MODE_BAD 26 | 192 | #define INFLATE_MODE_BAD 26 |
198 | #else | ||
199 | #define INFLATE_MODE_TYPE 3 | ||
200 | #define INFLATE_MODE_BAD 17 | ||
201 | #endif | ||
202 | 193 | ||
203 | 194 | ||
204 | #if ! defined( USE_MMX ) && ! defined( NO_MMX ) | 195 | #if ! defined( USE_MMX ) && ! defined( NO_MMX ) |
diff --git a/contrib/vstudio/vc7/zlib.rc b/contrib/vstudio/vc7/zlib.rc index 3ebe25b..cb779f7 100644 --- a/contrib/vstudio/vc7/zlib.rc +++ b/contrib/vstudio/vc7/zlib.rc | |||
@@ -2,8 +2,8 @@ | |||
2 | 2 | ||
3 | #define IDR_VERSION1 1 | 3 | #define IDR_VERSION1 1 |
4 | IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE | 4 | IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE |
5 | FILEVERSION 1,2,2 | 5 | FILEVERSION 1,2,2,1 |
6 | PRODUCTVERSION 1,2,2 | 6 | PRODUCTVERSION 1,2,2,1 |
7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK | 7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK |
8 | FILEFLAGS 0 | 8 | FILEFLAGS 0 |
9 | FILEOS VOS_DOS_WINDOWS32 | 9 | FILEOS VOS_DOS_WINDOWS32 |
@@ -17,7 +17,7 @@ BEGIN | |||
17 | 17 | ||
18 | BEGIN | 18 | BEGIN |
19 | VALUE "FileDescription", "zlib data compression library\0" | 19 | VALUE "FileDescription", "zlib data compression library\0" |
20 | VALUE "FileVersion", "1.2.2\0" | 20 | VALUE "FileVersion", "1.2.2.1\0" |
21 | VALUE "InternalName", "zlib\0" | 21 | VALUE "InternalName", "zlib\0" |
22 | VALUE "OriginalFilename", "zlib.dll\0" | 22 | VALUE "OriginalFilename", "zlib.dll\0" |
23 | VALUE "ProductName", "ZLib.DLL\0" | 23 | VALUE "ProductName", "ZLib.DLL\0" |
@@ -1,12 +1,12 @@ | |||
1 | /* crc32.c -- compute the CRC-32 of a data stream | 1 | /* crc32.c -- compute the CRC-32 of a data stream |
2 | * Copyright (C) 1995-2003 Mark Adler | 2 | * Copyright (C) 1995-2004 Mark Adler |
3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | * | 4 | * |
5 | * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster | 5 | * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster |
6 | * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing | 6 | * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing |
7 | * tables for updating the shift register in one step with three exclusive-ors | 7 | * tables for updating the shift register in one step with three exclusive-ors |
8 | * instead of four steps with four exclusive-ors. This results about a factor | 8 | * instead of four steps with four exclusive-ors. This results in about a |
9 | * of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. | 9 | * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | /* @(#) $Id$ */ | 12 | /* @(#) $Id$ */ |
@@ -72,6 +72,9 @@ local void make_crc_table OF((void)); | |||
72 | #ifdef MAKECRCH | 72 | #ifdef MAKECRCH |
73 | local void write_table OF((FILE *, const unsigned long FAR *)); | 73 | local void write_table OF((FILE *, const unsigned long FAR *)); |
74 | #endif /* MAKECRCH */ | 74 | #endif /* MAKECRCH */ |
75 | local unsigned long gf2_matrix_times OF((unsigned long *mat, | ||
76 | unsigned long vec)); | ||
77 | local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); | ||
75 | 78 | ||
76 | /* | 79 | /* |
77 | Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: | 80 | Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: |
@@ -331,3 +334,89 @@ local unsigned long crc32_big(crc, buf, len) | |||
331 | } | 334 | } |
332 | 335 | ||
333 | #endif /* BYFOUR */ | 336 | #endif /* BYFOUR */ |
337 | |||
338 | #define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ | ||
339 | |||
340 | /* ========================================================================= */ | ||
341 | local unsigned long gf2_matrix_times(mat, vec) | ||
342 | unsigned long *mat; | ||
343 | unsigned long vec; | ||
344 | { | ||
345 | unsigned long sum; | ||
346 | |||
347 | sum = 0; | ||
348 | while (vec) { | ||
349 | if (vec & 1) | ||
350 | sum ^= *mat; | ||
351 | vec >>= 1; | ||
352 | mat++; | ||
353 | } | ||
354 | return sum; | ||
355 | } | ||
356 | |||
357 | /* ========================================================================= */ | ||
358 | local void gf2_matrix_square(square, mat) | ||
359 | unsigned long *square; | ||
360 | unsigned long *mat; | ||
361 | { | ||
362 | int n; | ||
363 | |||
364 | for (n = 0; n < GF2_DIM; n++) | ||
365 | square[n] = gf2_matrix_times(mat, mat[n]); | ||
366 | } | ||
367 | |||
368 | /* ========================================================================= */ | ||
369 | uLong ZEXPORT crc32_combine(crc1, crc2, len2) | ||
370 | uLong crc1; | ||
371 | uLong crc2; | ||
372 | uLong len2; | ||
373 | { | ||
374 | int n; | ||
375 | unsigned long row; | ||
376 | unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */ | ||
377 | unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */ | ||
378 | |||
379 | /* degenerate case */ | ||
380 | if (len2 == 0) | ||
381 | return crc1; | ||
382 | |||
383 | /* put operator for one zero bit in odd */ | ||
384 | odd[0] = 0xedb88320L; /* CRC-32 polynomial */ | ||
385 | row = 1; | ||
386 | for (n = 1; n < GF2_DIM; n++) { | ||
387 | odd[n] = row; | ||
388 | row <<= 1; | ||
389 | } | ||
390 | |||
391 | /* put operator for two zero bits in even */ | ||
392 | gf2_matrix_square(even, odd); | ||
393 | |||
394 | /* put operator for four zero bits in odd */ | ||
395 | gf2_matrix_square(odd, even); | ||
396 | |||
397 | /* apply len2 zeros to crc1 (first square will put the operator for one | ||
398 | zero byte, eight zero bits, in even) */ | ||
399 | do { | ||
400 | /* apply zeros operator for this bit of len2 */ | ||
401 | gf2_matrix_square(even, odd); | ||
402 | if (len2 & 1) | ||
403 | crc1 = gf2_matrix_times(even, crc1); | ||
404 | len2 >>= 1; | ||
405 | |||
406 | /* if no more bits set, then done */ | ||
407 | if (len2 == 0) | ||
408 | break; | ||
409 | |||
410 | /* another iteration of the loop with odd and even swapped */ | ||
411 | gf2_matrix_square(odd, even); | ||
412 | if (len2 & 1) | ||
413 | crc1 = gf2_matrix_times(odd, crc1); | ||
414 | len2 >>= 1; | ||
415 | |||
416 | /* if no more bits set, then done */ | ||
417 | } while (len2 != 0); | ||
418 | |||
419 | /* return combined crc */ | ||
420 | crc1 ^= crc2; | ||
421 | return crc1; | ||
422 | } | ||
@@ -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.2 Copyright 1995-2004 Jean-loup Gailly "; | 55 | " deflate 1.2.2.1 Copyright 1995-2004 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 |
@@ -274,6 +274,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, | |||
274 | s->strm = strm; | 274 | s->strm = strm; |
275 | 275 | ||
276 | s->wrap = wrap; | 276 | s->wrap = wrap; |
277 | s->gzhead = Z_NULL; | ||
277 | s->w_bits = windowBits; | 278 | s->w_bits = windowBits; |
278 | s->w_size = 1 << s->w_bits; | 279 | s->w_size = 1 << s->w_bits; |
279 | s->w_mask = s->w_size - 1; | 280 | s->w_mask = s->w_size - 1; |
@@ -391,6 +392,17 @@ int ZEXPORT deflateReset (strm) | |||
391 | } | 392 | } |
392 | 393 | ||
393 | /* ========================================================================= */ | 394 | /* ========================================================================= */ |
395 | int ZEXPORT deflateSetHeader (strm, head) | ||
396 | z_streamp strm; | ||
397 | gz_headerp head; | ||
398 | { | ||
399 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | ||
400 | if (strm->state->wrap != 2) return Z_STREAM_ERROR; | ||
401 | strm->state->gzhead = head; | ||
402 | return Z_OK; | ||
403 | } | ||
404 | |||
405 | /* ========================================================================= */ | ||
394 | int ZEXPORT deflatePrime (strm, bits, value) | 406 | int ZEXPORT deflatePrime (strm, bits, value) |
395 | z_streamp strm; | 407 | z_streamp strm; |
396 | int bits; | 408 | int bits; |
@@ -548,20 +560,47 @@ int ZEXPORT deflate (strm, flush) | |||
548 | if (s->status == INIT_STATE) { | 560 | if (s->status == INIT_STATE) { |
549 | #ifdef GZIP | 561 | #ifdef GZIP |
550 | if (s->wrap == 2) { | 562 | if (s->wrap == 2) { |
563 | strm->adler = crc32(0L, Z_NULL, 0); | ||
551 | put_byte(s, 31); | 564 | put_byte(s, 31); |
552 | put_byte(s, 139); | 565 | put_byte(s, 139); |
553 | put_byte(s, 8); | 566 | put_byte(s, 8); |
554 | put_byte(s, 0); | 567 | if (s->gzhead == NULL) { |
555 | put_byte(s, 0); | 568 | put_byte(s, 0); |
556 | put_byte(s, 0); | 569 | put_byte(s, 0); |
557 | put_byte(s, 0); | 570 | put_byte(s, 0); |
558 | put_byte(s, 0); | 571 | put_byte(s, 0); |
559 | put_byte(s, s->level == 9 ? 2 : | 572 | put_byte(s, 0); |
560 | (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? | 573 | put_byte(s, s->level == 9 ? 2 : |
561 | 4 : 0)); | 574 | (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? |
562 | put_byte(s, 255); | 575 | 4 : 0)); |
563 | s->status = BUSY_STATE; | 576 | put_byte(s, 255); |
564 | strm->adler = crc32(0L, Z_NULL, 0); | 577 | s->status = BUSY_STATE; |
578 | } | ||
579 | else { | ||
580 | put_byte(s, (s->gzhead->text ? 1 : 0) + | ||
581 | (s->gzhead->hcrc ? 2 : 0) + | ||
582 | (s->gzhead->extra == Z_NULL ? 0 : 4) + | ||
583 | (s->gzhead->name == Z_NULL ? 0 : 8) + | ||
584 | (s->gzhead->comment == Z_NULL ? 0 : 16) | ||
585 | ); | ||
586 | put_byte(s, s->gzhead->time & 0xff); | ||
587 | put_byte(s, (s->gzhead->time >> 8) & 0xff); | ||
588 | put_byte(s, (s->gzhead->time >> 16) & 0xff); | ||
589 | put_byte(s, (s->gzhead->time >> 24) & 0xff); | ||
590 | put_byte(s, s->level == 9 ? 2 : | ||
591 | (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? | ||
592 | 4 : 0)); | ||
593 | put_byte(s, s->gzhead->os & 0xff); | ||
594 | if (s->gzhead->extra != NULL) { | ||
595 | put_byte(s, s->gzhead->extra_len & 0xff); | ||
596 | put_byte(s, (s->gzhead->extra_len >> 8) & 0xff); | ||
597 | } | ||
598 | if (s->gzhead->hcrc) | ||
599 | strm->adler = crc32(strm->adler, s->pending_buf, | ||
600 | s->pending); | ||
601 | s->gzindex = 0; | ||
602 | s->status = EXTRA_STATE; | ||
603 | } | ||
565 | } | 604 | } |
566 | else | 605 | else |
567 | #endif | 606 | #endif |
@@ -592,6 +631,110 @@ int ZEXPORT deflate (strm, flush) | |||
592 | strm->adler = adler32(0L, Z_NULL, 0); | 631 | strm->adler = adler32(0L, Z_NULL, 0); |
593 | } | 632 | } |
594 | } | 633 | } |
634 | #ifdef GZIP | ||
635 | if (s->status == EXTRA_STATE) { | ||
636 | if (s->gzhead->extra != NULL) { | ||
637 | int beg = s->pending; /* start of bytes to update crc */ | ||
638 | |||
639 | while (s->gzindex < (s->gzhead->extra_len & 0xffff)) { | ||
640 | if (s->pending == s->pending_buf_size) { | ||
641 | if (s->gzhead->hcrc && s->pending > beg) | ||
642 | strm->adler = crc32(strm->adler, s->pending_buf + beg, | ||
643 | s->pending - beg); | ||
644 | flush_pending(strm); | ||
645 | beg = s->pending; | ||
646 | if (s->pending == s->pending_buf_size) | ||
647 | break; | ||
648 | } | ||
649 | put_byte(s, s->gzhead->extra[s->gzindex]); | ||
650 | s->gzindex++; | ||
651 | } | ||
652 | if (s->gzhead->hcrc && s->pending > beg) | ||
653 | strm->adler = crc32(strm->adler, s->pending_buf + beg, | ||
654 | s->pending - beg); | ||
655 | if (s->gzindex == s->gzhead->extra_len) { | ||
656 | s->gzindex = 0; | ||
657 | s->status = NAME_STATE; | ||
658 | } | ||
659 | } | ||
660 | else | ||
661 | s->status = NAME_STATE; | ||
662 | } | ||
663 | if (s->status == NAME_STATE) { | ||
664 | if (s->gzhead->name != NULL) { | ||
665 | int beg = s->pending; /* start of bytes to update crc */ | ||
666 | int val; | ||
667 | |||
668 | do { | ||
669 | if (s->pending == s->pending_buf_size) { | ||
670 | if (s->gzhead->hcrc && s->pending > beg) | ||
671 | strm->adler = crc32(strm->adler, s->pending_buf + beg, | ||
672 | s->pending - beg); | ||
673 | flush_pending(strm); | ||
674 | beg = s->pending; | ||
675 | if (s->pending == s->pending_buf_size) { | ||
676 | val = 1; | ||
677 | break; | ||
678 | } | ||
679 | } | ||
680 | val = s->gzhead->name[s->gzindex++]; | ||
681 | put_byte(s, val); | ||
682 | } while (val != 0); | ||
683 | if (s->gzhead->hcrc && s->pending > beg) | ||
684 | strm->adler = crc32(strm->adler, s->pending_buf + beg, | ||
685 | s->pending - beg); | ||
686 | if (val == 0) { | ||
687 | s->gzindex = 0; | ||
688 | s->status = COMMENT_STATE; | ||
689 | } | ||
690 | } | ||
691 | else | ||
692 | s->status = COMMENT_STATE; | ||
693 | } | ||
694 | if (s->status == COMMENT_STATE) { | ||
695 | if (s->gzhead->comment != NULL) { | ||
696 | int beg = s->pending; /* start of bytes to update crc */ | ||
697 | int val; | ||
698 | |||
699 | do { | ||
700 | if (s->pending == s->pending_buf_size) { | ||
701 | if (s->gzhead->hcrc && s->pending > beg) | ||
702 | strm->adler = crc32(strm->adler, s->pending_buf + beg, | ||
703 | s->pending - beg); | ||
704 | flush_pending(strm); | ||
705 | beg = s->pending; | ||
706 | if (s->pending == s->pending_buf_size) { | ||
707 | val = 1; | ||
708 | break; | ||
709 | } | ||
710 | } | ||
711 | val = s->gzhead->comment[s->gzindex++]; | ||
712 | put_byte(s, val); | ||
713 | } while (val != 0); | ||
714 | if (s->gzhead->hcrc && s->pending > beg) | ||
715 | strm->adler = crc32(strm->adler, s->pending_buf + beg, | ||
716 | s->pending - beg); | ||
717 | if (val == 0) | ||
718 | s->status = HCRC_STATE; | ||
719 | } | ||
720 | else | ||
721 | s->status = HCRC_STATE; | ||
722 | } | ||
723 | if (s->status == HCRC_STATE) { | ||
724 | if (s->gzhead->hcrc) { | ||
725 | if (s->pending + 2 > s->pending_buf_size) | ||
726 | flush_pending(strm); | ||
727 | if (s->pending + 2 <= s->pending_buf_size) { | ||
728 | put_byte(s, strm->adler & 0xff); | ||
729 | put_byte(s, (strm->adler >> 8) & 0xff); | ||
730 | strm->adler = crc32(0L, Z_NULL, 0); | ||
731 | s->status = BUSY_STATE; | ||
732 | } | ||
733 | } | ||
734 | else | ||
735 | s->status = BUSY_STATE; | ||
736 | } | ||
737 | #endif | ||
595 | 738 | ||
596 | /* Flush as much pending output as possible */ | 739 | /* Flush as much pending output as possible */ |
597 | if (s->pending != 0) { | 740 | if (s->pending != 0) { |
@@ -704,7 +847,12 @@ int ZEXPORT deflateEnd (strm) | |||
704 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | 847 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; |
705 | 848 | ||
706 | status = strm->state->status; | 849 | status = strm->state->status; |
707 | if (status != INIT_STATE && status != BUSY_STATE && | 850 | if (status != INIT_STATE && |
851 | status != EXTRA_STATE && | ||
852 | status != NAME_STATE && | ||
853 | status != COMMENT_STATE && | ||
854 | status != HCRC_STATE && | ||
855 | status != BUSY_STATE && | ||
708 | status != FINISH_STATE) { | 856 | status != FINISH_STATE) { |
709 | return Z_STREAM_ERROR; | 857 | return Z_STREAM_ERROR; |
710 | } | 858 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* deflate.h -- internal compression state | 1 | /* deflate.h -- internal compression state |
2 | * Copyright (C) 1995-2002 Jean-loup Gailly | 2 | * Copyright (C) 1995-2004 Jean-loup Gailly |
3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -49,6 +49,10 @@ | |||
49 | /* All codes must not exceed MAX_BITS bits */ | 49 | /* All codes must not exceed MAX_BITS bits */ |
50 | 50 | ||
51 | #define INIT_STATE 42 | 51 | #define INIT_STATE 42 |
52 | #define EXTRA_STATE 69 | ||
53 | #define NAME_STATE 73 | ||
54 | #define COMMENT_STATE 91 | ||
55 | #define HCRC_STATE 103 | ||
52 | #define BUSY_STATE 113 | 56 | #define BUSY_STATE 113 |
53 | #define FINISH_STATE 666 | 57 | #define FINISH_STATE 666 |
54 | /* Stream status */ | 58 | /* Stream status */ |
@@ -95,6 +99,8 @@ typedef struct internal_state { | |||
95 | Bytef *pending_out; /* next pending byte to output to the stream */ | 99 | Bytef *pending_out; /* next pending byte to output to the stream */ |
96 | int pending; /* nb of bytes in the pending buffer */ | 100 | int pending; /* nb of bytes in the pending buffer */ |
97 | int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ | 101 | int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ |
102 | gz_headerp gzhead; /* gzip header information to write */ | ||
103 | int gzindex; /* where in extra, name, or comment */ | ||
98 | Byte method; /* STORED (for zip only) or DEFLATED */ | 104 | Byte method; /* STORED (for zip only) or DEFLATED */ |
99 | int last_flush; /* value of flush param for previous deflate call */ | 105 | int last_flush; /* value of flush param for previous deflate call */ |
100 | 106 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* example.c -- usage example of the zlib compression library | 1 | /* example.c -- usage example of the zlib compression library |
2 | * Copyright (C) 1995-2003 Jean-loup Gailly. | 2 | * Copyright (C) 1995-2004 Jean-loup Gailly. |
3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -11,8 +11,6 @@ | |||
11 | #ifdef STDC | 11 | #ifdef STDC |
12 | # include <string.h> | 12 | # include <string.h> |
13 | # include <stdlib.h> | 13 | # include <stdlib.h> |
14 | #else | ||
15 | extern void exit OF((int)); | ||
16 | #endif | 14 | #endif |
17 | 15 | ||
18 | #if defined(VMS) || defined(RISCOS) | 16 | #if defined(VMS) || defined(RISCOS) |
@@ -1,5 +1,5 @@ | |||
1 | /* gzio.c -- IO on .gz files | 1 | /* gzio.c -- IO on .gz files |
2 | * Copyright (C) 1995-2003 Jean-loup Gailly. | 2 | * Copyright (C) 1995-2004 Jean-loup Gailly. |
3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | * | 4 | * |
5 | * Compile this file with -DNO_GZCOMPRESS to avoid the compression code. | 5 | * Compile this file with -DNO_GZCOMPRESS to avoid the compression code. |
@@ -11,7 +11,7 @@ | |||
11 | 11 | ||
12 | #include "zutil.h" | 12 | #include "zutil.h" |
13 | 13 | ||
14 | #ifdef NO_DEFLATE /* for compatiblity with old definition */ | 14 | #ifdef NO_DEFLATE /* for compatibility with old definition */ |
15 | # define NO_GZCOMPRESS | 15 | # define NO_GZCOMPRESS |
16 | #endif | 16 | #endif |
17 | 17 | ||
@@ -941,7 +941,6 @@ local uLong getLong (s) | |||
941 | int ZEXPORT gzclose (file) | 941 | int ZEXPORT gzclose (file) |
942 | gzFile file; | 942 | gzFile file; |
943 | { | 943 | { |
944 | int err; | ||
945 | gz_stream *s = (gz_stream*)file; | 944 | gz_stream *s = (gz_stream*)file; |
946 | 945 | ||
947 | if (s == NULL) return Z_STREAM_ERROR; | 946 | if (s == NULL) return Z_STREAM_ERROR; |
@@ -950,8 +949,8 @@ int ZEXPORT gzclose (file) | |||
950 | #ifdef NO_GZCOMPRESS | 949 | #ifdef NO_GZCOMPRESS |
951 | return Z_STREAM_ERROR; | 950 | return Z_STREAM_ERROR; |
952 | #else | 951 | #else |
953 | err = do_flush (file, Z_FINISH); | 952 | if (do_flush (file, Z_FINISH) != Z_OK) |
954 | if (err != Z_OK) return destroy((gz_stream*)file); | 953 | return destroy((gz_stream*)file); |
955 | 954 | ||
956 | putLong (s->file, s->crc); | 955 | putLong (s->file, s->crc); |
957 | putLong (s->file, (uLong)(s->in & 0xffffffff)); | 956 | putLong (s->file, (uLong)(s->in & 0xffffffff)); |
@@ -1,5 +1,5 @@ | |||
1 | /* infback.c -- inflate using a call-back interface | 1 | /* infback.c -- inflate using a call-back interface |
2 | * Copyright (C) 1995-2003 Mark Adler | 2 | * Copyright (C) 1995-2004 Mark Adler |
3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -26,7 +26,7 @@ local void fixedtables OF((struct inflate_state FAR *state)); | |||
26 | window and output buffer that is 2**windowBits bytes. | 26 | window and output buffer that is 2**windowBits bytes. |
27 | */ | 27 | */ |
28 | int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size) | 28 | int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size) |
29 | z_stream FAR *strm; | 29 | z_streamp strm; |
30 | int windowBits; | 30 | int windowBits; |
31 | unsigned char FAR *window; | 31 | unsigned char FAR *window; |
32 | const char *version; | 32 | const char *version; |
@@ -238,7 +238,7 @@ struct inflate_state FAR *state; | |||
238 | are not correct, i.e. strm is Z_NULL or the state was not initialized. | 238 | are not correct, i.e. strm is Z_NULL or the state was not initialized. |
239 | */ | 239 | */ |
240 | int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc) | 240 | int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc) |
241 | z_stream FAR *strm; | 241 | z_streamp strm; |
242 | in_func in; | 242 | in_func in; |
243 | void FAR *in_desc; | 243 | void FAR *in_desc; |
244 | out_func out; | 244 | out_func out; |
@@ -611,7 +611,7 @@ void FAR *out_desc; | |||
611 | } | 611 | } |
612 | 612 | ||
613 | int ZEXPORT inflateBackEnd(strm) | 613 | int ZEXPORT inflateBackEnd(strm) |
614 | z_stream FAR *strm; | 614 | z_streamp strm; |
615 | { | 615 | { |
616 | if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) | 616 | if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) |
617 | return Z_STREAM_ERROR; | 617 | return Z_STREAM_ERROR; |
@@ -1,5 +1,5 @@ | |||
1 | /* inflate.c -- zlib decompression | 1 | /* inflate.c -- zlib decompression |
2 | * Copyright (C) 1995-2003 Mark Adler | 2 | * Copyright (C) 1995-2004 Mark Adler |
3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -113,6 +113,7 @@ z_streamp strm; | |||
113 | state->mode = HEAD; | 113 | state->mode = HEAD; |
114 | state->last = 0; | 114 | state->last = 0; |
115 | state->havedict = 0; | 115 | state->havedict = 0; |
116 | state->head = Z_NULL; | ||
116 | state->wsize = 0; | 117 | state->wsize = 0; |
117 | state->whave = 0; | 118 | state->whave = 0; |
118 | state->hold = 0; | 119 | state->hold = 0; |
@@ -582,6 +583,8 @@ int flush; | |||
582 | break; | 583 | break; |
583 | } | 584 | } |
584 | state->flags = 0; /* expect zlib header */ | 585 | state->flags = 0; /* expect zlib header */ |
586 | if (state->head != Z_NULL) | ||
587 | state->head->done = -1; | ||
585 | if (!(state->wrap & 1) || /* check if zlib header allowed */ | 588 | if (!(state->wrap & 1) || /* check if zlib header allowed */ |
586 | #else | 589 | #else |
587 | if ( | 590 | if ( |
@@ -621,16 +624,24 @@ int flush; | |||
621 | state->mode = BAD; | 624 | state->mode = BAD; |
622 | break; | 625 | break; |
623 | } | 626 | } |
627 | if (state->head != Z_NULL) | ||
628 | state->head->text = (int)((hold >> 8) & 1); | ||
624 | if (state->flags & 0x0200) CRC2(state->check, hold); | 629 | if (state->flags & 0x0200) CRC2(state->check, hold); |
625 | INITBITS(); | 630 | INITBITS(); |
626 | state->mode = TIME; | 631 | state->mode = TIME; |
627 | case TIME: | 632 | case TIME: |
628 | NEEDBITS(32); | 633 | NEEDBITS(32); |
634 | if (state->head != Z_NULL) | ||
635 | state->head->time = hold; | ||
629 | if (state->flags & 0x0200) CRC4(state->check, hold); | 636 | if (state->flags & 0x0200) CRC4(state->check, hold); |
630 | INITBITS(); | 637 | INITBITS(); |
631 | state->mode = OS; | 638 | state->mode = OS; |
632 | case OS: | 639 | case OS: |
633 | NEEDBITS(16); | 640 | NEEDBITS(16); |
641 | if (state->head != Z_NULL) { | ||
642 | state->head->xflags = (int)(hold & 0xff); | ||
643 | state->head->os = (int)(hold >> 8); | ||
644 | } | ||
634 | if (state->flags & 0x0200) CRC2(state->check, hold); | 645 | if (state->flags & 0x0200) CRC2(state->check, hold); |
635 | INITBITS(); | 646 | INITBITS(); |
636 | state->mode = EXLEN; | 647 | state->mode = EXLEN; |
@@ -638,15 +649,26 @@ int flush; | |||
638 | if (state->flags & 0x0400) { | 649 | if (state->flags & 0x0400) { |
639 | NEEDBITS(16); | 650 | NEEDBITS(16); |
640 | state->length = (unsigned)(hold); | 651 | state->length = (unsigned)(hold); |
652 | if (state->head != Z_NULL) | ||
653 | state->head->extra_len = (unsigned)hold; | ||
641 | if (state->flags & 0x0200) CRC2(state->check, hold); | 654 | if (state->flags & 0x0200) CRC2(state->check, hold); |
642 | INITBITS(); | 655 | INITBITS(); |
643 | } | 656 | } |
657 | else if (state->head != Z_NULL) | ||
658 | state->head->extra = Z_NULL; | ||
644 | state->mode = EXTRA; | 659 | state->mode = EXTRA; |
645 | case EXTRA: | 660 | case EXTRA: |
646 | if (state->flags & 0x0400) { | 661 | if (state->flags & 0x0400) { |
647 | copy = state->length; | 662 | copy = state->length; |
648 | if (copy > have) copy = have; | 663 | if (copy > have) copy = have; |
649 | if (copy) { | 664 | if (copy) { |
665 | if (state->head != Z_NULL && | ||
666 | state->head->extra != Z_NULL) { | ||
667 | len = state->head->extra_len - state->length; | ||
668 | zmemcpy(state->head->extra + len, next, | ||
669 | len + copy > state->head->extra_max ? | ||
670 | state->head->extra_max - len : copy); | ||
671 | } | ||
650 | if (state->flags & 0x0200) | 672 | if (state->flags & 0x0200) |
651 | state->check = crc32(state->check, next, copy); | 673 | state->check = crc32(state->check, next, copy); |
652 | have -= copy; | 674 | have -= copy; |
@@ -655,6 +677,7 @@ int flush; | |||
655 | } | 677 | } |
656 | if (state->length) goto inf_leave; | 678 | if (state->length) goto inf_leave; |
657 | } | 679 | } |
680 | state->length = 0; | ||
658 | state->mode = NAME; | 681 | state->mode = NAME; |
659 | case NAME: | 682 | case NAME: |
660 | if (state->flags & 0x0800) { | 683 | if (state->flags & 0x0800) { |
@@ -662,13 +685,20 @@ int flush; | |||
662 | copy = 0; | 685 | copy = 0; |
663 | do { | 686 | do { |
664 | len = (unsigned)(next[copy++]); | 687 | len = (unsigned)(next[copy++]); |
688 | if (state->head != Z_NULL && | ||
689 | state->head->name != Z_NULL && | ||
690 | state->length < state->head->name_max) | ||
691 | state->head->name[state->length++] = len; | ||
665 | } while (len && copy < have); | 692 | } while (len && copy < have); |
666 | if (state->flags & 0x02000) | 693 | if (state->flags & 0x0200) |
667 | state->check = crc32(state->check, next, copy); | 694 | state->check = crc32(state->check, next, copy); |
668 | have -= copy; | 695 | have -= copy; |
669 | next += copy; | 696 | next += copy; |
670 | if (len) goto inf_leave; | 697 | if (len) goto inf_leave; |
671 | } | 698 | } |
699 | else if (state->head != Z_NULL) | ||
700 | state->head->name = Z_NULL; | ||
701 | state->length = 0; | ||
672 | state->mode = COMMENT; | 702 | state->mode = COMMENT; |
673 | case COMMENT: | 703 | case COMMENT: |
674 | if (state->flags & 0x1000) { | 704 | if (state->flags & 0x1000) { |
@@ -676,13 +706,19 @@ int flush; | |||
676 | copy = 0; | 706 | copy = 0; |
677 | do { | 707 | do { |
678 | len = (unsigned)(next[copy++]); | 708 | len = (unsigned)(next[copy++]); |
709 | if (state->head != Z_NULL && | ||
710 | state->head->comment != Z_NULL && | ||
711 | state->length < state->head->comm_max) | ||
712 | state->head->comment[state->length++] = len; | ||
679 | } while (len && copy < have); | 713 | } while (len && copy < have); |
680 | if (state->flags & 0x02000) | 714 | if (state->flags & 0x0200) |
681 | state->check = crc32(state->check, next, copy); | 715 | state->check = crc32(state->check, next, copy); |
682 | have -= copy; | 716 | have -= copy; |
683 | next += copy; | 717 | next += copy; |
684 | if (len) goto inf_leave; | 718 | if (len) goto inf_leave; |
685 | } | 719 | } |
720 | else if (state->head != Z_NULL) | ||
721 | state->head->comment = Z_NULL; | ||
686 | state->mode = HCRC; | 722 | state->mode = HCRC; |
687 | case HCRC: | 723 | case HCRC: |
688 | if (state->flags & 0x0200) { | 724 | if (state->flags & 0x0200) { |
@@ -694,6 +730,10 @@ int flush; | |||
694 | } | 730 | } |
695 | INITBITS(); | 731 | INITBITS(); |
696 | } | 732 | } |
733 | if (state->head != Z_NULL) { | ||
734 | state->head->hcrc = (int)((state->flags >> 9) & 1); | ||
735 | state->head->done = 1; | ||
736 | } | ||
697 | strm->adler = state->check = crc32(0L, Z_NULL, 0); | 737 | strm->adler = state->check = crc32(0L, Z_NULL, 0); |
698 | state->mode = TYPE; | 738 | state->mode = TYPE; |
699 | break; | 739 | break; |
@@ -1110,12 +1150,16 @@ uInt dictLength; | |||
1110 | /* check state */ | 1150 | /* check state */ |
1111 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | 1151 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; |
1112 | state = (struct inflate_state FAR *)strm->state; | 1152 | state = (struct inflate_state FAR *)strm->state; |
1113 | if (state->mode != DICT) return Z_STREAM_ERROR; | 1153 | if (state->wrap != 0 && state->mode != DICT) |
1154 | return Z_STREAM_ERROR; | ||
1114 | 1155 | ||
1115 | /* check for correct dictionary id */ | 1156 | /* check for correct dictionary id */ |
1116 | id = adler32(0L, Z_NULL, 0); | 1157 | if (state->mode == DICT) { |
1117 | id = adler32(id, dictionary, dictLength); | 1158 | id = adler32(0L, Z_NULL, 0); |
1118 | if (id != state->check) return Z_DATA_ERROR; | 1159 | id = adler32(id, dictionary, dictLength); |
1160 | if (id != state->check) | ||
1161 | return Z_DATA_ERROR; | ||
1162 | } | ||
1119 | 1163 | ||
1120 | /* copy dictionary to window */ | 1164 | /* copy dictionary to window */ |
1121 | if (updatewindow(strm, strm->avail_out)) { | 1165 | if (updatewindow(strm, strm->avail_out)) { |
@@ -1137,6 +1181,23 @@ uInt dictLength; | |||
1137 | return Z_OK; | 1181 | return Z_OK; |
1138 | } | 1182 | } |
1139 | 1183 | ||
1184 | int ZEXPORT inflateGetHeader(strm, head) | ||
1185 | z_streamp strm; | ||
1186 | gz_headerp head; | ||
1187 | { | ||
1188 | struct inflate_state FAR *state; | ||
1189 | |||
1190 | /* check state */ | ||
1191 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | ||
1192 | state = (struct inflate_state FAR *)strm->state; | ||
1193 | if ((state->wrap & 2) == 0) return Z_STREAM_ERROR; | ||
1194 | |||
1195 | /* save header structure */ | ||
1196 | state->head = head; | ||
1197 | head->done = 0; | ||
1198 | return Z_OK; | ||
1199 | } | ||
1200 | |||
1140 | /* | 1201 | /* |
1141 | Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found | 1202 | Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found |
1142 | or when out of input. When called, *have is the number of pattern bytes | 1203 | or when out of input. When called, *have is the number of pattern bytes |
@@ -1,5 +1,5 @@ | |||
1 | /* inflate.h -- internal inflate state definition | 1 | /* inflate.h -- internal inflate state definition |
2 | * Copyright (C) 1995-2003 Mark Adler | 2 | * Copyright (C) 1995-2004 Mark Adler |
3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -19,7 +19,6 @@ | |||
19 | /* Possible inflate modes between inflate() calls */ | 19 | /* Possible inflate modes between inflate() calls */ |
20 | typedef enum { | 20 | typedef enum { |
21 | HEAD, /* i: waiting for magic header */ | 21 | HEAD, /* i: waiting for magic header */ |
22 | #ifdef GUNZIP | ||
23 | FLAGS, /* i: waiting for method and flags (gzip) */ | 22 | FLAGS, /* i: waiting for method and flags (gzip) */ |
24 | TIME, /* i: waiting for modification time (gzip) */ | 23 | TIME, /* i: waiting for modification time (gzip) */ |
25 | OS, /* i: waiting for extra flags and operating system (gzip) */ | 24 | OS, /* i: waiting for extra flags and operating system (gzip) */ |
@@ -28,7 +27,6 @@ typedef enum { | |||
28 | NAME, /* i: waiting for end of file name (gzip) */ | 27 | NAME, /* i: waiting for end of file name (gzip) */ |
29 | COMMENT, /* i: waiting for end of comment (gzip) */ | 28 | COMMENT, /* i: waiting for end of comment (gzip) */ |
30 | HCRC, /* i: waiting for header crc (gzip) */ | 29 | HCRC, /* i: waiting for header crc (gzip) */ |
31 | #endif | ||
32 | DICTID, /* i: waiting for dictionary check value */ | 30 | DICTID, /* i: waiting for dictionary check value */ |
33 | DICT, /* waiting for inflateSetDictionary() call */ | 31 | DICT, /* waiting for inflateSetDictionary() call */ |
34 | TYPE, /* i: waiting for type bits, including last-flag bit */ | 32 | TYPE, /* i: waiting for type bits, including last-flag bit */ |
@@ -45,9 +43,7 @@ typedef enum { | |||
45 | MATCH, /* o: waiting for output space to copy string */ | 43 | MATCH, /* o: waiting for output space to copy string */ |
46 | LIT, /* o: waiting for output space to write literal */ | 44 | LIT, /* o: waiting for output space to write literal */ |
47 | CHECK, /* i: waiting for 32-bit check value */ | 45 | CHECK, /* i: waiting for 32-bit check value */ |
48 | #ifdef GUNZIP | ||
49 | LENGTH, /* i: waiting for 32-bit length (gzip) */ | 46 | LENGTH, /* i: waiting for 32-bit length (gzip) */ |
50 | #endif | ||
51 | DONE, /* finished check, done -- remain here until reset */ | 47 | DONE, /* finished check, done -- remain here until reset */ |
52 | BAD, /* got a data error -- remain here until reset */ | 48 | BAD, /* got a data error -- remain here until reset */ |
53 | MEM, /* got an inflate() memory error -- remain here until reset */ | 49 | MEM, /* got an inflate() memory error -- remain here until reset */ |
@@ -86,6 +82,7 @@ struct inflate_state { | |||
86 | int flags; /* gzip header method and flags (0 if zlib) */ | 82 | int flags; /* gzip header method and flags (0 if zlib) */ |
87 | unsigned long check; /* protected copy of check value */ | 83 | unsigned long check; /* protected copy of check value */ |
88 | unsigned long total; /* protected copy of output count */ | 84 | unsigned long total; /* protected copy of output count */ |
85 | gz_headerp head; /* where to save gzip header information */ | ||
89 | /* sliding window */ | 86 | /* sliding window */ |
90 | unsigned wbits; /* log base 2 of requested window size */ | 87 | unsigned wbits; /* log base 2 of requested window size */ |
91 | unsigned wsize; /* window size or zero if not using window */ | 88 | unsigned wsize; /* window size or zero if not using window */ |
@@ -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.2 Copyright 1995-2004 Mark Adler "; | 12 | " inflate 1.2.2.1 Copyright 1995-2004 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, 199, 198}; | 65 | 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 77, 207}; |
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, |
@@ -1,5 +1,5 @@ | |||
1 | /* minigzip.c -- simulate gzip using the zlib compression library | 1 | /* minigzip.c -- simulate gzip using the zlib compression library |
2 | * Copyright (C) 1995-2002 Jean-loup Gailly. | 2 | * Copyright (C) 1995-2004 Jean-loup Gailly. |
3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -21,8 +21,6 @@ | |||
21 | #ifdef STDC | 21 | #ifdef STDC |
22 | # include <string.h> | 22 | # include <string.h> |
23 | # include <stdlib.h> | 23 | # include <stdlib.h> |
24 | #else | ||
25 | extern void exit OF((int)); | ||
26 | #endif | 24 | #endif |
27 | 25 | ||
28 | #ifdef USE_MMAP | 26 | #ifdef USE_MMAP |
diff --git a/projects/README.projects b/projects/README.projects index f32de76..1c029e4 100644 --- a/projects/README.projects +++ b/projects/README.projects | |||
@@ -10,18 +10,21 @@ please consider submitting the project to the contrib directory. | |||
10 | Requirements | 10 | Requirements |
11 | ============ | 11 | ============ |
12 | 12 | ||
13 | - The project must build zlib using exclusively the source files from | 13 | - The project must build zlib using the source files from the official |
14 | the official zlib distribution. | 14 | zlib source distribution, exclusively. |
15 | 15 | ||
16 | - If there are "official" makefiles in the zlib distribution, the builds | 16 | - If the project produces redistributable builds (e.g. shared objects |
17 | given by the makefiles must be compatible with the builds given by the | 17 | or DLL files), these builds must be compatible to those produced by |
18 | project. These builds are called "official" builds. | 18 | makefiles, if such makefiles exist in the zlib distribution. |
19 | 19 | In particular, if the project produces a DLL build for the Win32 | |
20 | - It is possible to add non-official pieces of code to the project, | 20 | platform, this build must comply to the officially-ammended Win32 DLL |
21 | if the resulting build remains compatible with an official build. | 21 | Application Binary Interface (ABI), described in win32/DLL_FAQ.txt. |
22 | For example, it is possible to add an "ASM build" target besides | 22 | |
23 | the regular target, by including ASM source files from the contrib | 23 | - The project may provide additional build targets, which depend on |
24 | directory. | 24 | 3rd-party (unofficially-supported) software, present in the contrib |
25 | directory. For example, it is possible to provide an "ASM build", | ||
26 | besides the officially-supported build, and have ASM source files | ||
27 | among its dependencies. | ||
25 | 28 | ||
26 | - If there are significant differences between the project files created | 29 | - If there are significant differences between the project files created |
27 | by different versions of an IDE (e.g. Visual C++ 6.0 vs. 7.0), the name | 30 | by different versions of an IDE (e.g. Visual C++ 6.0 vs. 7.0), the name |
diff --git a/projects/visualc6/README.txt b/projects/visualc6/README.txt index 71d6105..d0296c2 100644 --- a/projects/visualc6/README.txt +++ b/projects/visualc6/README.txt | |||
@@ -5,7 +5,23 @@ Copyright (C) 2004 Cosmin Truta. | |||
5 | For conditions of distribution and use, see copyright notice in zlib.h. | 5 | For conditions of distribution and use, see copyright notice in zlib.h. |
6 | 6 | ||
7 | 7 | ||
8 | To use: | 8 | This project builds the zlib binaries as follows: |
9 | |||
10 | * Win32_DLL_Release\zlib1.dll DLL build | ||
11 | * Win32_DLL_Debug\zlib1d.dll DLL build (debug version) | ||
12 | * Win32_DLL_ASM_Release\zlib1.dll DLL build using ASM code | ||
13 | * Win32_DLL_ASM_Debug\zlib1d.dll DLL build using ASM code (debug version) | ||
14 | * Win32_LIB_Release\zlib.lib static build | ||
15 | * Win32_LIB_Debug\zlibd.lib static build (debug version) | ||
16 | * Win32_LIB_ASM_Release\zlib.lib static build using ASM code | ||
17 | * Win32_LIB_ASM_Debug\zlibd.lib static build using ASM code (debug version) | ||
18 | |||
19 | |||
20 | For more information regarding the DLL builds, please see the DLL FAQ | ||
21 | in ..\..\win32\DLL_FAQ.txt. | ||
22 | |||
23 | |||
24 | To build and test: | ||
9 | 25 | ||
10 | 1) On the main menu, select "File | Open Workspace". | 26 | 1) On the main menu, select "File | Open Workspace". |
11 | Open "zlib.dsw". | 27 | Open "zlib.dsw". |
@@ -22,17 +38,36 @@ To use: | |||
22 | select "Build | Execute ... (Ctrl+F5)". | 38 | select "Build | Execute ... (Ctrl+F5)". |
23 | 39 | ||
24 | 40 | ||
25 | This project builds the zlib binaries as follows: | 41 | To use: |
26 | 42 | ||
27 | * Win32_DLL_Release\zlib1.dll DLL build | 43 | 1) Select "Project | Settings (Alt+F7)". |
28 | * Win32_DLL_Debug\zlib1d.dll DLL build (debug version) | 44 | Make note of the configuration names used in your project. |
29 | * Win32_DLL_ASM_Release\zlib1.dll DLL build using ASM code | 45 | Usually, these names are "Win32 Release" and "Win32 Debug". |
30 | * Win32_DLL_ASM_Debug\zlib1d.dll DLL build using ASM code (debug version) | ||
31 | * Win32_LIB_Release\zlib.lib static build | ||
32 | * Win32_LIB_Debug\zlibd.lib static build (debug version) | ||
33 | * Win32_LIB_ASM_Release\zlib.lib static build using ASM code | ||
34 | * Win32_LIB_ASM_Debug\zlibd.lib static build using ASM code (debug version) | ||
35 | 46 | ||
47 | 2) In the Workspace window, select the "FileView" tab. | ||
48 | Right-click on the root item "Workspace '...'". | ||
49 | Select "Insert Project into Workspace". | ||
50 | Switch on the checkbox "Dependency of:", and select the name | ||
51 | of your project. Open "zlib.dsp". | ||
36 | 52 | ||
37 | For more information regarding the DLL builds, please see the DLL FAQ | 53 | 3) Select "Build | Configurations". |
38 | in ..\..\win32\DLL_FAQ.txt. | 54 | For each configuration of your project: |
55 | 3.1) Choose the zlib configuration you wish to use. | ||
56 | 3.2) Click on "Add". | ||
57 | 3.3) Set the new zlib configuration name to the name used by | ||
58 | the configuration from the current iteration. | ||
59 | |||
60 | 4) Select "Build | Set Active Configuration". | ||
61 | Choose the configuration you wish to build. | ||
62 | |||
63 | 5) Select "Build | Build ... (F7)". | ||
64 | |||
65 | 6) If you built an executable program, select | ||
66 | "Build | Execute ... (Ctrl+F5)". | ||
67 | |||
68 | |||
69 | Note: | ||
70 | |||
71 | To build the ASM-enabled code, you need Microsoft Assembler | ||
72 | (ML.EXE). You can get it by downloading and installing the | ||
73 | latest Processor Pack for Visual C++ 6.0. | ||
diff --git a/projects/visualc6/example.dsp b/projects/visualc6/example.dsp index 308a82c..e072a37 100644 --- a/projects/visualc6/example.dsp +++ b/projects/visualc6/example.dsp | |||
@@ -47,7 +47,7 @@ RSC=rc.exe | |||
47 | # PROP Intermediate_Dir "Win32_DLL_Release" | 47 | # PROP Intermediate_Dir "Win32_DLL_Release" |
48 | # PROP Ignore_Export_Lib 0 | 48 | # PROP Ignore_Export_Lib 0 |
49 | # PROP Target_Dir "" | 49 | # PROP Target_Dir "" |
50 | # ADD BASE CPP /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c | 50 | # ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c |
51 | # SUBTRACT BASE CPP /YX | 51 | # SUBTRACT BASE CPP /YX |
52 | # ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c | 52 | # ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c |
53 | # SUBTRACT CPP /YX | 53 | # SUBTRACT CPP /YX |
@@ -58,7 +58,7 @@ BSC32=bscmake.exe | |||
58 | # ADD BSC32 /nologo | 58 | # ADD BSC32 /nologo |
59 | LINK32=link.exe | 59 | LINK32=link.exe |
60 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 | 60 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 |
61 | # ADD LINK32 zlib1.lib /nologo /subsystem:console /machine:I386 /libpath:"Win32_DLL_Release" | 61 | # ADD LINK32 /nologo /subsystem:console /machine:I386 |
62 | 62 | ||
63 | !ELSEIF "$(CFG)" == "example - Win32 DLL Debug" | 63 | !ELSEIF "$(CFG)" == "example - Win32 DLL Debug" |
64 | 64 | ||
@@ -73,7 +73,7 @@ LINK32=link.exe | |||
73 | # PROP Intermediate_Dir "Win32_DLL_Debug" | 73 | # PROP Intermediate_Dir "Win32_DLL_Debug" |
74 | # PROP Ignore_Export_Lib 0 | 74 | # PROP Ignore_Export_Lib 0 |
75 | # PROP Target_Dir "" | 75 | # PROP Target_Dir "" |
76 | # ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c | 76 | # ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c |
77 | # SUBTRACT BASE CPP /YX | 77 | # SUBTRACT BASE CPP /YX |
78 | # ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c | 78 | # ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c |
79 | # SUBTRACT CPP /YX | 79 | # SUBTRACT CPP /YX |
@@ -84,7 +84,7 @@ BSC32=bscmake.exe | |||
84 | # ADD BSC32 /nologo | 84 | # ADD BSC32 /nologo |
85 | LINK32=link.exe | 85 | LINK32=link.exe |
86 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept | 86 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept |
87 | # ADD LINK32 zlib1d.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"Win32_DLL_Debug" | 87 | # ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept |
88 | 88 | ||
89 | !ELSEIF "$(CFG)" == "example - Win32 DLL ASM Release" | 89 | !ELSEIF "$(CFG)" == "example - Win32 DLL ASM Release" |
90 | 90 | ||
@@ -99,7 +99,7 @@ LINK32=link.exe | |||
99 | # PROP Intermediate_Dir "Win32_DLL_ASM_Release" | 99 | # PROP Intermediate_Dir "Win32_DLL_ASM_Release" |
100 | # PROP Ignore_Export_Lib 0 | 100 | # PROP Ignore_Export_Lib 0 |
101 | # PROP Target_Dir "" | 101 | # PROP Target_Dir "" |
102 | # ADD BASE CPP /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c | 102 | # ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c |
103 | # SUBTRACT BASE CPP /YX | 103 | # SUBTRACT BASE CPP /YX |
104 | # ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c | 104 | # ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c |
105 | # SUBTRACT CPP /YX | 105 | # SUBTRACT CPP /YX |
@@ -110,7 +110,7 @@ BSC32=bscmake.exe | |||
110 | # ADD BSC32 /nologo | 110 | # ADD BSC32 /nologo |
111 | LINK32=link.exe | 111 | LINK32=link.exe |
112 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 | 112 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 |
113 | # ADD LINK32 zlib1.lib /nologo /subsystem:console /machine:I386 /libpath:"Win32_DLL_ASM_Release" | 113 | # ADD LINK32 /nologo /subsystem:console /machine:I386 |
114 | 114 | ||
115 | !ELSEIF "$(CFG)" == "example - Win32 DLL ASM Debug" | 115 | !ELSEIF "$(CFG)" == "example - Win32 DLL ASM Debug" |
116 | 116 | ||
@@ -125,7 +125,7 @@ LINK32=link.exe | |||
125 | # PROP Intermediate_Dir "Win32_DLL_ASM_Debug" | 125 | # PROP Intermediate_Dir "Win32_DLL_ASM_Debug" |
126 | # PROP Ignore_Export_Lib 0 | 126 | # PROP Ignore_Export_Lib 0 |
127 | # PROP Target_Dir "" | 127 | # PROP Target_Dir "" |
128 | # ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c | 128 | # ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c |
129 | # SUBTRACT BASE CPP /YX | 129 | # SUBTRACT BASE CPP /YX |
130 | # ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c | 130 | # ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c |
131 | # SUBTRACT CPP /YX | 131 | # SUBTRACT CPP /YX |
@@ -136,7 +136,7 @@ BSC32=bscmake.exe | |||
136 | # ADD BSC32 /nologo | 136 | # ADD BSC32 /nologo |
137 | LINK32=link.exe | 137 | LINK32=link.exe |
138 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept | 138 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept |
139 | # ADD LINK32 zlib1d.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"Win32_DLL_ASM_Debug" | 139 | # ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept |
140 | 140 | ||
141 | !ELSEIF "$(CFG)" == "example - Win32 LIB Release" | 141 | !ELSEIF "$(CFG)" == "example - Win32 LIB Release" |
142 | 142 | ||
@@ -151,7 +151,7 @@ LINK32=link.exe | |||
151 | # PROP Intermediate_Dir "Win32_LIB_Release" | 151 | # PROP Intermediate_Dir "Win32_LIB_Release" |
152 | # PROP Ignore_Export_Lib 0 | 152 | # PROP Ignore_Export_Lib 0 |
153 | # PROP Target_Dir "" | 153 | # PROP Target_Dir "" |
154 | # ADD BASE CPP /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c | 154 | # ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c |
155 | # SUBTRACT BASE CPP /YX | 155 | # SUBTRACT BASE CPP /YX |
156 | # ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c | 156 | # ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c |
157 | # SUBTRACT CPP /YX | 157 | # SUBTRACT CPP /YX |
@@ -162,7 +162,7 @@ BSC32=bscmake.exe | |||
162 | # ADD BSC32 /nologo | 162 | # ADD BSC32 /nologo |
163 | LINK32=link.exe | 163 | LINK32=link.exe |
164 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 | 164 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 |
165 | # ADD LINK32 zlib.lib /nologo /subsystem:console /machine:I386 /libpath:"Win32_LIB_Release" | 165 | # ADD LINK32 /nologo /subsystem:console /machine:I386 |
166 | 166 | ||
167 | !ELSEIF "$(CFG)" == "example - Win32 LIB Debug" | 167 | !ELSEIF "$(CFG)" == "example - Win32 LIB Debug" |
168 | 168 | ||
@@ -177,7 +177,7 @@ LINK32=link.exe | |||
177 | # PROP Intermediate_Dir "Win32_LIB_Debug" | 177 | # PROP Intermediate_Dir "Win32_LIB_Debug" |
178 | # PROP Ignore_Export_Lib 0 | 178 | # PROP Ignore_Export_Lib 0 |
179 | # PROP Target_Dir "" | 179 | # PROP Target_Dir "" |
180 | # ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c | 180 | # ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c |
181 | # SUBTRACT BASE CPP /YX | 181 | # SUBTRACT BASE CPP /YX |
182 | # ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c | 182 | # ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c |
183 | # SUBTRACT CPP /YX | 183 | # SUBTRACT CPP /YX |
@@ -188,7 +188,7 @@ BSC32=bscmake.exe | |||
188 | # ADD BSC32 /nologo | 188 | # ADD BSC32 /nologo |
189 | LINK32=link.exe | 189 | LINK32=link.exe |
190 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept | 190 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept |
191 | # ADD LINK32 zlibd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"Win32_LIB_Debug" | 191 | # ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept |
192 | 192 | ||
193 | !ELSEIF "$(CFG)" == "example - Win32 LIB ASM Release" | 193 | !ELSEIF "$(CFG)" == "example - Win32 LIB ASM Release" |
194 | 194 | ||
@@ -203,7 +203,7 @@ LINK32=link.exe | |||
203 | # PROP Intermediate_Dir "Win32_LIB_ASM_Release" | 203 | # PROP Intermediate_Dir "Win32_LIB_ASM_Release" |
204 | # PROP Ignore_Export_Lib 0 | 204 | # PROP Ignore_Export_Lib 0 |
205 | # PROP Target_Dir "" | 205 | # PROP Target_Dir "" |
206 | # ADD BASE CPP /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c | 206 | # ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c |
207 | # SUBTRACT BASE CPP /YX | 207 | # SUBTRACT BASE CPP /YX |
208 | # ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c | 208 | # ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c |
209 | # SUBTRACT CPP /YX | 209 | # SUBTRACT CPP /YX |
@@ -214,7 +214,7 @@ BSC32=bscmake.exe | |||
214 | # ADD BSC32 /nologo | 214 | # ADD BSC32 /nologo |
215 | LINK32=link.exe | 215 | LINK32=link.exe |
216 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 | 216 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 |
217 | # ADD LINK32 zlib.lib /nologo /subsystem:console /machine:I386 /libpath:"Win32_LIB_ASM_Release" | 217 | # ADD LINK32 /nologo /subsystem:console /machine:I386 |
218 | 218 | ||
219 | !ELSEIF "$(CFG)" == "example - Win32 LIB ASM Debug" | 219 | !ELSEIF "$(CFG)" == "example - Win32 LIB ASM Debug" |
220 | 220 | ||
@@ -229,7 +229,7 @@ LINK32=link.exe | |||
229 | # PROP Intermediate_Dir "Win32_LIB_ASM_Debug" | 229 | # PROP Intermediate_Dir "Win32_LIB_ASM_Debug" |
230 | # PROP Ignore_Export_Lib 0 | 230 | # PROP Ignore_Export_Lib 0 |
231 | # PROP Target_Dir "" | 231 | # PROP Target_Dir "" |
232 | # ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c | 232 | # ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c |
233 | # SUBTRACT BASE CPP /YX | 233 | # SUBTRACT BASE CPP /YX |
234 | # ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c | 234 | # ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c |
235 | # SUBTRACT CPP /YX | 235 | # SUBTRACT CPP /YX |
@@ -240,7 +240,7 @@ BSC32=bscmake.exe | |||
240 | # ADD BSC32 /nologo | 240 | # ADD BSC32 /nologo |
241 | LINK32=link.exe | 241 | LINK32=link.exe |
242 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept | 242 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept |
243 | # ADD LINK32 zlibd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"Win32_LIB_ASM_Debug" | 243 | # ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept |
244 | 244 | ||
245 | !ENDIF | 245 | !ENDIF |
246 | 246 | ||
diff --git a/projects/visualc6/minigzip.dsp b/projects/visualc6/minigzip.dsp index 91d981d..f32024e 100644 --- a/projects/visualc6/minigzip.dsp +++ b/projects/visualc6/minigzip.dsp | |||
@@ -47,7 +47,7 @@ RSC=rc.exe | |||
47 | # PROP Intermediate_Dir "Win32_DLL_Release" | 47 | # PROP Intermediate_Dir "Win32_DLL_Release" |
48 | # PROP Ignore_Export_Lib 0 | 48 | # PROP Ignore_Export_Lib 0 |
49 | # PROP Target_Dir "" | 49 | # PROP Target_Dir "" |
50 | # ADD BASE CPP /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c | 50 | # ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c |
51 | # SUBTRACT BASE CPP /YX | 51 | # SUBTRACT BASE CPP /YX |
52 | # ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c | 52 | # ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c |
53 | # SUBTRACT CPP /YX | 53 | # SUBTRACT CPP /YX |
@@ -58,7 +58,7 @@ BSC32=bscmake.exe | |||
58 | # ADD BSC32 /nologo | 58 | # ADD BSC32 /nologo |
59 | LINK32=link.exe | 59 | LINK32=link.exe |
60 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 | 60 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 |
61 | # ADD LINK32 zlib1.lib /nologo /subsystem:console /machine:I386 /libpath:"Win32_DLL_Release" | 61 | # ADD LINK32 /nologo /subsystem:console /machine:I386 |
62 | 62 | ||
63 | !ELSEIF "$(CFG)" == "minigzip - Win32 DLL Debug" | 63 | !ELSEIF "$(CFG)" == "minigzip - Win32 DLL Debug" |
64 | 64 | ||
@@ -73,7 +73,7 @@ LINK32=link.exe | |||
73 | # PROP Intermediate_Dir "Win32_DLL_Debug" | 73 | # PROP Intermediate_Dir "Win32_DLL_Debug" |
74 | # PROP Ignore_Export_Lib 0 | 74 | # PROP Ignore_Export_Lib 0 |
75 | # PROP Target_Dir "" | 75 | # PROP Target_Dir "" |
76 | # ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c | 76 | # ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c |
77 | # SUBTRACT BASE CPP /YX | 77 | # SUBTRACT BASE CPP /YX |
78 | # ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c | 78 | # ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c |
79 | # SUBTRACT CPP /YX | 79 | # SUBTRACT CPP /YX |
@@ -84,7 +84,7 @@ BSC32=bscmake.exe | |||
84 | # ADD BSC32 /nologo | 84 | # ADD BSC32 /nologo |
85 | LINK32=link.exe | 85 | LINK32=link.exe |
86 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept | 86 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept |
87 | # ADD LINK32 zlib1d.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"Win32_DLL_Debug" | 87 | # ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept |
88 | 88 | ||
89 | !ELSEIF "$(CFG)" == "minigzip - Win32 DLL ASM Release" | 89 | !ELSEIF "$(CFG)" == "minigzip - Win32 DLL ASM Release" |
90 | 90 | ||
@@ -99,7 +99,7 @@ LINK32=link.exe | |||
99 | # PROP Intermediate_Dir "Win32_DLL_ASM_Release" | 99 | # PROP Intermediate_Dir "Win32_DLL_ASM_Release" |
100 | # PROP Ignore_Export_Lib 0 | 100 | # PROP Ignore_Export_Lib 0 |
101 | # PROP Target_Dir "" | 101 | # PROP Target_Dir "" |
102 | # ADD BASE CPP /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c | 102 | # ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c |
103 | # SUBTRACT BASE CPP /YX | 103 | # SUBTRACT BASE CPP /YX |
104 | # ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c | 104 | # ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c |
105 | # SUBTRACT CPP /YX | 105 | # SUBTRACT CPP /YX |
@@ -110,7 +110,7 @@ BSC32=bscmake.exe | |||
110 | # ADD BSC32 /nologo | 110 | # ADD BSC32 /nologo |
111 | LINK32=link.exe | 111 | LINK32=link.exe |
112 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 | 112 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 |
113 | # ADD LINK32 zlib1.lib /nologo /subsystem:console /machine:I386 /libpath:"Win32_DLL_ASM_Release" | 113 | # ADD LINK32 /nologo /subsystem:console /machine:I386 |
114 | 114 | ||
115 | !ELSEIF "$(CFG)" == "minigzip - Win32 DLL ASM Debug" | 115 | !ELSEIF "$(CFG)" == "minigzip - Win32 DLL ASM Debug" |
116 | 116 | ||
@@ -125,7 +125,7 @@ LINK32=link.exe | |||
125 | # PROP Intermediate_Dir "Win32_DLL_ASM_Debug" | 125 | # PROP Intermediate_Dir "Win32_DLL_ASM_Debug" |
126 | # PROP Ignore_Export_Lib 0 | 126 | # PROP Ignore_Export_Lib 0 |
127 | # PROP Target_Dir "" | 127 | # PROP Target_Dir "" |
128 | # ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c | 128 | # ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c |
129 | # SUBTRACT BASE CPP /YX | 129 | # SUBTRACT BASE CPP /YX |
130 | # ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c | 130 | # ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c |
131 | # SUBTRACT CPP /YX | 131 | # SUBTRACT CPP /YX |
@@ -136,7 +136,7 @@ BSC32=bscmake.exe | |||
136 | # ADD BSC32 /nologo | 136 | # ADD BSC32 /nologo |
137 | LINK32=link.exe | 137 | LINK32=link.exe |
138 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept | 138 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept |
139 | # ADD LINK32 zlib1d.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"Win32_DLL_ASM_Debug" | 139 | # ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept |
140 | 140 | ||
141 | !ELSEIF "$(CFG)" == "minigzip - Win32 LIB Release" | 141 | !ELSEIF "$(CFG)" == "minigzip - Win32 LIB Release" |
142 | 142 | ||
@@ -151,7 +151,7 @@ LINK32=link.exe | |||
151 | # PROP Intermediate_Dir "Win32_LIB_Release" | 151 | # PROP Intermediate_Dir "Win32_LIB_Release" |
152 | # PROP Ignore_Export_Lib 0 | 152 | # PROP Ignore_Export_Lib 0 |
153 | # PROP Target_Dir "" | 153 | # PROP Target_Dir "" |
154 | # ADD BASE CPP /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c | 154 | # ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c |
155 | # SUBTRACT BASE CPP /YX | 155 | # SUBTRACT BASE CPP /YX |
156 | # ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c | 156 | # ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c |
157 | # SUBTRACT CPP /YX | 157 | # SUBTRACT CPP /YX |
@@ -162,7 +162,7 @@ BSC32=bscmake.exe | |||
162 | # ADD BSC32 /nologo | 162 | # ADD BSC32 /nologo |
163 | LINK32=link.exe | 163 | LINK32=link.exe |
164 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 | 164 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 |
165 | # ADD LINK32 zlib.lib /nologo /subsystem:console /machine:I386 /libpath:"Win32_LIB_Release" | 165 | # ADD LINK32 /nologo /subsystem:console /machine:I386 |
166 | 166 | ||
167 | !ELSEIF "$(CFG)" == "minigzip - Win32 LIB Debug" | 167 | !ELSEIF "$(CFG)" == "minigzip - Win32 LIB Debug" |
168 | 168 | ||
@@ -177,7 +177,7 @@ LINK32=link.exe | |||
177 | # PROP Intermediate_Dir "Win32_LIB_Debug" | 177 | # PROP Intermediate_Dir "Win32_LIB_Debug" |
178 | # PROP Ignore_Export_Lib 0 | 178 | # PROP Ignore_Export_Lib 0 |
179 | # PROP Target_Dir "" | 179 | # PROP Target_Dir "" |
180 | # ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c | 180 | # ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c |
181 | # SUBTRACT BASE CPP /YX | 181 | # SUBTRACT BASE CPP /YX |
182 | # ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c | 182 | # ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c |
183 | # SUBTRACT CPP /YX | 183 | # SUBTRACT CPP /YX |
@@ -188,7 +188,7 @@ BSC32=bscmake.exe | |||
188 | # ADD BSC32 /nologo | 188 | # ADD BSC32 /nologo |
189 | LINK32=link.exe | 189 | LINK32=link.exe |
190 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept | 190 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept |
191 | # ADD LINK32 zlibd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"Win32_LIB_Debug" | 191 | # ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept |
192 | 192 | ||
193 | !ELSEIF "$(CFG)" == "minigzip - Win32 LIB ASM Release" | 193 | !ELSEIF "$(CFG)" == "minigzip - Win32 LIB ASM Release" |
194 | 194 | ||
@@ -203,7 +203,7 @@ LINK32=link.exe | |||
203 | # PROP Intermediate_Dir "Win32_LIB_ASM_Release" | 203 | # PROP Intermediate_Dir "Win32_LIB_ASM_Release" |
204 | # PROP Ignore_Export_Lib 0 | 204 | # PROP Ignore_Export_Lib 0 |
205 | # PROP Target_Dir "" | 205 | # PROP Target_Dir "" |
206 | # ADD BASE CPP /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c | 206 | # ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c |
207 | # SUBTRACT BASE CPP /YX | 207 | # SUBTRACT BASE CPP /YX |
208 | # ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c | 208 | # ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c |
209 | # SUBTRACT CPP /YX | 209 | # SUBTRACT CPP /YX |
@@ -214,7 +214,7 @@ BSC32=bscmake.exe | |||
214 | # ADD BSC32 /nologo | 214 | # ADD BSC32 /nologo |
215 | LINK32=link.exe | 215 | LINK32=link.exe |
216 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 | 216 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 |
217 | # ADD LINK32 zlib.lib /nologo /subsystem:console /machine:I386 /libpath:"Win32_LIB_ASM_Release" | 217 | # ADD LINK32 /nologo /subsystem:console /machine:I386 |
218 | 218 | ||
219 | !ELSEIF "$(CFG)" == "minigzip - Win32 LIB ASM Debug" | 219 | !ELSEIF "$(CFG)" == "minigzip - Win32 LIB ASM Debug" |
220 | 220 | ||
@@ -229,7 +229,7 @@ LINK32=link.exe | |||
229 | # PROP Intermediate_Dir "Win32_LIB_ASM_Debug" | 229 | # PROP Intermediate_Dir "Win32_LIB_ASM_Debug" |
230 | # PROP Ignore_Export_Lib 0 | 230 | # PROP Ignore_Export_Lib 0 |
231 | # PROP Target_Dir "" | 231 | # PROP Target_Dir "" |
232 | # ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c | 232 | # ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c |
233 | # SUBTRACT BASE CPP /YX | 233 | # SUBTRACT BASE CPP /YX |
234 | # ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c | 234 | # ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c |
235 | # SUBTRACT CPP /YX | 235 | # SUBTRACT CPP /YX |
@@ -240,7 +240,7 @@ BSC32=bscmake.exe | |||
240 | # ADD BSC32 /nologo | 240 | # ADD BSC32 /nologo |
241 | LINK32=link.exe | 241 | LINK32=link.exe |
242 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept | 242 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept |
243 | # ADD LINK32 zlibd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"Win32_LIB_ASM_Debug" | 243 | # ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept |
244 | 244 | ||
245 | !ENDIF | 245 | !ENDIF |
246 | 246 | ||
diff --git a/projects/visualc6/zlib.dsp b/projects/visualc6/zlib.dsp index 8f16513..0fe0604 100644 --- a/projects/visualc6/zlib.dsp +++ b/projects/visualc6/zlib.dsp | |||
@@ -435,7 +435,7 @@ InputPath=..\..\contrib\masmx86\gvmat32.asm | |||
435 | InputName=gvmat32 | 435 | InputName=gvmat32 |
436 | 436 | ||
437 | "$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" | 437 | "$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" |
438 | ml /nologo /c /Cx /coff /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" | 438 | ml.exe /nologo /c /coff /Cx /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" |
439 | 439 | ||
440 | # End Custom Build | 440 | # End Custom Build |
441 | 441 | ||
@@ -447,7 +447,7 @@ InputPath=..\..\contrib\masmx86\gvmat32.asm | |||
447 | InputName=gvmat32 | 447 | InputName=gvmat32 |
448 | 448 | ||
449 | "$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" | 449 | "$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" |
450 | ml /nologo /c /Cx /coff /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" | 450 | ml.exe /nologo /c /coff /Cx /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" |
451 | 451 | ||
452 | # End Custom Build | 452 | # End Custom Build |
453 | 453 | ||
@@ -467,7 +467,7 @@ InputPath=..\..\contrib\masmx86\gvmat32.asm | |||
467 | InputName=gvmat32 | 467 | InputName=gvmat32 |
468 | 468 | ||
469 | "$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" | 469 | "$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" |
470 | ml /nologo /c /Cx /coff /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" | 470 | ml.exe /nologo /c /coff /Cx /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" |
471 | 471 | ||
472 | # End Custom Build | 472 | # End Custom Build |
473 | 473 | ||
@@ -479,7 +479,7 @@ InputPath=..\..\contrib\masmx86\gvmat32.asm | |||
479 | InputName=gvmat32 | 479 | InputName=gvmat32 |
480 | 480 | ||
481 | "$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" | 481 | "$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" |
482 | ml /nologo /c /Cx /coff /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" | 482 | ml.exe /nologo /c /coff /Cx /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" |
483 | 483 | ||
484 | # End Custom Build | 484 | # End Custom Build |
485 | 485 | ||
@@ -549,7 +549,7 @@ InputPath=..\..\contrib\masmx86\inffas32.asm | |||
549 | InputName=inffas32 | 549 | InputName=inffas32 |
550 | 550 | ||
551 | "$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" | 551 | "$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" |
552 | ml /nologo /c /Cx /coff /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" | 552 | ml.exe /nologo /c /coff /Cx /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" |
553 | 553 | ||
554 | # End Custom Build | 554 | # End Custom Build |
555 | 555 | ||
@@ -561,7 +561,7 @@ InputPath=..\..\contrib\masmx86\inffas32.asm | |||
561 | InputName=inffas32 | 561 | InputName=inffas32 |
562 | 562 | ||
563 | "$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" | 563 | "$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" |
564 | ml /nologo /c /Cx /coff /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" | 564 | ml.exe /nologo /c /coff /Cx /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" |
565 | 565 | ||
566 | # End Custom Build | 566 | # End Custom Build |
567 | 567 | ||
@@ -581,7 +581,7 @@ InputPath=..\..\contrib\masmx86\inffas32.asm | |||
581 | InputName=inffas32 | 581 | InputName=inffas32 |
582 | 582 | ||
583 | "$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" | 583 | "$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" |
584 | ml /nologo /c /Cx /coff /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" | 584 | ml.exe /nologo /c /coff /Cx /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" |
585 | 585 | ||
586 | # End Custom Build | 586 | # End Custom Build |
587 | 587 | ||
@@ -593,7 +593,7 @@ InputPath=..\..\contrib\masmx86\inffas32.asm | |||
593 | InputName=inffas32 | 593 | InputName=inffas32 |
594 | 594 | ||
595 | "$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" | 595 | "$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" |
596 | ml /nologo /c /Cx /coff /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" | 596 | ml.exe /nologo /c /coff /Cx /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" |
597 | 597 | ||
598 | # End Custom Build | 598 | # End Custom Build |
599 | 599 | ||
diff --git a/qnx/package.qpg b/qnx/package.qpg index bf14280..e80311c 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.2" install="/opt/lib/" user="root:bin" permission="644"/> | 28 | <QPG:Add file="../libz.so.1.2.2.1" 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.2"/> | 29 | <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.2.1"/> |
30 | <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.2"/> | 30 | <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.2.1"/> |
31 | <QPG:Add file="../libz.so.1.2.2" install="/opt/lib/" component="slib"/> | 31 | <QPG:Add file="../libz.so.1.2.2.1" 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.2</QPM:ReleaseVersion> | 66 | <QPM:ReleaseVersion>1.2.2.1</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> |
@@ -1,5 +1,5 @@ | |||
1 | /* trees.c -- output deflated data using Huffman coding | 1 | /* trees.c -- output deflated data using Huffman coding |
2 | * Copyright (C) 1995-2003 Jean-loup Gailly | 2 | * Copyright (C) 1995-2004 Jean-loup Gailly |
3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -930,8 +930,25 @@ void _tr_flush_block(s, buf, stored_len, eof) | |||
930 | /* Build the Huffman trees unless a stored block is forced */ | 930 | /* Build the Huffman trees unless a stored block is forced */ |
931 | if (s->level > 0) { | 931 | if (s->level > 0) { |
932 | 932 | ||
933 | /* Check if the file is ascii or binary */ | 933 | /* Check if the file is binary or text */ |
934 | if (s->strm->data_type == Z_UNKNOWN) set_data_type(s); | 934 | if (stored_len > 0 && s->strm->data_type == Z_UNKNOWN) |
935 | set_data_type(s); | ||
936 | |||
937 | #ifdef DEBUG | ||
938 | /* Write out literal/length frequencies for benchmarking */ | ||
939 | if (z_verbose) { | ||
940 | FILE *freq; | ||
941 | freq = fopen("defreq.txt", "a"); | ||
942 | if (freq != NULL) { | ||
943 | int n; | ||
944 | fputs("ltree:", freq); | ||
945 | for (n = 0; n < L_CODES; n++) | ||
946 | fprintf(freq, " %d", s->dyn_ltree[n].Freq); | ||
947 | putc('\n', freq); | ||
948 | fclose(freq); | ||
949 | } | ||
950 | } | ||
951 | #endif | ||
935 | 952 | ||
936 | /* Construct the literal and distance trees */ | 953 | /* Construct the literal and distance trees */ |
937 | build_tree(s, (tree_desc *)(&(s->l_desc))); | 954 | build_tree(s, (tree_desc *)(&(s->l_desc))); |
@@ -1117,21 +1134,24 @@ local void compress_block(s, ltree, dtree) | |||
1117 | } | 1134 | } |
1118 | 1135 | ||
1119 | /* =========================================================================== | 1136 | /* =========================================================================== |
1120 | * Set the data type to ASCII or BINARY, using a crude approximation: | 1137 | * Set the data type to BINARY or TEXT, using a crude approximation: |
1121 | * binary if more than 20% of the bytes are <= 6 or >= 128, ascii otherwise. | 1138 | * set it to Z_TEXT if all symbols are either printable characters (33 to 255) |
1122 | * IN assertion: the fields freq of dyn_ltree are set and the total of all | 1139 | * or white spaces (9 to 13, or 32); or set it to Z_BINARY otherwise. |
1123 | * frequencies does not exceed 64K (to fit in an int on 16 bit machines). | 1140 | * IN assertion: the fields Freq of dyn_ltree are set. |
1124 | */ | 1141 | */ |
1125 | local void set_data_type(s) | 1142 | local void set_data_type(s) |
1126 | deflate_state *s; | 1143 | deflate_state *s; |
1127 | { | 1144 | { |
1128 | int n = 0; | 1145 | int n; |
1129 | unsigned ascii_freq = 0; | 1146 | |
1130 | unsigned bin_freq = 0; | 1147 | for (n = 0; n < 9; n++) |
1131 | while (n < 7) bin_freq += s->dyn_ltree[n++].Freq; | 1148 | if (s->dyn_ltree[n].Freq != 0) |
1132 | while (n < 128) ascii_freq += s->dyn_ltree[n++].Freq; | 1149 | break; |
1133 | while (n < LITERALS) bin_freq += s->dyn_ltree[n++].Freq; | 1150 | if (n == 9) |
1134 | s->strm->data_type = bin_freq > (ascii_freq >> 2) ? Z_BINARY : Z_ASCII; | 1151 | for (n = 14; n < 32; n++) |
1152 | if (s->dyn_ltree[n].Freq != 0) | ||
1153 | break; | ||
1154 | s->strm->data_type = (n == 32) ? Z_TEXT : Z_BINARY; | ||
1135 | } | 1155 | } |
1136 | 1156 | ||
1137 | /* =========================================================================== | 1157 | /* =========================================================================== |
diff --git a/win32/DLL_FAQ.txt b/win32/DLL_FAQ.txt index 1746a95..fb18e07 100644 --- a/win32/DLL_FAQ.txt +++ b/win32/DLL_FAQ.txt | |||
@@ -175,7 +175,7 @@ in the zlib distribution, or at the following location: | |||
175 | zlib in other programming languages. Some of them, like Ada | 175 | zlib in other programming languages. Some of them, like Ada |
176 | (GNAT) and Fortran (GNU G77), have C bindings implemented | 176 | (GNAT) and Fortran (GNU G77), have C bindings implemented |
177 | initially on Unix, and relying on the C calling convention. | 177 | initially on Unix, and relying on the C calling convention. |
178 | On the other hand, the pre- .Net versions of Microsoft Visual | 178 | On the other hand, the pre- .NET versions of Microsoft Visual |
179 | Basic require STDCALL, while Borland Delphi prefers, although | 179 | Basic require STDCALL, while Borland Delphi prefers, although |
180 | it does not require, FASTCALL. | 180 | it does not require, FASTCALL. |
181 | 181 | ||
@@ -203,10 +203,10 @@ in the zlib distribution, or at the following location: | |||
203 | zlib distribution. | 203 | zlib distribution. |
204 | 204 | ||
205 | 205 | ||
206 | 8. I need to use zlib in my Microsoft .Net project. What can I | 206 | 8. I need to use zlib in my Microsoft .NET project. What can I |
207 | do? | 207 | do? |
208 | 208 | ||
209 | - Henrik Ravn has contributed a .Net wrapper around zlib. Look | 209 | - Henrik Ravn has contributed a .NET wrapper around zlib. Look |
210 | into contrib/dotzlib/, inside the zlib distribution. | 210 | into contrib/dotzlib/, inside the zlib distribution. |
211 | 211 | ||
212 | 212 | ||
@@ -225,8 +225,8 @@ in the zlib distribution, or at the following location: | |||
225 | depend on it should also be linked to MSVCRT.DLL. | 225 | depend on it should also be linked to MSVCRT.DLL. |
226 | 226 | ||
227 | 227 | ||
228 | 10. Why are you saying that ZLIB1.DLL and my application must be | 228 | 10. Why are you saying that ZLIB1.DLL and my application should |
229 | linked to the same C run-time (CRT) library? I linked my | 229 | be linked to the same C run-time (CRT) library? I linked my |
230 | application and my DLLs to different C libraries (e.g. my | 230 | application and my DLLs to different C libraries (e.g. my |
231 | application to a static library, and my DLLs to MSVCRT.DLL), | 231 | application to a static library, and my DLLs to MSVCRT.DLL), |
232 | and everything works fine. | 232 | and everything works fine. |
@@ -277,12 +277,6 @@ in the zlib distribution, or at the following location: | |||
277 | even run on it. Furthermore, no serious user should run | 277 | even run on it. Furthermore, no serious user should run |
278 | Windows 95 without a proper update installed. | 278 | Windows 95 without a proper update installed. |
279 | 279 | ||
280 | There is also the fact that the mainstream C compilers for | ||
281 | Windows are Microsoft Visual C++ 6.0, and gcc/MinGW. Both | ||
282 | are producing executables that link to MSVCRT.DLL by default, | ||
283 | without offering other dynamic CRTs as alternatives easy to | ||
284 | select by users. | ||
285 | |||
286 | 280 | ||
287 | 12. Why are you not linking ZLIB1.DLL to | 281 | 12. Why are you not linking ZLIB1.DLL to |
288 | <<my favorite C run-time library>> ? | 282 | <<my favorite C run-time library>> ? |
@@ -295,27 +289,60 @@ in the zlib distribution, or at the following location: | |||
295 | to a static C library, you may as well consider linking zlib | 289 | to a static C library, you may as well consider linking zlib |
296 | in statically, too. | 290 | in statically, too. |
297 | 291 | ||
298 | * Linking ZLIB1.DLL to CRTDLL.DLL looks very appealing, | 292 | * Linking ZLIB1.DLL to CRTDLL.DLL looks appealing, because |
299 | because CRTDLL.DLL is present on every Win32 installation. | 293 | CRTDLL.DLL is present on every Win32 installation. |
300 | Unfortunately, it has a series of problems: it raises | 294 | Unfortunately, it has a series of problems: it does not |
301 | difficulties when using it with C++ code, it does not work | 295 | work properly with Microsoft's C++ libraries, it does not |
302 | with 64-bit file offsets, (and so on...), and Microsoft | 296 | provide support for 64-bit file offsets, (and so on...), |
303 | discontinued its support a long time ago. | 297 | and Microsoft discontinued its support a long time ago. |
304 | 298 | ||
305 | * Linking ZLIB1.DLL to MSVCR70.DLL, supplied with the | 299 | * Linking ZLIB1.DLL to MSVCR70.DLL or MSVCR71.DLL, supplied |
306 | Microsoft .NET platform and Visual C++ 7.0 or newer, is not | 300 | with the Microsoft .NET platform, and Visual C++ 7.0/7.1, |
307 | a good option. Although it is available for free download | 301 | raises problems related to the status of ZLIB1.DLL as a |
308 | and distribution, its presence is scarce on today's Win32 | 302 | system component. According to the Microsoft Knowledge Base |
309 | installations. If it will ever become more popular than | 303 | article KB326922 "INFO: Redistribution of the Shared C |
310 | MSVCRT.DLL and will be pre-installed on the future Win32 | 304 | Runtime Component in Visual C++ .NET", MSVCR70.DLL and |
311 | systems, we will probably think again about it. | 305 | MSVCR71.DLL are not supposed to function as system DLLs, |
312 | 306 | because they may clash with MSVCRT.DLL. Instead, the | |
313 | * Linking ZLIB1.DLL to NTDLL.DLL is not possible. | 307 | application's installer is supposed to put these DLLs |
314 | NTDLL.DLL exports only a part of the C library, and only on | 308 | (if needed) in the application's private directory. |
315 | Windows NT systems. | 309 | If ZLIB1.DLL depends on a non-system runtime, it cannot |
316 | 310 | function as a redistributable system component. | |
317 | 311 | ||
318 | 13. I need to link my own DLL build to a CRT different than | 312 | * Linking ZLIB1.DLL to non-Microsoft runtimes, such as |
313 | Borland's, or Cygwin's, raises problems related to the | ||
314 | reliable presence of these runtimes on Win32 systems. | ||
315 | It's easier to let the DLL build of zlib up to the people | ||
316 | who distribute these runtimes, and who may proceed as | ||
317 | explained in the answer to Question 14. | ||
318 | |||
319 | |||
320 | 13. If ZLIB1.DLL cannot be linked to MSVCR70.DLL or MSVCR71.DLL, | ||
321 | how can I build/use ZLIB1.DLL in Microsoft Visual C++ 7.0 | ||
322 | (Visual Studio .NET) or newer? | ||
323 | |||
324 | - Due to the problems explained in the Microsoft Knowledge Base | ||
325 | article KB326922 (see the previous answer), the C runtime that | ||
326 | comes with the VC7 environment is no longer considered a | ||
327 | system component. That is, it should not be assumed that this | ||
328 | runtime exists, or may be installed in a system directory. | ||
329 | Since ZLIB1.DLL is supposed to be a system component, it may | ||
330 | not depend on a non-system component. | ||
331 | |||
332 | In order to link ZLIB1.DLL and your application to MSVCRT.DLL | ||
333 | in VC7, you need the library of Visual C++ 6.0 or older. If | ||
334 | you don't have this library at hand, it's probably best not to | ||
335 | use ZLIB1.DLL. | ||
336 | |||
337 | We are hoping that, in the future, Microsoft will provide a | ||
338 | way to build applications linked to a proper system runtime, | ||
339 | from the Visual C++ environment. Until then, you have a | ||
340 | couple of alternatives, such as linking zlib in statically. | ||
341 | If your application requires dynamic linking, you may proceed | ||
342 | as explained in the answer to Question 14. | ||
343 | |||
344 | |||
345 | 14. I need to link my own DLL build to a CRT different than | ||
319 | MSVCRT.DLL. What can I do? | 346 | MSVCRT.DLL. What can I do? |
320 | 347 | ||
321 | - Feel free to rebuild the DLL from the zlib sources, and link | 348 | - Feel free to rebuild the DLL from the zlib sources, and link |
@@ -331,7 +358,7 @@ in the zlib distribution, or at the following location: | |||
331 | CYGWIN1.DLL, and it is distributed under the name CYGZ.DLL. | 358 | CYGWIN1.DLL, and it is distributed under the name CYGZ.DLL. |
332 | 359 | ||
333 | 360 | ||
334 | 14. May I include additional pieces of code that I find useful, | 361 | 15. May I include additional pieces of code that I find useful, |
335 | link them in ZLIB1.DLL, and export them? | 362 | link them in ZLIB1.DLL, and export them? |
336 | 363 | ||
337 | - No. A legitimate build of ZLIB1.DLL must not include code | 364 | - No. A legitimate build of ZLIB1.DLL must not include code |
@@ -344,7 +371,7 @@ in the zlib distribution, or at the following location: | |||
344 | is a redistributable file, named VCLxx.DLL. | 371 | is a redistributable file, named VCLxx.DLL. |
345 | 372 | ||
346 | 373 | ||
347 | 15. May I remove some functionality out of ZLIB1.DLL, by enabling | 374 | 16. May I remove some functionality out of ZLIB1.DLL, by enabling |
348 | macros like NO_GZCOMPRESS or NO_GZIP at compile time? | 375 | macros like NO_GZCOMPRESS or NO_GZIP at compile time? |
349 | 376 | ||
350 | - No. A legitimate build of ZLIB1.DLL must provide the complete | 377 | - No. A legitimate build of ZLIB1.DLL must provide the complete |
@@ -353,7 +380,7 @@ in the zlib distribution, or at the following location: | |||
353 | different file name, as suggested in the previous answer. | 380 | different file name, as suggested in the previous answer. |
354 | 381 | ||
355 | 382 | ||
356 | 16. I made my own ZLIB1.DLL build. Can I test it for compliance? | 383 | 17. I made my own ZLIB1.DLL build. Can I test it for compliance? |
357 | 384 | ||
358 | - We prefer that you download the official DLL from the zlib | 385 | - We prefer that you download the official DLL from the zlib |
359 | web site. If you need something peculiar from this DLL, you | 386 | web site. If you need something peculiar from this DLL, you |
diff --git a/win32/zlib1.rc b/win32/zlib1.rc index 162ab8f..2e98542 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,2 | 8 | FILEVERSION 1,2,2,1 |
9 | PRODUCTVERSION 1,2,2 | 9 | PRODUCTVERSION 1,2,2,1 |
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.2\0" | 26 | VALUE "FileVersion", "1.2.2.1\0" |
27 | VALUE "InternalName", "zlib1.dll\0" | 27 | VALUE "InternalName", "zlib1.dll\0" |
28 | VALUE "LegalCopyright", "(C) 1995-2004 Jean-loup Gailly & Mark Adler\0" | 28 | VALUE "LegalCopyright", "(C) 1995-2004 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.2\0" | 31 | VALUE "ProductVersion", "1.2.2.1\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 |
@@ -43,6 +43,10 @@ | |||
43 | # define get_crc_table z_get_crc_table | 43 | # define get_crc_table z_get_crc_table |
44 | # define zError z_zError | 44 | # define zError z_zError |
45 | 45 | ||
46 | # define alloc_func z_alloc_func | ||
47 | # define free_func z_free_func | ||
48 | # define in_func z_in_func | ||
49 | # define out_func z_out_func | ||
46 | # define Byte z_Byte | 50 | # define Byte z_Byte |
47 | # define uInt z_uInt | 51 | # define uInt z_uInt |
48 | # define uLong z_uLong | 52 | # define uLong z_uLong |
@@ -43,6 +43,10 @@ | |||
43 | # define get_crc_table z_get_crc_table | 43 | # define get_crc_table z_get_crc_table |
44 | # define zError z_zError | 44 | # define zError z_zError |
45 | 45 | ||
46 | # define alloc_func z_alloc_func | ||
47 | # define free_func z_free_func | ||
48 | # define in_func z_in_func | ||
49 | # define out_func z_out_func | ||
46 | # define Byte z_Byte | 50 | # define Byte z_Byte |
47 | # define uInt z_uInt | 51 | # define uInt z_uInt |
48 | # define uLong z_uLong | 52 | # define uLong z_uLong |
@@ -1,4 +1,4 @@ | |||
1 | .TH ZLIB 3 "3 October 2004" | 1 | .TH ZLIB 3 "31 October 2004" |
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.2 | 136 | Version 1.2.2.1 |
137 | Copyright (C) 1995-2004 Jean-loup Gailly (jloup@gzip.org) | 137 | Copyright (C) 1995-2004 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.2, October 3rd, 2004 | 2 | version 1.2.2.1, October 31st, 2004 |
3 | 3 | ||
4 | Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler | 4 | Copyright (C) 1995-2004 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.2" | 40 | #define ZLIB_VERSION "1.2.2.1" |
41 | #define ZLIB_VERNUM 0x1220 | 41 | #define ZLIB_VERNUM 0x1221 |
42 | 42 | ||
43 | /* | 43 | /* |
44 | The 'zlib' compression library provides in-memory compression and | 44 | The 'zlib' compression library provides in-memory compression and |
@@ -95,7 +95,7 @@ typedef struct z_stream_s { | |||
95 | free_func zfree; /* used to free the internal state */ | 95 | free_func zfree; /* used to free the internal state */ |
96 | voidpf opaque; /* private data object passed to zalloc and zfree */ | 96 | voidpf opaque; /* private data object passed to zalloc and zfree */ |
97 | 97 | ||
98 | int data_type; /* best guess about the data type: ascii or binary */ | 98 | int data_type; /* best guess about the data type: binary or text */ |
99 | uLong adler; /* adler32 value of the uncompressed data */ | 99 | uLong adler; /* adler32 value of the uncompressed data */ |
100 | uLong reserved; /* reserved for future use */ | 100 | uLong reserved; /* reserved for future use */ |
101 | } z_stream; | 101 | } z_stream; |
@@ -103,6 +103,29 @@ typedef struct z_stream_s { | |||
103 | typedef z_stream FAR *z_streamp; | 103 | typedef z_stream FAR *z_streamp; |
104 | 104 | ||
105 | /* | 105 | /* |
106 | gzip header information passed to and from zlib routines. See RFC 1952 | ||
107 | for more details on the meanings of these fields. | ||
108 | */ | ||
109 | typedef struct gz_header_s { | ||
110 | int text; /* true if compressed data believed to be text */ | ||
111 | uLong time; /* modification time */ | ||
112 | int xflags; /* extra flags (not used when writing a gzip file) */ | ||
113 | int os; /* operating system */ | ||
114 | Bytef *extra; /* pointer to extra field or Z_NULL if none */ | ||
115 | uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ | ||
116 | uInt extra_max; /* space at extra (only when reading header) */ | ||
117 | Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ | ||
118 | uInt name_max; /* space at name (only when reading header) */ | ||
119 | Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ | ||
120 | uInt comm_max; /* space at comment (only when reading header) */ | ||
121 | int hcrc; /* true if there was or will be a header crc */ | ||
122 | int done; /* true when done reading gzip header (not used | ||
123 | when writing a gzip file) */ | ||
124 | } gz_header; | ||
125 | |||
126 | typedef gz_header FAR *gz_headerp; | ||
127 | |||
128 | /* | ||
106 | The application must update next_in and avail_in when avail_in has | 129 | The application must update next_in and avail_in when avail_in has |
107 | dropped to zero. It must update next_out and avail_out when avail_out | 130 | dropped to zero. It must update next_out and avail_out when avail_out |
108 | has dropped to zero. The application must initialize zalloc, zfree and | 131 | has dropped to zero. The application must initialize zalloc, zfree and |
@@ -170,7 +193,8 @@ typedef z_stream FAR *z_streamp; | |||
170 | /* compression strategy; see deflateInit2() below for details */ | 193 | /* compression strategy; see deflateInit2() below for details */ |
171 | 194 | ||
172 | #define Z_BINARY 0 | 195 | #define Z_BINARY 0 |
173 | #define Z_ASCII 1 | 196 | #define Z_TEXT 1 |
197 | #define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ | ||
174 | #define Z_UNKNOWN 2 | 198 | #define Z_UNKNOWN 2 |
175 | /* Possible values of the data_type field (though see inflate()) */ | 199 | /* Possible values of the data_type field (though see inflate()) */ |
176 | 200 | ||
@@ -244,6 +268,10 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); | |||
244 | and with zero avail_out, it must be called again after making room in the | 268 | and with zero avail_out, it must be called again after making room in the |
245 | output buffer because there might be more output pending. | 269 | output buffer because there might be more output pending. |
246 | 270 | ||
271 | Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to | ||
272 | decide how much data to accumualte before producing output, in order to | ||
273 | maximize compression. | ||
274 | |||
247 | If the parameter flush is set to Z_SYNC_FLUSH, all pending output is | 275 | If the parameter flush is set to Z_SYNC_FLUSH, all pending output is |
248 | flushed to the output buffer and the output is aligned on a byte boundary, so | 276 | flushed to the output buffer and the output is aligned on a byte boundary, so |
249 | that the decompressor can get all input data available so far. (In particular | 277 | that the decompressor can get all input data available so far. (In particular |
@@ -255,7 +283,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); | |||
255 | Z_SYNC_FLUSH, and the compression state is reset so that decompression can | 283 | Z_SYNC_FLUSH, and the compression state is reset so that decompression can |
256 | restart from this point if previous compressed data has been damaged or if | 284 | restart from this point if previous compressed data has been damaged or if |
257 | random access is desired. Using Z_FULL_FLUSH too often can seriously degrade | 285 | random access is desired. Using Z_FULL_FLUSH too often can seriously degrade |
258 | the compression. | 286 | compression. |
259 | 287 | ||
260 | If deflate returns with avail_out == 0, this function must be called again | 288 | If deflate returns with avail_out == 0, this function must be called again |
261 | with the same value of the flush parameter and more output space (updated | 289 | with the same value of the flush parameter and more output space (updated |
@@ -280,8 +308,8 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); | |||
280 | deflate() sets strm->adler to the adler32 checksum of all input read | 308 | deflate() sets strm->adler to the adler32 checksum of all input read |
281 | so far (that is, total_in bytes). | 309 | so far (that is, total_in bytes). |
282 | 310 | ||
283 | deflate() may update data_type if it can make a good guess about | 311 | deflate() may update strm->data_type if it can make a good guess about |
284 | the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered | 312 | the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered |
285 | binary. This field is only for information purposes and does not affect | 313 | binary. This field is only for information purposes and does not affect |
286 | the compression algorithm in any manner. | 314 | the compression algorithm in any manner. |
287 | 315 | ||
@@ -616,6 +644,30 @@ ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, | |||
616 | stream state was inconsistent. | 644 | stream state was inconsistent. |
617 | */ | 645 | */ |
618 | 646 | ||
647 | ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, | ||
648 | gz_headerp head)); | ||
649 | /* | ||
650 | deflateSetHeader() provides gzip header information for when a gzip | ||
651 | stream is requested by deflateInit2(). deflateSetHeader() may be called | ||
652 | after deflateInit2() or deflateReset() and before the first call of | ||
653 | deflate(). The text, time, os, extra field, name, and comment information | ||
654 | in the provided gz_header structure are written to the gzip header (xflag is | ||
655 | ignored -- the extra flags are set according to the compression level). The | ||
656 | caller must assure that, if not Z_NULL, name and comment are terminated with | ||
657 | a zero byte, and that if extra is not Z_NULL, that extra_len bytes are | ||
658 | available there. If hcrc is true, a gzip header crc is included. Note that | ||
659 | the current versions of the command-line version of gzip (up through version | ||
660 | 1.3.x) do not support header crc's, and will report that it is a "multi-part | ||
661 | gzip file" and give up. | ||
662 | |||
663 | If deflateSetHeader is not used, the default gzip header has text false, | ||
664 | the time set to zero, and os set to 255, with no extra, name, or comment | ||
665 | fields. The gzip header is returned to the default state by deflateReset(). | ||
666 | |||
667 | deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source | ||
668 | stream state was inconsistent. | ||
669 | */ | ||
670 | |||
619 | /* | 671 | /* |
620 | ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, | 672 | ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, |
621 | int windowBits)); | 673 | int windowBits)); |
@@ -664,11 +716,14 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, | |||
664 | uInt dictLength)); | 716 | uInt dictLength)); |
665 | /* | 717 | /* |
666 | Initializes the decompression dictionary from the given uncompressed byte | 718 | Initializes the decompression dictionary from the given uncompressed byte |
667 | sequence. This function must be called immediately after a call of inflate | 719 | sequence. This function must be called immediately after a call of inflate, |
668 | if this call returned Z_NEED_DICT. The dictionary chosen by the compressor | 720 | if that call returned Z_NEED_DICT. The dictionary chosen by the compressor |
669 | can be determined from the adler32 value returned by this call of | 721 | can be determined from the adler32 value returned by that call of inflate. |
670 | inflate. The compressor and decompressor must use exactly the same | 722 | The compressor and decompressor must use exactly the same dictionary (see |
671 | dictionary (see deflateSetDictionary). | 723 | deflateSetDictionary). For raw inflate, this function can be called |
724 | immediately after inflateInit2() or inflateReset() and before any call of | ||
725 | inflate() to set the dictionary. The application must insure that the | ||
726 | dictionary that was used for compression is provided. | ||
672 | 727 | ||
673 | inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a | 728 | inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a |
674 | parameter is invalid (such as NULL dictionary) or the stream state is | 729 | parameter is invalid (such as NULL dictionary) or the stream state is |
@@ -719,8 +774,48 @@ ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); | |||
719 | stream state was inconsistent (such as zalloc or state being NULL). | 774 | stream state was inconsistent (such as zalloc or state being NULL). |
720 | */ | 775 | */ |
721 | 776 | ||
777 | ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, | ||
778 | gz_headerp head)); | ||
779 | /* | ||
780 | inflateGetHeader() requests that gzip header information be stored in the | ||
781 | provided gz_header structure. inflateGetHeader() may be called after | ||
782 | inflateInit2() or inflateReset(), and before the first call of inflate(). | ||
783 | As inflate() processes the gzip stream, head->done is zero until the header | ||
784 | is completed, at which time head->done is set to one. If a zlib stream is | ||
785 | being decoded, then head->done is set to -1 to indicate that there will be | ||
786 | no gzip header information forthcoming. Note that Z_BLOCK can be used to | ||
787 | force inflate() to return immediately after header processing is complete | ||
788 | and before any actual data is decompressed. | ||
789 | |||
790 | The text, time, xflags, and os fields are filled in with the gzip header | ||
791 | contents. hcrc is set to true if there is a header CRC. (The header CRC | ||
792 | was valid if done is set to one.) If extra is not Z_NULL, then extra_max | ||
793 | contains the maximum number of bytes to write to extra. Once done is true, | ||
794 | extra_len contains the actual extra field length, and extra contains the | ||
795 | extra field, or that field truncated if extra_max is less than extra_len. | ||
796 | If name is not Z_NULL, then up to name_max characters are written there, | ||
797 | terminated with a zero unless the length is greater than name_max. If | ||
798 | comment is not Z_NULL, then up to comm_max characters are written there, | ||
799 | terminated with a zero unless the length is greater than comm_max. When | ||
800 | any of extra, name, or comment are not Z_NULL and the respective field is | ||
801 | not present in the header, then that field is set to Z_NULL to signal its | ||
802 | absence. This allows the use of deflateSetHeader() with the returned | ||
803 | structure to duplicate the header. However if those fields are set to | ||
804 | allocated memory, then the application will need to save those pointers | ||
805 | elsewhere so that they can be eventually freed. | ||
806 | |||
807 | If inflateGetHeader is not used, then the header information is simply | ||
808 | discarded. The header is always checked for validity, including the header | ||
809 | CRC if present. inflateReset() will reset the process to discard the header | ||
810 | information. The application would need to call inflateGetHeader() again to | ||
811 | retrieve the header from the next gzip stream. | ||
812 | |||
813 | inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source | ||
814 | stream state was inconsistent. | ||
815 | */ | ||
816 | |||
722 | /* | 817 | /* |
723 | ZEXTERN int ZEXPORT inflateBackInit OF((z_stream FAR *strm, int windowBits, | 818 | ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, |
724 | unsigned char FAR *window)); | 819 | unsigned char FAR *window)); |
725 | 820 | ||
726 | Initialize the internal stream state for decompression using inflateBack() | 821 | Initialize the internal stream state for decompression using inflateBack() |
@@ -744,7 +839,7 @@ ZEXTERN int ZEXPORT inflateBackInit OF((z_stream FAR *strm, int windowBits, | |||
744 | typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); | 839 | typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); |
745 | typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); | 840 | typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); |
746 | 841 | ||
747 | ZEXTERN int ZEXPORT inflateBack OF((z_stream FAR *strm, | 842 | ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, |
748 | in_func in, void FAR *in_desc, | 843 | in_func in, void FAR *in_desc, |
749 | out_func out, void FAR *out_desc)); | 844 | out_func out, void FAR *out_desc)); |
750 | /* | 845 | /* |
@@ -813,7 +908,7 @@ ZEXTERN int ZEXPORT inflateBack OF((z_stream FAR *strm, | |||
813 | that inflateBack() cannot return Z_OK. | 908 | that inflateBack() cannot return Z_OK. |
814 | */ | 909 | */ |
815 | 910 | ||
816 | ZEXTERN int ZEXPORT inflateBackEnd OF((z_stream FAR *strm)); | 911 | ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); |
817 | /* | 912 | /* |
818 | All memory allocated by inflateBackInit() is freed. | 913 | All memory allocated by inflateBackInit() is freed. |
819 | 914 | ||
@@ -1119,7 +1214,6 @@ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); | |||
1119 | */ | 1214 | */ |
1120 | 1215 | ||
1121 | ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); | 1216 | ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); |
1122 | |||
1123 | /* | 1217 | /* |
1124 | Update a running Adler-32 checksum with the bytes buf[0..len-1] and | 1218 | Update a running Adler-32 checksum with the bytes buf[0..len-1] and |
1125 | return the updated checksum. If buf is NULL, this function returns | 1219 | return the updated checksum. If buf is NULL, this function returns |
@@ -1135,12 +1229,21 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); | |||
1135 | if (adler != original_adler) error(); | 1229 | if (adler != original_adler) error(); |
1136 | */ | 1230 | */ |
1137 | 1231 | ||
1232 | ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, | ||
1233 | uLong len2)); | ||
1234 | /* | ||
1235 | Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 | ||
1236 | and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for | ||
1237 | each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of | ||
1238 | seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. | ||
1239 | */ | ||
1240 | |||
1138 | ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); | 1241 | ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); |
1139 | /* | 1242 | /* |
1140 | Update a running crc with the bytes buf[0..len-1] and return the updated | 1243 | Update a running CRC-32 with the bytes buf[0..len-1] and return the |
1141 | crc. If buf is NULL, this function returns the required initial value | 1244 | updated CRC-32. If buf is NULL, this function returns the required initial |
1142 | for the crc. Pre- and post-conditioning (one's complement) is performed | 1245 | value for the for the crc. Pre- and post-conditioning (one's complement) is |
1143 | within this function so it shouldn't be done by the application. | 1246 | performed within this function so it shouldn't be done by the application. |
1144 | Usage example: | 1247 | Usage example: |
1145 | 1248 | ||
1146 | uLong crc = crc32(0L, Z_NULL, 0); | 1249 | uLong crc = crc32(0L, Z_NULL, 0); |
@@ -1151,6 +1254,16 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); | |||
1151 | if (crc != original_crc) error(); | 1254 | if (crc != original_crc) error(); |
1152 | */ | 1255 | */ |
1153 | 1256 | ||
1257 | ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, uLong len2)); | ||
1258 | |||
1259 | /* | ||
1260 | Combine two CRC-32 check values into one. For two sequences of bytes, | ||
1261 | seq1 and seq2 with lengths len1 and len2, CRC-32 check values were | ||
1262 | calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 | ||
1263 | check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and | ||
1264 | len2. | ||
1265 | */ | ||
1266 | |||
1154 | 1267 | ||
1155 | /* various hacks, don't look :) */ | 1268 | /* various hacks, don't look :) */ |
1156 | 1269 | ||
@@ -1167,7 +1280,7 @@ ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, | |||
1167 | int stream_size)); | 1280 | int stream_size)); |
1168 | ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, | 1281 | ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, |
1169 | const char *version, int stream_size)); | 1282 | const char *version, int stream_size)); |
1170 | ZEXTERN int ZEXPORT inflateBackInit_ OF((z_stream FAR *strm, int windowBits, | 1283 | ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, |
1171 | unsigned char FAR *window, | 1284 | unsigned char FAR *window, |
1172 | const char *version, | 1285 | const char *version, |
1173 | int stream_size)); | 1286 | int stream_size)); |
@@ -1,5 +1,5 @@ | |||
1 | /* zutil.c -- target dependent utility functions for the compression library | 1 | /* zutil.c -- target dependent utility functions for the compression library |
2 | * Copyright (C) 1995-2003 Jean-loup Gailly. | 2 | * Copyright (C) 1995-2004 Jean-loup Gailly. |
3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -11,10 +11,6 @@ | |||
11 | struct internal_state {int dummy;}; /* for buggy compilers */ | 11 | struct internal_state {int dummy;}; /* for buggy compilers */ |
12 | #endif | 12 | #endif |
13 | 13 | ||
14 | #ifndef STDC | ||
15 | extern void exit OF((int)); | ||
16 | #endif | ||
17 | |||
18 | const char * const z_errmsg[10] = { | 14 | const char * const z_errmsg[10] = { |
19 | "need dictionary", /* Z_NEED_DICT 2 */ | 15 | "need dictionary", /* Z_NEED_DICT 2 */ |
20 | "stream end", /* Z_STREAM_END 1 */ | 16 | "stream end", /* Z_STREAM_END 1 */ |
@@ -1,5 +1,5 @@ | |||
1 | /* zutil.h -- internal interface and configuration of the compression library | 1 | /* zutil.h -- internal interface and configuration of the compression library |
2 | * Copyright (C) 1995-2003 Jean-loup Gailly. | 2 | * Copyright (C) 1995-2004 Jean-loup Gailly. |
3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | */ | 4 | */ |
5 | 5 | ||