diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2021-10-29 12:36:19 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2021-11-04 14:16:22 +0100 |
commit | 753944998dbc00ef6c9fdbf63345e5aa6c3f9f38 (patch) | |
tree | 8dc71bdab0b54f08be76708462b9aa765efaf4fb /src | |
parent | 46dd8baa67a6c7ba84a6ab3361d7f255a1ff33e2 (diff) |
Correct qcollator_posix.cpp's check against system locale
The check was made against the default locale but the code calls the
system functions (wcscoll, wcsxfrm, wcscmp) for locale-specific
collation, so should be comparing to the system locale's collation
locale (i.e. LC_COLLATE). Also correct the Android-only check in
tst_QCollator::compare() which duplicated the check but neglected the
C locale, which is also supported (via QString::compare).
Change-Id: I48c3237dd6825e2070272ab88d95bdb8cbb9fc37
Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 25d807f6292e9918ccdbe06cf7f590f60ecae457)
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/text/qcollator_posix.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/corelib/text/qcollator_posix.cpp b/src/corelib/text/qcollator_posix.cpp index 92148fa315..7f04847434 100644 --- a/src/corelib/text/qcollator_posix.cpp +++ b/src/corelib/text/qcollator_posix.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2020 Aleix Pol Gonzalez <aleixpol@kde.org> +** Copyright (C) 2021 The Qt Company Ltd. +** Copyright (C) 2013 Aleix Pol Gonzalez <aleixpol@kde.org> ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -49,8 +50,10 @@ QT_BEGIN_NAMESPACE void QCollatorPrivate::init() { if (!isC()) { - if (locale != QLocale()) - qWarning("Only C and default locale supported with the posix collation implementation"); + if (locale != QLocale::system().collation()) { + qWarning("Only the C and system collation locales are supported " + "with the POSIX collation implementation"); + } if (caseSensitivity != Qt::CaseSensitive) qWarning("Case insensitive sorting unsupported in the posix collation implementation"); } |