istream.c revision 1036ad17ac837a451f6b045cac504d3efa2edb8e
/* Copyright (c) 2002-2007 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "ioloop.h"
#include "str.h"
#include "istream-internal.h"
{
}
{
}
{
}
}
{
}
{
}
{
}
{
return -1;
}
{
/* within buffer */
return;
}
/* have to seek forward */
return;
}
{
return;
}
return;
}
{
return;
}
{
}
{
return NULL;
}
{
}
{
char *ret;
end = i - 1;
else
end = i;
/* modify the buffer directly */
} else {
/* use a temporary string to return it */
}
i++;
return ret;
}
{
char *ret_buf;
size_t i;
stream->stream_errno = 0;
return NULL;
}
i_error("i_stream_next_line() called for unmodifiable stream");
return NULL;
}
/* @UNSAFE */
/* got it */
break;
}
}
return ret_buf;
}
{
char *line;
for (;;) {
break;
if (i_stream_read(stream) <= 0)
return NULL;
}
return line;
}
{
*size_r = 0;
return NULL;
}
}
{
*size_r = 0;
return NULL;
}
}
{
do {
return 1;
/* we need more data */
if (ret > 0)
} while (ret > 0);
if (ret == -2)
return -2;
return 0;
}
return -1;
}
{
}
{
else
if (stream->max_buffer_size > 0 &&
}
{
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 */
}
}
}
static void
{
}
static const struct stat *
{
}
struct istream *
{
}
}
#ifdef STREAM_TEST
/* gcc istream.c -o teststream liblib.a -Wall -DHAVE_CONFIG_H -DSTREAM_TEST -g */
#include <fcntl.h>
#include <unistd.h>
#include "ostream.h"
{
size_t i;
for (i = 0; i < size; i++)
}
int main(void)
{
unsigned char buf[1024];
const unsigned char *data;
lib_init();
if (fd1 < 0)
i_fatal("open() failed: %m");
if (fd2 < 0)
i_fatal("open() failed: %m");
/* write initial data */
for (i = 0; i < sizeof(buf); i++)
/* test reading */
i_stream_seek(input, 0);
/* test moving data */
i_stream_seek(input, 0);
/* test moving with limits */
i_stream_seek(l_input, 0);
i_stream_seek(input, 0);
/* reading within limits */
i_stream_seek(l_input, 0);
unlink("teststream.1");
unlink("teststream.2");
return 0;
}
#endif