diff options
Diffstat (limited to 'include/fud_string.hpp')
-rw-r--r-- | include/fud_string.hpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/fud_string.hpp b/include/fud_string.hpp index 0213524..df03ad9 100644 --- a/include/fud_string.hpp +++ b/include/fud_string.hpp @@ -90,7 +90,6 @@ class String { } String output{}; - auto* data = output.m_buffer.data(); output.m_length = totalLength; output.m_allocator = allocator; if (output.m_length >= output.m_capacity) { @@ -103,10 +102,11 @@ class String { output.m_data = static_cast<utf8*>(dataResult.getOkay()); } + auto* data = output.data(); size_t cumulativeLength = 0; for (size_t idx = 0; idx < strPointers.size(); ++idx) { const auto* cString = strPointers[idx]; - auto copyStatus = copyMem(data, output.m_capacity - cumulativeLength, cString, lengths[idx]); + auto copyStatus = copyMem(data + cumulativeLength, output.m_capacity - cumulativeLength, cString, lengths[idx]); fudAssert(copyStatus == FudStatus::Success); cumulativeLength += lengths[idx]; } @@ -131,6 +131,8 @@ class String { static StringResult from(const String& rhs); + static StringResult from(StringView view, Allocator* allocator = &globalFudAllocator); + FudStatus copy(const String& rhs); [[nodiscard]] constexpr size_t length() const |