diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-09-29 09:18:07 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-09-29 10:38:21 +0300 |
commit | ea1848ce0a5f03c3a9f7e0a221350f4f4044bb08 (patch) | |
tree | fdbb5979dfe5f81a4d3e53ea71f625d84848e730 /core/extension | |
parent | f8745f2f71c79972df66f17a3da75f6e328bc55d (diff) |
Use `constexpr` in the conditions with template parameters and `sizeof`s to suppress C4127 warnings.
Diffstat (limited to 'core/extension')
-rw-r--r-- | core/extension/gdnative_interface.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/extension/gdnative_interface.cpp b/core/extension/gdnative_interface.cpp index 67dc55bdb7..193fcb8916 100644 --- a/core/extension/gdnative_interface.cpp +++ b/core/extension/gdnative_interface.cpp @@ -559,7 +559,7 @@ static void gdnative_string_new_with_utf32_chars(GDNativeStringPtr r_dest, const static void gdnative_string_new_with_wide_chars(GDNativeStringPtr r_dest, const wchar_t *p_contents) { String *dest = (String *)r_dest; - if (sizeof(wchar_t) == 2) { + if constexpr (sizeof(wchar_t) == 2) { // wchar_t is 16 bit, parse. memnew_placement(dest, String); dest->parse_utf16((const char16_t *)p_contents); @@ -596,7 +596,7 @@ static void gdnative_string_new_with_utf32_chars_and_len(GDNativeStringPtr r_des static void gdnative_string_new_with_wide_chars_and_len(GDNativeStringPtr r_dest, const wchar_t *p_contents, const GDNativeInt p_size) { String *dest = (String *)r_dest; - if (sizeof(wchar_t) == 2) { + if constexpr (sizeof(wchar_t) == 2) { // wchar_t is 16 bit, parse. memnew_placement(dest, String); dest->parse_utf16((const char16_t *)p_contents, p_size); @@ -655,7 +655,7 @@ static GDNativeInt gdnative_string_to_utf32_chars(const GDNativeStringPtr p_self return len; } static GDNativeInt gdnative_string_to_wide_chars(const GDNativeStringPtr p_self, wchar_t *r_text, GDNativeInt p_max_write_length) { - if (sizeof(wchar_t) == 4) { + if constexpr (sizeof(wchar_t) == 4) { return gdnative_string_to_utf32_chars(p_self, (char32_t *)r_text, p_max_write_length); } else { return gdnative_string_to_utf16_chars(p_self, (char16_t *)r_text, p_max_write_length); |