Lines Matching defs:rb
547 rbzs_grow(resbuf_t *rb)
549 off_t ptroff = (caddr_t)rb->rb_zstr.next_out - rb->rb_base;
551 rb->rb_size += RES_BUF_CHUNK_SIZE;
552 rb->rb_base = xrealloc(rb->rb_base, rb->rb_size);
553 rb->rb_ptr = rb->rb_base + ptroff;
554 rb->rb_zstr.next_out = (Bytef *)(rb->rb_ptr);
555 rb->rb_zstr.avail_out += RES_BUF_CHUNK_SIZE;
559 compress_start(resbuf_t *rb)
563 rb->rb_zstr.zalloc = (alloc_func)0;
564 rb->rb_zstr.zfree = (free_func)0;
565 rb->rb_zstr.opaque = (voidpf)0;
567 if ((rc = deflateInit(&rb->rb_zstr, Z_BEST_COMPRESSION)) != Z_OK)
574 resbuf_t *rb = (resbuf_t *)data;
577 rb->rb_zstr.next_out = (Bytef *)rb->rb_ptr;
578 rb->rb_zstr.avail_out = rb->rb_size - (rb->rb_ptr - rb->rb_base);
579 rb->rb_zstr.next_in = buf;
580 rb->rb_zstr.avail_in = n;
582 while (rb->rb_zstr.avail_in) {
583 if (rb->rb_zstr.avail_out == 0)
584 rbzs_grow(rb);
586 if ((rc = deflate(&rb->rb_zstr, Z_NO_FLUSH)) != Z_OK)
589 rb->rb_ptr = (caddr_t)rb->rb_zstr.next_out;
595 compress_flush(resbuf_t *rb, int type)
600 if (rb->rb_zstr.avail_out == 0)
601 rbzs_grow(rb);
603 rc = deflate(&rb->rb_zstr, type);
610 rb->rb_ptr = (caddr_t)rb->rb_zstr.next_out;
614 compress_end(resbuf_t *rb)
618 compress_flush(rb, Z_FINISH);
620 if ((rc = deflateEnd(&rb->rb_zstr)) != Z_OK)