diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-04-05 13:40:26 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-04-06 14:34:37 +0300 |
commit | f851c4aa330e1064a66db50be62db2466f4fb768 (patch) | |
tree | 70f3bd487e91feb4ca777dba214a09b17041da97 /core/string | |
parent | 72407a9cfbd4f58102972c0910429f3ab7006f07 (diff) |
Fix some issues found by cppcheck.
Diffstat (limited to 'core/string')
-rw-r--r-- | core/string/print_string.cpp | 2 | ||||
-rw-r--r-- | core/string/print_string.h | 2 | ||||
-rw-r--r-- | core/string/translation.cpp | 4 | ||||
-rw-r--r-- | core/string/translation.h | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/core/string/print_string.cpp b/core/string/print_string.cpp index 97e119bcf6..919c9e08e3 100644 --- a/core/string/print_string.cpp +++ b/core/string/print_string.cpp @@ -45,7 +45,7 @@ void add_print_handler(PrintHandlerList *p_handler) { _global_unlock(); } -void remove_print_handler(PrintHandlerList *p_handler) { +void remove_print_handler(const PrintHandlerList *p_handler) { _global_lock(); PrintHandlerList *prev = nullptr; diff --git a/core/string/print_string.h b/core/string/print_string.h index 669d2ea316..f19573ad45 100644 --- a/core/string/print_string.h +++ b/core/string/print_string.h @@ -54,7 +54,7 @@ String stringify_variants(Variant p_var, Args... p_args) { } void add_print_handler(PrintHandlerList *p_handler); -void remove_print_handler(PrintHandlerList *p_handler); +void remove_print_handler(const PrintHandlerList *p_handler); extern bool _print_line_enabled; extern bool _print_error_enabled; diff --git a/core/string/translation.cpp b/core/string/translation.cpp index c41828de05..d6d361b5f1 100644 --- a/core/string/translation.cpp +++ b/core/string/translation.cpp @@ -891,7 +891,7 @@ String TranslationServer::wrap_with_fakebidi_characters(String &p_message) const return res; } -String TranslationServer::add_padding(String &p_message, int p_length) const { +String TranslationServer::add_padding(const String &p_message, int p_length) const { String res; String prefix = pseudolocalization_prefix; String suffix; @@ -921,7 +921,7 @@ const char32_t *TranslationServer::get_accented_version(char32_t p_character) co } bool TranslationServer::is_placeholder(String &p_message, int p_index) const { - return p_message[p_index] == '%' && p_index < p_message.size() - 1 && + return p_index < p_message.size() - 1 && p_message[p_index] == '%' && (p_message[p_index + 1] == 's' || p_message[p_index + 1] == 'c' || p_message[p_index + 1] == 'd' || p_message[p_index + 1] == 'o' || p_message[p_index + 1] == 'x' || p_message[p_index + 1] == 'X' || p_message[p_index + 1] == 'f'); } diff --git a/core/string/translation.h b/core/string/translation.h index 947ca4c6d8..ded6ed5925 100644 --- a/core/string/translation.h +++ b/core/string/translation.h @@ -96,7 +96,7 @@ class TranslationServer : public Object { String double_vowels(String &p_message) const; String replace_with_accented_string(String &p_message) const; String wrap_with_fakebidi_characters(String &p_message) const; - String add_padding(String &p_message, int p_length) const; + String add_padding(const String &p_message, int p_length) const; const char32_t *get_accented_version(char32_t p_character) const; bool is_placeholder(String &p_message, int p_index) const; |