Commit 243c9630 authored by Max Kellermann's avatar Max Kellermann

archive/bz2: bz2_fillbuffer() returns bool

parent e3597e64
...@@ -181,7 +181,7 @@ bz2_is_close(struct input_stream *is) ...@@ -181,7 +181,7 @@ bz2_is_close(struct input_stream *is)
is->data = NULL; is->data = NULL;
} }
static int static bool
bz2_fillbuffer(bz2_context *context, size_t numBytes) bz2_fillbuffer(bz2_context *context, size_t numBytes)
{ {
size_t count; size_t count;
...@@ -190,14 +190,15 @@ bz2_fillbuffer(bz2_context *context, size_t numBytes) ...@@ -190,14 +190,15 @@ bz2_fillbuffer(bz2_context *context, size_t numBytes)
bzstream = &context->bzstream; bzstream = &context->bzstream;
if (bzstream->avail_in > 0) if (bzstream->avail_in > 0)
return 0; return true;
count = input_stream_read(&context->istream, count = input_stream_read(&context->istream,
context->buffer, BZ_BUFSIZE); context->buffer, BZ_BUFSIZE);
if (count == 0) { if (count == 0) {
if (bzstream->avail_out == numBytes) if (bzstream->avail_out == numBytes)
return -1; return false;
if (!input_stream_eof(&context->istream)) if (!input_stream_eof(&context->istream))
context->last_parent_result = 1; context->last_parent_result = 1;
} else { } else {
...@@ -205,7 +206,7 @@ bz2_fillbuffer(bz2_context *context, size_t numBytes) ...@@ -205,7 +206,7 @@ bz2_fillbuffer(bz2_context *context, size_t numBytes)
bzstream->avail_in = count; bzstream->avail_in = count;
} }
return 0; return true;
} }
static size_t static size_t
...@@ -227,7 +228,7 @@ bz2_is_read(struct input_stream *is, void *ptr, size_t size) ...@@ -227,7 +228,7 @@ bz2_is_read(struct input_stream *is, void *ptr, size_t size)
bzstream->avail_out = numBytes; bzstream->avail_out = numBytes;
while (bzstream->avail_out != 0) { while (bzstream->avail_out != 0) {
if (bz2_fillbuffer(context, numBytes) != 0) if (!bz2_fillbuffer(context, numBytes))
break; break;
bz_result = BZ2_bzDecompress(bzstream); bz_result = BZ2_bzDecompress(bzstream);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment