hash: Fix -Warray-parameter= warnings
authorAnatol Belski <ab@php.net>
Mon, 22 Mar 2021 20:17:43 +0000 (21:17 +0100)
committerAnatol Belski <ab@php.net>
Fri, 26 Mar 2021 22:29:01 +0000 (23:29 +0100)
Signed-off-by: Anatol Belski <ab@php.net>
ext/hash/murmur/PMurHash128.c
ext/hash/php_hash_fnv.h
ext/hash/php_hash_gost.h
ext/hash/php_hash_joaat.h

index 2856542190eac222f3408afb5799e930ae2e9671..4425f81575ef81932e2aae079de5293b8404e13f 100644 (file)
@@ -170,7 +170,7 @@ do {\
 } while(0)
 
 /* Finalize a hash. To match the original Murmur3_128x86 the total_length must be provided */
-void PMurHash128x86_Result(const uint32_t *ph, const uint32_t *pcarry, uint32_t total_length, uint32_t *out)
+void PMurHash128x86_Result(const uint32_t ph[4], const uint32_t pcarry[4], uint32_t total_length, uint32_t out[4])
 {
   uint32_t h1 = ph[0];
   uint32_t h2 = ph[1];
@@ -240,7 +240,7 @@ skiprot:
 
 /* Main hashing function. Initialise carry[4] to {0,0,0,0} and h[4] to an initial {seed,seed,seed,seed}
  * if wanted. Both ph and pcarry are required arguments. */
-void PMurHash128x86_Process(uint32_t * const ph, uint32_t * const pcarry, const void * const key, int len)
+void PMurHash128x86_Process(uint32_t ph[4], uint32_t pcarry[4], const void * const key, int len)
 {
   uint32_t h1 = ph[0];
   uint32_t h2 = ph[1];
@@ -480,8 +480,8 @@ do {\
 } while(0)
 
 /* Finalize a hash. To match the original Murmur3_128x64 the total_length must be provided */
-void PMurHash128x64_Result(const uint64_t * const ph, const uint64_t * const pcarry,
-                        const uint32_t total_length, uint64_t * const out)
+void PMurHash128x64_Result(const uint64_t ph[2], const uint64_t pcarry[2],
+                        const uint32_t total_length, uint64_t out[2])
 {
   uint64_t h1 = ph[0];
   uint64_t h2 = ph[1];
@@ -523,7 +523,7 @@ void PMurHash128x64_Result(const uint64_t * const ph, const uint64_t * const pca
 
 /* Main hashing function. Initialise carry[2] to {0,0} and h[2] to an initial {seed,seed}
  * if wanted. Both ph and pcarry are required arguments. */
-void PMurHash128x64_Process(uint64_t * const ph, uint64_t * const pcarry, const void * const key, int len)
+void PMurHash128x64_Process(uint64_t ph[2], uint64_t pcarry[2], const void * const key, int len)
 {
   uint64_t h1 = ph[0];
   uint64_t h2 = ph[1];
index f4dacb223e89405c273b67a2a23a2c20b2fcb89b..728b1f125e3934a78dcbd48b58cce207eb08049a 100644 (file)
@@ -55,12 +55,12 @@ typedef struct {
 PHP_HASH_API void PHP_FNV132Init(PHP_FNV132_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args);
 PHP_HASH_API void PHP_FNV132Update(PHP_FNV132_CTX *context, const unsigned char *input, size_t inputLen);
 PHP_HASH_API void PHP_FNV1a32Update(PHP_FNV132_CTX *context, const unsigned char *input, size_t inputLen);
-PHP_HASH_API void PHP_FNV132Final(unsigned char digest[16], PHP_FNV132_CTX * context);
+PHP_HASH_API void PHP_FNV132Final(unsigned char digest[4], PHP_FNV132_CTX * context);
 
 PHP_HASH_API void PHP_FNV164Init(PHP_FNV164_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args);
 PHP_HASH_API void PHP_FNV164Update(PHP_FNV164_CTX *context, const unsigned char *input, size_t inputLen);
 PHP_HASH_API void PHP_FNV1a64Update(PHP_FNV164_CTX *context, const unsigned char *input, size_t inputLen);
-PHP_HASH_API void PHP_FNV164Final(unsigned char digest[16], PHP_FNV164_CTX * context);
+PHP_HASH_API void PHP_FNV164Final(unsigned char digest[8], PHP_FNV164_CTX * context);
 
 static uint32_t fnv_32_buf(void *buf, size_t len, uint32_t hval, int alternate);
 static uint64_t fnv_64_buf(void *buf, size_t len, uint64_t hval, int alternate);
index 850b089506810538f64b36ad32b93c49348c06f7..a69dcc45eb1b6419d0c72e6967a5f99169e7a2c3 100644 (file)
@@ -31,6 +31,6 @@ typedef struct {
 
 PHP_HASH_API void PHP_GOSTInit(PHP_GOST_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *args);
 PHP_HASH_API void PHP_GOSTUpdate(PHP_GOST_CTX *, const unsigned char *, size_t);
-PHP_HASH_API void PHP_GOSTFinal(unsigned char[64], PHP_GOST_CTX *);
+PHP_HASH_API void PHP_GOSTFinal(unsigned char[32], PHP_GOST_CTX *);
 
 #endif
index 113983c2a42541b384569a4f85d1d068bdddd0ec..3dd2caa50cb937576009f2e93b3bb5f72050b5ca 100644 (file)
@@ -24,7 +24,7 @@ typedef struct {
 
 PHP_HASH_API void PHP_JOAATInit(PHP_JOAAT_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args);
 PHP_HASH_API void PHP_JOAATUpdate(PHP_JOAAT_CTX *context, const unsigned char *input, size_t inputLen);
-PHP_HASH_API void PHP_JOAATFinal(unsigned char digest[16], PHP_JOAAT_CTX * context);
+PHP_HASH_API void PHP_JOAATFinal(unsigned char digest[4], PHP_JOAAT_CTX * context);
 
 static uint32_t joaat_buf(void *buf, size_t len, uint32_t hval);