Using Python to gzip some data with the intention of unpacking it in our app/plugin, I ran into the issue where I had to manually specify the format when attempting to decompress the data with JUCE.
The issue of having to recognise and specify a format (for window bits) in advance isn’t necessary. Zlib provides a method to decompress agnostically by using MAX_WBITS | 32 as window bits.
It should be said that the most basic constructor of GZIPCompressorOutputStream is misleading in that it specifies a format under the hood, when it shouldn’t do that IMO. At the very least, the constructor’s documentation should specify that it assumes zlib formatted data.
I propose doing something like this, with unit tests updated to be more rigorous:
- juce_GZIPCompressorOutputStream.h (5.3 KB)
- juce_GZIPDecompressorInputStream.cpp (11.9 KB)
- juce_GZIPDecompressorInputStream.h (3.8 KB)
