summaryrefslogtreecommitdiffstats
path: root/qmake/library/qmakeparser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qmake/library/qmakeparser.cpp')
-rw-r--r--qmake/library/qmakeparser.cpp48
1 files changed, 12 insertions, 36 deletions
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;