Lines Matching refs:strm

89 local void flush_pending  OF((z_streamp strm));
90 local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
210 int ZEXPORT deflateInit_(strm, level, version, stream_size) in deflateInit_() argument
211 z_streamp strm; in deflateInit_()
216 return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
222 int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, in deflateInit2_() argument
224 z_streamp strm; in deflateInit2_()
246 if (strm == Z_NULL) return Z_STREAM_ERROR;
248 strm->msg = Z_NULL;
249 if (strm->zalloc == (alloc_func)0) {
250 strm->zalloc = zcalloc;
251 strm->opaque = (voidpf)0;
253 if (strm->zfree == (free_func)0) strm->zfree = zcfree;
277 s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
279 strm->state = (struct internal_state FAR *)s;
280 s->strm = strm;
293 s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
294 s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
295 s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos));
299 overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
306 strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);
307 (void) deflateEnd (strm);
317 return deflateReset(strm);
321 int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) in deflateSetDictionary() argument
322 z_streamp strm; in deflateSetDictionary()
331 if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL ||
332 strm->state->wrap == 2 ||
333 (strm->state->wrap == 1 && strm->state->status != INIT_STATE))
336 s = strm->state;
338 strm->adler = adler32(strm->adler, dictionary, dictLength);
363 int ZEXPORT deflateReset (strm) in deflateReset() argument
364 z_streamp strm; in deflateReset()
368 if (strm == Z_NULL || strm->state == Z_NULL ||
369 strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) {
373 strm->total_in = strm->total_out = 0;
374 strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
375 strm->data_type = Z_UNKNOWN;
377 s = (deflate_state *)strm->state;
385 strm->adler =
399 int ZEXPORT deflateSetHeader (strm, head) in deflateSetHeader() argument
400 z_streamp strm; in deflateSetHeader()
403 if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
404 if (strm->state->wrap != 2) return Z_STREAM_ERROR;
405 strm->state->gzhead = head;
410 int ZEXPORT deflatePrime (strm, bits, value) in deflatePrime() argument
411 z_streamp strm; in deflatePrime()
415 if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
416 strm->state->bi_valid = bits;
417 strm->state->bi_buf = (ush)(value & ((1 << bits) - 1));
422 int ZEXPORT deflateParams(strm, level, strategy) in deflateParams() argument
423 z_streamp strm; in deflateParams()
431 if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
432 s = strm->state;
444 if (func != configuration_table[level].func && strm->total_in != 0) {
446 err = deflate(strm, Z_PARTIAL_FLUSH);
460 int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) in deflateTune() argument
461 z_streamp strm; in deflateTune()
469 if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
470 s = strm->state;
495 uLong ZEXPORT deflateBound(strm, sourceLen) in deflateBound() argument
496 z_streamp strm; in deflateBound()
507 if (strm == Z_NULL || strm->state == Z_NULL)
511 s = strm->state;
538 local void flush_pending(strm) in flush_pending() argument
539 z_streamp strm; in flush_pending()
541 unsigned len = strm->state->pending;
543 if (len > strm->avail_out) len = strm->avail_out;
546 zmemcpy(strm->next_out, strm->state->pending_out, len);
547 strm->next_out += len;
548 strm->state->pending_out += len;
549 strm->total_out += len;
550 strm->avail_out -= len;
551 strm->state->pending -= len;
552 if (strm->state->pending == 0) {
553 strm->state->pending_out = strm->state->pending_buf;
558 int ZEXPORT deflate (strm, flush) in deflate() argument
559 z_streamp strm; in deflate()
565 if (strm == Z_NULL || strm->state == Z_NULL ||
569 s = strm->state;
571 if (strm->next_out == Z_NULL ||
572 (strm->next_in == Z_NULL && strm->avail_in != 0) ||
574 ERR_RETURN(strm, Z_STREAM_ERROR);
576 if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
578 s->strm = strm; /* just in case */
586 strm->adler = crc32(0L, Z_NULL, 0);
622 strm->adler = crc32(strm->adler, s->pending_buf,
651 putShortMSB(s, (uInt)(strm->adler >> 16));
652 putShortMSB(s, (uInt)(strm->adler & 0xffff));
654 strm->adler = adler32(0L, Z_NULL, 0);
665 strm->adler = crc32(strm->adler, s->pending_buf + beg,
667 flush_pending(strm);
676 strm->adler = crc32(strm->adler, s->pending_buf + beg,
694 strm->adler = crc32(strm->adler, s->pending_buf + beg,
696 flush_pending(strm);
707 strm->adler = crc32(strm->adler, s->pending_buf + beg,
725 strm->adler = crc32(strm->adler, s->pending_buf + beg,
727 flush_pending(strm);
738 strm->adler = crc32(strm->adler, s->pending_buf + beg,
749 flush_pending(strm);
751 put_byte(s, (Byte)(strm->adler & 0xff));
752 put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
753 strm->adler = crc32(0L, Z_NULL, 0);
764 flush_pending(strm);
765 if (strm->avail_out == 0) {
780 } else if (strm->avail_in == 0 && flush <= old_flush &&
782 ERR_RETURN(strm, Z_BUF_ERROR);
786 if (s->status == FINISH_STATE && strm->avail_in != 0) {
787 ERR_RETURN(strm, Z_BUF_ERROR);
792 if (strm->avail_in != 0 || s->lookahead != 0 ||
802 if (strm->avail_out == 0) {
826 flush_pending(strm);
827 if (strm->avail_out == 0) {
833 Assert(strm->avail_out > 0, "bug2");
841 put_byte(s, (Byte)(strm->adler & 0xff));
842 put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
843 put_byte(s, (Byte)((strm->adler >> 16) & 0xff));
844 put_byte(s, (Byte)((strm->adler >> 24) & 0xff));
845 put_byte(s, (Byte)(strm->total_in & 0xff));
846 put_byte(s, (Byte)((strm->total_in >> 8) & 0xff));
847 put_byte(s, (Byte)((strm->total_in >> 16) & 0xff));
848 put_byte(s, (Byte)((strm->total_in >> 24) & 0xff));
853 putShortMSB(s, (uInt)(strm->adler >> 16));
854 putShortMSB(s, (uInt)(strm->adler & 0xffff));
856 flush_pending(strm);
865 int ZEXPORT deflateEnd (strm) in deflateEnd() argument
866 z_streamp strm; in deflateEnd()
870 if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
872 status = strm->state->status;
884 TRY_FREE(strm, strm->state->pending_buf);
885 TRY_FREE(strm, strm->state->head);
886 TRY_FREE(strm, strm->state->prev);
887 TRY_FREE(strm, strm->state->window);
889 ZFREE(strm, strm->state);
890 strm->state = Z_NULL;
924 ds->strm = dest;
962 local int read_buf(strm, buf, size) in read_buf() argument
963 z_streamp strm; in read_buf()
967 unsigned len = strm->avail_in;
972 strm->avail_in -= len;
974 if (strm->state->wrap == 1) {
975 strm->adler = adler32(strm->adler, strm->next_in, len);
978 else if (strm->state->wrap == 2) {
979 strm->adler = crc32(strm->adler, strm->next_in, len);
982 zmemcpy(buf, strm->next_in, len);
983 strm->next_in += len;
984 strm->total_in += len;
1333 if (s->strm->avail_in == 0) return;
1348 n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
1363 } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
1377 flush_pending(s->strm); \
1384 if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \
1662 if (s->strm->avail_out == 0) return need_more;