From e420eca2b244c303af51534ab09632045a186b21 Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Thu, 3 Oct 2024 08:07:05 -0500 Subject: Cleanup from clang-tidy. --- source/fud_string.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'source/fud_string.cpp') 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(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(fudRealloc(m_data, newCapacity)); if (newData == nullptr) { -- cgit v1.2.3