diff options
Diffstat (limited to 'qmake/library')
-rw-r--r-- | qmake/library/ioutils.cpp | 61 | ||||
-rw-r--r-- | qmake/library/ioutils.h | 29 | ||||
-rw-r--r-- | qmake/library/proitems.cpp | 58 | ||||
-rw-r--r-- | qmake/library/proitems.h | 29 | ||||
-rw-r--r-- | qmake/library/qmake_global.h | 29 | ||||
-rw-r--r-- | qmake/library/qmakebuiltins.cpp | 121 | ||||
-rw-r--r-- | qmake/library/qmakeevaluator.cpp | 62 | ||||
-rw-r--r-- | qmake/library/qmakeevaluator.h | 29 | ||||
-rw-r--r-- | qmake/library/qmakeevaluator_p.h | 29 | ||||
-rw-r--r-- | qmake/library/qmakeglobals.cpp | 49 | ||||
-rw-r--r-- | qmake/library/qmakeglobals.h | 29 | ||||
-rw-r--r-- | qmake/library/qmakeparser.cpp | 48 | ||||
-rw-r--r-- | qmake/library/qmakeparser.h | 29 | ||||
-rw-r--r-- | qmake/library/qmakevfs.cpp | 29 | ||||
-rw-r--r-- | qmake/library/qmakevfs.h | 29 | ||||
-rw-r--r-- | qmake/library/registry.cpp | 29 | ||||
-rw-r--r-- | qmake/library/registry_p.h | 29 |
17 files changed, 139 insertions, 579 deletions
diff --git a/qmake/library/ioutils.cpp b/qmake/library/ioutils.cpp index c46eb7b663..38bb246341 100644 --- a/qmake/library/ioutils.cpp +++ b/qmake/library/ioutils.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "ioutils.h" @@ -34,6 +9,7 @@ #ifdef Q_OS_WIN # include <qt_windows.h> +# include <private/qsystemerror_p.h> #else # include <sys/types.h> # include <sys/stat.h> @@ -161,7 +137,7 @@ bool isSpecialChar(ushort c, const uchar (&iqm)[16]) inline static bool hasSpecialChars(const QString &arg, const uchar (&iqm)[16]) { - for (int x = arg.length() - 1; x >= 0; --x) { + for (int x = arg.size() - 1; x >= 0; --x) { if (isSpecialChar(arg.unicode()[x].unicode(), iqm)) return true; } @@ -176,7 +152,7 @@ QString IoUtils::shellQuoteUnix(const QString &arg) 0x00, 0x00, 0x00, 0x38, 0x01, 0x00, 0x00, 0x78 }; // 0-32 \'"$`<>|;&(){}*?#!~[] - if (!arg.length()) + if (!arg.size()) return QString::fromLatin1("''"); QString ret(arg); @@ -204,7 +180,7 @@ QString IoUtils::shellQuoteWin(const QString &arg) 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10 }; // &()<>^| - if (!arg.length()) + if (!arg.size()) return QString::fromLatin1("\"\""); QString ret(arg); @@ -220,7 +196,7 @@ QString IoUtils::shellQuoteWin(const QString &arg) // to the called process verbatim. In the unquoted state, the circumflex escapes // meta chars (including itself and quotes), and is removed from the command. bool quoted = true; - for (int i = 0; i < ret.length(); i++) { + for (int i = 0; i < ret.size(); i++) { QChar c = ret.unicode()[i]; if (c.unicode() == '"') quoted = !quoted; @@ -237,23 +213,6 @@ QString IoUtils::shellQuoteWin(const QString &arg) #if defined(PROEVALUATOR_FULL) -# if defined(Q_OS_WIN) -static QString windowsErrorCode() -{ - wchar_t *string = nullptr; - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPWSTR)&string, - 0, - NULL); - QString ret = QString::fromWCharArray(string); - LocalFree((HLOCAL)string); - return ret.trimmed(); -} -# endif - bool IoUtils::touchFile(const QString &targetFileName, const QString &referenceFileName, QString *errorString) { # ifdef Q_OS_UNIX @@ -280,7 +239,8 @@ bool IoUtils::touchFile(const QString &targetFileName, const QString &referenceF GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (rHand == INVALID_HANDLE_VALUE) { - *errorString = fL1S("Cannot open reference file %1: %2").arg(referenceFileName, windowsErrorCode()); + *errorString = fL1S("Cannot open reference file %1: %2") + .arg(referenceFileName, QSystemError::windowsString()); return false; } FILETIME ft; @@ -290,7 +250,8 @@ bool IoUtils::touchFile(const QString &targetFileName, const QString &referenceF GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (wHand == INVALID_HANDLE_VALUE) { - *errorString = fL1S("Cannot open %1: %2").arg(targetFileName, windowsErrorCode()); + *errorString = fL1S("Cannot open %1: %2") + .arg(targetFileName, QSystemError::windowsString()); return false; } SetFileTime(wHand, NULL, NULL, &ft); diff --git a/qmake/library/ioutils.h b/qmake/library/ioutils.h index c2b85dba04..2f288e543e 100644 --- a/qmake/library/ioutils.h +++ b/qmake/library/ioutils.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef IOUTILS_H #define IOUTILS_H diff --git a/qmake/library/proitems.cpp b/qmake/library/proitems.cpp index a8f4dfe039..2edd40a35c 100644 --- a/qmake/library/proitems.cpp +++ b/qmake/library/proitems.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "proitems.h" @@ -65,13 +40,13 @@ ProString::ProString(const ProString &other, OmitPreHashing) : } ProString::ProString(const QString &str, DoPreHashing) : - m_string(str), m_offset(0), m_length(str.length()), m_file(0) + m_string(str), m_offset(0), m_length(str.size()), m_file(0) { updatedHash(); } ProString::ProString(const QString &str) : - m_string(str), m_offset(0), m_length(str.length()), m_file(0), m_hash(0x80000000) + m_string(str), m_offset(0), m_length(str.size()), m_file(0), m_hash(0x80000000) { } @@ -109,7 +84,7 @@ ProString::ProString(const QString &str, int offset, int length) : void ProString::setValue(const QString &str) { - m_string = str, m_offset = 0, m_length = str.length(), m_hash = 0x80000000; + m_string = str, m_offset = 0, m_length = str.size(), m_hash = 0x80000000; } size_t ProString::updatedHash() const @@ -146,7 +121,7 @@ ProKey::ProKey(const QString &str, int off, int len, uint hash) : void ProKey::setValue(const QString &str) { - m_string = str, m_offset = 0, m_length = str.length(); + m_string = str, m_offset = 0, m_length = str.size(); updatedHash(); } @@ -169,7 +144,7 @@ ProString &ProString::prepend(const ProString &other) } else { m_string = other.toQStringView() + toQStringView(); m_offset = 0; - m_length = m_string.length(); + m_length = m_string.size(); if (!m_file) m_file = other.m_file; m_hash = 0x80000000; @@ -181,10 +156,10 @@ ProString &ProString::prepend(const ProString &other) ProString &ProString::append(const QLatin1String other) { if (other.size()) { - if (m_length != m_string.length()) { + if (m_length != m_string.size()) { m_string = toQStringView() + other; m_offset = 0; - m_length = m_string.length(); + m_length = m_string.size(); } else { Q_ASSERT(m_offset == 0); m_string.append(other); @@ -197,10 +172,10 @@ ProString &ProString::append(const QLatin1String other) ProString &ProString::append(QChar other) { - if (m_length != m_string.length()) { + if (m_length != m_string.size()) { m_string = toQStringView() + other; m_offset = 0; - m_length = m_string.length(); + m_length = m_string.size(); } else { Q_ASSERT(m_offset == 0); m_string.append(other); @@ -217,14 +192,14 @@ ProString &ProString::append(const ProString &other, bool *pending) if (!m_length) { *this = other; } else { - if (m_length != m_string.length()) + if (m_length != m_string.size()) m_string = toQString(); if (pending && !*pending) { m_string += QLatin1Char(' ') + other.toQStringView(); } else { m_string += other.toQStringView(); } - m_length = m_string.length(); + m_length = m_string.size(); m_offset = 0; if (other.m_file) m_file = other.m_file; @@ -248,14 +223,9 @@ ProString &ProString::append(const ProStringList &other, bool *pending, bool ski if (!m_length && sz == startIdx + 1) { *this = other.at(startIdx); } else { - int totalLength = sz - startIdx; - for (int i = startIdx; i < sz; ++i) - totalLength += other.at(i).size(); bool putSpace = false; if (pending && !*pending && m_length) putSpace = true; - else - totalLength--; m_string = toQString(); m_offset = 0; @@ -267,7 +237,7 @@ ProString &ProString::append(const ProStringList &other, bool *pending, bool ski const ProString &str = other.at(i); m_string += str.toQStringView(); } - m_length = m_string.length(); + m_length = m_string.size(); if (other.last().m_file) m_file = other.last().m_file; m_hash = 0x80000000; diff --git a/qmake/library/proitems.h b/qmake/library/proitems.h index f7eef39988..2de982034c 100644 --- a/qmake/library/proitems.h +++ b/qmake/library/proitems.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef PROITEMS_H #define PROITEMS_H diff --git a/qmake/library/qmake_global.h b/qmake/library/qmake_global.h index a718763859..612de43e9b 100644 --- a/qmake/library/qmake_global.h +++ b/qmake/library/qmake_global.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef QMAKE_GLOBAL_H #define QMAKE_GLOBAL_H diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index 5469a2ca7c..f885bb19c3 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "qmakeevaluator.h" @@ -250,12 +225,12 @@ QMakeEvaluator::getMemberArgs(const ProKey &func, int srclen, const ProStringLis int *start, int *end) { *start = 0, *end = 0; - if (args.count() >= 2) { + if (args.size() >= 2) { bool ok = true; const ProString &start_str = args.at(1); *start = start_str.toInt(&ok); if (!ok) { - if (args.count() == 2) { + if (args.size() == 2) { int dotdot = start_str.indexOf(statics.strDotDot); if (dotdot != -1) { *start = start_str.left(dotdot).toInt(&ok); @@ -271,7 +246,7 @@ QMakeEvaluator::getMemberArgs(const ProKey &func, int srclen, const ProStringLis } } else { *end = *start; - if (args.count() == 3) + if (args.size() == 3) *end = args.at(2).toInt(&ok); if (!ok) { ProStringRoUser u1(func, m_tmp1); @@ -571,7 +546,7 @@ void QMakeEvaluator::populateDeps( if (depends.isEmpty()) { rootSet.insert(first(ProKey(prefix + item + priosfx)).toInt(), item); } else { - for (const ProString &dep : qAsConst(depends)) { + for (const ProString &dep : std::as_const(depends)) { dset.insert(dep.toKey()); dependees[dep.toKey()] << item; } @@ -620,7 +595,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( var = args[0]; sep = args.at(1).toQString(); beg = args.at(2).toInt(); - if (args.count() == 4) + if (args.size() == 4) end = args.at(3).toInt(); } else { var = args[0]; @@ -655,7 +630,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( case E_SPRINTF: { ProStringRwUser u1(args.at(0), m_tmp1); QString tmp = u1.str(); - for (int i = 1; i < args.count(); ++i) + for (int i = 1; i < args.size(); ++i) tmp = tmp.arg(args.at(i).toQStringView()); ret << u1.extract(tmp); break; @@ -667,7 +642,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( bool zeropad = false; bool leftalign = false; enum { DefaultSign, PadSign, AlwaysSign } sign = DefaultSign; - if (args.count() >= 2) { + if (args.size() >= 2) { const auto opts = split_value_list(args.at(1).toQStringView()); for (const ProString &opt : opts) { if (opt.startsWith(QLatin1String("ibase="))) { @@ -712,7 +687,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( outstr = QLatin1Char(' '); } QString numstr = QString::number(num, obase); - int space = width - outstr.length() - numstr.length(); + int space = width - outstr.size() - numstr.size(); if (space <= 0) { outstr += numstr; } else if (leftalign) { @@ -728,7 +703,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( } case E_NUM_ADD: { qlonglong sum = 0; - for (const ProString &arg : qAsConst(args)) { + for (const ProString &arg : std::as_const(args)) { if (arg.contains(QLatin1Char('.'))) { evalError(fL1S("num_add(): floats are currently not supported.")); goto allfail; @@ -747,11 +722,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( } case E_JOIN: { ProString glue, before, after; - if (args.count() >= 2) + if (args.size() >= 2) glue = args.at(1); - if (args.count() >= 3) + if (args.size() >= 3) before = args[2]; - if (args.count() == 4) + if (args.size() == 4) after = args[3]; const ProStringList &var = values(map(args.at(0))); if (!var.isEmpty()) { @@ -767,7 +742,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( } case E_SPLIT: { ProStringRoUser u1(m_tmp1); - const QString &sep = (args.count() == 2) ? u1.set(args.at(1)) : statics.field_sep; + const QString &sep = (args.size() == 2) ? u1.set(args.at(1)) : statics.field_sep; const auto vars = values(map(args.at(0))); for (const ProString &var : vars) { // FIXME: this is inconsistent with the "there are no empty strings" dogma. @@ -841,7 +816,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( bool blob = false; bool lines = false; bool singleLine = true; - if (args.count() > 1) { + if (args.size() > 1) { if (!args.at(1).compare(QLatin1String("false"), Qt::CaseInsensitive)) singleLine = false; else if (!args.at(1).compare(QLatin1String("blob"), Qt::CaseInsensitive)) @@ -908,7 +883,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( bool blob = false; bool lines = false; bool singleLine = true; - if (args.count() > 1) { + if (args.size() > 1) { if (!args.at(1).compare(QLatin1String("false"), Qt::CaseInsensitive)) singleLine = false; else if (!args.at(1).compare(QLatin1String("blob"), Qt::CaseInsensitive)) @@ -918,7 +893,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( } int exitCode; QByteArray bytes = getCommandOutput(args.at(0).toQString(), &exitCode); - if (args.count() > 2 && !args.at(2).isEmpty()) { + if (args.size() > 2 && !args.at(2).isEmpty()) { m_valuemapStack.top()[args.at(2).toKey()] = ProStringList(ProString(QString::number(exitCode))); } @@ -961,7 +936,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( for (int i = 0; i < args.size(); ++i) { QString str = args.at(i).toQString(); QChar *i_data = str.data(); - int i_len = str.length(); + int i_len = str.size(); for (int x = 0; x < i_len; ++x) { if (*(i_data+x) == QLatin1Char('\\') && x < i_len-1) { if (*(i_data+x+1) == QLatin1Char('\\')) { @@ -1006,14 +981,14 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( case E_UPPER: case E_LOWER: case E_TITLE: - for (int i = 0; i < args.count(); ++i) { + for (int i = 0; i < args.size(); ++i) { ProStringRwUser u1(args.at(i), m_tmp1); QString rstr = u1.str(); if (func_t == E_UPPER) { rstr = rstr.toUpper(); } else { rstr = rstr.toLower(); - if (func_t == E_TITLE && rstr.length() > 0) + if (func_t == E_TITLE && rstr.size() > 0) rstr[0] = rstr.at(0).toTitleCase(); } ret << u1.extract(rstr); @@ -1021,7 +996,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( break; case E_FILES: { bool recursive = false; - if (args.count() == 2) + if (args.size() == 2) recursive = isTrue(args.at(1)); QStringList dirs; ProStringRoUser u1(args.at(0), m_tmp1); @@ -1047,7 +1022,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( evalError(fL1S("section(): Encountered invalid wildcard expression '%1'.").arg(pattern)); goto allfail; } - for (int d = 0; d < dirs.count(); d++) { + for (int d = 0; d < dirs.size(); d++) { QString dir = dirs[d]; QDir qdir(pfx + dir); for (int i = 0, count = int(qdir.count()); i < count; ++i) { @@ -1069,7 +1044,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( ProStringRoUser u1(args.at(0), m_tmp1); QString msg = m_option->expandEnvVars(u1.str()); bool decorate = true; - if (args.count() == 2) + if (args.size() == 2) decorate = isTrue(args.at(1)); if (decorate) { if (!msg.endsWith(QLatin1Char('?'))) @@ -1116,10 +1091,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( ProValueMap dependees; QMultiMap<int, ProString> rootSet; ProStringList orgList = values(args.at(0).toKey()); - ProString prefix = args.count() < 2 ? ProString() : args.at(1); - ProString priosfx = args.count() < 4 ? ProString(".priority") : args.at(3); + ProString prefix = args.size() < 2 ? ProString() : args.at(1); + ProString priosfx = args.size() < 4 ? ProString(".priority") : args.at(3); populateDeps(orgList, prefix, - args.count() < 3 ? ProStringList(ProString(".depends")) + args.size() < 3 ? ProStringList(ProString(".depends")) : split_value_list(args.at(2).toQStringView()), priosfx, dependencies, dependees, rootSet); while (!rootSet.isEmpty()) { @@ -1128,7 +1103,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( rootSet.erase(it); if ((func_t == E_RESOLVE_DEPENDS) || orgList.contains(item)) ret.prepend(item); - for (const ProString &dep : qAsConst(dependees[item.toKey()])) { + for (const ProString &dep : std::as_const(dependees[item.toKey()])) { QSet<ProKey> &dset = dependencies[dep.toKey()]; dset.remove(item.toKey()); if (dset.isEmpty()) @@ -1139,11 +1114,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( } case E_ENUMERATE_VARS: { QSet<ProString> keys; - for (const ProValueMap &vmap : qAsConst(m_valuemapStack)) + for (const ProValueMap &vmap : std::as_const(m_valuemapStack)) for (ProValueMap::ConstIterator it = vmap.constBegin(); it != vmap.constEnd(); ++it) keys.insert(it.key()); ret.reserve(keys.size()); - for (const ProString &key : qAsConst(keys)) + for (const ProString &key : std::as_const(keys)) ret << key; break; } case E_SHADOWED: { @@ -1156,7 +1131,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( case E_ABSOLUTE_PATH: { ProStringRwUser u1(args.at(0), m_tmp1); ProStringRwUser u2(m_tmp2); - QString baseDir = args.count() > 1 + QString baseDir = args.size() > 1 ? IoUtils::resolvePath(currentDirectory(), u2.set(args.at(1))) : currentDirectory(); QString rstr = u1.str().isEmpty() ? baseDir : IoUtils::resolvePath(baseDir, u1.str()); @@ -1166,7 +1141,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( case E_RELATIVE_PATH: { ProStringRwUser u1(args.at(0), m_tmp1); ProStringRoUser u2(m_tmp2); - QString baseDir = args.count() > 1 + QString baseDir = args.size() > 1 ? IoUtils::resolvePath(currentDirectory(), u2.set(args.at(1))) : currentDirectory(); QString absArg = u1.str().isEmpty() ? baseDir : IoUtils::resolvePath(baseDir, u1.str()); @@ -1277,7 +1252,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::testFunc_cache(const ProStringList & enum { TargetStash, TargetCache, TargetSuper } target = TargetCache; enum { CacheSet, CacheAdd, CacheSub } mode = CacheSet; ProKey srcvar; - if (args.count() >= 2) { + if (args.size() >= 2) { const auto opts = split_value_list(args.at(1).toQStringView()); for (const ProString &opt : opts) { if (opt == QLatin1String("transient")) { @@ -1297,7 +1272,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::testFunc_cache(const ProStringList & return ReturnFalse; } } - if (args.count() >= 3) { + if (args.size() >= 3) { srcvar = args.at(2).toKey(); } else if (mode != CacheSet) { evalError(fL1S("cache(): modes other than 'set' require a source variable.")); @@ -1392,7 +1367,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::testFunc_cache(const ProStringList & varstr += QLatin1String(" -="); else varstr += QLatin1String(" ="); - if (diffval.count() == 1) { + if (diffval.size() == 1) { varstr += QLatin1Char(' '); varstr += quoteValue(diffval.at(0)); } else if (!diffval.isEmpty()) { @@ -1450,7 +1425,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( switch (func_t) { case T_DEFINED: { const ProKey &var = args.at(0).toKey(); - if (args.count() > 1) { + if (args.size() > 1) { if (args[1] == QLatin1String("test")) { return returnBool(m_functionDefs.testFunctions.contains(var)); } else if (args[1] == QLatin1String("replace")) { @@ -1537,7 +1512,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( VisitReturn ok = evaluateFileInto(fn, &vars, LoadProOnly); if (ok != ReturnTrue) return ok; - if (args.count() == 2) + if (args.size() == 2) return returnBool(vars.contains(map(args.at(1)))); QRegularExpression regx; regx.setPatternOptions(QRegularExpression::DotMatchesEverythingOption); @@ -1587,14 +1562,14 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( m_current.pro->fileName(), m_current.line); } case T_CONFIG: { - if (args.count() == 1) + if (args.size() == 1) return returnBool(isActiveConfig(args.at(0).toQStringView())); const auto mutuals = args.at(1).toQStringView().split(QLatin1Char('|'), Qt::SkipEmptyParts); const ProStringList &configs = values(statics.strCONFIG); for (int i = configs.size() - 1; i >= 0; i--) { - for (int mut = 0; mut < mutuals.count(); mut++) { + for (int mut = 0; mut < mutuals.size(); mut++) { if (configs[i].toQStringView() == mutuals[mut].trimmed()) return returnBool(configs[i] == args[0]); } @@ -1614,7 +1589,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( } } const ProStringList &l = values(map(args.at(0))); - if (args.count() == 2) { + if (args.size() == 2) { for (int i = 0; i < l.size(); ++i) { const ProString &val = l[i]; if (val == qry) @@ -1630,7 +1605,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( Qt::SkipEmptyParts); for (int i = l.size() - 1; i >= 0; i--) { const ProString &val = l[i]; - for (int mut = 0; mut < mutuals.count(); mut++) { + for (int mut = 0; mut < mutuals.size(); mut++) { if (val.toQStringView() == mutuals[mut].trimmed()) { if (val == qry) return ReturnTrue; @@ -1647,9 +1622,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( return ReturnFalse; } case T_COUNT: { - int cnt = values(map(args.at(0))).count(); + int cnt = values(map(args.at(0))).size(); int val = args.at(1).toInt(); - if (args.count() == 3) { + if (args.size() == 3) { const ProString &comp = args.at(2); if (comp == QLatin1String(">") || comp == QLatin1String("greaterThan")) { return returnBool(cnt > val); @@ -1735,10 +1710,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( LoadFlags flags; if (m_cumulative) flags = LoadSilent; - if (args.count() >= 2) { + if (args.size() >= 2) { if (!args.at(1).isEmpty()) parseInto = args.at(1) + QLatin1Char('.'); - if (args.count() >= 3 && isTrue(args.at(2))) + if (args.size() >= 3 && isTrue(args.at(2))) flags = LoadSilent; } QString fn = filePathEnvArg0(args); @@ -1770,7 +1745,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( return ok; } case T_LOAD: { - bool ignore_error = (args.count() == 2 && isTrue(args.at(1))); + bool ignore_error = (args.size() == 2 && isTrue(args.at(1))); VisitReturn ok = evaluateFeatureFile(m_option->expandEnvVars(args.at(0).toQString()), ignore_error); if (ok == ReturnFalse && ignore_error) @@ -1869,11 +1844,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( QIODevice::OpenMode mode = QIODevice::Truncate; QMakeVfs::VfsFlags flags = (m_cumulative ? QMakeVfs::VfsCumulative : QMakeVfs::VfsExact); QString contents; - if (args.count() >= 2) { + if (args.size() >= 2) { const ProStringList &vals = values(args.at(1).toKey()); if (!vals.isEmpty()) contents = vals.join(QLatin1Char('\n')) + QLatin1Char('\n'); - if (args.count() >= 3) { + if (args.size() >= 3) { const auto opts = split_value_list(args.at(2).toQStringView()); for (const ProString &opt : opts) { if (opt == QLatin1String("append")) { diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index 3b0ff8ee93..df3f92d7d5 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "qmakeevaluator.h" #include "qmakeevaluator_p.h" @@ -281,7 +256,7 @@ ProStringList QMakeEvaluator::split_value_list(QStringView vals, int source) source = currentFileId(); const QChar *vals_data = vals.data(); - const int vals_len = vals.length(); + const int vals_len = vals.size(); char16_t quote = 0; bool hadWord = false; for (int x = 0; x < vals_len; x++) { @@ -826,7 +801,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProLoop( } else { ProString val; do { - if (index >= list.count()) + if (index >= list.size()) goto do_break; val = list.at(index++); } while (val.isEmpty()); // stupid, but qmake is like that @@ -878,19 +853,19 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProVariable( if (expandVariableReferences(tokPtr, sizeHint, &varVal, true) == ReturnError) return ReturnError; QStringView val = varVal.at(0).toQStringView(); - if (val.length() < 4 || val.at(0) != QLatin1Char('s')) { + if (val.size() < 4 || val.at(0) != QLatin1Char('s')) { evalError(fL1S("The ~= operator can handle only the s/// function.")); return ReturnTrue; } QChar sep = val.at(1); auto func = val.split(sep, Qt::KeepEmptyParts); - if (func.count() < 3 || func.count() > 4) { + if (func.size() < 3 || func.size() > 4) { evalError(fL1S("The s/// function expects 3 or 4 arguments.")); return ReturnTrue; } bool global = false, quote = false, case_sense = false; - if (func.count() == 4) { + if (func.size() == 4) { global = func[3].indexOf(QLatin1Char('g')) != -1; case_sense = func[3].indexOf(QLatin1Char('i')) == -1; quote = func[3].indexOf(QLatin1Char('q')) != -1; @@ -1038,10 +1013,13 @@ static ProString msvcArchitecture(const QString &vcInstallDir, const QString &pa void QMakeEvaluator::loadDefaults() { ProValueMap &vars = m_valuemapStack.top(); + qlonglong sde = qgetenv("SOURCE_DATE_EPOCH").toLongLong(); + QDateTime builddate = sde ? QDateTime::fromSecsSinceEpoch(sde) + : QDateTime::currentDateTime(); vars[ProKey("DIR_SEPARATOR")] << ProString(m_option->dir_sep); vars[ProKey("DIRLIST_SEPARATOR")] << ProString(m_option->dirlist_sep); - vars[ProKey("_DATE_")] << ProString(QDateTime::currentDateTime().toString()); + vars[ProKey("_DATE_")] << ProString(builddate.toString()); if (!m_option->qmake_abslocation.isEmpty()) vars[ProKey("QMAKE_QMAKE")] << ProString(m_option->qmake_abslocation); if (!m_option->qmake_args.isEmpty()) @@ -1258,7 +1236,7 @@ bool QMakeEvaluator::loadSpec() qmakespec = m_hostBuild ? QLatin1String("default-host") : QLatin1String("default"); #endif if (IoUtils::isRelativePath(qmakespec)) { - for (const QString &root : qAsConst(m_mkspecPaths)) { + for (const QString &root : std::as_const(m_mkspecPaths)) { QString mkspec = root + QLatin1Char('/') + qmakespec; if (IoUtils::exists(mkspec)) { qmakespec = mkspec; @@ -1500,7 +1478,7 @@ void QMakeEvaluator::updateMkspecPaths() for (const QString &it : paths) ret << it + concat; - for (const QString &it : qAsConst(m_qmakepath)) + for (const QString &it : std::as_const(m_qmakepath)) ret << it + concat; if (!m_buildRoot.isEmpty()) @@ -1541,7 +1519,7 @@ void QMakeEvaluator::updateFeaturePaths() for (const QString &item : items) feature_bases << (item + mkspecs_concat); - for (const QString &item : qAsConst(m_qmakepath)) + for (const QString &item : std::as_const(m_qmakepath)) feature_bases << (item + mkspecs_concat); if (!m_qmakespec.isEmpty()) { @@ -1563,21 +1541,21 @@ void QMakeEvaluator::updateFeaturePaths() feature_bases << (m_option->propertyValue(ProKey("QT_HOST_DATA/get")) + mkspecs_concat); feature_bases << (m_option->propertyValue(ProKey("QT_HOST_DATA/src")) + mkspecs_concat); - for (const QString &fb : qAsConst(feature_bases)) { + for (const QString &fb : std::as_const(feature_bases)) { const auto sfxs = values(ProKey("QMAKE_PLATFORM")); for (const ProString &sfx : sfxs) feature_roots << (fb + features_concat + sfx + QLatin1Char('/')); feature_roots << (fb + features_concat); } - for (int i = 0; i < feature_roots.count(); ++i) + for (int i = 0; i < feature_roots.size(); ++i) if (!feature_roots.at(i).endsWith(QLatin1Char('/'))) feature_roots[i].append(QLatin1Char('/')); feature_roots.removeDuplicates(); QStringList ret; - for (const QString &root : qAsConst(feature_roots)) + for (const QString &root : std::as_const(feature_roots)) if (IoUtils::exists(root)) ret << root; m_featureRoots = new QMakeFeatureRoots(ret); @@ -1595,7 +1573,7 @@ ProString QMakeEvaluator::propertyValue(const ProKey &name) const ProFile *QMakeEvaluator::currentProFile() const { - if (m_profileStack.count() > 0) + if (m_profileStack.size() > 0) return m_profileStack.top(); return nullptr; } @@ -1718,12 +1696,12 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFunction( m_locationStack.push(m_current); ProStringList args; - for (int i = 0; i < argumentsList.count(); ++i) { + for (int i = 0; i < argumentsList.size(); ++i) { args += argumentsList[i]; m_valuemapStack.top()[ProKey(QString::number(i+1))] = argumentsList[i]; } m_valuemapStack.top()[statics.strARGS] = args; - m_valuemapStack.top()[statics.strARGC] = ProStringList(ProString(QString::number(argumentsList.count()))); + m_valuemapStack.top()[statics.strARGC] = ProStringList(ProString(QString::number(argumentsList.size()))); vr = visitProBlock(func.pro(), func.tokPtr()); if (vr == ReturnReturn) vr = ReturnTrue; diff --git a/qmake/library/qmakeevaluator.h b/qmake/library/qmakeevaluator.h index ef60649f5c..2889ac0bee 100644 --- a/qmake/library/qmakeevaluator.h +++ b/qmake/library/qmakeevaluator.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef QMAKEEVALUATOR_H #define QMAKEEVALUATOR_H diff --git a/qmake/library/qmakeevaluator_p.h b/qmake/library/qmakeevaluator_p.h index eb997eebbe..ea18c3b45a 100644 --- a/qmake/library/qmakeevaluator_p.h +++ b/qmake/library/qmakeevaluator_p.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef QMAKEEVALUATOR_P_H #define QMAKEEVALUATOR_P_H diff --git a/qmake/library/qmakeglobals.cpp b/qmake/library/qmakeglobals.cpp index 7d51b0f184..e05d33c7c9 100644 --- a/qmake/library/qmakeglobals.cpp +++ b/qmake/library/qmakeglobals.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "qmakeglobals.h" @@ -114,7 +89,7 @@ QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments( QMakeCmdLineParserState &state, QStringList &args, int *pos) { enum { ArgNone, ArgConfig, ArgSpec, ArgXSpec, ArgTmpl, ArgTmplPfx, ArgCache, ArgQtConf } argState = ArgNone; - for (; *pos < args.count(); (*pos)++) { + for (; *pos < args.size(); (*pos)++) { QString arg = args.at(*pos); switch (argState) { case ArgConfig: @@ -193,7 +168,7 @@ void QMakeGlobals::commitCommandLineArguments(QMakeCmdLineParserState &state) { if (!state.extraargs.isEmpty()) { QString extra = fL1S("QMAKE_EXTRA_ARGS ="); - for (const QString &ea : qAsConst(state.extraargs)) + for (const QString &ea : std::as_const(state.extraargs)) extra += QLatin1Char(' ') + QMakeEvaluator::quoteValue(ProString(ea)); state.cmds[QMakeEvalBefore] << extra; } @@ -238,8 +213,8 @@ void QMakeGlobals::setDirectories(const QString &input_dir, const QString &outpu QString dstpath = output_dir; if (!dstpath.endsWith(QLatin1Char('/'))) dstpath += QLatin1Char('/'); - int srcLen = srcpath.length(); - int dstLen = dstpath.length(); + int srcLen = srcpath.size(); + int dstLen = dstpath.size(); int lastSl = -1; while (++lastSl, --srcLen, --dstLen, srcLen && dstLen && srcpath.at(srcLen) == dstpath.at(dstLen)) @@ -255,9 +230,9 @@ QString QMakeGlobals::shadowedPath(const QString &fileName) const if (source_root.isEmpty()) return fileName; if (fileName.startsWith(source_root) - && (fileName.length() == source_root.length() - || fileName.at(source_root.length()) == QLatin1Char('/'))) { - return build_root + fileName.mid(source_root.length()); + && (fileName.size() == source_root.size() + || fileName.at(source_root.size()) == QLatin1Char('/'))) { + return build_root + fileName.mid(source_root.size()); } return QString(); } @@ -268,7 +243,7 @@ QStringList QMakeGlobals::splitPathList(const QString &val) const if (!val.isEmpty()) { QString cwd(QDir::currentPath()); const QStringList vals = val.split(dirlist_sep, Qt::SkipEmptyParts); - ret.reserve(vals.length()); + ret.reserve(vals.size()); for (const QString &it : vals) ret << IoUtils::resolvePath(cwd, it); } @@ -297,7 +272,7 @@ QString QMakeGlobals::expandEnvVars(const QString &str) const startIndex = string.indexOf(QLatin1Char('$'), startIndex); if (startIndex < 0) break; - if (string.length() < startIndex + 3) + if (string.size() < startIndex + 3) break; if (string.at(startIndex + 1) != QLatin1Char('(')) { startIndex++; @@ -308,7 +283,7 @@ QString QMakeGlobals::expandEnvVars(const QString &str) const break; QString value = getEnv(string.mid(startIndex + 2, endIndex - startIndex - 2)); string.replace(startIndex, endIndex - startIndex + 1, value); - startIndex += value.length(); + startIndex += value.size(); } return string; } diff --git a/qmake/library/qmakeglobals.h b/qmake/library/qmakeglobals.h index 55e70ac784..437f131786 100644 --- a/qmake/library/qmakeglobals.h +++ b/qmake/library/qmakeglobals.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef QMAKEGLOBALS_H #define QMAKEGLOBALS_H diff --git a/qmake/library/qmakeparser.cpp b/qmake/library/qmakeparser.cpp index 52e4187dbb..ade2b091fe 100644 --- a/qmake/library/qmakeparser.cpp +++ b/qmake/library/qmakeparser.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "qmakeparser.h" @@ -52,7 +27,7 @@ ProFileCache::ProFileCache() ProFileCache::~ProFileCache() { - for (const Entry &ent : qAsConst(parsed_files)) + for (const Entry &ent : std::as_const(parsed_files)) if (ent.pro) ent.pro->deref(); QMakeVfs::deref(); @@ -359,7 +334,7 @@ void QMakeParser::read(ProFile *pro, QStringView in, int line, SubGrammar gramma xprStack.reserve(10); const ushort *cur = (const ushort *)in.data(); - const ushort *inend = cur + in.length(); + const ushort *inend = cur + in.size(); m_canElse = false; freshLine: m_state = StNew; @@ -757,7 +732,7 @@ void QMakeParser::read(ProFile *pro, QStringView in, int line, SubGrammar gramma if (!m_blockstack.top().braceLevel) { parseError(fL1S("Excess closing brace.")); } else if (!--m_blockstack.top().braceLevel - && m_blockstack.count() != 1) { + && m_blockstack.size() != 1) { leaveScope(tokPtr); m_state = StNew; m_canElse = false; @@ -1271,7 +1246,7 @@ bool QMakeParser::resolveVariable(ushort *xprPtr, int tlen, int needSep, ushort // The string is typically longer than the variable reference, so we need // to ensure that there is enough space in the output buffer - as unlikely // as an overflow is to actually happen in practice. - int need = (in.length() - (cur - (const ushort *)in.constData()) + 2) * 5 + out.length(); + int need = (in.size() - (cur - (const ushort *)in.constData()) + 2) * 5 + out.size(); int tused = *tokPtr - (ushort *)tokBuff->constData(); int xused; int total; @@ -1302,9 +1277,9 @@ bool QMakeParser::resolveVariable(ushort *xprPtr, int tlen, int needSep, ushort } xprPtr -= 2; // Was set up for variable reference xprPtr[-2] = TokLiteral | needSep; - xprPtr[-1] = out.length(); - memcpy(xprPtr, out.constData(), out.length() * 2); - *ptr = xprPtr + out.length(); + xprPtr[-1] = out.size(); + memcpy(xprPtr, out.constData(), out.size() * 2); + *ptr = xprPtr + out.size(); return true; } @@ -1549,7 +1524,8 @@ static bool getBlock(const ushort *tokens, int limit, int &offset, QString *outS ok = getSubBlock(tokens, limit, offset, outStr, indent, "block"); break; default: - Q_ASSERT(!"unhandled token"); + // unhandled token + Q_UNREACHABLE(); } } if (!ok) @@ -1563,7 +1539,7 @@ QString QMakeParser::formatProBlock(const QString &block) QString outStr; outStr += fL1S("\n << TS("); int offset = 0; - getBlock(reinterpret_cast<const ushort *>(block.constData()), block.length(), + getBlock(reinterpret_cast<const ushort *>(block.constData()), block.size(), offset, &outStr, 0); outStr += QLatin1Char(')'); return outStr; diff --git a/qmake/library/qmakeparser.h b/qmake/library/qmakeparser.h index 81aba061bc..a5a1192ec9 100644 --- a/qmake/library/qmakeparser.h +++ b/qmake/library/qmakeparser.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef QMAKEPARSER_H #define QMAKEPARSER_H diff --git a/qmake/library/qmakevfs.cpp b/qmake/library/qmakevfs.cpp index a187749ee1..a8517de0ff 100644 --- a/qmake/library/qmakevfs.cpp +++ b/qmake/library/qmakevfs.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "qmakevfs.h" diff --git a/qmake/library/qmakevfs.h b/qmake/library/qmakevfs.h index 0c9a8dca36..56bda3d0a0 100644 --- a/qmake/library/qmakevfs.h +++ b/qmake/library/qmakevfs.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef QMAKEVFS_H #define QMAKEVFS_H diff --git a/qmake/library/registry.cpp b/qmake/library/registry.cpp index 930e8e2ee6..7ab0c71fe6 100644 --- a/qmake/library/registry.cpp +++ b/qmake/library/registry.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include <QtCore/qstringlist.h> #include "registry_p.h" diff --git a/qmake/library/registry_p.h b/qmake/library/registry_p.h index f9e8bba016..00f2431f69 100644 --- a/qmake/library/registry_p.h +++ b/qmake/library/registry_p.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef QT_WINDOWS_REGISTRY_H #define QT_WINDOWS_REGISTRY_H |