From e0e717d06a9da75474c6550e163d0d2ca18c258a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 24 Mar 2017 13:01:41 +0100 Subject: Fix crash when QUrl::from{NS/CF}URL() was passed a nullptr Change-Id: Ib193447c4a91dd3d08746e97727f7d4764f33d80 Reviewed-by: Jake Petroules Reviewed-by: Timur Pocheptsov Reviewed-by: Thiago Macieira --- src/corelib/kernel/qcore_foundation.mm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qcore_foundation.mm b/src/corelib/kernel/qcore_foundation.mm index 0e69f69a85..56eabc4b8c 100644 --- a/src/corelib/kernel/qcore_foundation.mm +++ b/src/corelib/kernel/qcore_foundation.mm @@ -328,6 +328,8 @@ NSUUID *QUuid::toNSUUID() const */ QUrl QUrl::fromCFURL(CFURLRef url) { + if (!url) + return QUrl(); return QUrl(QString::fromCFString(CFURLGetString(url))); } @@ -355,6 +357,8 @@ CFURLRef QUrl::toCFURL() const */ QUrl QUrl::fromNSURL(const NSURL *url) { + if (!url) + return QUrl(); return QUrl(QString::fromNSString([url absoluteString])); } -- cgit v1.2.3 From ed96363d56b912dc828537549a8028c8ad4ea3bb Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Mon, 27 Mar 2017 22:51:46 +0300 Subject: QMimeGlobPattern: init all members only once ... by initializer list. Change-Id: I39d2f933dac171273f500963eb47ffa9165978de Reviewed-by: Thiago Macieira --- src/corelib/mimetypes/qmimeglobpattern_p.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/mimetypes/qmimeglobpattern_p.h b/src/corelib/mimetypes/qmimeglobpattern_p.h index c8b70464fd..21332e71bc 100644 --- a/src/corelib/mimetypes/qmimeglobpattern_p.h +++ b/src/corelib/mimetypes/qmimeglobpattern_p.h @@ -83,11 +83,9 @@ public: static const unsigned MinWeight = 1; explicit QMimeGlobPattern(const QString &thePattern, const QString &theMimeType, unsigned theWeight = DefaultWeight, Qt::CaseSensitivity s = Qt::CaseInsensitive) : - m_pattern(thePattern), m_mimeType(theMimeType), m_weight(theWeight), m_caseSensitivity(s) + m_pattern(s == Qt::CaseInsensitive ? thePattern.toLower() : thePattern), + m_mimeType(theMimeType), m_weight(theWeight), m_caseSensitivity(s) { - if (s == Qt::CaseInsensitive) { - m_pattern = m_pattern.toLower(); - } } void swap(QMimeGlobPattern &other) Q_DECL_NOTHROW -- cgit v1.2.3 From 18d6c82299d51aacca55465dd1a2066a93440618 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Mon, 27 Mar 2017 22:44:22 +0300 Subject: Prefer rvalue versions of toLower() and toUpper() ... to re-use existing buffers. Change-Id: Ib2bc938f1cf0451c1dbc012b3db022b878e987cb Reviewed-by: Thiago Macieira --- src/corelib/io/qsettings_mac.cpp | 2 +- src/corelib/tools/qlocale.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp index e4631bad12..39777e6c90 100644 --- a/src/corelib/io/qsettings_mac.cpp +++ b/src/corelib/io/qsettings_mac.cpp @@ -419,7 +419,7 @@ QMacSettingsPrivate::QMacSettingsPrivate(QSettings::Scope scope, const QString & curPos = nextDot + 1; } javaPackageName.prepend(domainName.midRef(curPos)); - javaPackageName = javaPackageName.toLower(); + javaPackageName = std::move(javaPackageName).toLower(); if (curPos == 0) javaPackageName.prepend(QLatin1String("com.")); suiteId = javaPackageName; diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 59952bd107..bde4bf553e 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -2891,7 +2891,7 @@ QString QLocaleData::doubleToString(const QChar _zero, const QChar plus, const Q num_str.prepend(QLatin1Char(' ')); if (flags & QLocaleData::CapitalEorX) - num_str = num_str.toUpper(); + num_str = std::move(num_str).toUpper(); return num_str; } @@ -2973,7 +2973,7 @@ QString QLocaleData::longLongToString(const QChar zero, const QChar group, } if (flags & CapitalEorX) - num_str = num_str.toUpper(); + num_str = std::move(num_str).toUpper(); if (base == 16 && (flags & ShowBase)) num_str.prepend(QLatin1String(flags & UppercaseBase ? "0X" : "0x")); @@ -3052,7 +3052,7 @@ QString QLocaleData::unsLongLongToString(const QChar zero, const QChar group, } if (flags & CapitalEorX) - num_str = num_str.toUpper(); + num_str = std::move(num_str).toUpper(); if (base == 16 && flags & ShowBase) num_str.prepend(QLatin1String(flags & UppercaseBase ? "0X" : "0x")); -- cgit v1.2.3 From 3c66df6400e364ead47f13a1fbdd5d4c49adbb46 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 21 Feb 2017 10:17:53 +0100 Subject: Core: Replace LGPL21 with LGPL license header Also use canonical contact url. Change-Id: I43f8c6a2c4949ee0e054045bccc17d82575b072c Reviewed-by: Thiago Macieira Reviewed-by: Jani Heikkinen --- src/corelib/global/qglobal_p.h | 32 ++++++++++++++++++------------ src/corelib/kernel/qdeadlinetimer.cpp | 32 ++++++++++++++++++------------ src/corelib/kernel/qdeadlinetimer.h | 32 ++++++++++++++++++------------ src/corelib/statemachine/qfinalstate_p.h | 34 +++++++++++++++++++------------- 4 files changed, 77 insertions(+), 53 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qglobal_p.h b/src/corelib/global/qglobal_p.h index b8f9e5fbf7..b1d2836783 100644 --- a/src/corelib/global/qglobal_p.h +++ b/src/corelib/global/qglobal_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** ** Copyright (C) 2015 Intel Corporation. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/corelib/kernel/qdeadlinetimer.cpp b/src/corelib/kernel/qdeadlinetimer.cpp index ad549dcd7b..a2ec813f11 100644 --- a/src/corelib/kernel/qdeadlinetimer.cpp +++ b/src/corelib/kernel/qdeadlinetimer.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** ** Copyright (C) 2016 Intel Corporation. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/corelib/kernel/qdeadlinetimer.h b/src/corelib/kernel/qdeadlinetimer.h index aa0f735fcc..ddab0191ad 100644 --- a/src/corelib/kernel/qdeadlinetimer.h +++ b/src/corelib/kernel/qdeadlinetimer.h @@ -1,31 +1,37 @@ /**************************************************************************** ** ** Copyright (C) 2016 Intel Corporation. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/corelib/statemachine/qfinalstate_p.h b/src/corelib/statemachine/qfinalstate_p.h index 57de703fe9..65598f6c19 100644 --- a/src/corelib/statemachine/qfinalstate_p.h +++ b/src/corelib/statemachine/qfinalstate_p.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** -- cgit v1.2.3 From ff259bffe6b1d09dfec2f56f6c9a4a326ff8e98a Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Tue, 28 Mar 2017 07:28:58 +0300 Subject: Use case-insensitive compare more ... to avoid allocations. Change-Id: I5993633d1509495ff6ce3a11274a53504aac7c5e Reviewed-by: Marc Mutz Reviewed-by: Thiago Macieira --- src/corelib/io/qloggingregistry.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp index 4f7bc95330..ff865dc9a1 100644 --- a/src/corelib/io/qloggingregistry.cpp +++ b/src/corelib/io/qloggingregistry.cpp @@ -215,7 +215,7 @@ void QLoggingSettingsParser::setContent(QTextStream &stream) continue; } - if (_section.toLower() == QLatin1String("rules")) { + if (_section.compare(QLatin1String("rules"), Qt::CaseInsensitive) == 0) { int equalPos = line.indexOf(QLatin1Char('=')); if (equalPos != -1) { if (line.lastIndexOf(QLatin1Char('=')) == equalPos) { -- cgit v1.2.3 From f901afaf4963341cd8e16d54fe630f06df031182 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Sun, 19 Mar 2017 21:01:59 +0300 Subject: Use QStringBuilder more Change-Id: If5283e364e921d99ffa7a8fa1abb07356a4a2682 Reviewed-by: Edward Welbourne --- src/corelib/io/qsettings_mac.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp index 39777e6c90..cf3a480623 100644 --- a/src/corelib/io/qsettings_mac.cpp +++ b/src/corelib/io/qsettings_mac.cpp @@ -425,8 +425,7 @@ QMacSettingsPrivate::QMacSettingsPrivate(QSettings::Scope scope, const QString & suiteId = javaPackageName; if (!application.isEmpty()) { - javaPackageName += QLatin1Char('.'); - javaPackageName += application; + javaPackageName += QLatin1Char('.') + application; applicationId = javaPackageName; } -- cgit v1.2.3 From 5ec57560c0b497f9f48671dd200bb23d1f6eac35 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Wed, 29 Mar 2017 07:10:46 +0300 Subject: Prefer rvalue versions of toLatin() and toUtf8() ... to re-use existing buffers. Change-Id: I7c42529b8cd4400520a59e658ab76f4f8e965cd4 Reviewed-by: Thiago Macieira --- src/corelib/io/qsettings_mac.cpp | 2 +- src/corelib/io/qurl.cpp | 6 ++---- src/corelib/tools/qlocale_win.cpp | 13 +++++-------- src/corelib/tools/qregularexpression.cpp | 2 +- src/corelib/tools/qtimezoneprivate_icu.cpp | 2 +- src/corelib/tools/qtimezoneprivate_win.cpp | 2 +- 6 files changed, 11 insertions(+), 16 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp index cf3a480623..2a08ee2e64 100644 --- a/src/corelib/io/qsettings_mac.cpp +++ b/src/corelib/io/qsettings_mac.cpp @@ -211,7 +211,7 @@ static QCFType macValue(const QVariant &value) default: QString string = QSettingsPrivate::variantToString(value); if (string.contains(QChar::Null)) - result = string.toUtf8().toCFData(); + result = std::move(string).toUtf8().toCFData(); else result = string.toCFString(); } diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index b5772b5ce2..9663235a67 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -3418,8 +3418,7 @@ QUrl QUrl::adjusted(QUrl::FormattingOptions options) const QByteArray QUrl::toEncoded(FormattingOptions options) const { options &= ~(FullyDecoded | FullyEncoded); - QString stringForm = toString(options | FullyEncoded); - return stringForm.toLatin1(); + return toString(options | FullyEncoded).toLatin1(); } /*! @@ -3536,8 +3535,7 @@ QString QUrl::fromAce(const QByteArray &domain) */ QByteArray QUrl::toAce(const QString &domain) { - QString result = qt_ACE_do(domain, ToAceOnly, ForbidLeadingDot /*FIXME: make configurable*/); - return result.toLatin1(); + return qt_ACE_do(domain, ToAceOnly, ForbidLeadingDot /*FIXME: make configurable*/).toLatin1(); } /*! diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp index d1abb8b565..2475859abd 100644 --- a/src/corelib/tools/qlocale_win.cpp +++ b/src/corelib/tools/qlocale_win.cpp @@ -1037,7 +1037,7 @@ static QString winIso639LangName(LPWSTR id) if (!lang_code.isEmpty()) { const char *endptr; bool ok; - QByteArray latin1_lang_code = lang_code.toLatin1(); + QByteArray latin1_lang_code = std::move(lang_code).toLatin1(); int i = qstrtoull(latin1_lang_code, &endptr, 16, &ok); if (ok && *endptr == '\0') { switch (i) { @@ -1120,15 +1120,12 @@ static QByteArray getWinLocaleName(LPWSTR id) id = lcName; } #endif // Q_OS_WINRT - QString resultuage = winIso639LangName(id); + QString resultusage = winIso639LangName(id); QString country = winIso3116CtryName(id); - result = resultuage.toLatin1(); - if (!country.isEmpty()) { - result += '_'; - result += country.toLatin1(); - } + if (!country.isEmpty()) + resultusage += QLatin1Char('_') + country; - return result; + return std::move(resultusage).toLatin1(); } Q_CORE_EXPORT QLocale qt_localeFromLCID(LCID id) diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index 8366e01ee8..f1fac093b0 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -1674,7 +1674,7 @@ QString QRegularExpression::errorString() const } while (errorStringLength < 0); errorString.resize(errorStringLength); - return QCoreApplication::translate("QRegularExpression", errorString.toLatin1().constData()); + return QCoreApplication::translate("QRegularExpression", std::move(errorString).toLatin1().constData()); } return QCoreApplication::translate("QRegularExpression", "no error"); } diff --git a/src/corelib/tools/qtimezoneprivate_icu.cpp b/src/corelib/tools/qtimezoneprivate_icu.cpp index 887486f567..a7226f2720 100644 --- a/src/corelib/tools/qtimezoneprivate_icu.cpp +++ b/src/corelib/tools/qtimezoneprivate_icu.cpp @@ -98,7 +98,7 @@ static QByteArray ucalDefaultTimeZoneId() // If successful on first or second go, resize and return if (U_SUCCESS(status)) { result.resize(size); - return result.toUtf8(); + return std::move(result).toUtf8(); } return QByteArray(); diff --git a/src/corelib/tools/qtimezoneprivate_win.cpp b/src/corelib/tools/qtimezoneprivate_win.cpp index 16dfaefb74..f963e10333 100644 --- a/src/corelib/tools/qtimezoneprivate_win.cpp +++ b/src/corelib/tools/qtimezoneprivate_win.cpp @@ -299,7 +299,7 @@ static QByteArray windowsSystemZoneId() id = readRegistryString(key, L"TimeZoneKeyName"); RegCloseKey(key); if (!id.isEmpty()) - return id.toUtf8(); + return std::move(id).toUtf8(); } // On XP we have to iterate over the zones until we find a match on -- cgit v1.2.3 From df43ef7b6dde35c13d2d06ad69c2d63f66b237fb Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 30 Mar 2017 19:19:45 +0200 Subject: QStringBuilder: simplify QConcatenable ... by delegating to QConcatenable. The only thing that varied was the nested type alias 'type', which therefore got retained. Change-Id: I202f899034e1ddd23c6d1978a31be5eb7c195697 Reviewed-by: Thiago Macieira --- src/corelib/tools/qstringbuilder.h | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h index b2832b5fbe..9a40abcfed 100644 --- a/src/corelib/tools/qstringbuilder.h +++ b/src/corelib/tools/qstringbuilder.h @@ -277,9 +277,9 @@ template <> struct QConcatenable : private QAbstractConcatenable } }; -template struct QConcatenable : private QAbstractConcatenable +template struct QConcatenable : private QAbstractConcatenable { - typedef char type[N]; + typedef const char type[N]; typedef QByteArray ConvertTo; enum { ExactSize = false }; static int size(const char[N]) { return N - 1; } @@ -296,23 +296,9 @@ template struct QConcatenable : private QAbstractConcatenable } }; -template struct QConcatenable : private QAbstractConcatenable +template struct QConcatenable : QConcatenable { - typedef const char type[N]; - typedef QByteArray ConvertTo; - enum { ExactSize = false }; - static int size(const char[N]) { return N - 1; } -#ifndef QT_NO_CAST_FROM_ASCII - static inline void QT_ASCII_CAST_WARN appendTo(const char a[N], QChar *&out) - { - QAbstractConcatenable::convertFromAscii(a, N - 1, out); - } -#endif - static inline void appendTo(const char a[N], char *&out) - { - while (*a) - *out++ = *a++; - } + typedef char type[N]; }; template <> struct QConcatenable : private QAbstractConcatenable -- cgit v1.2.3