summaryrefslogtreecommitdiff
path: root/contrib/infback9/infback9.diff
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/infback9/infback9.diff')
-rw-r--r--contrib/infback9/infback9.diff427
1 files changed, 427 insertions, 0 deletions
diff --git a/contrib/infback9/infback9.diff b/contrib/infback9/infback9.diff
new file mode 100644
index 0000000..cbe2e49
--- /dev/null
+++ b/contrib/infback9/infback9.diff
@@ -0,0 +1,427 @@
1*** infback.c Mon Aug 11 16:48:06 2003
2--- infback9.c Mon Sep 8 21:22:46 2003
3***************
4*** 1,19 ****
5! /* infback.c -- inflate using a call-back interface
6 * Copyright (C) 1995-2003 Mark Adler
7 * For conditions of distribution and use, see copyright notice in zlib.h
8 */
9
10- /*
11- This code is largely copied from inflate.c. Normally either infback.o or
12- inflate.o would be linked into an application--not both. The interface
13- with inffast.c is retained so that optimized assembler-coded versions of
14- inflate_fast() can be used with either inflate.c or infback.c.
15- */
16-
17 #include "zutil.h"
18! #include "inftrees.h"
19 #include "inflate.h"
20- #include "inffast.h"
21
22 /* function prototypes */
23 local void fixedtables OF((struct inflate_state FAR *state));
24--- 1,12 ----
25! /* infback9.c -- inflate deflate64 data using a call-back interface
26 * Copyright (C) 1995-2003 Mark Adler
27 * For conditions of distribution and use, see copyright notice in zlib.h
28 */
29
30 #include "zutil.h"
31! #include "infback9.h"
32! #include "inftree9.h"
33 #include "inflate.h"
34
35 /* function prototypes */
36 local void fixedtables OF((struct inflate_state FAR *state));
37***************
38*** 22,33 ****
39 strm provides memory allocation functions in zalloc and zfree, or
40 Z_NULL to use the library memory allocation functions.
41
42! windowBits is in the range 8..15, and window is a user-supplied
43! window and output buffer that is 2**windowBits bytes.
44 */
45! int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size)
46 z_stream FAR *strm;
47- int windowBits;
48 unsigned char FAR *window;
49 const char *version;
50 int stream_size;
51--- 15,24 ----
52 strm provides memory allocation functions in zalloc and zfree, or
53 Z_NULL to use the library memory allocation functions.
54
55! window is a user-supplied window and output buffer that is 64K bytes.
56 */
57! int ZEXPORT inflateBack9Init_(strm, window, version, stream_size)
58 z_stream FAR *strm;
59 unsigned char FAR *window;
60 const char *version;
61 int stream_size;
62***************
63*** 37,44 ****
64 if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
65 stream_size != (int)(sizeof(z_stream)))
66 return Z_VERSION_ERROR;
67! if (strm == Z_NULL || window == Z_NULL ||
68! windowBits < 8 || windowBits > 15)
69 return Z_STREAM_ERROR;
70 strm->msg = Z_NULL; /* in case we return an error */
71 if (strm->zalloc == (alloc_func)0) {
72--- 28,34 ----
73 if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
74 stream_size != (int)(sizeof(z_stream)))
75 return Z_VERSION_ERROR;
76! if (strm == Z_NULL || window == Z_NULL)
77 return Z_STREAM_ERROR;
78 strm->msg = Z_NULL; /* in case we return an error */
79 if (strm->zalloc == (alloc_func)0) {
80***************
81*** 51,58 ****
82 if (state == Z_NULL) return Z_MEM_ERROR;
83 Tracev((stderr, "inflate: allocated\n"));
84 strm->state = (voidpf)state;
85! state->wbits = windowBits;
86! state->wsize = 1U << windowBits;
87 state->window = window;
88 state->write = 0;
89 state->whave = 0;
90--- 41,48 ----
91 if (state == Z_NULL) return Z_MEM_ERROR;
92 Tracev((stderr, "inflate: allocated\n"));
93 strm->state = (voidpf)state;
94! state->wbits = 16;
95! state->wsize = 1U << 16;
96 state->window = window;
97 state->write = 0;
98 state->whave = 0;
99***************
100*** 91,110 ****
101 next = fixed;
102 lenfix = next;
103 bits = 9;
104! inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
105
106 /* distance table */
107 sym = 0;
108 while (sym < 32) state->lens[sym++] = 5;
109 distfix = next;
110 bits = 5;
111! inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
112
113 /* do this just once */
114 virgin = 0;
115 }
116 #else /* !BUILDFIXED */
117! # include "inffixed.h"
118 #endif /* BUILDFIXED */
119 state->lencode = lenfix;
120 state->lenbits = 9;
121--- 81,100 ----
122 next = fixed;
123 lenfix = next;
124 bits = 9;
125! inflate_table9(LENS, state->lens, 288, &(next), &(bits), state->work);
126
127 /* distance table */
128 sym = 0;
129 while (sym < 32) state->lens[sym++] = 5;
130 distfix = next;
131 bits = 5;
132! inflate_table9(DISTS, state->lens, 32, &(next), &(bits), state->work);
133
134 /* do this just once */
135 virgin = 0;
136 }
137 #else /* !BUILDFIXED */
138! # include "inffix9.h"
139 #endif /* BUILDFIXED */
140 state->lencode = lenfix;
141 state->lenbits = 9;
142***************
143*** 114,141 ****
144
145 /* Macros for inflateBack(): */
146
147- /* Load returned state from inflate_fast() */
148- #define LOAD() \
149- do { \
150- put = strm->next_out; \
151- left = strm->avail_out; \
152- next = strm->next_in; \
153- have = strm->avail_in; \
154- hold = state->hold; \
155- bits = state->bits; \
156- } while (0)
157-
158- /* Set state from registers for inflate_fast() */
159- #define RESTORE() \
160- do { \
161- strm->next_out = put; \
162- strm->avail_out = left; \
163- strm->next_in = next; \
164- strm->avail_in = have; \
165- state->hold = hold; \
166- state->bits = bits; \
167- } while (0)
168-
169 /* Clear the input bit accumulator */
170 #define INITBITS() \
171 do { \
172--- 104,109 ----
173***************
174*** 237,243 ****
175 inflateBack() can also return Z_STREAM_ERROR if the input parameters
176 are not correct, i.e. strm is Z_NULL or the state was not initialized.
177 */
178! int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc)
179 z_stream FAR *strm;
180 in_func in;
181 void FAR *in_desc;
182--- 205,211 ----
183 inflateBack() can also return Z_STREAM_ERROR if the input parameters
184 are not correct, i.e. strm is Z_NULL or the state was not initialized.
185 */
186! int ZEXPORT inflateBack9(strm, in, in_desc, out, out_desc)
187 z_stream FAR *strm;
188 in_func in;
189 void FAR *in_desc;
190***************
191*** 354,366 ****
192 DROPBITS(5);
193 state->ncode = BITS(4) + 4;
194 DROPBITS(4);
195! #ifndef PKZIP_BUG_WORKAROUND
196! if (state->nlen > 286 || state->ndist > 30) {
197! strm->msg = (char *)"too many length or distance symbols";
198 state->mode = BAD;
199 break;
200 }
201- #endif
202 Tracev((stderr, "inflate: table sizes ok\n"));
203
204 /* get code length code lengths (not a typo) */
205--- 322,332 ----
206 DROPBITS(5);
207 state->ncode = BITS(4) + 4;
208 DROPBITS(4);
209! if (state->nlen > 286) {
210! strm->msg = (char *)"too many length symbols";
211 state->mode = BAD;
212 break;
213 }
214 Tracev((stderr, "inflate: table sizes ok\n"));
215
216 /* get code length code lengths (not a typo) */
217***************
218*** 375,381 ****
219 state->next = state->codes;
220 state->lencode = (code const FAR *)(state->next);
221 state->lenbits = 7;
222! ret = inflate_table(CODES, state->lens, 19, &(state->next),
223 &(state->lenbits), state->work);
224 if (ret) {
225 strm->msg = (char *)"invalid code lengths set";
226--- 341,347 ----
227 state->next = state->codes;
228 state->lencode = (code const FAR *)(state->next);
229 state->lenbits = 7;
230! ret = inflate_table9(CODES, state->lens, 19, &(state->next),
231 &(state->lenbits), state->work);
232 if (ret) {
233 strm->msg = (char *)"invalid code lengths set";
234***************
235*** 438,445 ****
236 state->next = state->codes;
237 state->lencode = (code const FAR *)(state->next);
238 state->lenbits = 9;
239! ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
240! &(state->lenbits), state->work);
241 if (ret) {
242 strm->msg = (char *)"invalid literal/lengths set";
243 state->mode = BAD;
244--- 404,411 ----
245 state->next = state->codes;
246 state->lencode = (code const FAR *)(state->next);
247 state->lenbits = 9;
248! ret = inflate_table9(LENS, state->lens, state->nlen,
249! &(state->next), &(state->lenbits), state->work);
250 if (ret) {
251 strm->msg = (char *)"invalid literal/lengths set";
252 state->mode = BAD;
253***************
254*** 447,454 ****
255 }
256 state->distcode = (code const FAR *)(state->next);
257 state->distbits = 6;
258! ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
259! &(state->next), &(state->distbits), state->work);
260 if (ret) {
261 strm->msg = (char *)"invalid distances set";
262 state->mode = BAD;
263--- 413,421 ----
264 }
265 state->distcode = (code const FAR *)(state->next);
266 state->distbits = 6;
267! ret = inflate_table9(DISTS, state->lens + state->nlen,
268! state->ndist, &(state->next), &(state->distbits),
269! state->work);
270 if (ret) {
271 strm->msg = (char *)"invalid distances set";
272 state->mode = BAD;
273***************
274*** 458,473 ****
275 state->mode = LEN;
276
277 case LEN:
278- /* use inflate_fast() if we have enough input and output */
279- if (have >= 6 && left >= 258) {
280- RESTORE();
281- if (state->whave < state->wsize)
282- state->whave = state->wsize - left;
283- inflate_fast(strm, state->wsize);
284- LOAD();
285- break;
286- }
287-
288 /* get a literal, length, or end-of-block code */
289 for (;;) {
290 this = state->lencode[BITS(state->lenbits)];
291--- 425,430 ----
292***************
293*** 607,613 ****
294 return ret;
295 }
296
297! int ZEXPORT inflateBackEnd(strm)
298 z_stream FAR *strm;
299 {
300 if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
301--- 564,570 ----
302 return ret;
303 }
304
305! int ZEXPORT inflateBack9End(strm)
306 z_stream FAR *strm;
307 {
308 if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
309*** inftrees.c Sun Sep 7 10:59:10 2003
310--- inftree9.c Mon Sep 8 20:54:36 2003
311***************
312*** 1,15 ****
313! /* inftrees.c -- generate Huffman trees for efficient decoding
314 * Copyright (C) 1995-2003 Mark Adler
315 * For conditions of distribution and use, see copyright notice in zlib.h
316 */
317
318 #include "zutil.h"
319! #include "inftrees.h"
320
321 #define MAXBITS 15
322
323! const char inflate_copyright[] =
324! " inflate 1.2.0.5 Copyright 1995-2003 Mark Adler ";
325 /*
326 If you use the zlib library in a product, an acknowledgment is welcome
327 in the documentation of your product. If for some reason you cannot
328--- 1,15 ----
329! /* inftree9.c -- generate Huffman trees for efficient decoding
330 * Copyright (C) 1995-2003 Mark Adler
331 * For conditions of distribution and use, see copyright notice in zlib.h
332 */
333
334 #include "zutil.h"
335! #include "inftree9.h"
336
337 #define MAXBITS 15
338
339! const char inflate9_copyright[] =
340! " inflate9 1.2.0.5 Copyright 1995-2003 Mark Adler ";
341 /*
342 If you use the zlib library in a product, an acknowledgment is welcome
343 in the documentation of your product. If for some reason you cannot
344***************
345*** 29,35 ****
346 table index bits. It will differ if the request is greater than the
347 longest code or if it is less than the shortest code.
348 */
349! int inflate_table(type, lens, codes, table, bits, work)
350 codetype type;
351 unsigned short FAR *lens;
352 unsigned codes;
353--- 29,35 ----
354 table index bits. It will differ if the request is greater than the
355 longest code or if it is less than the shortest code.
356 */
357! int inflate_table9(type, lens, codes, table, bits, work)
358 codetype type;
359 unsigned short FAR *lens;
360 unsigned codes;
361***************
362*** 59,76 ****
363 unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
364 static const unsigned short lbase[31] = { /* Length codes 257..285 base */
365 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
366! 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
367 static const unsigned short lext[31] = { /* Length codes 257..285 extra */
368 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
369! 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 192, 78};
370! static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
371 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
372 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
373! 8193, 12289, 16385, 24577, 0, 0};
374! static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
375 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
376 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
377! 28, 28, 29, 29, 64, 64};
378
379 /*
380 Process a set of code lengths to create a canonical Huffman code. The
381--- 59,76 ----
382 unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
383 static const unsigned short lbase[31] = { /* Length codes 257..285 base */
384 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
385! 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 3, 0, 0};
386 static const unsigned short lext[31] = { /* Length codes 257..285 extra */
387 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
388! 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 32, 192, 78};
389! static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
390 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
391 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
392! 8193, 12289, 16385, 24577, 32769, 49153};
393! static const unsigned short dext[32] = { /* Distance codes 0..31 extra */
394 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
395 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
396! 28, 28, 29, 29, 30, 30};
397
398 /*
399 Process a set of code lengths to create a canonical Huffman code. The
400*** inftrees.h Sun Aug 10 15:15:50 2003
401--- inftree9.h Mon Sep 8 20:54:51 2003
402***************
403*** 1,4 ****
404! /* inftrees.h -- header to use inftrees.c
405 * Copyright (C) 1995-2003 Mark Adler
406 * For conditions of distribution and use, see copyright notice in zlib.h
407 */
408--- 1,4 ----
409! /* inftree9.h -- header to use inftree9.c
410 * Copyright (C) 1995-2003 Mark Adler
411 * For conditions of distribution and use, see copyright notice in zlib.h
412 */
413***************
414*** 50,55 ****
415 DISTS
416 } codetype;
417
418! extern int inflate_table OF((codetype type, unsigned short FAR *lens,
419 unsigned codes, code FAR * FAR *table,
420 unsigned FAR *bits, unsigned short FAR *work));
421--- 50,55 ----
422 DISTS
423 } codetype;
424
425! extern int inflate_table9 OF((codetype type, unsigned short FAR *lens,
426 unsigned codes, code FAR * FAR *table,
427 unsigned FAR *bits, unsigned short FAR *work));