diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-28 15:59:08 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-28 16:05:07 +0200 |
commit | 0e53dd642c44a613fdc1fa683ea373516e67c983 (patch) | |
tree | d3487cf419097a504dc884ddeb937bf9eca70c24 /core/string | |
parent | 14e1f36e614686f3fea0c74fac3624d1027dd5cc (diff) |
Fix MSVC warning C4706: assignment within conditional expression
Part of #66537.
Diffstat (limited to 'core/string')
-rw-r--r-- | core/string/ustring.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp index d8b93998af..75b797d397 100644 --- a/core/string/ustring.cpp +++ b/core/string/ustring.cpp @@ -2624,10 +2624,11 @@ double String::to_float() const { uint32_t String::hash(const char *p_cstr) { uint32_t hashv = 5381; - uint32_t c; + uint32_t c = *p_cstr++; - while ((c = *p_cstr++)) { + while (c) { hashv = ((hashv << 5) + hashv) + c; /* hash * 33 + c */ + c = *p_cstr++; } return hashv; @@ -2653,10 +2654,11 @@ uint32_t String::hash(const wchar_t *p_cstr, int p_len) { uint32_t String::hash(const wchar_t *p_cstr) { uint32_t hashv = 5381; - uint32_t c; + uint32_t c = *p_cstr++; - while ((c = *p_cstr++)) { + while (c) { hashv = ((hashv << 5) + hashv) + c; /* hash * 33 + c */ + c = *p_cstr++; } return hashv; @@ -2673,10 +2675,11 @@ uint32_t String::hash(const char32_t *p_cstr, int p_len) { uint32_t String::hash(const char32_t *p_cstr) { uint32_t hashv = 5381; - uint32_t c; + uint32_t c = *p_cstr++; - while ((c = *p_cstr++)) { + while (c) { hashv = ((hashv << 5) + hashv) + c; /* hash * 33 + c */ + c = *p_cstr++; } return hashv; @@ -2687,10 +2690,11 @@ uint32_t String::hash() const { const char32_t *chr = get_data(); uint32_t hashv = 5381; - uint32_t c; + uint32_t c = *chr++; - while ((c = *chr++)) { + while (c) { hashv = ((hashv << 5) + hashv) + c; /* hash * 33 + c */ + c = *chr++; } return hashv; @@ -2701,10 +2705,11 @@ uint64_t String::hash64() const { const char32_t *chr = get_data(); uint64_t hashv = 5381; - uint64_t c; + uint64_t c = *chr++; - while ((c = *chr++)) { + while (c) { hashv = ((hashv << 5) + hashv) + c; /* hash * 33 + c */ + c = *chr++; } return hashv; |