Lines Matching defs:strm
86 local void flush_pending OF((z_streamp strm));
87 local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
201 int ZEXPORT deflateInit_(strm, level, version, stream_size)
202 z_streamp strm;
207 return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
209 /* To do: ignore strm->next_in if we use it as window */
213 int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
215 z_streamp strm;
237 if (strm == Z_NULL) return Z_STREAM_ERROR;
239 strm->msg = Z_NULL;
240 if (strm->zalloc == (alloc_func)0) {
244 strm->zalloc = zcalloc;
245 strm->opaque = (voidpf)0;
248 if (strm->zfree == (free_func)0)
252 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));
301 overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
308 strm->msg = ERR_MSG(Z_MEM_ERROR);
309 deflateEnd (strm);
319 return deflateReset(strm);
323 int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
324 z_streamp strm;
334 if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL)
336 s = strm->state;
343 strm->adler = adler32(strm->adler, dictionary, dictLength);
359 avail = strm->avail_in;
360 next = strm->next_in;
361 strm->avail_in = dictLength;
362 strm->next_in = (z_const Bytef *)dictionary;
385 strm->next_in = next;
386 strm->avail_in = avail;
392 int ZEXPORT deflateResetKeep (strm)
393 z_streamp strm;
397 if (strm == Z_NULL || strm->state == Z_NULL ||
398 strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) {
402 strm->total_in = strm->total_out = 0;
403 strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
404 strm->data_type = Z_UNKNOWN;
406 s = (deflate_state *)strm->state;
414 strm->adler =
427 int ZEXPORT deflateReset (strm)
428 z_streamp strm;
432 ret = deflateResetKeep(strm);
434 lm_init(strm->state);
439 int ZEXPORT deflateSetHeader (strm, head)
440 z_streamp strm;
443 if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
444 if (strm->state->wrap != 2) return Z_STREAM_ERROR;
445 strm->state->gzhead = head;
450 int ZEXPORT deflatePending (strm, pending, bits)
453 z_streamp strm;
455 if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
457 *pending = strm->state->pending;
459 *bits = strm->state->bi_valid;
464 int ZEXPORT deflatePrime (strm, bits, value)
465 z_streamp strm;
472 if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
473 s = strm->state;
490 int ZEXPORT deflateParams(strm, level, strategy)
491 z_streamp strm;
499 if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
500 s = strm->state;
513 strm->total_in != 0) {
515 err = deflate(strm, Z_BLOCK);
531 int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
532 z_streamp strm;
540 if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
541 s = strm->state;
566 uLong ZEXPORT deflateBound(strm, sourceLen)
567 z_streamp strm;
579 if (strm == Z_NULL || strm->state == Z_NULL)
583 s = strm->state;
639 * to avoid allocating a large strm->next_out buffer and copying into it.
642 local void flush_pending(strm)
643 z_streamp strm;
646 deflate_state *s = strm->state;
650 if (len > strm->avail_out) len = strm->avail_out;
653 zmemcpy(strm->next_out, s->pending_out, len);
654 strm->next_out += len;
656 strm->total_out += len;
657 strm->avail_out -= len;
665 int ZEXPORT deflate (strm, flush)
666 z_streamp strm;
672 if (strm == Z_NULL || strm->state == Z_NULL ||
676 s = strm->state;
678 if (strm->next_out == Z_NULL ||
679 (strm->next_in == Z_NULL && strm->avail_in != 0) ||
681 ERR_RETURN(strm, Z_STREAM_ERROR);
683 if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
685 s->strm = strm; /* just in case */
693 strm->adler = crc32(0L, Z_NULL, 0);
729 strm->adler = crc32(strm->adler, s->pending_buf,
758 putShortMSB(s, (uInt)(strm->adler >> 16));
759 putShortMSB(s, (uInt)(strm->adler & 0xffff));
761 strm->adler = adler32(0L, Z_NULL, 0);
772 strm->adler = crc32(strm->adler, s->pending_buf + beg,
774 flush_pending(strm);
783 strm->adler = crc32(strm->adler, s->pending_buf + beg,
801 strm->adler = crc32(strm->adler, s->pending_buf + beg,
803 flush_pending(strm);
814 strm->adler = crc32(strm->adler, s->pending_buf + beg,
832 strm->adler = crc32(strm->adler, s->pending_buf + beg,
834 flush_pending(strm);
845 strm->adler = crc32(strm->adler, s->pending_buf + beg,
856 flush_pending(strm);
858 put_byte(s, (Byte)(strm->adler & 0xff));
859 put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
860 strm->adler = crc32(0L, Z_NULL, 0);
871 flush_pending(strm);
872 if (strm->avail_out == 0) {
887 } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) &&
889 ERR_RETURN(strm, Z_BUF_ERROR);
893 if (s->status == FINISH_STATE && strm->avail_in != 0) {
894 ERR_RETURN(strm, Z_BUF_ERROR);
899 if (strm->avail_in != 0 || s->lookahead != 0 ||
911 if (strm->avail_out == 0) {
940 flush_pending(strm);
941 if (strm->avail_out == 0) {
947 Assert(strm->avail_out > 0, "bug2");
955 put_byte(s, (Byte)(strm->adler & 0xff));
956 put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
957 put_byte(s, (Byte)((strm->adler >> 16) & 0xff));
958 put_byte(s, (Byte)((strm->adler >> 24) & 0xff));
959 put_byte(s, (Byte)(strm->total_in & 0xff));
960 put_byte(s, (Byte)((strm->total_in >> 8) & 0xff));
961 put_byte(s, (Byte)((strm->total_in >> 16) & 0xff));
962 put_byte(s, (Byte)((strm->total_in >> 24) & 0xff));
967 putShortMSB(s, (uInt)(strm->adler >> 16));
968 putShortMSB(s, (uInt)(strm->adler & 0xffff));
970 flush_pending(strm);
979 int ZEXPORT deflateEnd (strm)
980 z_streamp strm;
984 if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
986 status = strm->state->status;
998 TRY_FREE(strm, strm->state->pending_buf);
999 TRY_FREE(strm, strm->state->head);
1000 TRY_FREE(strm, strm->state->prev);
1001 TRY_FREE(strm, strm->state->window);
1003 ZFREE(strm, strm->state);
1004 strm->state = Z_NULL;
1038 ds->strm = dest;
1073 * allocating a large strm->next_in buffer and copying from it.
1076 local int read_buf(strm, buf, size)
1077 z_streamp strm;
1081 unsigned len = strm->avail_in;
1086 strm->avail_in -= len;
1088 zmemcpy(buf, strm->next_in, len);
1089 if (strm->state->wrap == 1) {
1090 strm->adler = adler32(strm->adler, buf, len);
1093 else if (strm->state->wrap == 2) {
1094 strm->adler = crc32(strm->adler, buf, len);
1097 strm->next_in += len;
1098 strm->total_in += len;
1452 if (s->strm->avail_in == 0) break;
1467 n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
1494 } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
1545 flush_pending(s->strm); \
1552 if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
1829 if (s->strm->avail_out == 0) return need_more;