From f572b82ea717c92616ed952b9bea4305541b1335 Mon Sep 17 00:00:00 2001 From: Tomas Mlcoch Date: Mon, 25 Jun 2012 15:14:47 +0200 Subject: [PATCH] Fix usage of the BZ2_bzRead() in the cw_read() --- src/compression_wrapper.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compression_wrapper.c b/src/compression_wrapper.c index 4b3e96c..9bb7485 100644 --- a/src/compression_wrapper.c +++ b/src/compression_wrapper.c @@ -471,6 +471,9 @@ int cw_read(CW_FILE *cw_file, void *buffer, unsigned int len) case (BZ2_COMPRESSION): // --------------------------------------------- ret = BZ2_bzRead(&bzerror, (BZFILE *) cw_file->FILE, buffer, len); + if (!ret && bzerror == BZ_SEQUENCE_ERROR) + // Next read after BZ_STREAM_END (EOF) + return 0; if (bzerror != BZ_OK && bzerror != BZ_STREAM_END) { return CW_ERR; } -- 2.7.4