istream.c revision 4c096615cb86a826fda377b87df22c579bfe5525
/* Copyright (c) 2002-2014 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "ioloop.h"
#include "array.h"
#include "str.h"
#include "istream-private.h"
{
}
{
return "";
}
}
{
if (stream->stream_errno == 0)
}
{
}
{
}
{
}
}
{
struct iostream_destroy_callback *dc;
}
void (*callback)())
{
const struct iostream_destroy_callback *dcs;
unsigned int i, count;
for (i = 0; i < count; i++) {
return;
}
}
i_unreached();
}
{
}
{
struct istream *s;
/* we'll only return errors for streams that have stream_errno set.
we might be returning unintended error otherwise. */
if (stream->stream_errno == 0)
return "<no error>";
if (s->stream_errno == 0)
break;
}
}
{
}
{
}
{
}
{
}
{
}
{
stream->access_counter++;
else {
}
}
{
return -1;
}
switch (ret) {
case -2:
break;
case -1:
if (stream->stream_errno != 0) {
/* error handling should be easier if we now just
assume the stream is now at EOF */
} else {
}
break;
case 0:
break;
default:
break;
}
return ret;
}
{
ret = 0;
else do {
return -2;
/* check again, in case the parent stream had been seeked
backwards and the previous read() didn't get us far
enough. */
(ret == 0 ? 0 : -1);
return ret;
}
{
/* within buffer */
return;
}
/* have to seek forward */
return;
stream->stream_errno = 0;
}
{
return TRUE;
/* use the fast route only if the parent stream hasn't been changed */
if (stream->access_counter !=
return FALSE;
}
{
else {
return;
}
}
{
return;
}
{
return;
}
}
{
return -1;
return -1;
return 0;
}
{
return -1;
}
{
}
{
(void)i_stream_read(stream);
return !i_stream_have_bytes_left(stream);
}
{
}
{
char *ret;
end = i - 1;
} else {
end = i;
}
/* modify the buffer directly */
} else {
/* use a temporary string to return it */
}
i++;
return ret;
}
{
/* the last line is missing LF and we want to return it. */
}
return NULL;
}
{
const unsigned char *pos;
stream->stream_errno = 0;
return NULL;
}
return i_stream_next_line_finish(_stream,
} else {
return i_stream_last_line(_stream);
}
}
{
char *line;
for (;;) {
break;
switch (i_stream_read(stream)) {
case -2:
return NULL;
case -1:
case 0:
return NULL;
}
}
return line;
}
{
}
const unsigned char *
{
*size_r = 0;
return NULL;
}
}
{
return 0;
else
}
{
*size_r = 0;
return NULL;
}
}
{
do {
return 1;
/* we need more data */
if (ret > 0)
} while (ret > 0);
if (ret == -2)
return -2;
if (ret == 0) {
/* need to read more */
return 0;
}
if (read_more) {
/* we read at least some new data */
return 0;
}
} else {
}
return -1;
}
{
}
{
else
else {
}
}
{
i_assert(wanted_size > 0);
/* remove the unused bytes from beginning of buffer */
} else if (stream->max_buffer_size == 0 ||
/* buffer is full - grow it */
}
}
if (stream->try_alloc_limit > 0 &&
return *size_r > 0;
}
{
if (avail_size < size) {
}
}
{
return FALSE;
return TRUE;
}
{
if (!pending)
return;
}
}
{
do {
}
{
}
}
{
}
}
static void
{
}
bool close_parent)
{
}
{
}
static void
{
}
{
i_panic("stream %s doesn't support seeking backwards",
if (available == 0) {
return;
}
else {
}
}
}
static int
{
return -1;
/* exact size is not known, even if parent returned something */
}
return 0;
}
static int
{
return -1;
return 0;
return 1;
}
{
/* if parent stream is an istream-error, copy the error */
}
struct istream *
{
}
}
if (_stream->init_buffer_size == 0)
}
{
struct istream_private *stream;
}
struct istream *
{
return input;
}