Commit 7de4458d authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-22865 compilation failure on win32-debug

ut_filename_hash(): Add better casts to please the compiler:

warning C4307: '*': integral constant overflow

This regression was introduced in
commit dd77f072 (MDEV-22841).
parent d6af055c
...@@ -820,10 +820,10 @@ static constexpr const char* ut_basename(const char *filename) ...@@ -820,10 +820,10 @@ static constexpr const char* ut_basename(const char *filename)
} }
/** Compute djb2 hash for a string. Stop at '.' , or '\0' */ /** Compute djb2 hash for a string. Stop at '.' , or '\0' */
constexpr uint32_t ut_filename_hash(const char* s, uint32_t h = 5381) constexpr uint32_t ut_filename_hash(const char *s, uint32_t h= 5381)
{ {
return *s == 0 || *s == '.' ? h : return *s == 0 || *s == '.' ? h :
ut_filename_hash(s + 1, 33 * h + (uint8_t)*s); ut_filename_hash(s + 1, static_cast<uint32_t>(uint64_t{33} * h + *s));
} }
/* Force constexpr to be evaluated at compile time.*/ /* Force constexpr to be evaluated at compile time.*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment