Compress empty strings with underlying compressor
authorStella Lau <laus@fb.com>
Tue, 5 Sep 2017 22:15:13 +0000 (15:15 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 5 Sep 2017 22:20:47 +0000 (15:20 -0700)
commit049fb12ea9c00ba1c6463501e2e66b21188cca1f
tree582d65cb4f2840081d0df2eb8efe196563c557e6
parent4fd5e900005f59337d3b22f3ec8ef6b182486d81
Compress empty strings with underlying compressor

Summary:
- Current behavior compresses empty strings to empty strings. This is undesirable as decompression using underlying decompressor (side-stepping the codec) will fail. This change passes empty strings to the underlying compressor
- Decompressing empty string -> empty string was kept for backwards compatibility
- Fix `getUncompressedLength` for zlib

Reviewed By: terrelln, yfeldblum

Differential Revision: D5740034

fbshipit-source-id: 5a747ea4963dad872103209aa4410197f6c605db
folly/io/Compression.cpp
folly/io/Compression.h
folly/io/compression/Zlib.cpp
folly/io/test/CompressionTest.cpp