Lines Matching full:state
42 /* Our state */
58 struct deflate_state *state = (struct deflate_state *)v;
60 state->seqno = 0;
61 state->uncomp_rec = 0;
62 deflateReset(&state->cx);
72 struct deflate_state *state = (struct deflate_state *)v;
98 *wp++ = state->seqno >> 8;
99 *wp++ = state->seqno & 0377;
100 log_Printf(LogDEBUG, "DeflateOutput: Seq %d\n", state->seqno);
101 state->seqno++;
104 state->cx.next_out = wp;
105 state->cx.avail_out = DEFLATE_CHUNK_LEN - 2;
106 state->cx.next_in = MBUF_CTOP(mi);
107 state->cx.avail_in = mi->m_len;
112 if ((res = deflate(&state->cx, flush)) != Z_OK) {
116 res, state->cx.msg ? state->cx.msg : "");
119 state->seqno--;
123 if (flush == Z_SYNC_FLUSH && state->cx.avail_out != 0)
126 if (state->cx.avail_in == 0 && mi->m_next != NULL) {
128 state->cx.next_in = MBUF_CTOP(mi);
129 state->cx.avail_in = mi->m_len;
134 if (state->cx.avail_out == 0) {
139 state->cx.next_out = MBUF_CTOP(mo);
140 state->cx.avail_out = DEFLATE_CHUNK_LEN;
144 olen += (mo->m_len = DEFLATE_CHUNK_LEN - state->cx.avail_out);
190 struct deflate_state *state = (struct deflate_state *)v;
192 state->seqno = 0;
193 state->uncomp_rec = 0;
194 inflateReset(&state->cx);
201 struct deflate_state *state = (struct deflate_state *)v;
215 if (seq != state->seqno) {
216 if (seq <= state->uncomp_rec)
222 state->seqno = seq;
225 seq, state->seqno);
231 state->seqno++;
232 state->uncomp_rec = 0;
246 state->cx.next_in = MBUF_CTOP(mi);
247 state->cx.avail_in = mi->m_len;
248 state->cx.next_out = wp + 1;
249 state->cx.avail_out = 1;
257 if ((res = inflate(&state->cx, flush)) != Z_OK) {
261 res, state->cx.msg ? state->cx.msg : "");
268 if (flush == Z_SYNC_FLUSH && state->cx.avail_out != 0)
271 if (state->cx.avail_in == 0 && mi && (mi = m_free(mi)) != NULL) {
273 state->cx.next_in = MBUF_CTOP(mi);
274 ilen += (state->cx.avail_in = mi->m_len);
279 if (state->cx.avail_out == 0) {
285 state->cx.next_out--;
286 state->cx.avail_out = DEFLATE_CHUNK_LEN-1;
288 state->cx.avail_out = DEFLATE_CHUNK_LEN-2;
294 state->cx.next_out = MBUF_CTOP(mo);
295 state->cx.avail_out = DEFLATE_CHUNK_LEN;
310 olen += (mo->m_len = DEFLATE_CHUNK_LEN - state->cx.avail_out);
327 state->cx.next_out = garbage;
328 state->cx.avail_out = sizeof garbage;
329 state->cx.next_in = EMPTY_BLOCK;
330 state->cx.avail_in = sizeof EMPTY_BLOCK;
331 inflate(&state->cx, Z_SYNC_FLUSH);
339 struct deflate_state *state = (struct deflate_state *)v;
345 log_Printf(LogDEBUG, "DeflateDictSetup: Got seq %d\n", state->seqno);
372 state->cx.next_in = rp;
373 state->cx.avail_in = mi->m_len;
374 state->cx.next_out = garbage;
375 state->cx.avail_out = sizeof garbage;
380 if ((res = inflate(&state->cx, flush)) != Z_OK) {
386 res, state->cx.msg ? state->cx.msg : "");
388 state->cx.avail_in, state->cx.avail_out);
394 if (flush == Z_SYNC_FLUSH && state->cx.avail_out != 0)
397 if (state->cx.avail_in == 0 && mi && (mi = mi->m_next) != NULL) {
399 state->cx.next_in = MBUF_CTOP(mi);
400 state->cx.avail_in = mi->m_len;
405 if (state->cx.avail_out == 0) {
406 if (state->cx.avail_in == 0)
420 state->cx.next_out = garbage;
421 state->cx.avail_out = sizeof garbage;
428 state->seqno++;
429 state->uncomp_rec++;
491 struct deflate_state *state;
493 state = (struct deflate_state *)malloc(sizeof(struct deflate_state));
494 if (state != NULL) {
495 state->winsize = (o->data[0] >> 4) + 8;
496 state->cx.zalloc = NULL;
497 state->cx.opaque = NULL;
498 state->cx.zfree = NULL;
499 state->cx.next_out = NULL;
500 if (inflateInit2(&state->cx, -state->winsize) == Z_OK)
501 DeflateResetInput(state);
503 free(state);
504 state = NULL;
508 return state;
514 struct deflate_state *state;
516 state = (struct deflate_state *)malloc(sizeof(struct deflate_state));
517 if (state != NULL) {
518 state->winsize = (o->data[0] >> 4) + 8;
519 state->cx.zalloc = NULL;
520 state->cx.opaque = NULL;
521 state->cx.zfree = NULL;
522 state->cx.next_in = NULL;
523 if (deflateInit2(&state->cx, Z_DEFAULT_COMPRESSION, 8,
524 -state->winsize, 8, Z_DEFAULT_STRATEGY) == Z_OK)
525 DeflateResetOutput(state);
527 free(state);
528 state = NULL;
532 return state;
538 struct deflate_state *state = (struct deflate_state *)v;
540 inflateEnd(&state->cx);
541 free(state);
547 struct deflate_state *state = (struct deflate_state *)v;
549 deflateEnd(&state->cx);
550 free(state);