diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-28 20:47:23 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-28 20:47:23 +0200 |
commit | 361d9b514ef969a44f596c0bab9c86d9521379f3 (patch) | |
tree | 06980838c57d647127638b47e5ff4c26721bdc3c /core/string/ustring.cpp | |
parent | 0ce7e2763d8f32de9cd1980dd6339264339c946b (diff) | |
parent | 0e53dd642c44a613fdc1fa683ea373516e67c983 (diff) | |
download | redot-engine-361d9b514ef969a44f596c0bab9c86d9521379f3.tar.gz |
Merge pull request #66542 from akien-mga/msvc-warning-c4706
Fix MSVC warning C4706: assignment within conditional expression
Diffstat (limited to 'core/string/ustring.cpp')
-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; |