Lines Matching refs:zstream
26 struct lzma_ostream *zstream = (struct lzma_ostream *)stream;
28 lzma_end(&zstream->strm);
30 o_stream_close(zstream->ostream.parent);
33 static int o_stream_zlib_send_outbuf(struct lzma_ostream *zstream)
38 if (zstream->outbuf_used == 0)
41 size = zstream->outbuf_used - zstream->outbuf_offset;
43 ret = o_stream_send(zstream->ostream.parent,
44 zstream->outbuf + zstream->outbuf_offset, size);
46 o_stream_copy_error_from_parent(&zstream->ostream);
50 zstream->outbuf_offset += ret;
53 zstream->outbuf_offset = 0;
54 zstream->outbuf_used = 0;
59 o_stream_lzma_send_chunk(struct lzma_ostream *zstream,
62 lzma_stream *zs = &zstream->strm;
65 i_assert(zstream->outbuf_used == 0);
73 zs->next_out = zstream->outbuf;
74 zs->avail_out = sizeof(zstream->outbuf);
76 zstream->outbuf_used = sizeof(zstream->outbuf);
77 if ((ret = o_stream_zlib_send_outbuf(zstream)) < 0)
92 o_stream_get_name(&zstream->ostream.ostream));
95 o_stream_get_name(&zstream->ostream.ostream), ret);
100 zstream->flushed = FALSE;
104 static int o_stream_lzma_send_flush(struct lzma_ostream *zstream)
106 lzma_stream *zs = &zstream->strm;
113 if (zstream->flushed)
116 if ((ret = o_stream_flush_parent_if_needed(&zstream->ostream)) <= 0)
118 if ((ret = o_stream_zlib_send_outbuf(zstream)) <= 0)
121 i_assert(zstream->outbuf_used == 0);
133 o_stream_get_name(&zstream->ostream.ostream));
136 o_stream_get_name(&zstream->ostream.ostream), ret);
139 len = sizeof(zstream->outbuf) - zs->avail_out;
140 zs->next_out = zstream->outbuf;
141 zs->avail_out = sizeof(zstream->outbuf);
143 zstream->outbuf_used = len;
144 if ((ret = o_stream_zlib_send_outbuf(zstream)) <= 0)
149 zstream->flushed = TRUE;
155 struct lzma_ostream *zstream = (struct lzma_ostream *)stream;
157 if (o_stream_lzma_send_flush(zstream) < 0)
167 struct lzma_ostream *zstream = (struct lzma_ostream *)stream;
171 if ((ret = o_stream_zlib_send_outbuf(zstream)) <= 0) {
178 ret = o_stream_lzma_send_chunk(zstream, iov[i].iov_base,
190 zstream->strm.avail_in = 0;
196 struct lzma_ostream *zstream;
201 zstream = i_new(struct lzma_ostream, 1);
202 zstream->ostream.sendv = o_stream_lzma_sendv;
203 zstream->ostream.flush = o_stream_lzma_flush;
204 zstream->ostream.iostream.close = o_stream_lzma_close;
206 ret = lzma_easy_encoder(&zstream->strm, level, LZMA_CHECK_CRC64);
218 zstream->strm.next_out = zstream->outbuf;
219 zstream->strm.avail_out = sizeof(zstream->outbuf);
220 return o_stream_create(&zstream->ostream, output,