From 6d1f90c7390fda62b6d3ddeae2282833c4b72634 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Tue, 5 Aug 2025 07:12:35 -0400 Subject: [PATCH] AK: Remove now-unused UTF-16 length from UTF-8 string helper --- AK/Utf16View.cpp | 5 ----- AK/Utf16View.h | 2 -- Tests/AK/TestUtf16View.cpp | 8 -------- 3 files changed, 15 deletions(-) diff --git a/AK/Utf16View.cpp b/AK/Utf16View.cpp index a653cb1dc82..cc308c4157e 100644 --- a/AK/Utf16View.cpp +++ b/AK/Utf16View.cpp @@ -26,11 +26,6 @@ bool validate_utf16_be(ReadonlyBytes bytes) return simdutf::validate_utf16be(reinterpret_cast(bytes.data()), bytes.size() / 2); } -size_t utf16_code_unit_length_from_utf8(StringView string) -{ - return simdutf::utf16_length_from_utf8(string.characters_without_null_termination(), string.length()); -} - ErrorOr Utf16View::to_utf8(AllowLonelySurrogates allow_lonely_surrogates) const { if (is_empty()) diff --git a/AK/Utf16View.h b/AK/Utf16View.h index c459f9358b9..751c8a49bca 100644 --- a/AK/Utf16View.h +++ b/AK/Utf16View.h @@ -28,8 +28,6 @@ namespace AK { [[nodiscard]] bool validate_utf16_le(ReadonlyBytes); [[nodiscard]] bool validate_utf16_be(ReadonlyBytes); -size_t utf16_code_unit_length_from_utf8(StringView); - namespace Detail { static constexpr inline auto UTF16_FLAG = NumericLimits::digits() - 1; diff --git a/Tests/AK/TestUtf16View.cpp b/Tests/AK/TestUtf16View.cpp index 3a7ed789b15..99562ae657c 100644 --- a/Tests/AK/TestUtf16View.cpp +++ b/Tests/AK/TestUtf16View.cpp @@ -86,14 +86,6 @@ TEST_CASE(decode_utf16) EXPECT_EQ(i, expected.size()); } -TEST_CASE(utf16_code_unit_length_from_utf8) -{ - EXPECT_EQ(AK::utf16_code_unit_length_from_utf8(""sv), 0uz); - EXPECT_EQ(AK::utf16_code_unit_length_from_utf8("abc"sv), 3uz); - EXPECT_EQ(AK::utf16_code_unit_length_from_utf8("😀"sv), 2uz); - EXPECT_EQ(AK::utf16_code_unit_length_from_utf8("Привет, мир! 😀 γειά σου κόσμος こんにちは世界"sv), 39uz); -} - TEST_CASE(null_view) { Utf16View view;