istream-zlib.c (dovecot-2.3.16) | : | istream-zlib.c (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 174 | skipping to change at line 174 | |||
static ssize_t i_stream_zlib_read(struct istream_private *stream) | static ssize_t i_stream_zlib_read(struct istream_private *stream) | |||
{ | { | |||
struct zlib_istream *zstream = (struct zlib_istream *)stream; | struct zlib_istream *zstream = (struct zlib_istream *)stream; | |||
const unsigned char *data; | const unsigned char *data; | |||
uoff_t high_offset; | uoff_t high_offset; | |||
size_t size, out_size; | size_t size, out_size; | |||
int ret; | int ret; | |||
high_offset = stream->istream.v_offset + (stream->pos - stream->skip); | high_offset = stream->istream.v_offset + (stream->pos - stream->skip); | |||
if (zstream->eof_offset == high_offset) { | if (zstream->eof_offset == high_offset) { | |||
/* zlib library returned EOF. */ | ||||
if (!zstream->gz) { | ||||
/* deflate - ignore if there's still more data */ | ||||
stream->istream.eof = TRUE; | ||||
return -1; | ||||
} | ||||
/* gz format - read the trailer */ | ||||
if (!zstream->trailer_read) { | if (!zstream->trailer_read) { | |||
do { | do { | |||
ret = i_stream_zlib_read_trailer(zstream); | ret = i_stream_zlib_read_trailer(zstream); | |||
} while (ret == 0 && stream->istream.blocking); | } while (ret == 0 && stream->istream.blocking); | |||
if (ret <= 0) | if (ret <= 0) | |||
return ret; | return ret; | |||
} | } | |||
if (!zstream->gz || i_stream_read_eof(stream->parent)) { | /* See if there's another concatenated gz stream. */ | |||
if (i_stream_read_eof(stream->parent)) { | ||||
/* EOF or error */ | ||||
stream->istream.stream_errno = | ||||
stream->parent->stream_errno; | ||||
stream->istream.eof = TRUE; | stream->istream.eof = TRUE; | |||
return -1; | return -1; | |||
} | } | |||
/* Multiple gz streams concatenated together */ | ||||
zstream->starting_concated_output = TRUE; | zstream->starting_concated_output = TRUE; | |||
} | } | |||
if (zstream->starting_concated_output) { | if (zstream->starting_concated_output) { | |||
/* make sure there actually is something in parent stream. | /* make sure there actually is something in parent stream. | |||
we don't want to reset the stream unless we actually see | we don't want to reset the stream unless we actually see | |||
some concated output. */ | some concated output. */ | |||
ret = i_stream_read_more(stream->parent, &data, &size); | ret = i_stream_read_more(stream->parent, &data, &size); | |||
if (ret <= 0) { | if (ret <= 0) { | |||
if (ret == 0) | if (ret == 0) | |||
return 0; | return 0; | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 13 lines changed or added |