Browse Source

Update SheenBidi and use the new decoding function

Use the `SBCodepointDecodeNextFromUTF8` function
introduced in https://github.com/Tehreer/SheenBidi/pull/33
pull/7793/head
Gleb Mazovetskiy 1 year ago
parent
commit
4e4cdf4d0c
  1. 4
      3rdParty/SheenBidi/CMakeLists.txt
  2. 8
      Source/utils/utf8.cpp

4
3rdParty/SheenBidi/CMakeLists.txt vendored

@ -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)

8
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<void *>(static_cast<const void *>(input.data())),
.stringLength = static_cast<SBUInteger>(input.size())
};
SBUInteger index = 0;
SBCodepoint result = SBCodepointSequenceGetCodepointAt(&seq, &index);
SBCodepoint result = SBCodepointDecodeNextFromUTF8(
reinterpret_cast<const SBUInt8 *>(input.data()), static_cast<SBUInteger>(input.size()), &index);
*len = index;
return result;
}

Loading…
Cancel
Save