istream.c revision 0e8fd7a2a52e3682ddfe1b6f52e1bd379fae4c36
5f5870385cff47efd2f58e7892f251cf13761528Timo Sirainen/* Copyright (c) 2002-2010 Dovecot authors, see the included COPYING file */
7ace5117d5f2395bd66f20b09e77dac05492f7ceTimo Sirainen io_stream_ref(&stream->real_stream->iostream);
7ace5117d5f2395bd66f20b09e77dac05492f7ceTimo Sirainen struct istream_private *_stream = (*stream)->real_stream;
6ef7e31619edfaa17ed044b45861d106a86191efTimo Sirainen io_stream_unref(&(*stream)->real_stream->iostream);
8759adc67109b5a12a7af3ed717c7040622a0a04Timo Sirainenvoid i_stream_set_destroy_callback(struct istream *stream,
dc9bfb7dc057964238e181d3d8b08751527bb08aTimo Sirainen struct iostream_private *iostream = &stream->real_stream->iostream;
00bde9ae9eab9e720462bf6ec9a4dd85e88c3bbfTimo Sirainen struct istream_private *_stream = stream->real_stream;
dc9bfb7dc057964238e181d3d8b08751527bb08aTimo Sirainen io_stream_close(&stream->real_stream->iostream);
3ab7783791bd46cdd46e9b9de3e98e8efcb6c6bfTimo Sirainenvoid i_stream_set_init_buffer_size(struct istream *stream, size_t size)
24d7c5fc9fa1cb1f49402ec796654113199ba4e6Timo Sirainenvoid i_stream_set_max_buffer_size(struct istream *stream, size_t max_size)
24d7c5fc9fa1cb1f49402ec796654113199ba4e6Timo Sirainen io_stream_set_max_buffer_size(&stream->real_stream->iostream, max_size);
24d7c5fc9fa1cb1f49402ec796654113199ba4e6Timo Sirainenvoid i_stream_set_return_partial_line(struct istream *stream, bool set)
145d2eef238ed8bbff635e3b06951a83f0ee5a03Timo Sirainen struct istream_private *_stream = stream->real_stream;
6ef7e31619edfaa17ed044b45861d106a86191efTimo Sirainen /* error handling should be easier if we now just
6ef7e31619edfaa17ed044b45861d106a86191efTimo Sirainen assume the stream is now at EOF */
145d2eef238ed8bbff635e3b06951a83f0ee5a03Timo Sirainen i_assert((size_t)ret+old_size == _stream->pos - _stream->skip);
7ace5117d5f2395bd66f20b09e77dac05492f7ceTimo Sirainenssize_t i_stream_read_copy_from_parent(struct istream *istream)
dc9bfb7dc057964238e181d3d8b08751527bb08aTimo Sirainen struct istream_private *stream = istream->real_stream;
dc9bfb7dc057964238e181d3d8b08751527bb08aTimo Sirainen stream->buffer = i_stream_get_data(stream->parent, &pos);
a3dd97fb6d92a89c3de0597fed2d4b044c7aeb84Timo Sirainen if ((ret = i_stream_read(stream->parent)) == -2)
cc0495b3bbe3c3e41c512274b302d6f0fa028187Timo Sirainen stream->istream.stream_errno = stream->parent->stream_errno;
dc9bfb7dc057964238e181d3d8b08751527bb08aTimo Sirainen stream->buffer = i_stream_get_data(stream->parent, &pos);
dc9bfb7dc057964238e181d3d8b08751527bb08aTimo Sirainen /* check again, in case the parent stream had been seeked
a64adf62fa33f2463a86f990217b0c9078531a40Timo Sirainen backwards and the previous read() didn't get us far
a64adf62fa33f2463a86f990217b0c9078531a40Timo Sirainen ret = pos > stream->pos ? (ssize_t)(pos - stream->pos) :
31a12066e4cd9310d64091c81b59fb8eb1986023Timo Sirainenvoid i_stream_skip(struct istream *stream, uoff_t count)
61618d4c58080570f689614fec204ae14e90cef2Timo Sirainen struct istream_private *_stream = stream->real_stream;
dc9bfb7dc057964238e181d3d8b08751527bb08aTimo Sirainen /* within buffer */
return TRUE;
return FALSE;
return NULL;
char *ret;
end = i;
return ret;
return NULL;
char *ret_buf;
size_t i;
return NULL;
return NULL;
return ret_buf;
char *line;
return line;
*size_r = 0;
return NULL;
*size_r = 0;
return NULL;
if (ret > 0)
} while (ret > 0);
if (ret == 0) {
if (read_more) {
return FALSE;
return TRUE;
if (available == 0) {
static const struct stat *
struct istream *