ENH: Support more compression formats

This MR adds support for the bzip2 and zstd compression formats. As part of this work, the code has been converted from C to C++, and substantially refactored - adding new compression formats in the future will be very straightforward.

The API has been changed, but there are very few direct users of the znzlib library, so updating the rest of the code base won't require too much work, and a full rebuild of all projects won't be needed.

  • All symbols are now located in a znz C++ namespace.
  • znzFile is now a C++ class rather than a pointer to a struct.
  • znz* functions are called on a znzFile instance, rather than being standalone functions into which a znzFile pointer is passed:
    • znzopen -> znzFile / znzFile.open
    • znzread -> znzFile.read
    • znzwrite -> znzFile.write
    • znzseek -> znzFile.seek
    • znzrewind -> znzFile.rewind
    • znzeof -> znzFile.eof
    • znztell -> Removed (no use in codebase)
    • znzputs -> Removed (no use in codebase)
    • znzgets -> Removed (no use in codebase)
    • znzprintf -> Removed (no use in codebase)
    • znzclose() -> znzFile.close() (file is closed automatically upon destruction)
  • When creating a znzFile, rather than a boolean use_compression flag, a znzFormat value may be passed, specifying the compression format.
  • When creating a znzFile for reading, the default behaviour is to guess the compression format from the file contents.
  • When creating a znzFile for writing, the default behaviour is to guess the compression format from the file suffix.
Edited by Paul McCarthy

Merge request reports

Loading