@@ -21,11 +21,11 @@ using TScriptsArray = std::array<UScriptCode, 32>;
2121
2222// Writes the script and the script extensions of the Unicode codepoint.
2323// Returns the number of written scripts.
24- size_t GetScriptExtensions (char32_t codepoint, TScriptsArray & scripts)
24+ int32_t GetScriptExtensions (char32_t codepoint, TScriptsArray & scripts)
2525{
2626 // Fill scripts with the script extensions.
2727 UErrorCode icu_error = U_ZERO_ERROR;
28- size_t const count = uscript_getScriptExtensions (static_cast <UChar32>(codepoint), scripts.data (),
28+ int32_t const count = uscript_getScriptExtensions (static_cast <UChar32>(codepoint), scripts.data (),
2929 static_cast <int32_t >(scripts.max_size ()), &icu_error);
3030 if (U_FAILURE (icu_error))
3131 {
@@ -38,7 +38,7 @@ size_t GetScriptExtensions(char32_t codepoint, TScriptsArray & scripts)
3838
3939// Intersects the script extensions set of codepoint with scripts and returns the updated size of the scripts.
4040// The output result will be a subset of the input result (thus resultSize can only be smaller).
41- size_t ScriptSetIntersect (char32_t codepoint, TScriptsArray & inOutScripts, size_t inOutScriptsCount)
41+ int32_t ScriptSetIntersect (char32_t codepoint, TScriptsArray & inOutScripts, int32_t inOutScriptsCount)
4242{
4343 // Each codepoint has a Script property and a Script Extensions (Scx) property.
4444 //
@@ -65,7 +65,7 @@ size_t ScriptSetIntersect(char32_t codepoint, TScriptsArray & inOutScripts, size
6565 // For most of the codepoints, the script extensions set contains only one element. For CJK codepoints, it's common
6666 // to see 3-4 scripts. For really rare cases, the set can go above 20 scripts.
6767 TScriptsArray codepointScripts;
68- size_t const codepointScriptsCount = GetScriptExtensions (codepoint, codepointScripts);
68+ size_t const codepointScriptsCount = static_cast < size_t >( GetScriptExtensions (codepoint, codepointScripts) );
6969
7070 // Implicit script 'inherited' is inheriting scripts from preceding codepoint.
7171 if (codepointScriptsCount == 1 && codepointScripts[0 ] == USCRIPT_INHERITED)
@@ -99,27 +99,27 @@ size_t ScriptSetIntersect(char32_t codepoint, TScriptsArray & inOutScripts, size
9999//
100100// Consider 3 characters with the script values {Kana}, {Hira, Kana}, {Kana}. Without script extensions only the first
101101// script in each set would be taken into account, resulting in 3 segments where 1 would be enough.
102- size_t ScriptInterval (std::u16string const & text, int32_t start, size_t length, UScriptCode & outScript)
102+ int32_t ScriptInterval (std::u16string const & text, int32_t start, int32_t length, UScriptCode & outScript)
103103{
104104 ASSERT_GREATER (length, 0U , ());
105105
106106 auto const begin = text.begin () + start;
107- auto const end = text.begin () + start + static_cast < int32_t >( length) ;
107+ auto const end = text.begin () + start + length;
108108 auto iterator = begin;
109109
110110 auto c32 = utf8::unchecked::next16 (iterator);
111111
112112 TScriptsArray scripts;
113- size_t scriptsSize = GetScriptExtensions (c32, scripts);
113+ int32_t scriptsSize = GetScriptExtensions (c32, scripts);
114114
115115 while (iterator != end)
116116 {
117117 auto prev = iterator;
118118 c32 = utf8::unchecked::next16 (iterator);
119119 scriptsSize = ScriptSetIntersect (c32, scripts, scriptsSize);
120- if (scriptsSize == 0U )
120+ if (scriptsSize == 0 )
121121 {
122- length = prev - begin;
122+ length = static_cast < int32_t >( prev - begin) ;
123123 break ;
124124 }
125125 }
@@ -168,7 +168,7 @@ void GetSingleTextLineRuns(TextSegments & segments)
168168 {
169169 // Find the longest sequence of characters that have at least one common UScriptCode value.
170170 UScriptCode script = USCRIPT_INVALID_CODE;
171- size_t const scriptRunEnd =
171+ int32_t const scriptRunEnd =
172172 ScriptInterval (segments.m_text , scriptRunStart, bidiRunEnd - scriptRunStart, script) + scriptRunStart;
173173 ASSERT_LESS (scriptRunStart, base::asserted_cast<int32_t >(scriptRunEnd), ());
174174
@@ -179,7 +179,7 @@ void GetSingleTextLineRuns(TextSegments & segments)
179179 bidiLevel & 0x01 ? HB_DIRECTION_RTL : HB_DIRECTION_LTR);
180180
181181 // Move to the next script sequence.
182- scriptRunStart = static_cast < int32_t >( scriptRunEnd) ;
182+ scriptRunStart = scriptRunEnd;
183183 }
184184 // Move to the next direction sequence.
185185 bidiRunStart = bidiRunEnd;
0 commit comments