summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2021-07-30 12:45:47 -0700
committerThiago Macieira <thiago.macieira@intel.com>2021-08-02 15:09:43 -0700
commit4d2e574fb0e5f084a39edb380c254465467cfcc2 (patch)
tree5fddf213973c0b40c7f6802dab3d790c0117bf2c
parentQByteArray: don't coerce negative to unsigned for any base (diff)
downloadqtbase-4d2e574fb0e5f084a39edb380c254465467cfcc2.tar.xz
qtbase-4d2e574fb0e5f084a39edb380c254465467cfcc2.zip
QCollator/Win: Remove WinRT remnants
USE_COMPARESTRINGEX is not defined anywhere. Its definition was removed by commit 45b0f1be686cfba8dcecb9be5c875cae59c69276 ("Remove winrt"). Change-Id: I7e0b82c2d2fe464082d8fffd1696a931fa301986 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r--src/corelib/text/qcollator_p.h4
-rw-r--r--src/corelib/text/qcollator_win.cpp25
2 files changed, 1 insertions, 28 deletions
diff --git a/src/corelib/text/qcollator_p.h b/src/corelib/text/qcollator_p.h
index b1a483c4e2..402b58f1fb 100644
--- a/src/corelib/text/qcollator_p.h
+++ b/src/corelib/text/qcollator_p.h
@@ -92,12 +92,8 @@ public:
QAtomicInt ref = 1;
QLocale locale;
#if defined(Q_OS_WIN) && !QT_CONFIG(icu)
-#ifdef USE_COMPARESTRINGEX
- QString localeName;
-#else
LCID localeID;
#endif
-#endif
Qt::CaseSensitivity caseSensitivity = Qt::CaseSensitive;
bool numericMode = false;
bool ignorePunctuation = false;
diff --git a/src/corelib/text/qcollator_win.cpp b/src/corelib/text/qcollator_win.cpp
index 54f57f1d24..59f8add822 100644
--- a/src/corelib/text/qcollator_win.cpp
+++ b/src/corelib/text/qcollator_win.cpp
@@ -63,11 +63,7 @@ void QCollatorPrivate::init()
if (isC())
return;
-#ifndef USE_COMPARESTRINGEX
localeID = qt_inIsoNametoLCID(QLocalePrivate::get(locale)->bcp47Name().constData());
-#else
- localeName = locale.bcp47Name();
-#endif
if (caseSensitivity == Qt::CaseInsensitive)
collator |= NORM_IGNORECASE;
@@ -108,16 +104,9 @@ int QCollator::compare(QStringView s1, QStringView s2) const
// [...] The function returns 0 if it does not succeed.
// https://docs.microsoft.com/en-us/windows/desktop/api/stringapiset/nf-stringapiset-comparestringex#return-value
-#ifndef USE_COMPARESTRINGEX
const int ret = CompareString(d->localeID, d->collator,
reinterpret_cast<const wchar_t *>(s1.data()), s1.size(),
reinterpret_cast<const wchar_t *>(s2.data()), s2.size());
-#else
- const int ret = CompareStringEx(LPCWSTR(d->localeName.utf16()), d->collator,
- reinterpret_cast<LPCWSTR>(s1.data()), s1.size(),
- reinterpret_cast<LPCWSTR>(s2.data()), s2.size(),
- nullptr, nullptr, 0);
-#endif
if (Q_LIKELY(ret))
return ret - 2;
@@ -144,26 +133,14 @@ QCollatorSortKey QCollator::sortKey(const QString &string) const
if (d->isC())
return QCollatorSortKey(new QCollatorSortKeyPrivate(string));
-#ifndef USE_COMPARESTRINGEX
int size = LCMapStringW(d->localeID, LCMAP_SORTKEY | d->collator,
reinterpret_cast<const wchar_t*>(string.constData()), string.size(),
0, 0);
-#else
- int size = LCMapStringEx(LPCWSTR(d->localeName.utf16()), LCMAP_SORTKEY | d->collator,
- reinterpret_cast<LPCWSTR>(string.constData()), string.size(),
- 0, 0, NULL, NULL, 0);
-#endif
+
QString ret(size, Qt::Uninitialized);
-#ifndef USE_COMPARESTRINGEX
int finalSize = LCMapStringW(d->localeID, LCMAP_SORTKEY | d->collator,
reinterpret_cast<const wchar_t*>(string.constData()), string.size(),
reinterpret_cast<wchar_t*>(ret.data()), ret.size());
-#else
- int finalSize = LCMapStringEx(LPCWSTR(d->localeName.utf16()), LCMAP_SORTKEY | d->collator,
- reinterpret_cast<LPCWSTR>(string.constData()), string.size(),
- reinterpret_cast<LPWSTR>(ret.data()), ret.size(),
- NULL, NULL, 0);
-#endif
if (finalSize == 0) {
qWarning()
<< "there were problems when generating the ::sortKey by LCMapStringW with error:"