istream-concat.c (dovecot-2.3.16) | : | istream-concat.c (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 338 | skipping to change at line 338 | |||
stream->statbuf.st_size = 0; | stream->statbuf.st_size = 0; | |||
for (i = 0; i < cstream->unknown_size_idx; i++) | for (i = 0; i < cstream->unknown_size_idx; i++) | |||
stream->statbuf.st_size += cstream->input_size[i]; | stream->statbuf.st_size += cstream->input_size[i]; | |||
return 0; | return 0; | |||
} | } | |||
struct istream *i_stream_create_concat(struct istream *input[]) | struct istream *i_stream_create_concat(struct istream *input[]) | |||
{ | { | |||
struct concat_istream *cstream; | struct concat_istream *cstream; | |||
unsigned int count; | unsigned int count; | |||
size_t max_buffer_size = I_STREAM_MIN_SIZE; | size_t max_buffer_size = 0; | |||
bool blocking = TRUE, seekable = TRUE; | bool blocking = TRUE, seekable = TRUE; | |||
/* if any of the streams isn't blocking or seekable, set ourself also | /* if any of the streams isn't blocking or seekable, set ourself also | |||
nonblocking/nonseekable */ | nonblocking/nonseekable */ | |||
for (count = 0; input[count] != NULL; count++) { | for (count = 0; input[count] != NULL; count++) { | |||
size_t cur_max = i_stream_get_max_buffer_size(input[count]); | size_t cur_max = i_stream_get_max_buffer_size(input[count]); | |||
if (cur_max > max_buffer_size) | i_assert(cur_max != 0); | |||
if (cur_max != SIZE_MAX && cur_max > max_buffer_size) | ||||
max_buffer_size = cur_max; | max_buffer_size = cur_max; | |||
if (!input[count]->blocking) | if (!input[count]->blocking) | |||
blocking = FALSE; | blocking = FALSE; | |||
if (!input[count]->seekable) | if (!input[count]->seekable) | |||
seekable = FALSE; | seekable = FALSE; | |||
i_stream_ref(input[count]); | i_stream_ref(input[count]); | |||
} | } | |||
i_assert(count != 0); | i_assert(count != 0); | |||
if (max_buffer_size == 0) | ||||
max_buffer_size = SIZE_MAX; | ||||
if (max_buffer_size < I_STREAM_MIN_SIZE) | ||||
max_buffer_size = I_STREAM_MIN_SIZE; | ||||
cstream = i_new(struct concat_istream, 1); | cstream = i_new(struct concat_istream, 1); | |||
cstream->input_count = count; | cstream->input_count = count; | |||
cstream->input = p_memdup(default_pool, input, sizeof(*input) * count); | cstream->input = p_memdup(default_pool, input, sizeof(*input) * count); | |||
cstream->input_size = i_new(uoff_t, count); | cstream->input_size = i_new(uoff_t, count); | |||
cstream->cur_input = cstream->input[0]; | cstream->cur_input = cstream->input[0]; | |||
i_stream_seek(cstream->cur_input, 0); | i_stream_seek(cstream->cur_input, 0); | |||
cstream->istream.iostream.close = i_stream_concat_close; | cstream->istream.iostream.close = i_stream_concat_close; | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 7 lines changed or added |