Skip to content

Commit

Permalink
Remove break if no bytes read because bytes might still be output.
Browse files Browse the repository at this point in the history
Remove unnecessary in_bytes or out_bytes check.
  • Loading branch information
nmoinvaz committed Sep 17, 2019
1 parent b4d17e6 commit cc3aa21
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions mz_strm_bzip.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ int32_t mz_stream_bzip_read(void *stream, void *buf, int32_t size)

if (read < 0)
return read;
if (read == 0)
break;

bzip->bzstream.next_in = (char *)bzip->buffer;
bzip->bzstream.avail_in = (uint32_t)read;
Expand Down Expand Up @@ -188,7 +186,7 @@ int32_t mz_stream_bzip_read(void *stream, void *buf, int32_t size)
break;
}
}
while ((bzip->bzstream.avail_out > 0) && (in_bytes > 0 || out_bytes > 0));
while (bzip->bzstream.avail_out > 0);

if (bzip->error != 0)
return MZ_DATA_ERROR;
Expand Down
4 changes: 1 addition & 3 deletions mz_strm_lzma.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,6 @@ int32_t mz_stream_lzma_read(void *stream, void *buf, int32_t size)

if (read < 0)
return read;
if (read == 0)
break;

lzma->lstream.next_in = lzma->buffer;
lzma->lstream.avail_in = (size_t)read;
Expand Down Expand Up @@ -217,7 +215,7 @@ int32_t mz_stream_lzma_read(void *stream, void *buf, int32_t size)
break;
}
}
while ((lzma->lstream.avail_out > 0) && (in_bytes > 0 || out_bytes > 0));
while (lzma->lstream.avail_out > 0);

if (lzma->error != 0)
return MZ_DATA_ERROR;
Expand Down
2 changes: 1 addition & 1 deletion mz_strm_zlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ int32_t mz_stream_zlib_read(void *stream, void *buf, int32_t size)
break;
}
}
while ((zlib->zstream.avail_out > 0) && (in_bytes > 0 || out_bytes > 0));
while (zlib->zstream.avail_out > 0);

if (zlib->error != 0)
{
Expand Down

0 comments on commit cc3aa21

Please sign in to comment.