From 9a759750421bc72ed41c1dc67c0fa9b5564b8abc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Wed, 18 Apr 2018 22:20:39 +0200 Subject: Fix some Coverity warnings in String API - StringName::StringName(const StringName &p_name) Non-static class member _data is not initialized in this constructor nor in any functions that it calls. - StringName::_Data() Non-static class member idx is not initialized in this constructor nor in any functions that it calls. - String::num_uint64(...) This less-than-zero comparison of an unsigned value is never true. n % base < 0UL. - String::hex_to_int(...) and String::hex_to_int64(...) Execution cannot reach this statement (deadcode) --- core/string_db.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'core/string_db.cpp') diff --git a/core/string_db.cpp b/core/string_db.cpp index 6e1f887754..2475cbe3e8 100644 --- a/core/string_db.cpp +++ b/core/string_db.cpp @@ -164,21 +164,14 @@ void StringName::operator=(const StringName &p_name) { _data = p_name._data; } } -/* was inlined -StringName::operator String() const { - if (_data) - return _data->get_name(); - - return ""; -} -*/ StringName::StringName(const StringName &p_name) { - ERR_FAIL_COND(!configured); _data = NULL; - if (p_name._data && p_name._data->refcount.ref()) { + ERR_FAIL_COND(!configured); + + if (p_name._data && p_name._data->refcount.ref()) { _data = p_name._data; } } -- cgit v1.2.3