summaryrefslogtreecommitdiff
path: root/infblock.c
diff options
context:
space:
mode:
Diffstat (limited to 'infblock.c')
-rw-r--r--infblock.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/infblock.c b/infblock.c
index 3a58280..4d8bd48 100644
--- a/infblock.c
+++ b/infblock.c
@@ -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
63struct inflate_blocks_state *inflate_blocks_new(z,wsize) 63struct inflate_blocks_state *inflate_blocks_new(z, c, w)
64z_stream *z; 64z_stream *z;
65uInt wsize; 65check_func c;
66uInt 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;
312uLong *c; 315uLong *c;
313int *e; 316int *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)