swift - iOS compression_encode_buffer doesn't include zlib header? -
i'm using compression_encode_buffer compression_zlib zlib-compress data in ios app, result missing zlib header.
for example:
size = compression_encode_buffer( destinationbuffer, destinationbuffersize, sourcebuffer, sourcebuffersize, nil, compression_zlib ) will return bytes:
ad 53 c1 8e 9b 30 … while using, example, python's data.encode("zlib") on same data return:
78 9c ad 53 c1 8e 9b 30 … ^^ ^^ correct zlib header what's that? why isn't header being included? , there "correct" way add it?
the 2 bytes zlib header, not magic number. missing final 4 bytes of stream (the adler32 checksum) well, , have "deflate" datastream expected wrapped in zlib datatstream. ios documentation says much:
zlib encoded format raw deflate format described in ietf rfc 1951 using zlib library they should have called compression method "deflate" not "zlib".
see related question dealing zlib vs deflate data.
Comments
Post a Comment