Skip to content

Commit

Permalink
Fix code style issues with clang_format
Browse files Browse the repository at this point in the history
  • Loading branch information
lint-action committed Jan 2, 2025
1 parent 559bcf0 commit 723d725
Show file tree
Hide file tree
Showing 121 changed files with 23,017 additions and 23,541 deletions.
183 changes: 65 additions & 118 deletions lib/libdeflate-x64/libdeflate.h

Large diffs are not rendered by default.

126 changes: 38 additions & 88 deletions lib/libdeflate/libdeflate.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
extern "C" {
#endif

#define LIBDEFLATE_VERSION_MAJOR 1
#define LIBDEFLATE_VERSION_MINOR 17
#define LIBDEFLATE_VERSION_STRING "1.17"
#define LIBDEFLATE_VERSION_MAJOR 1
#define LIBDEFLATE_VERSION_MINOR 17
#define LIBDEFLATE_VERSION_STRING "1.17"

/*
* Users of libdeflate.dll on Windows can define LIBDEFLATE_DLL to cause
Expand All @@ -23,11 +23,11 @@ extern "C" {
* optimization that is irrelevant for most use cases of libdeflate.
*/
#ifndef LIBDEFLATEAPI
# if defined(LIBDEFLATE_DLL) && (defined(_WIN32) || defined(__CYGWIN__))
# define LIBDEFLATEAPI __declspec(dllimport)
# else
# define LIBDEFLATEAPI
# endif
#if defined(LIBDEFLATE_DLL) && (defined(_WIN32) || defined(__CYGWIN__))
#define LIBDEFLATEAPI __declspec(dllimport)
#else
#define LIBDEFLATEAPI
#endif
#endif

/* ========================================================================== */
Expand All @@ -54,8 +54,7 @@ struct libdeflate_compressor;
* A single compressor is not safe to use by multiple threads concurrently.
* However, different threads may use different compressors concurrently.
*/
LIBDEFLATEAPI struct libdeflate_compressor *
libdeflate_alloc_compressor(int compression_level);
LIBDEFLATEAPI struct libdeflate_compressor* libdeflate_alloc_compressor(int compression_level);

/*
* libdeflate_deflate_compress() performs raw DEFLATE compression on a buffer of
Expand Down Expand Up @@ -89,10 +88,7 @@ libdeflate_alloc_compressor(int compression_level);
* To avoid this, either don't write tests like the above, or make sure to
* include at least 9 bytes of slack space in 'out_nbytes_avail'.
*/
LIBDEFLATEAPI size_t
libdeflate_deflate_compress(struct libdeflate_compressor *compressor,
const void *in, size_t in_nbytes,
void *out, size_t out_nbytes_avail);
LIBDEFLATEAPI size_t libdeflate_deflate_compress(struct libdeflate_compressor* compressor, const void* in, size_t in_nbytes, void* out, size_t out_nbytes_avail);

/*
* libdeflate_deflate_compress_bound() returns a worst-case upper bound on the
Expand All @@ -118,53 +114,40 @@ libdeflate_deflate_compress(struct libdeflate_compressor *compressor,
* libdeflate_deflate_compress() returns 0, indicating that the compressed data
* did not fit into the provided output buffer.
*/
LIBDEFLATEAPI size_t
libdeflate_deflate_compress_bound(struct libdeflate_compressor *compressor,
size_t in_nbytes);
LIBDEFLATEAPI size_t libdeflate_deflate_compress_bound(struct libdeflate_compressor* compressor, size_t in_nbytes);

/*
* Like libdeflate_deflate_compress(), but uses the zlib wrapper format instead
* of raw DEFLATE.
*/
LIBDEFLATEAPI size_t
libdeflate_zlib_compress(struct libdeflate_compressor *compressor,
const void *in, size_t in_nbytes,
void *out, size_t out_nbytes_avail);
LIBDEFLATEAPI size_t libdeflate_zlib_compress(struct libdeflate_compressor* compressor, const void* in, size_t in_nbytes, void* out, size_t out_nbytes_avail);

/*
* Like libdeflate_deflate_compress_bound(), but assumes the data will be
* compressed with libdeflate_zlib_compress() rather than with
* libdeflate_deflate_compress().
*/
LIBDEFLATEAPI size_t
libdeflate_zlib_compress_bound(struct libdeflate_compressor *compressor,
size_t in_nbytes);
LIBDEFLATEAPI size_t libdeflate_zlib_compress_bound(struct libdeflate_compressor* compressor, size_t in_nbytes);

/*
* Like libdeflate_deflate_compress(), but uses the gzip wrapper format instead
* of raw DEFLATE.
*/
LIBDEFLATEAPI size_t
libdeflate_gzip_compress(struct libdeflate_compressor *compressor,
const void *in, size_t in_nbytes,
void *out, size_t out_nbytes_avail);
LIBDEFLATEAPI size_t libdeflate_gzip_compress(struct libdeflate_compressor* compressor, const void* in, size_t in_nbytes, void* out, size_t out_nbytes_avail);

/*
* Like libdeflate_deflate_compress_bound(), but assumes the data will be
* compressed with libdeflate_gzip_compress() rather than with
* libdeflate_deflate_compress().
*/
LIBDEFLATEAPI size_t
libdeflate_gzip_compress_bound(struct libdeflate_compressor *compressor,
size_t in_nbytes);
LIBDEFLATEAPI size_t libdeflate_gzip_compress_bound(struct libdeflate_compressor* compressor, size_t in_nbytes);

/*
* libdeflate_free_compressor() frees a compressor that was allocated with
* libdeflate_alloc_compressor(). If a NULL pointer is passed in, no action is
* taken.
*/
LIBDEFLATEAPI void
libdeflate_free_compressor(struct libdeflate_compressor *compressor);
LIBDEFLATEAPI void libdeflate_free_compressor(struct libdeflate_compressor* compressor);

/* ========================================================================== */
/* Decompression */
Expand All @@ -184,28 +167,27 @@ struct libdeflate_decompressor;
* A single decompressor is not safe to use by multiple threads concurrently.
* However, different threads may use different decompressors concurrently.
*/
LIBDEFLATEAPI struct libdeflate_decompressor *
libdeflate_alloc_decompressor(void);
LIBDEFLATEAPI struct libdeflate_decompressor* libdeflate_alloc_decompressor(void);

/*
* Result of a call to libdeflate_deflate_decompress(),
* libdeflate_zlib_decompress(), or libdeflate_gzip_decompress().
*/
enum libdeflate_result {
/* Decompression was successful. */
LIBDEFLATE_SUCCESS = 0,
/* Decompression was successful. */
LIBDEFLATE_SUCCESS = 0,

/* Decompression failed because the compressed data was invalid,
* corrupt, or otherwise unsupported. */
LIBDEFLATE_BAD_DATA = 1,
/* Decompression failed because the compressed data was invalid,
* corrupt, or otherwise unsupported. */
LIBDEFLATE_BAD_DATA = 1,

/* A NULL 'actual_out_nbytes_ret' was provided, but the data would have
* decompressed to fewer than 'out_nbytes_avail' bytes. */
LIBDEFLATE_SHORT_OUTPUT = 2,
/* A NULL 'actual_out_nbytes_ret' was provided, but the data would have
* decompressed to fewer than 'out_nbytes_avail' bytes. */
LIBDEFLATE_SHORT_OUTPUT = 2,

/* The data would have decompressed to more than 'out_nbytes_avail'
* bytes. */
LIBDEFLATE_INSUFFICIENT_SPACE = 3,
/* The data would have decompressed to more than 'out_nbytes_avail'
* bytes. */
LIBDEFLATE_INSUFFICIENT_SPACE = 3,
};

/*
Expand Down Expand Up @@ -239,24 +221,15 @@ enum libdeflate_result {
* not large enough but no other problems were encountered, or another
* nonzero result code if decompression failed for another reason.
*/
LIBDEFLATEAPI enum libdeflate_result
libdeflate_deflate_decompress(struct libdeflate_decompressor *decompressor,
const void *in, size_t in_nbytes,
void *out, size_t out_nbytes_avail,
size_t *actual_out_nbytes_ret);
LIBDEFLATEAPI enum libdeflate_result libdeflate_deflate_decompress(struct libdeflate_decompressor* decompressor, const void* in, size_t in_nbytes, void* out, size_t out_nbytes_avail, size_t* actual_out_nbytes_ret);

/*
* Like libdeflate_deflate_decompress(), but adds the 'actual_in_nbytes_ret'
* argument. If decompression succeeds and 'actual_in_nbytes_ret' is not NULL,
* then the actual compressed size of the DEFLATE stream (aligned to the next
* byte boundary) is written to *actual_in_nbytes_ret.
*/
LIBDEFLATEAPI enum libdeflate_result
libdeflate_deflate_decompress_ex(struct libdeflate_decompressor *decompressor,
const void *in, size_t in_nbytes,
void *out, size_t out_nbytes_avail,
size_t *actual_in_nbytes_ret,
size_t *actual_out_nbytes_ret);
LIBDEFLATEAPI enum libdeflate_result libdeflate_deflate_decompress_ex(struct libdeflate_decompressor* decompressor, const void* in, size_t in_nbytes, void* out, size_t out_nbytes_avail, size_t* actual_in_nbytes_ret, size_t* actual_out_nbytes_ret);

/*
* Like libdeflate_deflate_decompress(), but assumes the zlib wrapper format
Expand All @@ -266,11 +239,7 @@ libdeflate_deflate_decompress_ex(struct libdeflate_decompressor *decompressor,
* than 'in_nbytes'. If you need to know exactly where the zlib stream ended,
* use libdeflate_zlib_decompress_ex().
*/
LIBDEFLATEAPI enum libdeflate_result
libdeflate_zlib_decompress(struct libdeflate_decompressor *decompressor,
const void *in, size_t in_nbytes,
void *out, size_t out_nbytes_avail,
size_t *actual_out_nbytes_ret);
LIBDEFLATEAPI enum libdeflate_result libdeflate_zlib_decompress(struct libdeflate_decompressor* decompressor, const void* in, size_t in_nbytes, void* out, size_t out_nbytes_avail, size_t* actual_out_nbytes_ret);

/*
* Like libdeflate_zlib_decompress(), but adds the 'actual_in_nbytes_ret'
Expand All @@ -279,12 +248,7 @@ libdeflate_zlib_decompress(struct libdeflate_decompressor *decompressor,
* buffer was decompressed), then the actual number of input bytes consumed is
* written to *actual_in_nbytes_ret.
*/
LIBDEFLATEAPI enum libdeflate_result
libdeflate_zlib_decompress_ex(struct libdeflate_decompressor *decompressor,
const void *in, size_t in_nbytes,
void *out, size_t out_nbytes_avail,
size_t *actual_in_nbytes_ret,
size_t *actual_out_nbytes_ret);
LIBDEFLATEAPI enum libdeflate_result libdeflate_zlib_decompress_ex(struct libdeflate_decompressor* decompressor, const void* in, size_t in_nbytes, void* out, size_t out_nbytes_avail, size_t* actual_in_nbytes_ret, size_t* actual_out_nbytes_ret);

/*
* Like libdeflate_deflate_decompress(), but assumes the gzip wrapper format
Expand All @@ -294,11 +258,7 @@ libdeflate_zlib_decompress_ex(struct libdeflate_decompressor *decompressor,
* will be decompressed. Use libdeflate_gzip_decompress_ex() if you need
* multi-member support.
*/
LIBDEFLATEAPI enum libdeflate_result
libdeflate_gzip_decompress(struct libdeflate_decompressor *decompressor,
const void *in, size_t in_nbytes,
void *out, size_t out_nbytes_avail,
size_t *actual_out_nbytes_ret);
LIBDEFLATEAPI enum libdeflate_result libdeflate_gzip_decompress(struct libdeflate_decompressor* decompressor, const void* in, size_t in_nbytes, void* out, size_t out_nbytes_avail, size_t* actual_out_nbytes_ret);

/*
* Like libdeflate_gzip_decompress(), but adds the 'actual_in_nbytes_ret'
Expand All @@ -307,20 +267,14 @@ libdeflate_gzip_decompress(struct libdeflate_decompressor *decompressor,
* buffer was decompressed), then the actual number of input bytes consumed is
* written to *actual_in_nbytes_ret.
*/
LIBDEFLATEAPI enum libdeflate_result
libdeflate_gzip_decompress_ex(struct libdeflate_decompressor *decompressor,
const void *in, size_t in_nbytes,
void *out, size_t out_nbytes_avail,
size_t *actual_in_nbytes_ret,
size_t *actual_out_nbytes_ret);
LIBDEFLATEAPI enum libdeflate_result libdeflate_gzip_decompress_ex(struct libdeflate_decompressor* decompressor, const void* in, size_t in_nbytes, void* out, size_t out_nbytes_avail, size_t* actual_in_nbytes_ret, size_t* actual_out_nbytes_ret);

/*
* libdeflate_free_decompressor() frees a decompressor that was allocated with
* libdeflate_alloc_decompressor(). If a NULL pointer is passed in, no action
* is taken.
*/
LIBDEFLATEAPI void
libdeflate_free_decompressor(struct libdeflate_decompressor *decompressor);
LIBDEFLATEAPI void libdeflate_free_decompressor(struct libdeflate_decompressor* decompressor);

/* ========================================================================== */
/* Checksums */
Expand All @@ -332,8 +286,7 @@ libdeflate_free_decompressor(struct libdeflate_decompressor *decompressor);
* required initial value for 'adler' is 1. This value is also returned when
* 'buffer' is specified as NULL.
*/
LIBDEFLATEAPI uint32_t
libdeflate_adler32(uint32_t adler, const void *buffer, size_t len);
LIBDEFLATEAPI uint32_t libdeflate_adler32(uint32_t adler, const void* buffer, size_t len);


/*
Expand All @@ -342,8 +295,7 @@ libdeflate_adler32(uint32_t adler, const void *buffer, size_t len);
* initial value for 'crc' is 0. This value is also returned when 'buffer' is
* specified as NULL.
*/
LIBDEFLATEAPI uint32_t
libdeflate_crc32(uint32_t crc, const void *buffer, size_t len);
LIBDEFLATEAPI uint32_t libdeflate_crc32(uint32_t crc, const void* buffer, size_t len);

/* ========================================================================== */
/* Custom memory allocator */
Expand All @@ -357,9 +309,7 @@ libdeflate_crc32(uint32_t crc, const void *buffer, size_t len);
* There must not be any libdeflate_compressor or libdeflate_decompressor
* structures in existence when calling this function.
*/
LIBDEFLATEAPI void
libdeflate_set_memory_allocator(void *(*malloc_func)(size_t),
void (*free_func)(void *));
LIBDEFLATEAPI void libdeflate_set_memory_allocator(void* (*malloc_func)(size_t), void (*free_func)(void*));

#ifdef __cplusplus
}
Expand Down
Loading

0 comments on commit 723d725

Please sign in to comment.