Don't second-guess strcoll()

It's defective on Android, but no worse so than the fall-back we were
using; and we can't remember why we had that fall-back anyway.

Task-number: QTBUG-63518
Change-Id: I28e9b5c7cc64963c9e3941eb1bad85aced280a9b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Edward Welbourne 2020-07-30 16:30:00 +02:00
parent 2d5dcd1b9f
commit 2d6705575c

View File

@ -1655,9 +1655,7 @@ inline char qToLower(char ch)
localeAwareCompare() compares according the "Order for sorted
lists" setting in the International preferences panel. On other
Unix-like systems without ICU, the comparison falls back to the
system library's \c strcoll(), falling back when it considers
strings equal to QString's (locale-unaware) comparison, described
above,
system library's \c strcoll(),
\section1 Converting Between encoded strings data and QString
@ -5931,11 +5929,8 @@ int QString::localeAwareCompare_helper(const QChar *data1, qsizetype length1,
CFRelease(otherString);
return result;
# elif defined(Q_OS_UNIX)
// declared in <string.h>
int delta = strcoll(lhs.toLocal8Bit().constData(), rhs.toLocal8Bit().constData());
if (delta == 0)
delta = qt_compare_strings(lhs, rhs, Qt::CaseSensitive);
return delta;
// declared in <string.h> (no better than qt_compare_strings() on Android, sadly)
return strcoll(lhs.toLocal8Bit().constData(), rhs.toLocal8Bit().constData());
# else
# error "This case shouldn't happen"
return qt_compare_strings(lhs, rhs, Qt::CaseSensitive);