mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
MDEV-34321: call to crc32c_3way through pointer to incorrect function type
In commit 9ec7819c58
the CRC-32 function
signatures had been unified somewhat, but not enough.
clang -fsanitize=undefined would flag a function pointer signature
mismatch between const char* and const void*, but not between
uint32_t and unsigned. We try to fix both inconsistencies anyway.
Reviewed by: Vladislav Vaintroub
This commit is contained in:
parent
b7a75fbb8a
commit
d9d0e8fd60
3 changed files with 6 additions and 6 deletions
|
@ -526,7 +526,7 @@ extern "C" const char *my_crc32c_implementation()
|
|||
} // namespace crc32c
|
||||
} // namespace mysys_namespace
|
||||
|
||||
extern "C" unsigned my_crc32c(unsigned int crc, const char *buf, size_t size)
|
||||
extern "C" uint32 my_crc32c(uint32 crc, const void *buf, size_t size)
|
||||
{
|
||||
return mysys_namespace::crc32c::ChosenExtend(crc,buf, size);
|
||||
}
|
||||
|
|
|
@ -184,9 +184,9 @@ static inline uint64_t CombineCRC(
|
|||
// Compute CRC-32C using the Intel hardware instruction.
|
||||
extern "C"
|
||||
USE_PCLMUL
|
||||
uint32_t crc32c_3way(uint32_t crc, const char *buf, size_t len)
|
||||
uint32_t crc32c_3way(uint32_t crc, const void *buf, size_t len)
|
||||
{
|
||||
const unsigned char* next = (const unsigned char*)buf;
|
||||
const unsigned char* next = static_cast<const unsigned char*>(buf);
|
||||
uint64_t count;
|
||||
uint64_t crc0, crc1, crc2;
|
||||
crc0 = crc ^ 0xffffffffu;
|
||||
|
|
|
@ -54,9 +54,9 @@ static uint32_t cpuid_ecx()
|
|||
#endif
|
||||
}
|
||||
|
||||
typedef unsigned (*my_crc32_t)(unsigned, const void *, size_t);
|
||||
extern "C" unsigned int crc32_pclmul(unsigned int, const void *, size_t);
|
||||
extern "C" unsigned int crc32c_3way(unsigned int, const void *, size_t);
|
||||
typedef uint32_t (*my_crc32_t)(uint32_t, const void *, size_t);
|
||||
extern "C" uint32_t crc32_pclmul(uint32_t, const void *, size_t);
|
||||
extern "C" uint32_t crc32c_3way(uint32_t, const void *, size_t);
|
||||
|
||||
#ifdef USE_VPCLMULQDQ
|
||||
# include <immintrin.h>
|
||||
|
|
Loading…
Add table
Reference in a new issue