diff options
Diffstat (limited to 'source/fud_string.cpp')
-rw-r--r-- | source/fud_string.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/source/fud_string.cpp b/source/fud_string.cpp index 4cffb60..3a9aca0 100644 --- a/source/fud_string.cpp +++ b/source/fud_string.cpp @@ -46,9 +46,11 @@ ssize_t cStringLength(const char* str, size_t maxLength) return size; } +// NOLINTBEGIN(cppcoreguidelines-pro-type-reinterpret-cast) String::String(const utf8* cString) : String(reinterpret_cast<const char*>(cString)) { } +// NOLINTEND(cppcoreguidelines-pro-type-reinterpret-cast) String::String(const char* cString) { @@ -82,7 +84,7 @@ String::String(const String& rhs) : m_length{rhs.m_length}, m_capacity{rhs.m_cap } } -String::String(String&& rhs) : m_length{rhs.m_length}, m_capacity{rhs.m_capacity} +String::String(String&& rhs) noexcept : m_length{rhs.m_length}, m_capacity{rhs.m_capacity} { if (isLarge()) { cleanup(); @@ -91,7 +93,7 @@ String::String(String&& rhs) : m_length{rhs.m_length}, m_capacity{rhs.m_capacity m_data = rhs.m_data; rhs.m_data = nullptr; } else { - m_buffer = std::move(rhs.m_buffer); + m_buffer = rhs.m_buffer; fudAssert(nullTerminate() == FudStatus::Success); } } @@ -122,7 +124,7 @@ String& String::operator=(const String& rhs) return *this; } -String& String::operator=(String&& rhs) +String& String::operator=(String&& rhs) noexcept { cleanup(); @@ -132,7 +134,7 @@ String& String::operator=(String&& rhs) m_data = rhs.m_data; rhs.m_data = nullptr; } else { - m_buffer = std::move(rhs.m_buffer); + m_buffer = rhs.m_buffer; fudAssert(nullTerminate() == FudStatus::Success); } return *this; @@ -172,7 +174,7 @@ FudStatus String::resize(size_t newCapacity) return FudStatus::Success; } - utf8* newData; + utf8* newData = nullptr; if (isLarge()) { newData = static_cast<utf8*>(fudRealloc(m_data, newCapacity)); if (newData == nullptr) { |