Skip to content

Commit

Permalink
Update SheenBidi and use the new decoding function
Browse files Browse the repository at this point in the history
Use the `SBCodepointDecodeNextFromUTF8` function
introduced in Tehreer/SheenBidi#33
  • Loading branch information
glebm committed Feb 28, 2025
1 parent c58ca79 commit 4e4cdf4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions 3rdParty/SheenBidi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 2 additions & 6 deletions Source/utils/utf8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 4e4cdf4

Please sign in to comment.