diff options
author | Marc Lehmann <schmorpforge@schmorp.de> | 2012-12-11 00:46:06 +0400 |
---|---|---|
committer | Marc Lehmann <schmorpforge@schmorp.de> | 2012-12-11 00:46:06 +0400 |
commit | 4b7485b0b2f1c39a510225ad79c3c41dc4c9595d (patch) | |
tree | f2cbe7d3f5e3ffcb408225965f235724f53544a9 | |
parent | 5e2c66a3be3be596a83d5aeb74e4f9ba5411ecac (diff) |
*** empty log message ***
-rw-r--r-- | lzf.h | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -46,7 +46,12 @@ ** ***********************************************************************/ -#define LZF_VERSION 0x0105 /* 1.5, API version */ +/* API version (major * 256 + minor) + * major API version gets bumped on incompatible changes. + * minor API version gets bumped on compatible changes. + * 1.5 => 1.6: add LZF_MAX_COMPRESSED_SIZE + */ +#define LZF_VERSION 0x0106 /* * Compress in_len bytes stored at the memory block starting at @@ -78,6 +83,17 @@ lzf_compress (const void *const in_data, unsigned int in_len, void *out_data, unsigned int out_len); /* + * The maximum out_len that needs to be allocated to make sure + * any input data can be compressed without overflowing the output + * buffer, i.e. maximum out_len = LZF_MAX_COMPRESSED_SIZE (in_len). + * This is useful if you don't want to bother with the case of + * incompressible data and just want to provide a buffer that is + * guaranteeed to be big enough. + * This macro can be used at preprocessing time. + */ +#define LZF_MAX_COMPRESSED_SIZE(n) ((n) * 33 / 32 + 1) + +/* * Decompress data compressed with some version of the lzf_compress * function and stored at location in_data and length in_len. The result * will be stored at out_data up to a maximum of out_len characters. |