Closed wiltseb closed 10 months ago
The returned negative integers are error codes. Zstd returns 0 if there is valid frame header but there is no size encoded there - this could happen if the frame was compressed in streaming mode.
On you errors:
Zstd.decompressedSize(ByteBuffer.allocate(0))
. Zstd.decompressedSize
requires direct buffers, so it returns -1 (generic error)
Zstd.decompressedSize(ByteBuffer.allocateDirect(0))
- returns -2 because it cannot find the frame header.
Based on the documentation, I'd expect that
Zstd.decompressedSize(ByteBuffer)
would always return a non-negative value. But somewhere between 1.5.0-4 and 1.5.5-4, it began returning negative values when provided with an emptyByteBuffer
. For emptyByteBuffer
s specifically, I would expect the method to return zero (despite the ambiguity with the return value when the size is unknown).Somewhere between 1.5.0-4 and 1.5.5-4, Zstd.decompressedSize(ByteBuffer) began returning negative values when passed an empty ByteBuffer.
Zstd.decompressedSize(ByteBuffer.allocate(0))
1.5.0-4 returns1
1.5.5-4 returns-1
Zstd.decompressedSize(ByteBuffer.allocateDirect(0))
1.5.0-4 returns0
1.5.5-4 returns-2