summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/tools/qlocale_icu.cpp24
-rw-r--r--src/corelib/tools/qlocale_p.h2
-rw-r--r--src/corelib/tools/qstring.cpp11
3 files changed, 4 insertions, 33 deletions
diff --git a/src/corelib/tools/qlocale_icu.cpp b/src/corelib/tools/qlocale_icu.cpp
index 97ce82108b..af6b6e2dfa 100644
--- a/src/corelib/tools/qlocale_icu.cpp
+++ b/src/corelib/tools/qlocale_icu.cpp
@@ -45,8 +45,6 @@
#include "qlocale_p.h"
#include "qmutex.h"
-#include "unicode/uversion.h"
-#include "unicode/ucol.h"
#include "unicode/uloc.h"
#include "unicode/ustring.h"
@@ -54,28 +52,6 @@ QT_BEGIN_NAMESPACE
typedef int32_t (*Ptr_u_strToCase)(UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, const char *locale, UErrorCode *pErrorCode);
-bool QIcu::strcoll(const QByteArray &localeID,
- const QChar *source, int sourceLength, const QChar *target, int targetLength, int *result)
-{
- Q_ASSERT(result);
- Q_ASSERT(source);
- Q_ASSERT(target);
-
- UErrorCode icuStatus = U_ZERO_ERROR;
- UCollator *collator = ucol_open(localeID, &icuStatus);
-
- if (U_FAILURE((icuStatus)))
- return false;
-
- *result = ucol_strcoll(collator,
- reinterpret_cast<const UChar *>(source), int32_t(sourceLength),
- reinterpret_cast<const UChar *>(target), int32_t(targetLength));
-
- ucol_close(collator);
-
- return true;
-}
-
// caseFunc can either be u_strToUpper or u_strToLower
static bool qt_u_strToCase(const QString &str, QString *out, const char *localeID, Ptr_u_strToCase caseFunc)
{
diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h
index 1902e4e5af..09a3e0eb51 100644
--- a/src/corelib/tools/qlocale_p.h
+++ b/src/corelib/tools/qlocale_p.h
@@ -130,8 +130,6 @@ private:
namespace QIcu {
QString toUpper(const QByteArray &localeId, const QString &str, bool *ok);
QString toLower(const QByteArray &localeId, const QString &str, bool *ok);
-
- bool strcoll(const QByteArray &localeID, const QChar *source, int sourceLength, const QChar *target, int targetLength, int *result);
}
#endif
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 4f8d0e5614..493661bad1 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -59,6 +59,7 @@
#include "qhash.h"
#include "qdebug.h"
#include "qendian.h"
+#include "qcollator_p.h"
#ifdef Q_OS_MAC
#include <private/qcore_mac_p.h>
@@ -5003,14 +5004,10 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1,
CFRelease(thisString);
CFRelease(otherString);
return result;
+#elif defined(QT_USE_ICU)
+ QCollator collator;
+ return collator.compare(data1, length1, data2, length2);
#elif defined(Q_OS_UNIX)
-# if defined(QT_USE_ICU)
- QLocale locale;
- int res;
- if (QIcu::strcoll(locale.d.constData()->m_localeID, data1, length1, data2, length2, &res))
- return res;
- // else fall through
-# endif
// declared in <string.h>
int delta = strcoll(toLocal8Bit_helper(data1, length1).constData(), toLocal8Bit_helper(data2, length2).constData());
if (delta == 0)