From 4d2e574fb0e5f084a39edb380c254465467cfcc2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 30 Jul 2021 12:45:47 -0700 Subject: [PATCH] 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 --- src/corelib/text/qcollator_p.h | 4 ---- src/corelib/text/qcollator_win.cpp | 25 +------------------------ 2 files changed, 1 insertion(+), 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,11 +92,7 @@ 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; 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(s1.data()), s1.size(), reinterpret_cast(s2.data()), s2.size()); -#else - const int ret = CompareStringEx(LPCWSTR(d->localeName.utf16()), d->collator, - reinterpret_cast(s1.data()), s1.size(), - reinterpret_cast(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(string.constData()), string.size(), 0, 0); -#else - int size = LCMapStringEx(LPCWSTR(d->localeName.utf16()), LCMAP_SORTKEY | d->collator, - reinterpret_cast(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(string.constData()), string.size(), reinterpret_cast(ret.data()), ret.size()); -#else - int finalSize = LCMapStringEx(LPCWSTR(d->localeName.utf16()), LCMAP_SORTKEY | d->collator, - reinterpret_cast(string.constData()), string.size(), - reinterpret_cast(ret.data()), ret.size(), - NULL, NULL, 0); -#endif if (finalSize == 0) { qWarning() << "there were problems when generating the ::sortKey by LCMapStringW with error:"