BZError 3: failure and solution

12 views
Skip to first unread message

Daniel

unread,
Jan 8, 2011, 7:42:59 PM1/8/11
to ZipMT
ZipMT seems to work great, but certain input data would always fail
with:

BZError 3
BZError 3
...
Error Occured while compressing data

This happens in stream mode only.

That error is "BZ_FINISH_OK". Turns out that a chunk of data was so
incompressible that it actually expanded, and BZ2_bzCompress() was
running out of space to write the compressed data, so returned this
code, expecting the calling program to call it again with more space
to keep writing. I solved the problem by increasing the value of
WRITEBUFZ by some arbitrary value. Testing with random data suggested
8 kB is not sufficient, but 9 kB appears to do the trick. So line 17
would read:

#define WRITEBUFZ READBUFZ + 9216

Thanks for this useful program!
-D.

drusifer

unread,
Jan 8, 2011, 8:21:33 PM1/8/11
to ZipMT
thanks for the tip. I'll update the source.
Reply all
Reply to author
Forward
0 new messages