From b8345246dcc2121bcb6d1515a9341789de20199f Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Sun, 27 Oct 2024 09:04:05 -0500 Subject: First crack at file objects. --- include/fud_string.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include/fud_string.hpp') 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(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 -- cgit v1.2.3