kspalaiologos / bzip3

A better and stronger spiritual successor to BZip2.
GNU Lesser General Public License v3.0
687 stars 38 forks source link

Suggestion: add fflush when encode/decode complete #35

Closed synodriver closed 2 years ago

synodriver commented 2 years ago

Sometimes I got empty output files after encode/decode. I did some search and found that bzip3 just use fclose after complete. I have encountered this problem myself in the python wrapper, and after I use flush on file stream it's fixed. So maybe the origin one should add it too?

synodriver commented 2 years ago

This can be reproduced with the latest release, both on windows and linux.

alerque commented 2 years ago

Is there precedent for doing a flush in other archive/compression tooling? This doesn't sound quite right...

kspalaiologos commented 2 years ago

The fclose() function flushes the stream pointed to by stream (writing any buffered output data using fflush(3)) and closes the underlying file descriptor.

Per man fflush. I can add it nonetheless, but it seems like you're running a non-standards compliant platform.

kspalaiologos commented 2 years ago

Stale and a suggested fix has been pushed. Closing.