Update some function headers.

This commit is contained in:
Gregory Nutt 2018-03-15 09:19:26 -06:00
parent 0ab037e6b4
commit 43ba19025d
3 changed files with 91 additions and 32 deletions

View File

@ -56,44 +56,60 @@ typedef lzf_hslot_t lzf_state_t[1 << HLOG];
* Public Function Prototypes * Public Function Prototypes
****************************************************************************/ ****************************************************************************/
/* Compress in_len bytes stored at the memory block starting at /****************************************************************************
* in_data and write the result to out_data, up to a maximum length * Name: lzf_compress
* of out_len bytes.
* *
* If the output buffer is not large enough or any error occurs return 0, * Description:
* otherwise return the number of bytes used, which might be considerably * Compress in_len bytes stored at the memory block starting at
* more than in_len (but less than 104% of the original size), so it * in_data and write the result to out_data, up to a maximum length
* makes sense to always use out_len == in_len - 1), to ensure _some_ * of out_len bytes.
* compression, and store the data uncompressed otherwise (with a flag, of
* course.
* *
* lzf_compress might use different algorithms on different systems and * If the output buffer is not large enough or any error occurs return 0,
* even different runs, thus might result in different compressed strings * otherwise return the number of bytes used, which might be considerably
* depending on the phase of the moon or similar factors. However, all * more than in_len (but less than 104% of the original size), so it
* these strings are architecture-independent and will result in the * makes sense to always use out_len == in_len - 1), to ensure _some_
* original data when decompressed using lzf_decompress. * compression, and store the data uncompressed otherwise (with a flag, of
* course.
* *
* The buffers must not be overlapping. * lzf_compress might use different algorithms on different systems and
*/ * even different runs, thus might result in different compressed strings
* depending on the phase of the moon or similar factors. However, all
* these strings are architecture-independent and will result in the
* original data when decompressed using lzf_decompress.
*
* The buffers must not be overlapping.
*
* Compressed format:
*
* 000LLLLL <L+1> ; literal, L+1=1..33 octets
* LLLooooo oooooooo ; backref L+1=1..7 octets, o+1=1..4096 offset
* 111ooooo LLLLLLLL oooooooo ; backref L+8 octets, o+1=1..4096 offset
*
****************************************************************************/
unsigned int lzf_compress(FAR const void *const in_data, unsigned int lzf_compress(FAR const void *const in_data,
unsigned int in_len, FAR void *out_data, unsigned int in_len, FAR void *out_data,
unsigned int out_len, lzf_state_t htab); unsigned int out_len, lzf_state_t htab);
/* Decompress data compressed with some version of the lzf_compress /****************************************************************************
* function and stored at location in_data and length in_len. The result * Name: lzf_decompress
* will be stored at out_data up to a maximum of out_len characters.
* *
* If the output buffer is not large enough to hold the decompressed * Description:
* data, a 0 is returned and errno is set to E2BIG. Otherwise the number * Decompress data compressed with some version of the lzf_compress
* of decompressed bytes (i.e. the original length of the data) is * function and stored at location in_data and length in_len. The result
* returned. * will be stored at out_data up to a maximum of out_len characters.
* *
* If an error in the compressed data is detected, a zero is returned and * If the output buffer is not large enough to hold the decompressed
* errno is set to EINVAL. * data, a 0 is returned and errno is set to E2BIG. Otherwise the number
* of decompressed bytes (i.e. the original length of the data) is
* returned.
* *
* This function is very fast, about as fast as a copying loop. * If an error in the compressed data is detected, a zero is returned and
*/ * errno is set to EINVAL.
*
* This function is very fast, about as fast as a copying loop.
*
****************************************************************************/
unsigned int lzf_decompress(FAR const void *const in_data, unsigned int lzf_decompress(FAR const void *const in_data,
unsigned int in_len, FAR void *out_data, unsigned int in_len, FAR void *out_data,

View File

@ -92,13 +92,36 @@
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
/* Compressed format /****************************************************************************
* Name: lzf_compress
* *
* 000LLLLL <L+1> ; literal, L+1=1..33 octets * Description:
* LLLooooo oooooooo ; backref L+1=1..7 octets, o+1=1..4096 offset * Compress in_len bytes stored at the memory block starting at
* 111ooooo LLLLLLLL oooooooo ; backref L+8 octets, o+1=1..4096 offset * in_data and write the result to out_data, up to a maximum length
* of out_len bytes.
* *
*/ * If the output buffer is not large enough or any error occurs return 0,
* otherwise return the number of bytes used, which might be considerably
* more than in_len (but less than 104% of the original size), so it
* makes sense to always use out_len == in_len - 1), to ensure _some_
* compression, and store the data uncompressed otherwise (with a flag, of
* course.
*
* lzf_compress might use different algorithms on different systems and
* even different runs, thus might result in different compressed strings
* depending on the phase of the moon or similar factors. However, all
* these strings are architecture-independent and will result in the
* original data when decompressed using lzf_decompress.
*
* The buffers must not be overlapping.
*
* Compressed format:
*
* 000LLLLL <L+1> ; literal, L+1=1..33 octets
* LLLooooo oooooooo ; backref L+1=1..7 octets, o+1=1..4096 offset
* 111ooooo LLLLLLLL oooooooo ; backref L+8 octets, o+1=1..4096 offset
*
****************************************************************************/
unsigned int lzf_compress(FAR const void *const in_data, unsigned int lzf_compress(FAR const void *const in_data,
unsigned int in_len, FAR void *out_data, unsigned int in_len, FAR void *out_data,

View File

@ -38,6 +38,26 @@
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
/****************************************************************************
* Name: lzf_decompress
*
* Description:
* 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.
*
* If the output buffer is not large enough to hold the decompressed
* data, a 0 is returned and errno is set to E2BIG. Otherwise the number
* of decompressed bytes (i.e. the original length of the data) is
* returned.
*
* If an error in the compressed data is detected, a zero is returned and
* errno is set to EINVAL.
*
* This function is very fast, about as fast as a copying loop.
*
****************************************************************************/
unsigned int lzf_decompress (FAR const void *const in_data, unsigned int lzf_decompress (FAR const void *const in_data,
unsigned int in_len, FAR void *out_data, unsigned int in_len, FAR void *out_data,
unsigned int out_len) unsigned int out_len)