From c2776f660e00dd9c0ec4cc50369b2a9cf2ed3e70 Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Wed, 2 Oct 2024 12:19:53 -0500 Subject: Fix error in string reserve. --- source/fud_string_view.cpp | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'source/fud_string_view.cpp') diff --git a/source/fud_string_view.cpp b/source/fud_string_view.cpp index 4795cf2..411f055 100644 --- a/source/fud_string_view.cpp +++ b/source/fud_string_view.cpp @@ -139,7 +139,7 @@ FudStatus fud_string_reverse_substring(ExtBasicString* source, StringView subStr size_t index = 0; auto* data = source->m_data + dataOffset; while (index < subString.length) { - if (ext_lib_char_is_ascii(static_cast(data[index]))) { + if (fud_char_is_ascii(static_cast(data[index]))) { index++; continue; } @@ -173,7 +173,7 @@ FudStatus fud_string_reverse_substring(ExtBasicString* source, StringView subStr index += utf8Size; } - ext_lib::DataView dataView{subString.length, data}; + DataView dataView{subString.length, data}; reverse(dataView); return FudStatus::Success; @@ -241,7 +241,7 @@ FudStatus fud_string_unicode_chr(StringView extString, const ExtUtf8* unicode, s const uint8_t* dataMem = unicode->data(); ExtDebugAssert(dataMem != nullptr); - std::array localData{}; + Array localData{}; auto copyStatus = ExtCopyMem(localData.data(), localData.size(), dataMem, charSize); ExtDebugAssert(copyStatus == FudStatus::Success); @@ -264,8 +264,6 @@ FudStatus fud_string_unicode_chr(StringView extString, const ExtUtf8* unicode, s return ExtNotFound; } -namespace ext_lib { - FudStatus fud_string_span_c_api( const StringView& inputView, const StringView& characterSetString, @@ -358,8 +356,6 @@ FudStatus fud_string_span_set(StringView inputView, const ExtUtf8Set* characterS return ExtNotFound; } -} // namespace ext_lib - FudStatus fud_string_span(StringView extString, StringView characterSetString, StringView* result) { if (result == nullptr) { @@ -386,12 +382,12 @@ FudStatus fud_string_c_span(StringView extString, StringView characterSetString, FudStatus fud_string_span_set(StringView extString, const ExtUtf8Set* characterSet, StringView* stringView) { - return ext_lib::fud_string_span_set(extString, characterSet, stringView, true); + return fud_string_span_set(extString, characterSet, stringView, true); } FudStatus fud_string_c_span_set(StringView extString, const ExtUtf8Set* characterSet, StringView* stringView) { - return ext_lib::fud_string_span_set(extString, characterSet, stringView, false); + return fud_string_span_set(extString, characterSet, stringView, false); } FudStatus fud_string_find_substring(StringView haystack, StringView needle, StringView* stringView) @@ -446,8 +442,6 @@ FudStatus fud_string_find_substring(StringView haystack, StringView needle, Stri return ExtNotFound; } -namespace ext_lib { - FudStatus skipWhitespace(StringView& view, size_t& skipIndex) { auto skipResult = view.skipWhitespace(); @@ -461,8 +455,6 @@ FudStatus skipWhitespace(StringView& view, size_t& skipIndex) return FudStatus::Success; } -} // namespace ext_lib - FudStatus fud_string_view_skip_whitespace(StringView* view) { if (view == nullptr) { @@ -496,7 +488,7 @@ FudStatus fud_string_view_trim_whitespace(StringView* view) } namespace impl { -constexpr ext_lib::Array AsciiLookup{ +constexpr Array AsciiLookup{ {-1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -2, -2, -2, -2, -2, -2, -2, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, @@ -619,7 +611,7 @@ FudStatus stringViewToUnsignedInteger(StringView input, T& number, uint8_t speci StringView view{input}; size_t skipIndex = 0; - auto status = ext_lib::skipWhitespace(view, skipIndex); + auto status = skipWhitespace(view, skipIndex); if (status != FudStatus::Success) { return status; } @@ -742,7 +734,7 @@ FudStatus stringViewToSignedInteger(StringView input, T& number, uint8_t specifi StringView view{input}; size_t skipIndex = 0; - auto status = ext_lib::skipWhitespace(view, skipIndex); + auto status = skipWhitespace(view, skipIndex); if (status != FudStatus::Success) { return status; } @@ -850,8 +842,8 @@ template bool isNanOrInf(T& num, StringView& view, T& sign, size_t& digitIndex) { if (view.length >= 3) { - std::array letters{{view.data[0], view.data[1], view.data[2]}}; - ext_lib::mapMut(letters, ext_lib_char_to_lower); + Array letters{{view.data[0], view.data[1], view.data[2]}}; + mapMut(letters, fud_char_to_lower); if (letters[0] == 'i' && letters[1] == 'n' && letters[2] == 'f') { num = sign * std::numeric_limits::infinity(); digitIndex = 3; -- cgit v1.2.3