@@ -61,12 +61,12 @@ namespace PlatformAgnostic
6161 // Otherwise, we treat the char before as the invalid one and return index - 1
6262 // This function has defined behavior only for null-terminated strings.
6363 // If the string is not null terminated, the behavior is undefined (likely hang)
64- static bool IsUtf16StringValid (const UChar* str, size_t length, int32 * invalidIndex)
64+ static bool IsUtf16StringValid (const UChar* str, size_t length, size_t * invalidIndex)
6565 {
6666 Assert (invalidIndex != nullptr );
67- *invalidIndex = - 1 ;
67+ *invalidIndex = static_cast < size_t >(- 1 ) ;
6868
69- int32 i = 0 ;
69+ size_t i = 0 ;
7070 for (;;)
7171 {
7272 // Iterate through the UTF16-LE string
@@ -172,11 +172,11 @@ namespace PlatformAgnostic
172172 // is a malformed utf16 string. Maintain the same behavior here.
173173 // Note that Windows returns this failure only if the dest buffer
174174 // is passed in, not in the estimation case
175- int32 invalidIndex = 0 ;
175+ size_t invalidIndex = 0 ;
176176 if (destString != nullptr && !IsUtf16StringValid ((const UChar*) sourceString, sourceLength, &invalidIndex))
177177 {
178178 *pErrorOut = InvalidUnicodeText;
179- return -1 * invalidIndex; // mimicking the behavior of Win32 NormalizeString
179+ return -1 * static_cast <int32>( invalidIndex) ; // mimicking the behavior of Win32 NormalizeString
180180 }
181181
182182 const UNormalizer2 *normalizer = StaticUNormalizerFactory (normalizationForm);
@@ -203,7 +203,7 @@ namespace PlatformAgnostic
203203
204204 // On Windows, IsNormalizedString returns failure if the string
205205 // is a malformed utf16 string. Maintain the same behavior here.
206- int32 invalidIndex = 0 ;
206+ size_t invalidIndex = 0 ;
207207 if (!IsUtf16StringValid ((const UChar*) testString, testStringLength, &invalidIndex))
208208 {
209209 return false ;
0 commit comments