From 243c96304b02f57f29b5e8d217a55fed752a5cb7 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 15 Dec 2009 09:08:30 +0100 Subject: archive/bz2: bz2_fillbuffer() returns bool --- src/archive/bz2_plugin.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/archive/bz2_plugin.c b/src/archive/bz2_plugin.c index cebf995e1..20f8a427b 100644 --- a/src/archive/bz2_plugin.c +++ b/src/archive/bz2_plugin.c @@ -181,7 +181,7 @@ bz2_is_close(struct input_stream *is) is->data = NULL; } -static int +static bool bz2_fillbuffer(bz2_context *context, size_t numBytes) { size_t count; @@ -190,14 +190,15 @@ bz2_fillbuffer(bz2_context *context, size_t numBytes) bzstream = &context->bzstream; if (bzstream->avail_in > 0) - return 0; + return true; count = input_stream_read(&context->istream, context->buffer, BZ_BUFSIZE); if (count == 0) { if (bzstream->avail_out == numBytes) - return -1; + return false; + if (!input_stream_eof(&context->istream)) context->last_parent_result = 1; } else { @@ -205,7 +206,7 @@ bz2_fillbuffer(bz2_context *context, size_t numBytes) bzstream->avail_in = count; } - return 0; + return true; } static size_t @@ -227,7 +228,7 @@ bz2_is_read(struct input_stream *is, void *ptr, size_t size) bzstream->avail_out = numBytes; while (bzstream->avail_out != 0) { - if (bz2_fillbuffer(context, numBytes) != 0) + if (!bz2_fillbuffer(context, numBytes)) break; bz_result = BZ2_bzDecompress(bzstream); -- cgit v1.2.3