QCollator/Win: Remove WinRT remnants
USE_COMPARESTRINGEX is not defined anywhere. Its definition was removed
by commit 45b0f1be68 ("Remove winrt").
Change-Id: I7e0b82c2d2fe464082d8fffd1696a931fa301986
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
bb10
parent
260168d9d7
commit
4d2e574fb0
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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:"
|
||||
|
|
|
|||
Loading…
Reference in New Issue