diff options
Diffstat (limited to 'infblock.c')
-rw-r--r-- | infblock.c | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -60,16 +60,17 @@ local uInt border[] = { /* Order of the bit length code lengths */ | |||
60 | the two sets of lengths. | 60 | the two sets of lengths. |
61 | */ | 61 | */ |
62 | 62 | ||
63 | struct inflate_blocks_state *inflate_blocks_new(z,wsize) | 63 | struct inflate_blocks_state *inflate_blocks_new(z, c, w) |
64 | z_stream *z; | 64 | z_stream *z; |
65 | uInt wsize; | 65 | check_func c; |
66 | uInt w; | ||
66 | { | 67 | { |
67 | struct inflate_blocks_state *s; | 68 | struct inflate_blocks_state *s; |
68 | 69 | ||
69 | if ((s = (struct inflate_blocks_state *)ZALLOC | 70 | if ((s = (struct inflate_blocks_state *)ZALLOC |
70 | (z,1,sizeof(struct inflate_blocks_state))) == Z_NULL) | 71 | (z,1,sizeof(struct inflate_blocks_state))) == Z_NULL) |
71 | return s; | 72 | return s; |
72 | if ((s->window = (Byte *)ZALLOC(z,1,wsize)) == Z_NULL) | 73 | if ((s->window = (Byte *)ZALLOC(z, 1, w)) == Z_NULL) |
73 | { | 74 | { |
74 | ZFREE(z, s); | 75 | ZFREE(z, s); |
75 | return Z_NULL; | 76 | return Z_NULL; |
@@ -77,8 +78,10 @@ uInt wsize; | |||
77 | s->mode = TYPE; | 78 | s->mode = TYPE; |
78 | s->bitk = 0; | 79 | s->bitk = 0; |
79 | s->read = s->write = s->window; | 80 | s->read = s->write = s->window; |
80 | s->end = s->window + wsize; | 81 | s->end = s->window + w; |
81 | s->check = 1; | 82 | s->checkfn = c; |
83 | if (s->checkfn != Z_NULL) | ||
84 | s->check = (*s->checkfn)(0L, Z_NULL, 0); | ||
82 | return s; | 85 | return s; |
83 | } | 86 | } |
84 | 87 | ||
@@ -312,8 +315,9 @@ z_stream *z; | |||
312 | uLong *c; | 315 | uLong *c; |
313 | int *e; | 316 | int *e; |
314 | { | 317 | { |
315 | *e = s->bitk > 7 ? (s->bitb >> (s->bitk & 7)) & 0xff : -1; | 318 | *e = (int)(s->bitk > 7 ? (s->bitb >> (s->bitk & 7)) & 0xff : -1); |
316 | *c = s->check; | 319 | if (s->checkfn != Z_NULL) |
320 | *c = s->check; | ||
317 | if (s->mode == BTREE || s->mode == DTREE) | 321 | if (s->mode == BTREE || s->mode == DTREE) |
318 | ZFREE(z, s->sub.trees.blens); | 322 | ZFREE(z, s->sub.trees.blens); |
319 | if (s->mode == CODES) | 323 | if (s->mode == CODES) |