3939 }
4040 else
4141 {
42- NSString *locName = [NSString stringWithCharacters: localeName length: lNameLength];
42+ NSString *locName = [NSString stringWithCharacters: localeName length: ( NSUInteger ) lNameLength];
4343 currentLocale = [NSLocale localeWithLocaleIdentifier: locName];
4444 }
4545 return currentLocale;
@@ -90,9 +90,9 @@ int32_t GlobalizationNative_CompareStringNative(const uint16_t* localeName, int3
9090 if (!IsComparisonOptionSupported (comparisonOptions))
9191 return ERROR_COMPARISON_OPTIONS_NOT_FOUND;
9292 NSLocale *currentLocale = GetCurrentLocale (localeName, lNameLength);
93- NSString *sourceString = [NSString stringWithCharacters: lpSource length: cwSourceLength];
93+ NSString *sourceString = [NSString stringWithCharacters: lpSource length: ( NSUInteger ) cwSourceLength];
9494 NSString *sourceStrPrecomposed = sourceString.precomposedStringWithCanonicalMapping ;
95- NSString *targetString = [NSString stringWithCharacters: lpTarget length: cwTargetLength];
95+ NSString *targetString = [NSString stringWithCharacters: lpTarget length: ( NSUInteger ) cwTargetLength];
9696 NSString *targetStrPrecomposed = targetString.precomposedStringWithCanonicalMapping ;
9797
9898 if (comparisonOptions & IgnoreKanaType)
@@ -110,7 +110,7 @@ int32_t GlobalizationNative_CompareStringNative(const uint16_t* localeName, int3
110110
111111 NSStringCompareOptions options = ConvertFromCompareOptionsToNSStringCompareOptions (comparisonOptions, true );
112112 NSRange comparisonRange = NSMakeRange (0 , sourceStrPrecomposed.length );
113- return [sourceStrPrecomposed compare: targetStrPrecomposed
113+ return ( int32_t ) [sourceStrPrecomposed compare: targetStrPrecomposed
114114 options: options
115115 range: comparisonRange
116116 locale: currentLocale];
@@ -158,9 +158,9 @@ Range GlobalizationNative_IndexOfNative(const uint16_t* localeName, int32_t lNam
158158 return result;
159159 }
160160 NSStringCompareOptions options = ConvertFromCompareOptionsToNSStringCompareOptions (comparisonOptions, true );
161- NSString *searchString = [NSString stringWithCharacters: lpTarget length: cwTargetLength];
161+ NSString *searchString = [NSString stringWithCharacters: lpTarget length: ( NSUInteger ) cwTargetLength];
162162 NSString *searchStrCleaned = RemoveWeightlessCharacters (searchString);
163- NSString *sourceString = [NSString stringWithCharacters: lpSource length: cwSourceLength];
163+ NSString *sourceString = [NSString stringWithCharacters: lpSource length: ( NSUInteger ) cwSourceLength];
164164 NSString *sourceStrCleaned = RemoveWeightlessCharacters (sourceString);
165165 if (comparisonOptions & IgnoreKanaType)
166166 {
@@ -170,7 +170,7 @@ Range GlobalizationNative_IndexOfNative(const uint16_t* localeName, int32_t lNam
170170
171171 if (sourceStrCleaned.length == 0 || searchStrCleaned.length == 0 )
172172 {
173- result.location = fromBeginning ? 0 : sourceString.length ;
173+ result.location = fromBeginning ? 0 : ( int32_t ) sourceString.length ;
174174 return result;
175175 }
176176
@@ -204,8 +204,8 @@ Range GlobalizationNative_IndexOfNative(const uint16_t* localeName, int32_t lNam
204204
205205 if (nsRange.location != NSNotFound )
206206 {
207- result.location = nsRange.location ;
208- result.length = nsRange.length ;
207+ result.location = ( int32_t ) nsRange.location ;
208+ result.length = ( int32_t ) nsRange.length ;
209209 // in case of CompareOptions.IgnoreCase if letters have different representations in source and search strings
210210 // and case insensitive search appears more than one time in source string take last index for LastIndexOf and first index for IndexOf
211211 // e.g. new CultureInfo().CompareInfo.LastIndexOf("Is \u0055\u0308 or \u0075\u0308 the same as \u00DC or \u00FC?", "U\u0308", 25,18, CompareOptions.IgnoreCase);
@@ -230,8 +230,8 @@ Range GlobalizationNative_IndexOfNative(const uint16_t* localeName, int32_t lNam
230230 if ((comparisonOptions & IgnoreCase) && IsIndexFound (fromBeginning, (int32_t )result.location , (int32_t )precomposedRange.location ))
231231 return result;
232232
233- result.location = precomposedRange.location ;
234- result.length = precomposedRange.length ;
233+ result.location = ( int32_t ) precomposedRange.location ;
234+ result.length = ( int32_t ) precomposedRange.length ;
235235 if (!(comparisonOptions & IgnoreCase))
236236 return result;
237237 }
@@ -249,8 +249,8 @@ Range GlobalizationNative_IndexOfNative(const uint16_t* localeName, int32_t lNam
249249 if ((comparisonOptions & IgnoreCase) && IsIndexFound (fromBeginning, (int32_t )result.location , (int32_t )decomposedRange.location ))
250250 return result;
251251
252- result.location = decomposedRange.location ;
253- result.length = decomposedRange.length ;
252+ result.location = ( int32_t ) decomposedRange.location ;
253+ result.length = ( int32_t ) decomposedRange.length ;
254254 return result;
255255 }
256256
@@ -270,9 +270,9 @@ int32_t GlobalizationNative_StartsWithNative(const uint16_t* localeName, int32_t
270270 return ERROR_COMPARISON_OPTIONS_NOT_FOUND;
271271 NSStringCompareOptions options = ConvertFromCompareOptionsToNSStringCompareOptions (comparisonOptions, true );
272272 NSLocale *currentLocale = GetCurrentLocale (localeName, lNameLength);
273- NSString *prefixString = [NSString stringWithCharacters: lpPrefix length: cwPrefixLength];
273+ NSString *prefixString = [NSString stringWithCharacters: lpPrefix length: ( NSUInteger ) cwPrefixLength];
274274 NSString *prefixStrComposed = RemoveWeightlessCharacters (prefixString.precomposedStringWithCanonicalMapping );
275- NSString *sourceString = [NSString stringWithCharacters: lpSource length: cwSourceLength];
275+ NSString *sourceString = [NSString stringWithCharacters: lpSource length: ( NSUInteger ) cwSourceLength];
276276 NSString *sourceStrComposed = RemoveWeightlessCharacters (sourceString.precomposedStringWithCanonicalMapping );
277277 if (comparisonOptions & IgnoreKanaType)
278278 {
@@ -282,7 +282,7 @@ int32_t GlobalizationNative_StartsWithNative(const uint16_t* localeName, int32_t
282282
283283 NSRange sourceRange = NSMakeRange (0 , prefixStrComposed.length > sourceStrComposed.length ? sourceStrComposed.length : prefixStrComposed.length );
284284
285- int32_t result = [sourceStrComposed compare: prefixStrComposed
285+ int32_t result = ( int32_t ) [sourceStrComposed compare: prefixStrComposed
286286 options: options
287287 range: sourceRange
288288 locale: currentLocale];
@@ -302,19 +302,19 @@ int32_t GlobalizationNative_EndsWithNative(const uint16_t* localeName, int32_t l
302302 return ERROR_COMPARISON_OPTIONS_NOT_FOUND;
303303 NSStringCompareOptions options = ConvertFromCompareOptionsToNSStringCompareOptions (comparisonOptions, true );
304304 NSLocale *currentLocale = GetCurrentLocale (localeName, lNameLength);
305- NSString *suffixString = [NSString stringWithCharacters: lpSuffix length: cwSuffixLength];
305+ NSString *suffixString = [NSString stringWithCharacters: lpSuffix length: ( NSUInteger ) cwSuffixLength];
306306 NSString *suffixStrComposed = RemoveWeightlessCharacters (suffixString.precomposedStringWithCanonicalMapping );
307- NSString *sourceString = [NSString stringWithCharacters: lpSource length: cwSourceLength];
307+ NSString *sourceString = [NSString stringWithCharacters: lpSource length: ( NSUInteger ) cwSourceLength];
308308 NSString *sourceStrComposed = RemoveWeightlessCharacters (sourceString.precomposedStringWithCanonicalMapping );
309309 if (comparisonOptions & IgnoreKanaType)
310310 {
311311 suffixStrComposed = ConvertToKatakana (suffixStrComposed);
312312 sourceStrComposed = ConvertToKatakana (sourceStrComposed);
313313 }
314- int32_t startIndex = suffixStrComposed.length > sourceStrComposed.length ? 0 : sourceStrComposed.length - suffixStrComposed.length ;
314+ NSUInteger startIndex = suffixStrComposed.length > sourceStrComposed.length ? 0 : sourceStrComposed.length - suffixStrComposed.length ;
315315 NSRange sourceRange = NSMakeRange (startIndex, sourceStrComposed.length - startIndex);
316316
317- int32_t result = [sourceStrComposed compare: suffixStrComposed
317+ int32_t result = ( int32_t ) [sourceStrComposed compare: suffixStrComposed
318318 options: options
319319 range: sourceRange
320320 locale: currentLocale];
@@ -334,7 +334,7 @@ int32_t GlobalizationNative_GetSortKeyNative(const uint16_t* localeName, int32_t
334334 }
335335 if (!IsComparisonOptionSupported (options))
336336 return 0 ;
337- NSString *sourceString = [NSString stringWithCharacters: lpStr length: cwStrLength];
337+ NSString *sourceString = [NSString stringWithCharacters: lpStr length: ( NSUInteger ) cwStrLength];
338338 if (options & IgnoreKanaType)
339339 {
340340 sourceString = ConvertToKatakana (sourceString);
@@ -363,6 +363,7 @@ int32_t GlobalizationNative_GetSortKeyNative(const uint16_t* localeName, int32_t
363363 if (result)
364364 return (int32_t )usedLength;
365365
366+ (void )cbSortKeyLength; // ignore unused parameter
366367 return 0 ;
367368 }
368369}
0 commit comments