mirror of
https://github.com/facebook/zstd.git
synced 2025-03-06 16:56:49 +02:00
fix clangbuild
notably -Wconversion and -Wdocumentation
This commit is contained in:
parent
b34517a440
commit
e62e15df19
@ -630,7 +630,6 @@ XXH_PUBLIC_API XXH_PUREF XXH32_hash_t XXH32 (const void* input, size_t length, X
|
||||
* @brief The opaque state struct for the XXH32 streaming API.
|
||||
*
|
||||
* @see XXH32_state_s for details.
|
||||
* @see @ref streaming_example "Streaming Example"
|
||||
*/
|
||||
typedef struct XXH32_state_s XXH32_state_t;
|
||||
|
||||
@ -641,8 +640,6 @@ typedef struct XXH32_state_s XXH32_state_t;
|
||||
* @return `NULL` on failure.
|
||||
*
|
||||
* @note Must be freed with XXH32_freeState().
|
||||
*
|
||||
* @see @ref streaming_example "Streaming Example"
|
||||
*/
|
||||
XXH_PUBLIC_API XXH_MALLOCF XXH32_state_t* XXH32_createState(void);
|
||||
/*!
|
||||
@ -654,8 +651,6 @@ XXH_PUBLIC_API XXH_MALLOCF XXH32_state_t* XXH32_createState(void);
|
||||
*
|
||||
* @note @p statePtr must be allocated with XXH32_createState().
|
||||
*
|
||||
* @see @ref streaming_example "Streaming Example"
|
||||
*
|
||||
*/
|
||||
XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr);
|
||||
/*!
|
||||
@ -681,8 +676,6 @@ XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* dst_state, const XXH32_state_
|
||||
* @return @ref XXH_ERROR on failure.
|
||||
*
|
||||
* @note This function resets and seeds a state. Call it before @ref XXH32_update().
|
||||
*
|
||||
* @see @ref streaming_example "Streaming Example"
|
||||
*/
|
||||
XXH_PUBLIC_API XXH_errorcode XXH32_reset (XXH32_state_t* statePtr, XXH32_hash_t seed);
|
||||
|
||||
@ -704,8 +697,6 @@ XXH_PUBLIC_API XXH_errorcode XXH32_reset (XXH32_state_t* statePtr, XXH32_hash_t
|
||||
* @return @ref XXH_ERROR on failure.
|
||||
*
|
||||
* @note Call this to incrementally consume blocks of data.
|
||||
*
|
||||
* @see @ref streaming_example "Streaming Example"
|
||||
*/
|
||||
XXH_PUBLIC_API XXH_errorcode XXH32_update (XXH32_state_t* statePtr, const void* input, size_t length);
|
||||
|
||||
@ -722,8 +713,6 @@ XXH_PUBLIC_API XXH_errorcode XXH32_update (XXH32_state_t* statePtr, const void*
|
||||
* @note
|
||||
* Calling XXH32_digest() will not affect @p statePtr, so you can update,
|
||||
* digest, and update again.
|
||||
*
|
||||
* @see @ref streaming_example "Streaming Example"
|
||||
*/
|
||||
XXH_PUBLIC_API XXH_PUREF XXH32_hash_t XXH32_digest (const XXH32_state_t* statePtr);
|
||||
#endif /* !XXH_NO_STREAM */
|
||||
@ -900,7 +889,6 @@ XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH64(XXH_NOESCAPE const void* input, size
|
||||
* @brief The opaque state struct for the XXH64 streaming API.
|
||||
*
|
||||
* @see XXH64_state_s for details.
|
||||
* @see @ref streaming_example "Streaming Example"
|
||||
*/
|
||||
typedef struct XXH64_state_s XXH64_state_t; /* incomplete type */
|
||||
|
||||
@ -911,8 +899,6 @@ typedef struct XXH64_state_s XXH64_state_t; /* incomplete type */
|
||||
* @return `NULL` on failure.
|
||||
*
|
||||
* @note Must be freed with XXH64_freeState().
|
||||
*
|
||||
* @see @ref streaming_example "Streaming Example"
|
||||
*/
|
||||
XXH_PUBLIC_API XXH_MALLOCF XXH64_state_t* XXH64_createState(void);
|
||||
|
||||
@ -924,8 +910,6 @@ XXH_PUBLIC_API XXH_MALLOCF XXH64_state_t* XXH64_createState(void);
|
||||
* @return @ref XXH_OK.
|
||||
*
|
||||
* @note @p statePtr must be allocated with XXH64_createState().
|
||||
*
|
||||
* @see @ref streaming_example "Streaming Example"
|
||||
*/
|
||||
XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr);
|
||||
|
||||
@ -952,8 +936,6 @@ XXH_PUBLIC_API void XXH64_copyState(XXH_NOESCAPE XXH64_state_t* dst_state, const
|
||||
* @return @ref XXH_ERROR on failure.
|
||||
*
|
||||
* @note This function resets and seeds a state. Call it before @ref XXH64_update().
|
||||
*
|
||||
* @see @ref streaming_example "Streaming Example"
|
||||
*/
|
||||
XXH_PUBLIC_API XXH_errorcode XXH64_reset (XXH_NOESCAPE XXH64_state_t* statePtr, XXH64_hash_t seed);
|
||||
|
||||
@ -975,8 +957,6 @@ XXH_PUBLIC_API XXH_errorcode XXH64_reset (XXH_NOESCAPE XXH64_state_t* statePtr,
|
||||
* @return @ref XXH_ERROR on failure.
|
||||
*
|
||||
* @note Call this to incrementally consume blocks of data.
|
||||
*
|
||||
* @see @ref streaming_example "Streaming Example"
|
||||
*/
|
||||
XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH_NOESCAPE XXH64_state_t* statePtr, XXH_NOESCAPE const void* input, size_t length);
|
||||
|
||||
@ -993,8 +973,6 @@ XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH_NOESCAPE XXH64_state_t* statePtr,
|
||||
* @note
|
||||
* Calling XXH64_digest() will not affect @p statePtr, so you can update,
|
||||
* digest, and update again.
|
||||
*
|
||||
* @see @ref streaming_example "Streaming Example"
|
||||
*/
|
||||
XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH64_digest (XXH_NOESCAPE const XXH64_state_t* statePtr);
|
||||
#endif /* !XXH_NO_STREAM */
|
||||
@ -1199,7 +1177,6 @@ XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH3_64bits_withSecret(XXH_NOESCAPE const
|
||||
* @brief The opaque state struct for the XXH3 streaming API.
|
||||
*
|
||||
* @see XXH3_state_s for details.
|
||||
* @see @ref streaming_example "Streaming Example"
|
||||
*/
|
||||
typedef struct XXH3_state_s XXH3_state_t;
|
||||
XXH_PUBLIC_API XXH_MALLOCF XXH3_state_t* XXH3_createState(void);
|
||||
@ -1231,8 +1208,6 @@ XXH_PUBLIC_API void XXH3_copyState(XXH_NOESCAPE XXH3_state_t* dst_state, XXH_NOE
|
||||
* - Call this function before @ref XXH3_64bits_update().
|
||||
* - Digest will be equivalent to `XXH3_64bits()`.
|
||||
*
|
||||
* @see @ref streaming_example "Streaming Example"
|
||||
*
|
||||
*/
|
||||
XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset(XXH_NOESCAPE XXH3_state_t* statePtr);
|
||||
|
||||
@ -1253,8 +1228,6 @@ XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset(XXH_NOESCAPE XXH3_state_t* stateP
|
||||
* - Call this function before @ref XXH3_64bits_update().
|
||||
* - Digest will be equivalent to `XXH3_64bits_withSeed()`.
|
||||
*
|
||||
* @see @ref streaming_example "Streaming Example"
|
||||
*
|
||||
*/
|
||||
XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH64_hash_t seed);
|
||||
|
||||
@ -1279,8 +1252,6 @@ XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSeed(XXH_NOESCAPE XXH3_state_
|
||||
* (secret's content should look like a bunch of random bytes).
|
||||
* When in doubt about the randomness of a candidate `secret`,
|
||||
* consider employing `XXH3_generateSecret()` instead (see below).
|
||||
*
|
||||
* @see @ref streaming_example "Streaming Example"
|
||||
*/
|
||||
XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSecret(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize);
|
||||
|
||||
@ -1302,8 +1273,6 @@ XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSecret(XXH_NOESCAPE XXH3_stat
|
||||
* @return @ref XXH_ERROR on failure.
|
||||
*
|
||||
* @note Call this to incrementally consume blocks of data.
|
||||
*
|
||||
* @see @ref streaming_example "Streaming Example"
|
||||
*/
|
||||
XXH_PUBLIC_API XXH_errorcode XXH3_64bits_update (XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* input, size_t length);
|
||||
|
||||
@ -1320,8 +1289,6 @@ XXH_PUBLIC_API XXH_errorcode XXH3_64bits_update (XXH_NOESCAPE XXH3_state_t* stat
|
||||
* @note
|
||||
* Calling XXH3_64bits_digest() will not affect @p statePtr, so you can update,
|
||||
* digest, and update again.
|
||||
*
|
||||
* @see @ref streaming_example "Streaming Example"
|
||||
*/
|
||||
XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH3_64bits_digest (XXH_NOESCAPE const XXH3_state_t* statePtr);
|
||||
#endif /* !XXH_NO_STREAM */
|
||||
@ -1442,8 +1409,6 @@ XXH_PUBLIC_API XXH_PUREF XXH128_hash_t XXH3_128bits_withSecret(XXH_NOESCAPE cons
|
||||
* - This function resets `statePtr` and generate a secret with default parameters.
|
||||
* - Call it before @ref XXH3_128bits_update().
|
||||
* - Digest will be equivalent to `XXH3_128bits()`.
|
||||
*
|
||||
* @see @ref streaming_example "Streaming Example"
|
||||
*/
|
||||
XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset(XXH_NOESCAPE XXH3_state_t* statePtr);
|
||||
|
||||
@ -1463,8 +1428,6 @@ XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset(XXH_NOESCAPE XXH3_state_t* state
|
||||
* - This function resets `statePtr` and generate a secret from `seed`.
|
||||
* - Call it before @ref XXH3_128bits_update().
|
||||
* - Digest will be equivalent to `XXH3_128bits_withSeed()`.
|
||||
*
|
||||
* @see @ref streaming_example "Streaming Example"
|
||||
*/
|
||||
XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH64_hash_t seed);
|
||||
/*!
|
||||
@ -1486,8 +1449,6 @@ XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSeed(XXH_NOESCAPE XXH3_state
|
||||
* (secret's content should look like a bunch of random bytes).
|
||||
* When in doubt about the randomness of a candidate `secret`,
|
||||
* consider employing `XXH3_generateSecret()` instead (see below).
|
||||
*
|
||||
* @see @ref streaming_example "Streaming Example"
|
||||
*/
|
||||
XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSecret(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize);
|
||||
|
||||
@ -6072,8 +6033,6 @@ static void XXH_alignedFree(void* p)
|
||||
* @return `NULL` on failure.
|
||||
*
|
||||
* @note Must be freed with XXH3_freeState().
|
||||
*
|
||||
* @see @ref streaming_example "Streaming Example"
|
||||
*/
|
||||
XXH_PUBLIC_API XXH3_state_t* XXH3_createState(void)
|
||||
{
|
||||
@ -6092,8 +6051,6 @@ XXH_PUBLIC_API XXH3_state_t* XXH3_createState(void)
|
||||
* @return @ref XXH_OK.
|
||||
*
|
||||
* @note Must be allocated with XXH3_createState().
|
||||
*
|
||||
* @see @ref streaming_example "Streaming Example"
|
||||
*/
|
||||
XXH_PUBLIC_API XXH_errorcode XXH3_freeState(XXH3_state_t* statePtr)
|
||||
{
|
||||
|
@ -141,7 +141,7 @@ static const size_t maxMemory = (sizeof(size_t) == 4)
|
||||
* sprintf() would be the supported one, but it's labelled unsafe,
|
||||
* so some modern static analyzer will flag it as such, making it unusable.
|
||||
* formatString_u() replaces snprintf() for the specific case where there are only %u arguments */
|
||||
static int formatString_u(char *buffer, size_t buffer_size, const char *formatString, unsigned int value)
|
||||
static int formatString_u(char* buffer, size_t buffer_size, const char* formatString, unsigned int value)
|
||||
{
|
||||
size_t written = 0;
|
||||
int i;
|
||||
@ -156,14 +156,14 @@ static int formatString_u(char *buffer, size_t buffer_size, const char *formatSt
|
||||
if (formatString[++i] == 'u') {
|
||||
/* Handle single digit */
|
||||
if (value < 10) {
|
||||
buffer[written++] = '0' + value;
|
||||
buffer[written++] = '0' + (char)value;
|
||||
} else if (value < 100) {
|
||||
/* Handle two digits */
|
||||
if (written >= buffer_size - 2) {
|
||||
return -1; /* buffer overflow */
|
||||
}
|
||||
buffer[written++] = '0' + value / 10;
|
||||
buffer[written++] = '0' + value % 10;
|
||||
buffer[written++] = '0' + (char)(value / 10);
|
||||
buffer[written++] = '0' + (char)(value % 10);
|
||||
} else { /* 100 */
|
||||
if (written >= buffer_size - 3) {
|
||||
return -1; /* buffer overflow */
|
||||
@ -185,7 +185,7 @@ static int formatString_u(char *buffer, size_t buffer_size, const char *formatSt
|
||||
buffer[0] = '\0'; /* Handle truncation */
|
||||
}
|
||||
|
||||
return written;
|
||||
return (int)written;
|
||||
}
|
||||
|
||||
/* *************************************
|
||||
|
Loading…
x
Reference in New Issue
Block a user