From 0b860bb5dd6d2007db605291d239a6a9d41f57d1 Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Mon, 23 Sep 2024 07:36:16 -0500 Subject: Installable library. --- include/fud_string.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'include/fud_string.hpp') diff --git a/include/fud_string.hpp b/include/fud_string.hpp index 42009b4..5229f26 100644 --- a/include/fud_string.hpp +++ b/include/fud_string.hpp @@ -54,7 +54,7 @@ class String { [[nodiscard]] constexpr size_t capacity() const { - return m_capacity; + return m_capacity - 1; } /** \brier The underlying data, guaranteed to have c string representation. */ @@ -87,7 +87,7 @@ class String { [[nodiscard]] bool utf8Valid() const; - [[nodiscard]] FudStatus nullTerminate() const; + [[nodiscard]] FudStatus nullTerminate(); [[nodiscard]] constexpr size_t remainingLength() const { @@ -117,11 +117,11 @@ class String { utf8* m_data; }; size_t m_length{0}; - size_t m_capacity{0}; + size_t m_capacity{SSO_BUF_SIZE}; [[nodiscard]] constexpr bool isLarge() const { - return m_capacity > SSO_BUF_LENGTH; + return m_capacity > SSO_BUF_SIZE; } }; @@ -131,12 +131,12 @@ class StringView { { } - constexpr StringView(size_t strLen, const utf8* strData) : m_length(0), m_data{strData} + constexpr StringView(size_t strLen, const utf8* strData) : m_length(strLen), m_data{strData} { } StringView(size_t strLen, const char* strData) : - m_length(0), // line break + m_length(strLen), // line break m_data{reinterpret_cast(strData)} // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast) { } -- cgit v1.2.3