istream-concat.c revision 9511a40d933181045343110c8101b75887062aae
/* Copyright (c) 2007 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 need to keep the current data */
/* we already verified that the data size is less than the
maximum buffer size */
i_unreached();
}
{
const unsigned char *data;
bool last_stream;
return -1;
}
skip = 0;
} else {
/* we don't need the buffer anymore */
stream->buffer_size = 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);
}
}
} 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;
}
{
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)
}
}