Lines Matching defs:strm
74 local int deflateStateCheck OF((z_streamp strm));
86 local void flush_pending OF((z_streamp strm));
87 local unsigned read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
229 int ZEXPORT deflateInit_(strm, level, version, stream_size)
230 z_streamp strm;
235 return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
237 /* To do: ignore strm->next_in if we use it as window */
241 int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
243 z_streamp strm;
260 if (strm == Z_NULL) return Z_STREAM_ERROR;
262 strm->msg = Z_NULL;
263 if (strm->zalloc == (alloc_func)0) {
267 strm->zalloc = zcalloc;
268 strm->opaque = (voidpf)0;
271 if (strm->zfree == (free_func)0)
275 strm->zfree = zcfree;
300 s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
302 strm->state = (struct internal_state FAR *)s;
303 s->strm = strm;
317 s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
318 s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
319 s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos));
364 s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4);
370 strm->msg = ERR_MSG(Z_MEM_ERROR);
371 deflateEnd (strm);
385 return deflateReset(strm);
391 local int deflateStateCheck (strm)
392 z_streamp strm;
395 if (strm == Z_NULL ||
396 strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
398 s = strm->state;
399 if (s == Z_NULL || s->strm != strm || (s->status != INIT_STATE &&
414 int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
415 z_streamp strm;
425 if (deflateStateCheck(strm) || dictionary == Z_NULL)
427 s = strm->state;
434 strm->adler = adler32(strm->adler, dictionary, dictLength);
450 avail = strm->avail_in;
451 next = strm->next_in;
452 strm->avail_in = dictLength;
453 strm->next_in = (z_const Bytef *)dictionary;
476 strm->next_in = next;
477 strm->avail_in = avail;
483 int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength)
484 z_streamp strm;
491 if (deflateStateCheck(strm))
493 s = strm->state;
505 int ZEXPORT deflateResetKeep (strm)
506 z_streamp strm;
510 if (deflateStateCheck(strm)) {
514 strm->total_in = strm->total_out = 0;
515 strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
516 strm->data_type = Z_UNKNOWN;
518 s = (deflate_state *)strm->state;
530 strm->adler =
543 int ZEXPORT deflateReset (strm)
544 z_streamp strm;
548 ret = deflateResetKeep(strm);
550 lm_init(strm->state);
555 int ZEXPORT deflateSetHeader (strm, head)
556 z_streamp strm;
559 if (deflateStateCheck(strm) || strm->state->wrap != 2)
561 strm->state->gzhead = head;
566 int ZEXPORT deflatePending (strm, pending, bits)
569 z_streamp strm;
571 if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
573 *pending = strm->state->pending;
575 *bits = strm->state->bi_valid;
580 int ZEXPORT deflatePrime (strm, bits, value)
581 z_streamp strm;
588 if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
589 s = strm->state;
607 int ZEXPORT deflateParams(strm, level, strategy)
608 z_streamp strm;
615 if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
616 s = strm->state;
631 int err = deflate(strm, Z_BLOCK);
634 if (strm->avail_in || (s->strstart - s->block_start) + s->lookahead)
656 int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
657 z_streamp strm;
665 if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
666 s = strm->state;
691 uLong ZEXPORT deflateBound(strm, sourceLen)
692 z_streamp strm;
703 if (deflateStateCheck(strm))
707 s = strm->state;
767 * strm->next_out buffer and copying into it. (See also read_buf()).
769 local void flush_pending(strm)
770 z_streamp strm;
773 deflate_state *s = strm->state;
777 if (len > strm->avail_out) len = strm->avail_out;
780 zmemcpy(strm->next_out, s->pending_out, len);
781 strm->next_out += len;
783 strm->total_out += len;
784 strm->avail_out -= len;
797 strm->adler = crc32(strm->adler, s->pending_buf + (beg), \
802 int ZEXPORT deflate (strm, flush)
803 z_streamp strm;
809 if (deflateStateCheck(strm) || flush > Z_BLOCK || flush < 0) {
812 s = strm->state;
814 if (strm->next_out == Z_NULL ||
815 (strm->avail_in != 0 && strm->next_in == Z_NULL) ||
817 ERR_RETURN(strm, Z_STREAM_ERROR);
819 if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
826 flush_pending(strm);
827 if (strm->avail_out == 0) {
842 } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) &&
844 ERR_RETURN(strm, Z_BUF_ERROR);
848 if (s->status == FINISH_STATE && strm->avail_in != 0) {
849 ERR_RETURN(strm, Z_BUF_ERROR);
876 putShortMSB(s, (uInt)(strm->adler >> 16));
877 putShortMSB(s, (uInt)(strm->adler & 0xffff));
879 strm->adler = adler32(0L, Z_NULL, 0);
883 flush_pending(strm);
892 strm->adler = crc32(0L, Z_NULL, 0);
909 flush_pending(strm);
935 strm->adler = crc32(strm->adler, s->pending_buf,
952 flush_pending(strm);
975 flush_pending(strm);
997 flush_pending(strm);
1014 flush_pending(strm);
1020 put_byte(s, (Byte)(strm->adler & 0xff));
1021 put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
1022 strm->adler = crc32(0L, Z_NULL, 0);
1027 flush_pending(strm);
1037 if (strm->avail_in != 0 || s->lookahead != 0 ||
1050 if (strm->avail_out == 0) {
1079 flush_pending(strm);
1080 if (strm->avail_out == 0) {
1093 put_byte(s, (Byte)(strm->adler & 0xff));
1094 put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
1095 put_byte(s, (Byte)((strm->adler >> 16) & 0xff));
1096 put_byte(s, (Byte)((strm->adler >> 24) & 0xff));
1097 put_byte(s, (Byte)(strm->total_in & 0xff));
1098 put_byte(s, (Byte)((strm->total_in >> 8) & 0xff));
1099 put_byte(s, (Byte)((strm->total_in >> 16) & 0xff));
1100 put_byte(s, (Byte)((strm->total_in >> 24) & 0xff));
1105 putShortMSB(s, (uInt)(strm->adler >> 16));
1106 putShortMSB(s, (uInt)(strm->adler & 0xffff));
1108 flush_pending(strm);
1117 int ZEXPORT deflateEnd (strm)
1118 z_streamp strm;
1122 if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
1124 status = strm->state->status;
1127 TRY_FREE(strm, strm->state->pending_buf);
1128 TRY_FREE(strm, strm->state->head);
1129 TRY_FREE(strm, strm->state->prev);
1130 TRY_FREE(strm, strm->state->window);
1132 ZFREE(strm, strm->state);
1133 strm->state = Z_NULL;
1166 ds->strm = dest;
1199 * allocating a large strm->next_in buffer and copying from it.
1202 local unsigned read_buf(strm, buf, size)
1203 z_streamp strm;
1207 unsigned len = strm->avail_in;
1212 strm->avail_in -= len;
1214 zmemcpy(buf, strm->next_in, len);
1215 if (strm->state->wrap == 1) {
1216 strm->adler = adler32(strm->adler, buf, len);
1219 else if (strm->state->wrap == 2) {
1220 strm->adler = crc32(strm->adler, buf, len);
1223 strm->next_in += len;
1224 strm->total_in += len;
1559 if (s->strm->avail_in == 0) break;
1574 n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
1601 } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
1652 flush_pending(s->strm); \
1659 if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
1698 unsigned used = s->strm->avail_in;
1706 if (s->strm->avail_out < have) /* need room for header */
1709 have = s->strm->avail_out - have;
1711 if (len > (ulg)left + s->strm->avail_in)
1712 len = left + s->strm->avail_in; /* limit len to the input */
1723 len != left + s->strm->avail_in))
1729 last = flush == Z_FINISH && len == left + s->strm->avail_in ? 1 : 0;
1739 flush_pending(s->strm);
1751 zmemcpy(s->strm->next_out, s->window + s->block_start, left);
1752 s->strm->next_out += left;
1753 s->strm->avail_out -= left;
1754 s->strm->total_out += left;
1763 read_buf(s->strm, s->strm->next_out, len);
1764 s->strm->next_out += len;
1765 s->strm->avail_out -= len;
1766 s->strm->total_out += len;
1776 used -= s->strm->avail_in; /* number of input bytes directly copied */
1783 zmemcpy(s->window, s->strm->next_in - s->w_size, s->w_size);
1797 zmemcpy(s->window + s->strstart, s->strm->next_in - used, used);
1812 s->strm->avail_in == 0 && (long)s->strstart == s->block_start)
1817 if (s->strm->avail_in > have && s->block_start >= (long)s->w_size) {
1828 if (have > s->strm->avail_in)
1829 have = s->strm->avail_in;
1831 read_buf(s->strm, s->window + s->strstart, have);
1850 s->strm->avail_in == 0 && left <= have)) {
1852 last = flush == Z_FINISH && s->strm->avail_in == 0 &&
1856 flush_pending(s->strm);
2071 if (s->strm->avail_out == 0) return need_more;