Minor doc improvements

This commit is contained in:
Hugues Delorme 2017-01-26 17:25:05 +01:00
parent 14a7be93a6
commit e7a36b4a60
3 changed files with 13 additions and 26 deletions

View File

@ -34,10 +34,9 @@
#include <stddef.h> #include <stddef.h>
/*! Stores a mutable string of 8-bit chars. /*! Stores a mutable string of chars.
* For faster lookups, it knowns the length of its contents. Length must not * For faster lookups, it knowns the length of its contents. Length must not
* exceeds the maximum size(capacity). * exceeds the maximum size(capacity). */
*/
struct gmio_string struct gmio_string
{ {
char* ptr; /*!< Contents */ char* ptr; /*!< Contents */
@ -103,9 +102,7 @@ char* gmio_cstr_copy(
char* dst, size_t dst_capacity, const char* src, size_t src_len) char* dst, size_t dst_capacity, const char* src, size_t src_len)
{ {
const size_t copy_len = const size_t copy_len =
dst_capacity > 0 ? dst_capacity > 0 ? GMIO_MIN(dst_capacity - 1, src_len) : 0;
GMIO_MIN(dst_capacity - 1, src_len) :
0;
if (copy_len > 0) { if (copy_len > 0) {
strncpy(dst, src, copy_len); strncpy(dst, src, copy_len);
dst[copy_len] = '\0'; dst[copy_len] = '\0';

View File

@ -47,22 +47,20 @@ bool gmio_check_zlib_compress_options(
int* error, const struct gmio_zlib_compress_options* z_opts); int* error, const struct gmio_zlib_compress_options* z_opts);
/*! Decompresses the source buffer into the destination buffer. /*! Decompresses the source buffer into the destination buffer.
* * \p src_len is the byte length of the source buffer. Upon entry, \p dest_len
* \p sourceLen is the byte length of the source buffer. Upon entry, \p destLen
* is the total size of the destination buffer, which must be large enough to * is the total size of the destination buffer, which must be large enough to
* hold the entire uncompressed data. * hold the entire uncompressed data.
* Upon exit, destLen is the actual size of the compressed buffer. * Upon exit, \p dest_len is the actual size of the compressed buffer. */
*/
int gmio_zlib_uncompress_buffer( int gmio_zlib_uncompress_buffer(
uint8_t* dest, size_t* dest_len, const uint8_t* src, size_t src_len); uint8_t* dest, size_t* dest_len, const uint8_t* src, size_t src_len);
/*! Computes the CRC-32 value with the bytes buff[0..buff_len-1] */ /*! Computes the CRC-32 value with the bytes from \p buff */
uint32_t gmio_zlib_crc32(const uint8_t* buff, size_t buff_len); uint32_t gmio_zlib_crc32(const uint8_t* buff, size_t buff_len);
/*! Returns the required initial value for the gmio_zlib_crc32_update() */ /*! Returns the required initial value for gmio_zlib_crc32_update() */
uint32_t gmio_zlib_crc32_initial(); uint32_t gmio_zlib_crc32_initial();
/*! Updates a running CRC-32 with the bytes buff[0..buff_len-1] */ /*! Updates a running CRC-32 with the bytes from \p buff */
uint32_t gmio_zlib_crc32_update( uint32_t gmio_zlib_crc32_update(
uint32_t crc, const uint8_t* buff, size_t buff_len); uint32_t crc, const uint8_t* buff, size_t buff_len);

View File

@ -62,21 +62,14 @@ enum gmio_zlib_compress_strategy
* *
* Initialising gmio_zlib_compress_options with \c {0} (or \c {} in C++) is the * Initialising gmio_zlib_compress_options with \c {0} (or \c {} in C++) is the
* convenient way to set default values. * convenient way to set default values.
*/ */
struct gmio_zlib_compress_options struct gmio_zlib_compress_options
{ {
/*! Compression level /*! Compression level.
* * Use enum value from \c gmio_zlib_compress_level */
* \c 0 : default compression
* \c 1 : best speed
* \c 9 : best compression */
uint8_t level; uint8_t level;
/*! Compression strategy /*! Compression strategy */
*
* \c 0 : default strategy
* \c 1 : filtered
* \c 9 : best compression */
enum gmio_zlib_compress_strategy strategy; enum gmio_zlib_compress_strategy strategy;
/*! Specifies how much memory should be allocated for the internal /*! Specifies how much memory should be allocated for the internal
@ -86,8 +79,7 @@ struct gmio_zlib_compress_options
* default usage. * default usage.
* *
* \c 1 uses minimum memory but is slow and reduces compression ratio * \c 1 uses minimum memory but is slow and reduces compression ratio
* \c 9 uses maximum memory for optimal speed * \c 9 uses maximum memory for optimal speed */
*/
uint8_t memory_usage; uint8_t memory_usage;
}; };