Home | History | Annotate | Download | only in zlib

Lines Matching refs:strm

86 local void flush_pending  OF((z_streamp strm));
87 local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
198 int ZEXPORT deflateInit_(strm, level, version, stream_size)
199 z_streamp strm;
204 return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
206 /* To do: ignore strm->next_in if we use it as window */
210 int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
212 z_streamp strm;
234 if (strm == Z_NULL) return Z_STREAM_ERROR;
236 strm->msg = Z_NULL;
237 if (strm->zalloc == (alloc_func)0) {
238 strm->zalloc = zcalloc;
239 strm->opaque = (voidpf)0;
241 if (strm->zfree == (free_func)0) strm->zfree = zcfree;
265 s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
267 strm->state = (struct internal_state FAR *)s;
268 s->strm = strm;
281 s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
282 s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
283 s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos));
289 overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
296 strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);
297 deflateEnd (strm);
307 return deflateReset(strm);
311 int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
312 z_streamp strm;
321 if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL ||
322 strm->state->wrap == 2 ||
323 (strm->state->wrap == 1 && strm->state->status != INIT_STATE))
326 s = strm->state;
328 strm->adler = adler32(strm->adler, dictionary, dictLength);
353 int ZEXPORT deflateReset (strm)
354 z_streamp strm;
358 if (strm == Z_NULL || strm->state == Z_NULL ||
359 strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) {
363 strm->total_in = strm->total_out = 0;
364 strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
365 strm->data_type = Z_UNKNOWN;
367 s = (deflate_state *)strm->state;
375 strm->adler =
389 int ZEXPORT deflateSetHeader (strm, head)
390 z_streamp strm;
393 if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
394 if (strm->state->wrap != 2) return Z_STREAM_ERROR;
395 strm->state->gzhead = head;
400 int ZEXPORT deflatePrime (strm, bits, value)
401 z_streamp strm;
405 if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
406 strm->state->bi_valid = bits;
407 strm->state->bi_buf = (ush)(value & ((1 << bits) - 1));
412 int ZEXPORT deflateParams(strm, level, strategy)
413 z_streamp strm;
421 if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
422 s = strm->state;
435 strm->total_in != 0) {
437 err = deflate(strm, Z_BLOCK);
451 int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
452 z_streamp strm;
460 if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
461 s = strm->state;
486 uLong ZEXPORT deflateBound(strm, sourceLen)
487 z_streamp strm;
499 if (strm == Z_NULL || strm->state == Z_NULL)
503 s = strm->state;
559 * to avoid allocating a large strm->next_out buffer and copying into it.
562 local void flush_pending(strm)
563 z_streamp strm;
565 unsigned len = strm->state->pending;
567 if (len > strm->avail_out) len = strm->avail_out;
570 zmemcpy(strm->next_out, strm->state->pending_out, len);
571 strm->next_out += len;
572 strm->state->pending_out += len;
573 strm->total_out += len;
574 strm->avail_out -= len;
575 strm->state->pending -= len;
576 if (strm->state->pending == 0) {
577 strm->state->pending_out = strm->state->pending_buf;
582 int ZEXPORT deflate (strm, flush)
583 z_streamp strm;
589 if (strm == Z_NULL || strm->state == Z_NULL ||
593 s = strm->state;
595 if (strm->next_out == Z_NULL ||
596 (strm->next_in == Z_NULL && strm->avail_in != 0) ||
598 ERR_RETURN(strm, Z_STREAM_ERROR);
600 if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
602 s->strm = strm; /* just in case */
610 strm->adler = crc32(0L, Z_NULL, 0);
646 strm->adler = crc32(strm->adler, s->pending_buf,
675 putShortMSB(s, (uInt)(strm->adler >> 16));
676 putShortMSB(s, (uInt)(strm->adler & 0xffff));
678 strm->adler = adler32(0L, Z_NULL, 0);
689 strm->adler = crc32(strm->adler, s->pending_buf + beg,
691 flush_pending(strm);
700 strm->adler = crc32(strm->adler, s->pending_buf + beg,
718 strm->adler = crc32(strm->adler, s->pending_buf + beg,
720 flush_pending(strm);
731 strm->adler = crc32(strm->adler, s->pending_buf + beg,
749 strm->adler = crc32(strm->adler, s->pending_buf + beg,
751 flush_pending(strm);
762 strm->adler = crc32(strm->adler, s->pending_buf + beg,
773 flush_pending(strm);
775 put_byte(s, (Byte)(strm->adler & 0xff));
776 put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
777 strm->adler = crc32(0L, Z_NULL, 0);
788 flush_pending(strm);
789 if (strm->avail_out == 0) {
804 } else if (strm->avail_in == 0 && flush <= old_flush &&
806 ERR_RETURN(strm, Z_BUF_ERROR);
810 if (s->status == FINISH_STATE && strm->avail_in != 0) {
811 ERR_RETURN(strm, Z_BUF_ERROR);
816 if (strm->avail_in != 0 || s->lookahead != 0 ||
828 if (strm->avail_out == 0) {
856 flush_pending(strm);
857 if (strm->avail_out == 0) {
863 Assert(strm->avail_out > 0, "bug2");
871 put_byte(s, (Byte)(strm->adler & 0xff));
872 put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
873 put_byte(s, (Byte)((strm->adler >> 16) & 0xff));
874 put_byte(s, (Byte)((strm->adler >> 24) & 0xff));
875 put_byte(s, (Byte)(strm->total_in & 0xff));
876 put_byte(s, (Byte)((strm->total_in >> 8) & 0xff));
877 put_byte(s, (Byte)((strm->total_in >> 16) & 0xff));
878 put_byte(s, (Byte)((strm->total_in >> 24) & 0xff));
883 putShortMSB(s, (uInt)(strm->adler >> 16));
884 putShortMSB(s, (uInt)(strm->adler & 0xffff));
886 flush_pending(strm);
895 int ZEXPORT deflateEnd (strm)
896 z_streamp strm;
900 if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
902 status = strm->state->status;
914 TRY_FREE(strm, strm->state->pending_buf);
915 TRY_FREE(strm, strm->state->head);
916 TRY_FREE(strm, strm->state->prev);
917 TRY_FREE(strm, strm->state->window);
919 ZFREE(strm, strm->state);
920 strm->state = Z_NULL;
954 ds->strm = dest;
989 * allocating a large strm->next_in buffer and copying from it.
992 local int read_buf(strm, buf, size)
993 z_streamp strm;
997 unsigned len = strm->avail_in;
1002 strm->avail_in -= len;
1004 if (strm->state->wrap == 1) {
1005 strm->adler = adler32(strm->adler, strm->next_in, len);
1008 else if (strm->state->wrap == 2) {
1009 strm->adler = crc32(strm->adler, strm->next_in, len);
1012 zmemcpy(buf, strm->next_in, len);
1013 strm->next_in += len;
1014 strm->total_in += len;
1365 if (s->strm->avail_in == 0) return;
1380 n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
1395 } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
1443 flush_pending(s->strm); \
1450 if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
1715 if (s->strm->avail_out == 0) return need_more;