Open tkram01 opened 5 years ago
In the above code, I believe there is an error in the following line:
const size_t uncompressed_size = LZSSE2_Decompress(compressed_buffer, size, uncompressed_buffer, BLOCK_SIZE);
The outputLength parameter should in this case be the original uncompressed size, not the BLOCK_SIZE. This is why it works correctly when they are the same. Note that LZSSE doesn't frame blocks, relying on the user to provide framing that best suits their use case, so it can't detect end of stream from the stream alone.
Looking at the documentation of that parameter, I believe it's probably not clear enough and will change the language as a fix.
For the following program if the BLOCK_SIZE > the length of the uncompressed data then I get the wrong size returned from LZSSE2_Decompress(). If I set BLOCK_SIZE == the uncompressed data size then I get the expected result. The header indicates any block size >= the uncompressed data size is acceptable.