Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix incorrect compression resulting from input vs output confusion.
Also adds a test that fails without this fix. `BS.drop writtenInt bs` made no sense, given that `bs` is the *input* ByteString; neither did `writtenInt < BS.length bs`. This is because `writtenInt` in the number of compressed Bytes output. What I originally had in mind was to drop the number of consumed input Bytes. But `LZ4F_compressUpdate()` does not return those, because it *always* consumes the full input (and sizing the output buffer based on `lz4fCompressBound()` ensures that it always fits into the output). That means that the check whether it fits is not necessary at all. This commit fixes the issue by removing the incorrect and unnecessary check. But the whole concept of `loopSingleBs` is unnecessary, because we we never need to loop over a single BS. The next commit will remove this unnecessary logic.
- Loading branch information