diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | README | 11 | ||||
-rw-r--r-- | crc32.c | 69 | ||||
-rw-r--r-- | deflate.c | 35 | ||||
-rw-r--r-- | deflate.h | 1 | ||||
-rw-r--r-- | infblock.c | 22 | ||||
-rw-r--r-- | infcodes.c | 81 | ||||
-rw-r--r-- | inffast.c | 155 | ||||
-rw-r--r-- | inftrees.c | 14 | ||||
-rw-r--r-- | inftrees.h | 15 | ||||
-rw-r--r-- | infutil.h | 7 | ||||
-rw-r--r-- | minigzip.c | 2 | ||||
-rw-r--r-- | trees.c | 11 | ||||
-rw-r--r-- | zconf.h | 10 | ||||
-rw-r--r-- | zlib.h | 7 | ||||
-rw-r--r-- | zutil.h | 8 |
16 files changed, 253 insertions, 203 deletions
@@ -1,5 +1,13 @@ | |||
1 | ChangeLog file for zlib | 1 | ChangeLog file for zlib |
2 | 2 | ||
3 | Changes in 0.93 (25 June 95) | ||
4 | - temporarily disable inline functions | ||
5 | - make deflate deterministic | ||
6 | - give enough lookahead for PARTIAL_FLUSH | ||
7 | - Set binary mode for stdin/stdout in minigzip.c for OS/2 | ||
8 | - don't even use signed char in inflate (not portable enough) | ||
9 | - fix inflate memory leak for segmented architectures | ||
10 | |||
3 | Changes in 0.92 (3 May 95) | 11 | Changes in 0.92 (3 May 95) |
4 | - don't assume that char is signed (problem on SGI) | 12 | - don't assume that char is signed (problem on SGI) |
5 | - Clear bit buffer when starting a stored block | 13 | - Clear bit buffer when starting a stored block |
@@ -1,4 +1,4 @@ | |||
1 | zlib 0.92 is a beta version of a general purpose compression library. | 1 | zlib 0.93 is a beta version of a general purpose compression library. |
2 | 2 | ||
3 | The data format used by the zlib library is described in the | 3 | The data format used by the zlib library is described in the |
4 | files zlib-3.1.doc, deflate-1.1.doc and gzip-4.1.doc, available | 4 | files zlib-3.1.doc, deflate-1.1.doc and gzip-4.1.doc, available |
@@ -14,9 +14,12 @@ To install the zlib library (libgz.a) in /usr/local/lib, type: make install | |||
14 | To install in a different directory, use for example: make install prefix=$HOME | 14 | To install in a different directory, use for example: make install prefix=$HOME |
15 | This will install in $HOME/lib instead of /usr/local/lib. | 15 | This will install in $HOME/lib instead of /usr/local/lib. |
16 | 16 | ||
17 | The changes made in version 0.92 are documented in the file ChangeLog. | 17 | The changes made in version 0.93 are documented in the file ChangeLog. |
18 | The main changes since 0.9 are: | 18 | The main changes since 0.9 are: |
19 | - don't assume that char is signed (problem on SGI) | 19 | - temporarily disable inline functions |
20 | - make deflate deterministic | ||
21 | - don't use signed char in inflate (not portable enough) | ||
22 | - fix inflate memory leak for segmented architectures | ||
20 | - Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h | 23 | - Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h |
21 | - Document the memory requirements in zconf.h | 24 | - Document the memory requirements in zconf.h |
22 | - added "make install" | 25 | - added "make install" |
@@ -50,7 +53,7 @@ medium model with far allocation of big objects. | |||
50 | 3. This notice may not be removed or altered from any source distribution. | 53 | 3. This notice may not be removed or altered from any source distribution. |
51 | 54 | ||
52 | Jean-loup Gailly Mark Adler | 55 | Jean-loup Gailly Mark Adler |
53 | gzip@prep.ai.mit.edu madler@cco.caltech.edu | 56 | gzip@prep.ai.mit.edu madler@alumni.caltech.edu |
54 | 57 | ||
55 | If you use the zlib library in a product, we would appreciate *not* | 58 | If you use the zlib library in a product, we would appreciate *not* |
56 | receiving lengthy legal documents to sign. The sources are provided | 59 | receiving lengthy legal documents to sign. The sources are provided |
@@ -7,57 +7,35 @@ | |||
7 | 7 | ||
8 | #include "zlib.h" | 8 | #include "zlib.h" |
9 | 9 | ||
10 | extern uLong crc_table[]; /* crc table, defined below */ | 10 | #define local static |
11 | |||
12 | #define DO1(buf) crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8); | ||
13 | #define DO2(buf) DO1(buf); DO1(buf); | ||
14 | #define DO4(buf) DO2(buf); DO2(buf); | ||
15 | #define DO8(buf) DO4(buf); DO4(buf); | ||
16 | |||
17 | /* ========================================================================= */ | ||
18 | uLong crc32(crc, buf, len) | ||
19 | uLong crc; | ||
20 | Byte *buf; | ||
21 | uInt len; | ||
22 | { | ||
23 | if (buf == Z_NULL) return 0L; | ||
24 | crc = crc ^ 0xffffffffL; | ||
25 | while (len >= 8) | ||
26 | { | ||
27 | DO8(buf); | ||
28 | len -= 8; | ||
29 | } | ||
30 | if (len) do { | ||
31 | DO1(buf); | ||
32 | } while (--len); | ||
33 | return crc ^ 0xffffffffL; | ||
34 | } | ||
35 | 11 | ||
12 | #ifdef DYNAMIC_CRC_TABLE | ||
36 | /* ========================================================================= | 13 | /* ========================================================================= |
37 | * Make the crc table. This function is needed only if you want to compute | 14 | * Make the crc table. This function is needed only if you want to compute |
38 | * the table dynamically. | 15 | * the table dynamically. |
39 | */ | 16 | */ |
40 | #ifdef DYNAMIC_CRC_TABLE | 17 | local int crc_table_empty = 1; |
18 | local uLong crc_table[256]; | ||
41 | 19 | ||
42 | local void make_crc_table() | 20 | local void make_crc_table() |
43 | { | 21 | { |
44 | uLong c; | 22 | uLong c; |
45 | int n, k; | 23 | int n, k; |
46 | 24 | ||
47 | for (n = 0; n < 256; n++) | 25 | for (n = 0; n < 256; n++) |
48 | { | 26 | { |
49 | c = (uLong)n; | 27 | c = (uLong)n; |
50 | for (k = 0; k < 8; k++) | 28 | for (k = 0; k < 8; k++) |
51 | c = c & 1 ? 0xedb88320L ^ (c >> 1) : c >> 1; | 29 | c = c & 1 ? 0xedb88320L ^ (c >> 1) : c >> 1; |
52 | crc_table[n] = c; | 30 | crc_table[n] = c; |
53 | } | 31 | } |
32 | crc_table_empty = 0; | ||
54 | } | 33 | } |
55 | #endif | 34 | #else |
56 | |||
57 | /* ======================================================================== | 35 | /* ======================================================================== |
58 | * Table of CRC-32's of all single-byte values (made by make_crc_table) | 36 | * Table of CRC-32's of all single-byte values (made by make_crc_table) |
59 | */ | 37 | */ |
60 | uLong crc_table[] = { | 38 | local uLong crc_table[] = { |
61 | 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, | 39 | 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, |
62 | 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, | 40 | 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, |
63 | 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, | 41 | 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, |
@@ -111,3 +89,32 @@ uLong crc_table[] = { | |||
111 | 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, | 89 | 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, |
112 | 0x2d02ef8dL | 90 | 0x2d02ef8dL |
113 | }; | 91 | }; |
92 | #endif | ||
93 | |||
94 | #define DO1(buf) crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8); | ||
95 | #define DO2(buf) DO1(buf); DO1(buf); | ||
96 | #define DO4(buf) DO2(buf); DO2(buf); | ||
97 | #define DO8(buf) DO4(buf); DO4(buf); | ||
98 | |||
99 | /* ========================================================================= */ | ||
100 | uLong crc32(crc, buf, len) | ||
101 | uLong crc; | ||
102 | Byte *buf; | ||
103 | uInt len; | ||
104 | { | ||
105 | if (buf == Z_NULL) return 0L; | ||
106 | #ifdef DYNAMIC_CRC_TABLE | ||
107 | if (crc_table_empty) | ||
108 | make_crc_table(); | ||
109 | #endif | ||
110 | crc = crc ^ 0xffffffffL; | ||
111 | while (len >= 8) | ||
112 | { | ||
113 | DO8(buf); | ||
114 | len -= 8; | ||
115 | } | ||
116 | if (len) do { | ||
117 | DO1(buf); | ||
118 | } while (--len); | ||
119 | return crc ^ 0xffffffffL; | ||
120 | } | ||
@@ -117,7 +117,7 @@ local void fill_window __P((deflate_state *s)); | |||
117 | local int deflate_fast __P((deflate_state *s, int flush)); | 117 | local int deflate_fast __P((deflate_state *s, int flush)); |
118 | local int deflate_slow __P((deflate_state *s, int flush)); | 118 | local int deflate_slow __P((deflate_state *s, int flush)); |
119 | local void lm_init __P((deflate_state *s)); | 119 | local void lm_init __P((deflate_state *s)); |
120 | local int longest_match __P((deflate_state *s, IPos cur_match)); | 120 | local inline int longest_match __P((deflate_state *s, IPos cur_match)); |
121 | local void putShortMSB __P((deflate_state *s, uInt b)); | 121 | local void putShortMSB __P((deflate_state *s, uInt b)); |
122 | local void flush_pending __P((z_stream *strm)); | 122 | local void flush_pending __P((z_stream *strm)); |
123 | local int read_buf __P((z_stream *strm, char *buf, unsigned size)); | 123 | local int read_buf __P((z_stream *strm, char *buf, unsigned size)); |
@@ -354,13 +354,17 @@ int deflate (strm, flush) | |||
354 | } else { | 354 | } else { |
355 | quit = deflate_slow(strm->state, flush); | 355 | quit = deflate_slow(strm->state, flush); |
356 | } | 356 | } |
357 | if (flush == Z_FULL_FLUSH) { | 357 | if (flush == Z_FULL_FLUSH || flush == Z_SYNC_FLUSH) { |
358 | ct_stored_block(strm->state, (char*)0, 0L, 0); /* special marker */ | 358 | ct_stored_block(strm->state, (char*)0, 0L, 0); /* special marker */ |
359 | flush_pending(strm); | 359 | flush_pending(strm); |
360 | CLEAR_HASH(strm->state); /* forget history */ | 360 | if (flush == Z_FULL_FLUSH) { |
361 | if (strm->avail_out == 0) return Z_OK; | 361 | CLEAR_HASH(strm->state); /* forget history */ |
362 | } | ||
363 | } else if (flush == Z_PARTIAL_FLUSH) { | ||
364 | ct_align(strm->state); | ||
365 | flush_pending(strm); | ||
362 | } | 366 | } |
363 | if (quit) return Z_OK; | 367 | if (quit || strm->avail_out == 0) return Z_OK; |
364 | } | 368 | } |
365 | Assert(strm->avail_out > 0, "bug2"); | 369 | Assert(strm->avail_out > 0, "bug2"); |
366 | 370 | ||
@@ -447,8 +451,6 @@ local int read_buf(strm, buf, size) | |||
447 | local void lm_init (s) | 451 | local void lm_init (s) |
448 | deflate_state *s; | 452 | deflate_state *s; |
449 | { | 453 | { |
450 | register unsigned j; | ||
451 | |||
452 | s->window_size = (ulg)2L*s->w_size; | 454 | s->window_size = (ulg)2L*s->w_size; |
453 | 455 | ||
454 | CLEAR_HASH(s); | 456 | CLEAR_HASH(s); |
@@ -465,15 +467,10 @@ local void lm_init (s) | |||
465 | s->lookahead = 0; | 467 | s->lookahead = 0; |
466 | s->match_length = MIN_MATCH-1; | 468 | s->match_length = MIN_MATCH-1; |
467 | s->match_available = 0; | 469 | s->match_available = 0; |
470 | s->ins_h = 0; | ||
468 | #ifdef ASMV | 471 | #ifdef ASMV |
469 | match_init(); /* initialize the asm code */ | 472 | match_init(); /* initialize the asm code */ |
470 | #endif | 473 | #endif |
471 | |||
472 | s->ins_h = 0; | ||
473 | for (j=0; j<MIN_MATCH-1; j++) UPDATE_HASH(s, s->ins_h, s->window[j]); | ||
474 | /* If lookahead < MIN_MATCH, ins_h is garbage, but this is | ||
475 | * not important since only literal bytes will be emitted. | ||
476 | */ | ||
477 | } | 474 | } |
478 | 475 | ||
479 | /* =========================================================================== | 476 | /* =========================================================================== |
@@ -488,7 +485,7 @@ local void lm_init (s) | |||
488 | /* For 80x86 and 680x0, an optimized version will be provided in match.asm or | 485 | /* For 80x86 and 680x0, an optimized version will be provided in match.asm or |
489 | * match.S. The code will be functionally equivalent. | 486 | * match.S. The code will be functionally equivalent. |
490 | */ | 487 | */ |
491 | local INLINE int longest_match(s, cur_match) | 488 | local inline int longest_match(s, cur_match) |
492 | deflate_state *s; | 489 | deflate_state *s; |
493 | IPos cur_match; /* current match */ | 490 | IPos cur_match; /* current match */ |
494 | { | 491 | { |
@@ -730,6 +727,16 @@ local void fill_window(s) | |||
730 | more); | 727 | more); |
731 | s->lookahead += n; | 728 | s->lookahead += n; |
732 | 729 | ||
730 | /* Initialize the hash value now that we have some input: */ | ||
731 | if (s->strstart == 0 && s->lookahead >= MIN_MATCH-1) { | ||
732 | for (n=0; n<MIN_MATCH-1; n++) { | ||
733 | UPDATE_HASH(s, s->ins_h, s->window[n]); | ||
734 | } | ||
735 | } | ||
736 | /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, | ||
737 | * but this is not important since only literal bytes will be emitted. | ||
738 | */ | ||
739 | |||
733 | } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); | 740 | } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); |
734 | } | 741 | } |
735 | 742 | ||
@@ -268,5 +268,6 @@ typedef struct internal_state { | |||
268 | void ct_init __P((deflate_state *s)); | 268 | void ct_init __P((deflate_state *s)); |
269 | int ct_tally __P((deflate_state *s, int dist, int lc)); | 269 | int ct_tally __P((deflate_state *s, int dist, int lc)); |
270 | ulg ct_flush_block __P((deflate_state *s, char *buf, ulg stored_len, int eof)); | 270 | ulg ct_flush_block __P((deflate_state *s, char *buf, ulg stored_len, int eof)); |
271 | void ct_align __P((deflate_state *s)); | ||
271 | void ct_stored_block __P((deflate_state *s, char *buf, ulg stored_len, | 272 | void ct_stored_block __P((deflate_state *s, char *buf, ulg stored_len, |
272 | int eof)); | 273 | int eof)); |
@@ -71,7 +71,11 @@ uLong *c; | |||
71 | if (s->mode == BTREE || s->mode == DTREE) | 71 | if (s->mode == BTREE || s->mode == DTREE) |
72 | ZFREE(z, s->sub.trees.blens); | 72 | ZFREE(z, s->sub.trees.blens); |
73 | if (s->mode == CODES) | 73 | if (s->mode == CODES) |
74 | inflate_codes_free(s->sub.codes, z); | 74 | { |
75 | inflate_codes_free(s->sub.decode.codes, z); | ||
76 | inflate_trees_free(s->sub.decode.td, z); | ||
77 | inflate_trees_free(s->sub.decode.tl, z); | ||
78 | } | ||
75 | s->mode = TYPE; | 79 | s->mode = TYPE; |
76 | s->bitk = 0; | 80 | s->bitk = 0; |
77 | s->bitb = 0; | 81 | s->bitb = 0; |
@@ -147,12 +151,14 @@ int r; | |||
147 | inflate_huft *tl, *td; | 151 | inflate_huft *tl, *td; |
148 | 152 | ||
149 | inflate_trees_fixed(&bl, &bd, &tl, &td); | 153 | inflate_trees_fixed(&bl, &bd, &tl, &td); |
150 | s->sub.codes = inflate_codes_new(bl, bd, tl, td, z); | 154 | s->sub.decode.codes = inflate_codes_new(bl, bd, tl, td, z); |
151 | if (s->sub.codes == Z_NULL) | 155 | if (s->sub.decode.codes == Z_NULL) |
152 | { | 156 | { |
153 | r = Z_MEM_ERROR; | 157 | r = Z_MEM_ERROR; |
154 | LEAVE | 158 | LEAVE |
155 | } | 159 | } |
160 | s->sub.decode.tl = Z_NULL; /* don't try to free these */ | ||
161 | s->sub.decode.td = Z_NULL; | ||
156 | } | 162 | } |
157 | DUMPBITS(3) | 163 | DUMPBITS(3) |
158 | s->mode = CODES; | 164 | s->mode = CODES; |
@@ -181,7 +187,7 @@ int r; | |||
181 | LEAVE | 187 | LEAVE |
182 | } | 188 | } |
183 | s->sub.left = (uInt)b & 0xffff; | 189 | s->sub.left = (uInt)b & 0xffff; |
184 | k = b = 0; /* dump bits */ | 190 | b = k = 0; /* dump bits */ |
185 | Tracev((stderr, "inflate: stored length %u\n", s->sub.left)); | 191 | Tracev((stderr, "inflate: stored length %u\n", s->sub.left)); |
186 | s->mode = s->sub.left ? STORED : TYPE; | 192 | s->mode = s->sub.left ? STORED : TYPE; |
187 | break; | 193 | break; |
@@ -318,7 +324,9 @@ int r; | |||
318 | LEAVE | 324 | LEAVE |
319 | } | 325 | } |
320 | ZFREE(z, s->sub.trees.blens); | 326 | ZFREE(z, s->sub.trees.blens); |
321 | s->sub.codes = c; | 327 | s->sub.decode.codes = c; |
328 | s->sub.decode.tl = tl; | ||
329 | s->sub.decode.td = td; | ||
322 | } | 330 | } |
323 | s->mode = CODES; | 331 | s->mode = CODES; |
324 | case CODES: | 332 | case CODES: |
@@ -326,7 +334,9 @@ int r; | |||
326 | if ((r = inflate_codes(s, z, r)) != Z_STREAM_END) | 334 | if ((r = inflate_codes(s, z, r)) != Z_STREAM_END) |
327 | return inflate_flush(s, z, r); | 335 | return inflate_flush(s, z, r); |
328 | r = Z_OK; | 336 | r = Z_OK; |
329 | inflate_codes_free(s->sub.codes, z); | 337 | inflate_codes_free(s->sub.decode.codes, z); |
338 | inflate_trees_free(s->sub.decode.td, z); | ||
339 | inflate_trees_free(s->sub.decode.tl, z); | ||
330 | LOAD | 340 | LOAD |
331 | Tracev((stderr, "inflate: codes end, %lu total out\n", | 341 | Tracev((stderr, "inflate: codes end, %lu total out\n", |
332 | z->total_out + (q >= s->read ? q - s->read : | 342 | z->total_out + (q >= s->read ? q - s->read : |
@@ -83,7 +83,7 @@ int r; | |||
83 | { | 83 | { |
84 | uInt j; /* temporary storage */ | 84 | uInt j; /* temporary storage */ |
85 | inflate_huft *t; /* temporary pointer */ | 85 | inflate_huft *t; /* temporary pointer */ |
86 | int e; /* extra bits or operation */ | 86 | uInt e; /* extra bits or operation */ |
87 | uLong b; /* bit buffer */ | 87 | uLong b; /* bit buffer */ |
88 | uInt k; /* bits in bit buffer */ | 88 | uInt k; /* bits in bit buffer */ |
89 | Byte *p; /* input data pointer */ | 89 | Byte *p; /* input data pointer */ |
@@ -91,7 +91,7 @@ int r; | |||
91 | Byte *q; /* output window write pointer */ | 91 | Byte *q; /* output window write pointer */ |
92 | uInt m; /* bytes to end of window or read pointer */ | 92 | uInt m; /* bytes to end of window or read pointer */ |
93 | Byte *f; /* pointer to copy strings from */ | 93 | Byte *f; /* pointer to copy strings from */ |
94 | struct inflate_codes_state *c = s->sub.codes; /* codes state */ | 94 | struct inflate_codes_state *c = s->sub.decode.codes; /* codes state */ |
95 | 95 | ||
96 | /* copy input/output information to locals (UPDATE macro restores) */ | 96 | /* copy input/output information to locals (UPDATE macro restores) */ |
97 | LOAD | 97 | LOAD |
@@ -121,27 +121,8 @@ int r; | |||
121 | NEEDBITS(j) | 121 | NEEDBITS(j) |
122 | t = c->sub.code.tree + ((uInt)b & inflate_mask[j]); | 122 | t = c->sub.code.tree + ((uInt)b & inflate_mask[j]); |
123 | DUMPBITS(t->bits) | 123 | DUMPBITS(t->bits) |
124 | if ((e = (int)(t->exop)) < 0) | 124 | e = (uInt)(t->exop); |
125 | { | 125 | if (e == 0) /* literal */ |
126 | if (e == -128) /* invalid code */ | ||
127 | { | ||
128 | c->mode = BADCODE; | ||
129 | z->msg = "invalid literal/length code"; | ||
130 | r = Z_DATA_ERROR; | ||
131 | LEAVE | ||
132 | } | ||
133 | e = -e; | ||
134 | if (e & 64) /* end of block */ | ||
135 | { | ||
136 | Tracevv((stderr, "inflate: end of block\n")); | ||
137 | c->mode = WASH; | ||
138 | break; | ||
139 | } | ||
140 | c->sub.code.need = e; | ||
141 | c->sub.code.tree = t->next; | ||
142 | break; | ||
143 | } | ||
144 | if (e & 16) /* literal */ | ||
145 | { | 126 | { |
146 | c->sub.lit = t->base; | 127 | c->sub.lit = t->base; |
147 | Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ? | 128 | Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ? |
@@ -150,9 +131,29 @@ int r; | |||
150 | c->mode = LIT; | 131 | c->mode = LIT; |
151 | break; | 132 | break; |
152 | } | 133 | } |
153 | c->sub.copy.get = e; | 134 | if (e & 16) /* length */ |
154 | c->len = t->base; | 135 | { |
155 | c->mode = LENEXT; | 136 | c->sub.copy.get = e & 15; |
137 | c->len = t->base; | ||
138 | c->mode = LENEXT; | ||
139 | break; | ||
140 | } | ||
141 | if ((e & 64) == 0) /* next table */ | ||
142 | { | ||
143 | c->sub.code.need = e; | ||
144 | c->sub.code.tree = t->next; | ||
145 | break; | ||
146 | } | ||
147 | if (e & 32) /* end of block */ | ||
148 | { | ||
149 | Tracevv((stderr, "inflate: end of block\n")); | ||
150 | c->mode = WASH; | ||
151 | break; | ||
152 | } | ||
153 | c->mode = BADCODE; /* invalid code */ | ||
154 | z->msg = "invalid literal/length code"; | ||
155 | r = Z_DATA_ERROR; | ||
156 | LEAVE | ||
156 | case LENEXT: /* i: getting length extra (have base) */ | 157 | case LENEXT: /* i: getting length extra (have base) */ |
157 | j = c->sub.copy.get; | 158 | j = c->sub.copy.get; |
158 | NEEDBITS(j) | 159 | NEEDBITS(j) |
@@ -167,22 +168,24 @@ int r; | |||
167 | NEEDBITS(j) | 168 | NEEDBITS(j) |
168 | t = c->sub.code.tree + ((uInt)b & inflate_mask[j]); | 169 | t = c->sub.code.tree + ((uInt)b & inflate_mask[j]); |
169 | DUMPBITS(t->bits) | 170 | DUMPBITS(t->bits) |
170 | if ((e = (int)(t->exop)) < 0) | 171 | e = (uInt)(t->exop); |
172 | if (e & 16) /* distance */ | ||
171 | { | 173 | { |
172 | if (e == -128) | 174 | c->sub.copy.get = e & 15; |
173 | { | 175 | c->sub.copy.dist = t->base; |
174 | c->mode = BADCODE; | 176 | c->mode = DISTEXT; |
175 | z->msg = "invalid distance code"; | 177 | break; |
176 | r = Z_DATA_ERROR; | 178 | } |
177 | LEAVE | 179 | if ((e & 64) == 0) /* next table */ |
178 | } | 180 | { |
179 | c->sub.code.need = -e; | 181 | c->sub.code.need = e; |
180 | c->sub.code.tree = t->next; | 182 | c->sub.code.tree = t->next; |
181 | break; | 183 | break; |
182 | } | 184 | } |
183 | c->sub.copy.dist = t->base; | 185 | c->mode = BADCODE; /* invalid code */ |
184 | c->sub.copy.get = e; | 186 | z->msg = "invalid distance code"; |
185 | c->mode = DISTEXT; | 187 | r = Z_DATA_ERROR; |
188 | LEAVE | ||
186 | case DISTEXT: /* i: getting distance extra */ | 189 | case DISTEXT: /* i: getting distance extra */ |
187 | j = c->sub.copy.get; | 190 | j = c->sub.copy.get; |
188 | NEEDBITS(j) | 191 | NEEDBITS(j) |
@@ -231,8 +234,6 @@ void inflate_codes_free(c, z) | |||
231 | struct inflate_codes_state *c; | 234 | struct inflate_codes_state *c; |
232 | z_stream *z; | 235 | z_stream *z; |
233 | { | 236 | { |
234 | inflate_trees_free(c->dtree, z); | ||
235 | inflate_trees_free(c->ltree, z); | ||
236 | ZFREE(z, c); | 237 | ZFREE(z, c); |
237 | Tracev((stderr, "inflate: codes free\n")); | 238 | Tracev((stderr, "inflate: codes free\n")); |
238 | } | 239 | } |
@@ -17,10 +17,6 @@ struct inflate_codes_state {int dummy;}; /* for buggy compilers */ | |||
17 | #define bits word.what.Bits | 17 | #define bits word.what.Bits |
18 | 18 | ||
19 | /* macros for bit input with no checking and for returning unused bytes */ | 19 | /* macros for bit input with no checking and for returning unused bytes */ |
20 | #ifdef DEBUG | ||
21 | # undef NEXTBYTE | ||
22 | # define NEXTBYTE (n--?0:fprintf(stderr,"inffast underrun\n"),*p++) | ||
23 | #endif | ||
24 | #define GRABBITS(j) {while(k<(j)){b|=((uLong)NEXTBYTE)<<k;k+=8;}} | 20 | #define GRABBITS(j) {while(k<(j)){b|=((uLong)NEXTBYTE)<<k;k+=8;}} |
25 | #define UNGRAB {n+=(c=k>>3);p-=c;k&=7;} | 21 | #define UNGRAB {n+=(c=k>>3);p-=c;k&=7;} |
26 | 22 | ||
@@ -36,7 +32,7 @@ struct inflate_blocks_state *s; | |||
36 | z_stream *z; | 32 | z_stream *z; |
37 | { | 33 | { |
38 | inflate_huft *t; /* temporary pointer */ | 34 | inflate_huft *t; /* temporary pointer */ |
39 | int e; /* extra bits or operation */ | 35 | uInt e; /* extra bits or operation */ |
40 | uLong b; /* bit buffer */ | 36 | uLong b; /* bit buffer */ |
41 | uInt k; /* bits in bit buffer */ | 37 | uInt k; /* bits in bit buffer */ |
42 | Byte *p; /* input data pointer */ | 38 | Byte *p; /* input data pointer */ |
@@ -52,7 +48,7 @@ z_stream *z; | |||
52 | /* load input, output, bit values */ | 48 | /* load input, output, bit values */ |
53 | LOAD | 49 | LOAD |
54 | 50 | ||
55 | /* initialize masks in registers */ | 51 | /* initialize masks */ |
56 | ml = inflate_mask[bl]; | 52 | ml = inflate_mask[bl]; |
57 | md = inflate_mask[bd]; | 53 | md = inflate_mask[bd]; |
58 | 54 | ||
@@ -60,93 +56,106 @@ z_stream *z; | |||
60 | do { /* assume called with m >= 258 && n >= 10 */ | 56 | do { /* assume called with m >= 258 && n >= 10 */ |
61 | /* get literal/length code */ | 57 | /* get literal/length code */ |
62 | GRABBITS(20) /* max bits for literal/length code */ | 58 | GRABBITS(20) /* max bits for literal/length code */ |
63 | if ((e = (t = tl + ((uInt)b & ml))->exop) < 0) | 59 | if ((e = (t = tl + ((uInt)b & ml))->exop) == 0) |
64 | do { | ||
65 | if (e == -128) | ||
66 | { | ||
67 | z->msg = "invalid literal/length code"; | ||
68 | UNGRAB | ||
69 | UPDATE | ||
70 | return Z_DATA_ERROR; | ||
71 | } | ||
72 | DUMPBITS(t->bits) | ||
73 | e = -e; | ||
74 | if (e & 64) /* end of block */ | ||
75 | { | ||
76 | Tracevv((stderr, "inflate: * end of block\n")); | ||
77 | UNGRAB | ||
78 | UPDATE | ||
79 | return Z_STREAM_END; | ||
80 | } | ||
81 | } while ((e = (t = t->next + ((uInt)b & inflate_mask[e]))->exop) < 0); | ||
82 | DUMPBITS(t->bits) | ||
83 | |||
84 | /* process literal or length (end of block already trapped) */ | ||
85 | if (e & 16) /* then it's a literal */ | ||
86 | { | 60 | { |
61 | DUMPBITS(t->bits) | ||
87 | Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ? | 62 | Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ? |
88 | "inflate: * literal '%c'\n" : | 63 | "inflate: * literal '%c'\n" : |
89 | "inflate: * literal 0x%02x\n", t->base)); | 64 | "inflate: * literal 0x%02x\n", t->base)); |
90 | *q++ = (Byte)t->base; | 65 | *q++ = (Byte)t->base; |
91 | m--; | 66 | m--; |
67 | continue; | ||
92 | } | 68 | } |
93 | else /* it's a length */ | 69 | do { |
94 | { | 70 | DUMPBITS(t->bits) |
95 | /* get length of block to copy (already have extra bits) */ | 71 | if (e & 16) |
96 | c = t->base + ((uInt)b & inflate_mask[e]); | 72 | { |
97 | DUMPBITS(e); | 73 | /* get extra bits for length */ |
98 | Tracevv((stderr, "inflate: * length %u\n", c)); | 74 | e &= 15; |
75 | c = t->base + ((uInt)b & inflate_mask[e]); | ||
76 | DUMPBITS(e) | ||
77 | Tracevv((stderr, "inflate: * length %u\n", c)); | ||
99 | 78 | ||
100 | /* decode distance base of block to copy */ | 79 | /* decode distance base of block to copy */ |
101 | GRABBITS(15); /* max bits for distance code */ | 80 | GRABBITS(15); /* max bits for distance code */ |
102 | if ((e = (t = td + ((uInt)b & md))->exop) < 0) | 81 | e = (t = td + ((uInt)b & md))->exop; |
103 | do { | 82 | do { |
104 | if (e == -128) | 83 | DUMPBITS(t->bits) |
84 | if (e & 16) | ||
85 | { | ||
86 | /* get extra bits to add to distance base */ | ||
87 | e &= 15; | ||
88 | GRABBITS(e) /* get extra bits (up to 13) */ | ||
89 | d = t->base + ((uInt)b & inflate_mask[e]); | ||
90 | DUMPBITS(e) | ||
91 | Tracevv((stderr, "inflate: * distance %u\n", d)); | ||
92 | |||
93 | /* do the copy */ | ||
94 | m -= c; | ||
95 | if ((uInt)(q - s->window) >= d) /* offset before dest */ | ||
96 | { /* just copy */ | ||
97 | r = q - d; | ||
98 | *q++ = *r++; c--; /* minimum count is three, */ | ||
99 | *q++ = *r++; c--; /* so unroll loop a little */ | ||
100 | } | ||
101 | else /* else offset after destination */ | ||
102 | { | ||
103 | e = d - (q - s->window); /* bytes from offset to end */ | ||
104 | r = s->end - e; /* pointer to offset */ | ||
105 | if (c > e) /* if source crosses, */ | ||
106 | { | ||
107 | c -= e; /* copy to end of window */ | ||
108 | do { | ||
109 | *q++ = *r++; | ||
110 | } while (--e); | ||
111 | r = s->window; /* copy rest from start of window */ | ||
112 | } | ||
113 | } | ||
114 | do { /* copy all or what's left */ | ||
115 | *q++ = *r++; | ||
116 | } while (--c); | ||
117 | break; | ||
118 | } | ||
119 | else if ((e & 64) == 0) | ||
120 | e = (t = t->next + ((uInt)b & inflate_mask[e]))->exop; | ||
121 | else | ||
105 | { | 122 | { |
106 | z->msg = "invalid distance code"; | 123 | z->msg = "invalid distance code"; |
107 | UNGRAB | 124 | UNGRAB |
108 | UPDATE | 125 | UPDATE |
109 | return Z_DATA_ERROR; | 126 | return Z_DATA_ERROR; |
110 | } | 127 | } |
111 | DUMPBITS(t->bits) | 128 | } while (1); |
112 | e = -e; | 129 | break; |
113 | } while ((e = (t = t->next + ((uInt)b & inflate_mask[e]))->exop) < 0); | ||
114 | DUMPBITS(t->bits) | ||
115 | |||
116 | /* get extra bits to add to distance base */ | ||
117 | GRABBITS((uInt)e) /* get extra bits (up to 13) */ | ||
118 | d = t->base + ((uInt)b & inflate_mask[e]); | ||
119 | DUMPBITS(e) | ||
120 | Tracevv((stderr, "inflate: * distance %u\n", d)); | ||
121 | |||
122 | /* do the copy */ | ||
123 | m -= c; | ||
124 | if ((uInt)(q - s->window) >= d) /* if offset before destination, */ | ||
125 | { /* just copy */ | ||
126 | r = q - d; | ||
127 | *q++ = *r++; c--; /* minimum count is three, */ | ||
128 | *q++ = *r++; c--; /* so unroll loop a little */ | ||
129 | do { | ||
130 | *q++ = *r++; | ||
131 | } while (--c); | ||
132 | } | 130 | } |
133 | else /* else offset after destination */ | 131 | if ((e & 64) == 0) |
134 | { | 132 | { |
135 | e = d - (q - s->window); /* bytes from offset to end */ | 133 | if ((e = (t = t->next + ((uInt)b & inflate_mask[e]))->exop) == 0) |
136 | r = s->end - e; /* pointer to offset */ | ||
137 | if (c > (uInt)e) /* if source crosses, */ | ||
138 | { | 134 | { |
139 | c -= e; /* copy to end of window */ | 135 | DUMPBITS(t->bits) |
140 | do { | 136 | Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ? |
141 | *q++ = *r++; | 137 | "inflate: * literal '%c'\n" : |
142 | } while (--e); | 138 | "inflate: * literal 0x%02x\n", t->base)); |
143 | r = s->window; /* copy rest from start of window */ | 139 | *q++ = (Byte)t->base; |
140 | m--; | ||
141 | break; | ||
144 | } | 142 | } |
145 | do { /* copy all or what's left */ | ||
146 | *q++ = *r++; | ||
147 | } while (--c); | ||
148 | } | 143 | } |
149 | } | 144 | else if (e & 32) |
145 | { | ||
146 | Tracevv((stderr, "inflate: * end of block\n")); | ||
147 | UNGRAB | ||
148 | UPDATE | ||
149 | return Z_STREAM_END; | ||
150 | } | ||
151 | else | ||
152 | { | ||
153 | z->msg = "invalid literal/length code"; | ||
154 | UNGRAB | ||
155 | UPDATE | ||
156 | return Z_DATA_ERROR; | ||
157 | } | ||
158 | } while (1); | ||
150 | } while (m >= 258 && n >= 10); | 159 | } while (m >= 258 && n >= 10); |
151 | 160 | ||
152 | /* not enough input or output--restore pointers and return */ | 161 | /* not enough input or output--restore pointers and return */ |
@@ -41,7 +41,7 @@ local uInt cplens[] = { /* Copy lengths for literal codes 257..285 */ | |||
41 | /* actually lengths - 2; also see note #13 above about 258 */ | 41 | /* actually lengths - 2; also see note #13 above about 258 */ |
42 | local uInt cplext[] = { /* Extra bits for literal codes 257..285 */ | 42 | local uInt cplext[] = { /* Extra bits for literal codes 257..285 */ |
43 | 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, | 43 | 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, |
44 | 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 128, 128}; /* 128==invalid */ | 44 | 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 192, 192}; /* 192==invalid */ |
45 | local uInt cpdist[] = { /* Copy offsets for distance codes 0..29 */ | 45 | local uInt cpdist[] = { /* Copy offsets for distance codes 0..29 */ |
46 | 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, | 46 | 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, |
47 | 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, | 47 | 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, |
@@ -246,7 +246,7 @@ z_stream *zs; /* for zalloc function */ | |||
246 | { | 246 | { |
247 | x[h] = i; /* save pattern for backing up */ | 247 | x[h] = i; /* save pattern for backing up */ |
248 | r.bits = (Byte)l; /* bits to dump before this table */ | 248 | r.bits = (Byte)l; /* bits to dump before this table */ |
249 | r.exop = -(Char)j; /* bits in this table */ | 249 | r.exop = j; /* bits in this table */ |
250 | r.next = q; /* pointer to this table */ | 250 | r.next = q; /* pointer to this table */ |
251 | j = i >> (w - l); /* (get around Turbo C bug) */ | 251 | j = i >> (w - l); /* (get around Turbo C bug) */ |
252 | u[h-1][j] = r; /* connect to last table */ | 252 | u[h-1][j] = r; /* connect to last table */ |
@@ -256,15 +256,15 @@ z_stream *zs; /* for zalloc function */ | |||
256 | /* set up table entry in r */ | 256 | /* set up table entry in r */ |
257 | r.bits = (Byte)(k - w); | 257 | r.bits = (Byte)(k - w); |
258 | if (p >= v + n) | 258 | if (p >= v + n) |
259 | r.exop = (Char)(-128); /* out of values--invalid code */ | 259 | r.exop = 128 + 64; /* out of values--invalid code */ |
260 | else if (*p < s) | 260 | else if (*p < s) |
261 | { | 261 | { |
262 | r.exop = (Char)(*p < 256 ? 16 : -64); /* 256 is end-of-block code */ | 262 | r.exop = (*p < 256 ? 0 : 32 + 64); /* 256 is end-of-block */ |
263 | r.base = *p++; /* simple code is just the value */ | 263 | r.base = *p++; /* simple code is just the value */ |
264 | } | 264 | } |
265 | else | 265 | else |
266 | { | 266 | { |
267 | r.exop = (Char)e[*p - s]; /* non-simple--look up in lists */ | 267 | r.exop = e[*p - s] + 16 + 64; /* non-simple--look up in lists */ |
268 | r.base = d[*p++ - s]; | 268 | r.base = d[*p++ - s]; |
269 | } | 269 | } |
270 | 270 | ||
@@ -457,10 +457,6 @@ z_stream *z; /* for zfree function */ | |||
457 | { | 457 | { |
458 | register inflate_huft *p, *q; | 458 | register inflate_huft *p, *q; |
459 | 459 | ||
460 | /* Don't free fixed trees */ | ||
461 | if (t >= fixed_mem && t <= fixed_mem + FIXEDH) | ||
462 | return Z_OK; | ||
463 | |||
464 | /* Go through linked list, freeing from the malloced (t[-1]) address. */ | 460 | /* Go through linked list, freeing from the malloced (t[-1]) address. */ |
465 | p = t; | 461 | p = t; |
466 | while (p != Z_NULL) | 462 | while (p != Z_NULL) |
@@ -9,24 +9,13 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | /* Huffman code lookup table entry--this entry is four bytes for machines | 11 | /* Huffman code lookup table entry--this entry is four bytes for machines |
12 | that have 16-bit pointers (e.g. PC's in the small or medium model). | 12 | that have 16-bit pointers (e.g. PC's in the small or medium model). */ |
13 | Valid extra bits (exop) are 0..13. exop == -64 is EOB (end of block), | ||
14 | exop == 16 means that v is a literal, exop < 0 means that v is a pointer | ||
15 | to the next table, which codes -exop bits, and lastly exop == -128 | ||
16 | indicates an unused code. If a code with exop == -128 is looked up, | ||
17 | this implies an error in the data. */ | ||
18 | |||
19 | #if defined(STDC) || defined(sgi) | ||
20 | typedef signed char Char; | ||
21 | #else | ||
22 | typedef char Char; /* just hope that char is signed */ | ||
23 | #endif | ||
24 | 13 | ||
25 | typedef struct inflate_huft_s inflate_huft; | 14 | typedef struct inflate_huft_s inflate_huft; |
26 | struct inflate_huft_s { | 15 | struct inflate_huft_s { |
27 | union { | 16 | union { |
28 | struct { | 17 | struct { |
29 | Char Exop; /* number of extra bits or operation */ | 18 | Byte Exop; /* number of extra bits or operation */ |
30 | Byte Bits; /* number of bits in this code or subcode */ | 19 | Byte Bits; /* number of bits in this code or subcode */ |
31 | } what; | 20 | } what; |
32 | Byte *pad; /* pad structure to a power of 2 (4 bytes for */ | 21 | Byte *pad; /* pad structure to a power of 2 (4 bytes for */ |
@@ -35,8 +35,11 @@ struct inflate_blocks_state { | |||
35 | uInt bb; /* bit length tree depth */ | 35 | uInt bb; /* bit length tree depth */ |
36 | inflate_huft *tb; /* bit length decoding tree */ | 36 | inflate_huft *tb; /* bit length decoding tree */ |
37 | } trees; /* if DTREE, decoding info for trees */ | 37 | } trees; /* if DTREE, decoding info for trees */ |
38 | struct inflate_codes_state | 38 | struct { |
39 | *codes; /* if CODES, current state */ | 39 | inflate_huft *tl, *td; /* trees to free */ |
40 | struct inflate_codes_state | ||
41 | *codes; | ||
42 | } decode; /* if CODES, current state */ | ||
40 | } sub; /* submode */ | 43 | } sub; /* submode */ |
41 | uInt last; /* true if this block is the last block */ | 44 | uInt last; /* true if this block is the last block */ |
42 | 45 | ||
@@ -27,7 +27,7 @@ extern int unlink __P((const char *)); | |||
27 | # include <string.h> | 27 | # include <string.h> |
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | #ifdef MSDOS | 30 | #if defined(MSDOS) || defined(OS2) || defined(WIN32) |
31 | # include <fcntl.h> | 31 | # include <fcntl.h> |
32 | # include <io.h> | 32 | # include <io.h> |
33 | # define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) | 33 | # define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) |
@@ -739,6 +739,17 @@ void ct_stored_block(s, buf, stored_len, eof) | |||
739 | } | 739 | } |
740 | 740 | ||
741 | /* =========================================================================== | 741 | /* =========================================================================== |
742 | * Send one empty static block to give enough lookahead for inflate | ||
743 | */ | ||
744 | void ct_align(s) | ||
745 | deflate_state *s; | ||
746 | { | ||
747 | send_bits(s, STATIC_TREES<<1, 3); | ||
748 | send_code(s, END_BLOCK, static_ltree); | ||
749 | s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ | ||
750 | } | ||
751 | |||
752 | /* =========================================================================== | ||
742 | * Determine the best encoding for the current block: dynamic trees, static | 753 | * Determine the best encoding for the current block: dynamic trees, static |
743 | * trees or store, and output the encoded block to the zip file. This function | 754 | * trees or store, and output the encoded block to the zip file. This function |
744 | * returns the total compressed length for the file so far. | 755 | * returns the total compressed length for the file so far. |
@@ -28,8 +28,14 @@ | |||
28 | #if defined(MSDOS) && !defined(__32BIT__) | 28 | #if defined(MSDOS) && !defined(__32BIT__) |
29 | # define MAXSEG_64K | 29 | # define MAXSEG_64K |
30 | #endif | 30 | #endif |
31 | #if !defined(STDC) && (defined(MSDOS) || defined(__STDC__)) | 31 | #ifndef STDC |
32 | # define STDC | 32 | # if defined(MSDOS) || defined(__STDC__) || defined(__cplusplus) |
33 | # define STDC | ||
34 | # endif | ||
35 | #endif | ||
36 | |||
37 | #if !defined(STDC) && !defined(const) | ||
38 | # define const | ||
33 | #endif | 39 | #endif |
34 | 40 | ||
35 | /* Maximum value for memLevel in deflateInit2 */ | 41 | /* Maximum value for memLevel in deflateInit2 */ |
@@ -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 0.92 May 3rd, 1995. | 2 | version 0.93 June 25th, 1995. |
3 | 3 | ||
4 | Copyright (C) 1995 Jean-loup Gailly and Mark Adler | 4 | Copyright (C) 1995 Jean-loup Gailly and Mark Adler |
5 | 5 | ||
@@ -20,7 +20,7 @@ | |||
20 | 3. This notice may not be removed or altered from any source distribution. | 20 | 3. This notice may not be removed or altered from any source distribution. |
21 | 21 | ||
22 | Jean-loup Gailly Mark Adler | 22 | Jean-loup Gailly Mark Adler |
23 | gzip@prep.ai.mit.edu madler@cco.caltech.edu | 23 | gzip@prep.ai.mit.edu madler@alumni.caltech.edu |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #ifndef _ZLIB_H | 26 | #ifndef _ZLIB_H |
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | #include "zconf.h" | 29 | #include "zconf.h" |
30 | 30 | ||
31 | #define ZLIB_VERSION "0.92" | 31 | #define ZLIB_VERSION "0.93" |
32 | 32 | ||
33 | /* | 33 | /* |
34 | The 'zlib' compression library provides in-memory compression and | 34 | The 'zlib' compression library provides in-memory compression and |
@@ -108,6 +108,7 @@ typedef struct z_stream_s { | |||
108 | #define Z_NO_FLUSH 0 | 108 | #define Z_NO_FLUSH 0 |
109 | #define Z_PARTIAL_FLUSH 1 | 109 | #define Z_PARTIAL_FLUSH 1 |
110 | #define Z_FULL_FLUSH 2 | 110 | #define Z_FULL_FLUSH 2 |
111 | #define Z_SYNC_FLUSH 3 /* experimental: partial_flush + byte align */ | ||
111 | #define Z_FINISH 4 | 112 | #define Z_FINISH 4 |
112 | /* See deflate() below for the usage of these constants */ | 113 | /* See deflate() below for the usage of these constants */ |
113 | 114 | ||
@@ -15,11 +15,9 @@ | |||
15 | 15 | ||
16 | #include "zlib.h" | 16 | #include "zlib.h" |
17 | 17 | ||
18 | #ifdef __GNUC__ | 18 | /* #ifndef __GNUC__ disable inline for now */ |
19 | # define INLINE inline | 19 | # define inline |
20 | #else | 20 | /* #endif */ |
21 | # define INLINE | ||
22 | #endif | ||
23 | 21 | ||
24 | #ifdef MSDOS | 22 | #ifdef MSDOS |
25 | # include <stddef.h> | 23 | # include <stddef.h> |