This project is read-only.

Couple issues with the code ... at least I think so !



I noticed a couple issue with the LZF compression algorithm.
  1. Cannot compress a buffer of size 1
    This will throw an index to big exception on the following line:
    uint hval = (uint)(((input[iidx]) << 8) | input[iidx + 1]); // FRST(in_data, iidx);
  2. Max compression size
    This LZF code is based on the LibLZF C code (
    In the lzf.h code it states the following for determining the max size for the output buffer in the case no compression is achieved:

define LZF_MAX_COMPRESSED_SIZE(n) ((((n) * 33) >> 5 ) + 1)

This will not work with very small data sets (i.e. 10 bytes)

My workaround for this is to enforce that the splitting of the data into buffers of 64kb don't leave a final buffer with a very small data size.

Hope this helps.