(svn r27377) -Codechange: use the pkg-config files of ICU as well. Since they are split into separate libraries it becomes possible to split RTL support for natural sorting, although the effect will be minimal

This commit is contained in:
rubidium
2015-08-09 13:54:17 +00:00
parent cc5b8ea6cb
commit eb4b6a08d0
2 changed files with 45 additions and 77 deletions

View File

@@ -575,20 +575,7 @@ int strnatcmp(const char *s1, const char *s2, bool ignore_garbage_at_front)
#ifdef WITH_ICU_SORT
if (_current_collator != NULL) {
UErrorCode status = U_ZERO_ERROR;
int result;
/* We want to use the new faster method for ICU 4.2 and higher. */
#if U_ICU_VERSION_MAJOR_NUM > 4 || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM >= 2)
/* The StringPiece parameter gets implicitly constructed from the char *. */
result = _current_collator->compareUTF8(s1, s2, status);
#else /* The following for 4.0 and lower. */
UChar buffer1[DRAW_STRING_BUFFER];
u_strFromUTF8Lenient(buffer1, lengthof(buffer1), NULL, s1, -1, &status);
UChar buffer2[DRAW_STRING_BUFFER];
u_strFromUTF8Lenient(buffer2, lengthof(buffer2), NULL, s2, -1, &status);
result = _current_collator->compare(buffer1, buffer2, status);
#endif /* ICU version check. */
int result = _current_collator->compareUTF8(s1, s2, status);
if (U_SUCCESS(status)) return result;
}