Skip to content

Commit

Permalink
lib-compression: Changed impossible errors to asserts.
Browse files Browse the repository at this point in the history
o_stream_flush() no longer calls the stream's flush() if stream has failed.
  • Loading branch information
sirainen authored and GitLab committed May 18, 2016
1 parent 2fb2464 commit 08ab0b2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 18 deletions.
7 changes: 1 addition & 6 deletions src/lib-compression/ostream-bzlib.c
Expand Up @@ -103,12 +103,7 @@ static int o_stream_bzlib_send_flush(struct bzlib_ostream *zstream)
bool done = FALSE;
int ret;

if (zs->avail_in != 0) {
i_assert(zstream->ostream.ostream.last_failed_errno != 0);
zstream->ostream.ostream.stream_errno =
zstream->ostream.ostream.last_failed_errno;
return -1;
}
i_assert(zs->avail_in == 0);

if (zstream->flushed)
return 0;
Expand Down
7 changes: 1 addition & 6 deletions src/lib-compression/ostream-lzma.c
Expand Up @@ -109,12 +109,7 @@ static int o_stream_lzma_send_flush(struct lzma_ostream *zstream)
bool done = FALSE;
int ret;

if (zs->avail_in != 0) {
i_assert(zstream->ostream.ostream.last_failed_errno != 0);
zstream->ostream.ostream.stream_errno =
zstream->ostream.ostream.last_failed_errno;
return -1;
}
i_assert(zs->avail_in == 0);

if (zstream->flushed)
return 0;
Expand Down
7 changes: 1 addition & 6 deletions src/lib-compression/ostream-zlib.c
Expand Up @@ -172,12 +172,7 @@ o_stream_zlib_send_flush(struct zlib_ostream *zstream, bool final)
bool done = FALSE;
int ret, flush;

if (zs->avail_in != 0) {
i_assert(zstream->ostream.ostream.last_failed_errno != 0);
zstream->ostream.ostream.stream_errno =
zstream->ostream.ostream.last_failed_errno;
return -1;
}
i_assert(zs->avail_in == 0);

if (zstream->flushed)
return 0;
Expand Down

0 comments on commit 08ab0b2

Please sign in to comment.