From 4e4cdf4d0c9a55adc8c9c1aa7449ef96c3d7f645 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Fri, 28 Feb 2025 09:53:53 +0900 Subject: [PATCH] Update SheenBidi and use the new decoding function Use the `SBCodepointDecodeNextFromUTF8` function introduced in https://github.com/Tehreer/SheenBidi/pull/33 --- 3rdParty/SheenBidi/CMakeLists.txt | 4 ++-- Source/utils/utf8.cpp | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/3rdParty/SheenBidi/CMakeLists.txt b/3rdParty/SheenBidi/CMakeLists.txt index 7f8633c91..283b6e71a 100644 --- a/3rdParty/SheenBidi/CMakeLists.txt +++ b/3rdParty/SheenBidi/CMakeLists.txt @@ -6,7 +6,7 @@ set(ASAN OFF) set(UBSAN OFF) FetchContent_Declare_ExcludeFromAll(SheenBidi - URL https://github.com/Tehreer/SheenBidi/archive/a1a55a8d6fbb63bab26f4f8ff43bdea5ec30a60a.tar.gz - URL_HASH MD5=f652da33c6a437ff8038d25c6fc9a01c + URL https://github.com/Tehreer/SheenBidi/archive/c44eb1163c0aac67544862b4fef8d1d3c747f1f0.tar.gz + URL_HASH MD5=2ae98ceaccb6d0be165766c9af1a6c2b ) FetchContent_MakeAvailable_ExcludeFromAll(SheenBidi) diff --git a/Source/utils/utf8.cpp b/Source/utils/utf8.cpp index 01f57c5e3..25e996269 100644 --- a/Source/utils/utf8.cpp +++ b/Source/utils/utf8.cpp @@ -13,13 +13,9 @@ namespace devilution { char32_t DecodeFirstUtf8CodePoint(std::string_view input, std::size_t *len) { - SBCodepointSequence seq { - .stringEncoding = SBStringEncodingUTF8, - .stringBuffer = const_cast(static_cast(input.data())), - .stringLength = static_cast(input.size()) - }; SBUInteger index = 0; - SBCodepoint result = SBCodepointSequenceGetCodepointAt(&seq, &index); + SBCodepoint result = SBCodepointDecodeNextFromUTF8( + reinterpret_cast(input.data()), static_cast(input.size()), &index); *len = index; return result; }