istream-concat.c revision 64c48ffb71f1cf99acf375768fde4cff9b512648
/* Copyright (c) 2007-2010 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "buffer.h"
#include "istream-internal.h"
#include "istream-concat.h"
struct concat_istream {
struct istream_private istream;
unsigned int cur_idx, unknown_size_idx;
};
{
unsigned int i;
}
{
unsigned int i;
}
static void
{
unsigned int i;
}
{
const unsigned char *data;
return;
}
/* we already verified that the data size is less than the
maximum buffer size */
if (data_size > 0) {
i_unreached();
}
}
{
const unsigned char *data;
bool last_stream;
return -1;
}
if (cstream->prev_stream_left == 0) {
/* no need to worry about buffers, skip everything */
/* we're still skipping inside buffer */
bytes_skipped = 0;
} else {
/* done with the buffer */
cstream->prev_stream_left = 0;
}
ret = 0;
else {
/* need to read more */
return ret;
return -1;
}
/* we either read something or we're at EOF */
return -2;
return i_stream_concat_read(stream);
}
}
if (cstream->prev_stream_left == 0) {
} else {
return -2;
}
(ret == 0 ? 0 : -1);
return ret;
}
static unsigned int
{
unsigned int i;
if (*v_offset == 0) {
/* seek to beginning of this stream */
break;
}
if (i == cstream->unknown_size_idx) {
/* we'll need to figure out this stream's size */
return (unsigned int)-1;
}
/* @UNSAFE */
}
break;
}
return i;
}
{
cstream->prev_stream_left = 0;
return;
}
}
static const struct stat *
{
unsigned int i;
/* make sure we have all sizes */
for (i = 0; i < cstream->unknown_size_idx; i++)
}
{
struct concat_istream *cstream;
unsigned int count;
/* if any of the streams isn't blocking or seekable, set ourself also
if (cur_max > max_buffer_size)
}
}