forked from qt-creator/qt-creator
Fix warning: "Use midRef() instead of mid()"
[-Wclazy-qstring-ref] Change-Id: If8a0844b39377feb3772542559655854a92b93cd Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -122,7 +122,7 @@ QList<FormattedText> AnsiEscapeCodeHandler::parseText(const FormattedText &input
|
||||
strippedText.remove(0, 1);
|
||||
continue;
|
||||
}
|
||||
m_pendingText += strippedText.mid(0, escape.length());
|
||||
m_pendingText += strippedText.midRef(0, escape.length());
|
||||
strippedText.remove(0, escape.length());
|
||||
|
||||
// \e[K is not supported. Just strip it.
|
||||
@@ -144,7 +144,7 @@ QList<FormattedText> AnsiEscapeCodeHandler::parseText(const FormattedText &input
|
||||
break;
|
||||
strNumber.clear();
|
||||
}
|
||||
m_pendingText += strippedText.mid(0, 1);
|
||||
m_pendingText += strippedText.midRef(0, 1);
|
||||
strippedText.remove(0, 1);
|
||||
}
|
||||
if (strippedText.isEmpty())
|
||||
|
||||
@@ -399,7 +399,7 @@ void QtTestOutputReader::processResultOutput(const QString &result, const QStrin
|
||||
if (!description.isEmpty()) {
|
||||
if (!m_description.isEmpty())
|
||||
m_description.append('\n');
|
||||
m_description.append(description.mid(1)); // cut the first whitespace
|
||||
m_description.append(description.midRef(1)); // cut the first whitespace
|
||||
}
|
||||
m_formerTestCase = m_testCase;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ const QString QtTestResult::outputString(bool selected) const
|
||||
int breakPos = desc.indexOf('(');
|
||||
output.append(": ").append(desc.left(breakPos));
|
||||
if (selected)
|
||||
output.append('\n').append(desc.mid(breakPos));
|
||||
output.append('\n').append(desc.midRef(breakPos));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -90,7 +90,7 @@ void BareMetalDevice::setChannelByServerProvider(GdbServerProvider *provider)
|
||||
return;
|
||||
QSsh::SshConnectionParameters sshParams = sshParameters();
|
||||
sshParams.setHost(channel.left(colon));
|
||||
sshParams.setPort(channel.mid(colon + 1).toUShort());
|
||||
sshParams.setPort(channel.midRef(colon + 1).toUShort());
|
||||
setSshParameters(sshParams);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,8 +49,8 @@ namespace {
|
||||
int distance(const FileName &targetDirectory, const FileName &fileName)
|
||||
{
|
||||
const QString commonParent = commonPath(QStringList({targetDirectory.toString(), fileName.toString()}));
|
||||
return targetDirectory.toString().mid(commonParent.size()).count('/')
|
||||
+ fileName.toString().mid(commonParent.size()).count('/');
|
||||
return targetDirectory.toString().midRef(commonParent.size()).count('/')
|
||||
+ fileName.toString().midRef(commonParent.size()).count('/');
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ void BreakpointParameters::updateLocation(const QString &location)
|
||||
{
|
||||
if (location.size()) {
|
||||
int pos = location.indexOf(':');
|
||||
lineNumber = location.mid(pos + 1).toInt();
|
||||
lineNumber = location.midRef(pos + 1).toInt();
|
||||
QString file = location.left(pos);
|
||||
if (file.startsWith('"') && file.endsWith('"'))
|
||||
file = file.mid(1, file.size() - 2);
|
||||
@@ -345,7 +345,7 @@ void BreakpointParameters::updateFromGdbOutput(const GdbMi &bkpt)
|
||||
QString what = bkpt["what"].data();
|
||||
if (what.startsWith("*0x")) {
|
||||
type = WatchpointAtAddress;
|
||||
address = what.mid(1).toULongLong(0, 0);
|
||||
address = what.midRef(1).toULongLong(0, 0);
|
||||
} else {
|
||||
type = WatchpointAtExpression;
|
||||
expression = what;
|
||||
|
||||
@@ -2245,7 +2245,7 @@ static inline bool checkCommandToken(const QString &tokenPrefix, const QString &
|
||||
if (!c.startsWith(tokenPrefix))
|
||||
return false;
|
||||
bool ok;
|
||||
*token = c.mid(tokenPrefixSize, size - tokenPrefixSize - 1).toInt(&ok);
|
||||
*token = c.midRef(tokenPrefixSize, size - tokenPrefixSize - 1).toInt(&ok);
|
||||
return ok;
|
||||
}
|
||||
|
||||
@@ -2266,19 +2266,19 @@ void CdbEngine::parseOutputLine(QString line)
|
||||
const int tokenPos = creatorExtPrefix.size() + 2;
|
||||
const int tokenEndPos = line.indexOf('|', tokenPos);
|
||||
QTC_ASSERT(tokenEndPos != -1, return);
|
||||
const int token = line.mid(tokenPos, tokenEndPos - tokenPos).toInt();
|
||||
const int token = line.midRef(tokenPos, tokenEndPos - tokenPos).toInt();
|
||||
// remainingChunks
|
||||
const int remainingChunksPos = tokenEndPos + 1;
|
||||
const int remainingChunksEndPos = line.indexOf('|', remainingChunksPos);
|
||||
QTC_ASSERT(remainingChunksEndPos != -1, return);
|
||||
const int remainingChunks = line.mid(remainingChunksPos, remainingChunksEndPos - remainingChunksPos).toInt();
|
||||
const int remainingChunks = line.midRef(remainingChunksPos, remainingChunksEndPos - remainingChunksPos).toInt();
|
||||
// const char 'serviceName'
|
||||
const int whatPos = remainingChunksEndPos + 1;
|
||||
const int whatEndPos = line.indexOf('|', whatPos);
|
||||
QTC_ASSERT(whatEndPos != -1, return);
|
||||
const QString what = line.mid(whatPos, whatEndPos - whatPos);
|
||||
// Build up buffer, call handler once last chunk was encountered
|
||||
m_extensionMessageBuffer += line.mid(whatEndPos + 1);
|
||||
m_extensionMessageBuffer += line.midRef(whatEndPos + 1);
|
||||
if (remainingChunks == 0) {
|
||||
handleExtensionMessage(type, token, what, m_extensionMessageBuffer);
|
||||
m_extensionMessageBuffer.clear();
|
||||
@@ -2843,7 +2843,7 @@ void CdbEngine::handleWidgetAt(const DebuggerResponse &response)
|
||||
break;
|
||||
}
|
||||
// 0x000 -> nothing found
|
||||
if (!watchExp.mid(sepPos + 1).toULongLong(nullptr, 0)) {
|
||||
if (!watchExp.midRef(sepPos + 1).toULongLong(nullptr, 0)) {
|
||||
message = QString("No widget could be found at %1, %2.").arg(m_watchPointX).arg(m_watchPointY);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -652,7 +652,7 @@ QString decodeData(const QString &ba, const QString &encoding)
|
||||
case DebuggerEncoding::JulianDateAndMillisecondsSinceMidnight: {
|
||||
const int p = ba.indexOf('/');
|
||||
const QDate date = dateFromData(ba.left(p).toInt());
|
||||
const QTime time = timeFromData(ba.mid(p + 1 ).toInt());
|
||||
const QTime time = timeFromData(ba.midRef(p + 1 ).toInt());
|
||||
const QDateTime dateTime = QDateTime(date, time);
|
||||
return dateTime.isValid() ? dateTime.toString(Qt::TextDate) : "(invalid)";
|
||||
}
|
||||
@@ -693,15 +693,15 @@ QString decodeData(const QString &ba, const QString &encoding)
|
||||
|
||||
qint64 msecs = ba.left(p0).toLongLong();
|
||||
++p0;
|
||||
Qt::TimeSpec spec = Qt::TimeSpec(ba.mid(p0, p1 - p0).toInt());
|
||||
Qt::TimeSpec spec = Qt::TimeSpec(ba.midRef(p0, p1 - p0).toInt());
|
||||
++p1;
|
||||
qulonglong offset = ba.mid(p1, p2 - p1).toInt();
|
||||
qulonglong offset = ba.midRef(p1, p2 - p1).toInt();
|
||||
++p2;
|
||||
QByteArray timeZoneId = QByteArray::fromHex(ba.mid(p2, p3 - p2).toUtf8());
|
||||
++p3;
|
||||
int status = ba.mid(p3, p4 - p3).toInt();
|
||||
int status = ba.midRef(p3, p4 - p3).toInt();
|
||||
++p4;
|
||||
int tiVersion = ba.mid(p4).toInt();
|
||||
int tiVersion = ba.midRef(p4).toInt();
|
||||
|
||||
QDate date;
|
||||
QTime time;
|
||||
|
||||
@@ -47,7 +47,7 @@ void DisassemblerLine::fromString(const QString &unparsed)
|
||||
|
||||
// Mac gdb has an overflow reporting 64bit addresses causing the instruction
|
||||
// to follow the last digit "0x000000013fff4810mov 1,1". Truncate here.
|
||||
if (pos > 19 && unparsed.mid(3, 16).toULongLong())
|
||||
if (pos > 19 && unparsed.midRef(3, 16).toULongLong())
|
||||
pos = 19;
|
||||
|
||||
QString addr = unparsed.left(pos);
|
||||
@@ -191,7 +191,7 @@ void DisassemblerLines::appendUnparsed(const QString &unparsed)
|
||||
}
|
||||
dl.address = address.left(pos1 - 1).toULongLong(nullptr, 0);
|
||||
dl.function = m_lastFunction;
|
||||
dl.offset = address.mid(pos2).toUInt();
|
||||
dl.offset = address.midRef(pos2).toUInt();
|
||||
} else {
|
||||
// Plain data like "0x0000cd64:\tadd\tlr, pc, lr\n"
|
||||
dl.address = address.toULongLong(nullptr, 0);
|
||||
|
||||
@@ -167,7 +167,7 @@ static QString msgWinException(const QString &data, unsigned *exCodeIn = nullptr
|
||||
const int addressPos = blankPos != -1 ? data.indexOf("0x", blankPos + 1) : -1;
|
||||
if (addressPos < 0)
|
||||
return GdbEngine::tr("An exception was triggered.");
|
||||
const unsigned exCode = data.mid(exCodePos, blankPos - exCodePos).toUInt(nullptr, 0);
|
||||
const unsigned exCode = data.midRef(exCodePos, blankPos - exCodePos).toUInt(nullptr, 0);
|
||||
if (exCodeIn)
|
||||
*exCodeIn = exCode;
|
||||
const quint64 address = data.mid(addressPos).trimmed().toULongLong(nullptr, 0);
|
||||
@@ -1390,7 +1390,7 @@ void GdbEngine::handleStop2(const GdbMi &data)
|
||||
const GdbMi wpt = data["wpt"];
|
||||
const QString rid = wpt["number"].data();
|
||||
const Breakpoint bp = breakHandler()->findBreakpointByResponseId(rid);
|
||||
const quint64 bpAddress = wpt["exp"].data().mid(1).toULongLong(nullptr, 0);
|
||||
const quint64 bpAddress = wpt["exp"].data().midRef(1).toULongLong(nullptr, 0);
|
||||
QString msg;
|
||||
if (bp) {
|
||||
if (bp->type() == WatchpointAtExpression)
|
||||
@@ -2154,7 +2154,7 @@ void GdbEngine::handleWatchInsert(const DebuggerResponse &response, const Breakp
|
||||
bp->setResponseId(wpt["number"].data());
|
||||
QString exp = wpt["exp"].data();
|
||||
if (exp.startsWith('*'))
|
||||
bp->setAddress(exp.mid(1).toULongLong(nullptr, 0));
|
||||
bp->setAddress(exp.midRef(1).toULongLong(nullptr, 0));
|
||||
QTC_CHECK(!bp->needsChange());
|
||||
notifyBreakpointInsertOk(bp);
|
||||
} else if (ba.startsWith("Hardware watchpoint ")
|
||||
@@ -2165,7 +2165,7 @@ void GdbEngine::handleWatchInsert(const DebuggerResponse &response, const Breakp
|
||||
const QString address = ba.mid(end + 2).trimmed();
|
||||
bp->setResponseId(ba.mid(begin, end - begin));
|
||||
if (address.startsWith('*'))
|
||||
bp->setAddress(address.mid(1).toULongLong(nullptr, 0));
|
||||
bp->setAddress(address.midRef(1).toULongLong(nullptr, 0));
|
||||
QTC_CHECK(!bp->needsChange());
|
||||
notifyBreakpointInsertOk(bp);
|
||||
} else {
|
||||
|
||||
@@ -499,7 +499,7 @@ void PdbEngine::handleOutput2(const QString &data)
|
||||
const int pos2 = line.lastIndexOf(':');
|
||||
QTC_ASSERT(pos2 != -1, continue);
|
||||
const QString fileName = line.mid(pos1 + 4, pos2 - pos1 - 4);
|
||||
const int lineNumber = line.mid(pos2 + 1).toInt();
|
||||
const int lineNumber = line.midRef(pos2 + 1).toInt();
|
||||
const Breakpoint bp = Utils::findOrDefault(breakHandler()->breakpoints(), [&](const Breakpoint &bp) {
|
||||
return bp->parameters().isLocatedAt(fileName, lineNumber, bp->markerFileName())
|
||||
|| bp->requestedParameters().isLocatedAt(fileName, lineNumber, bp->markerFileName());
|
||||
|
||||
@@ -437,7 +437,7 @@ void QmlInspectorAgent::verifyAndInsertObjectInTree(const ObjectReference &objec
|
||||
const int firstIndex = strlen("inspect");
|
||||
const int secondIndex = iname.indexOf('.', firstIndex + 1);
|
||||
if (secondIndex != -1)
|
||||
engineId = iname.mid(firstIndex + 1, secondIndex - firstIndex - 1).toInt();
|
||||
engineId = iname.midRef(firstIndex + 1, secondIndex - firstIndex - 1).toInt();
|
||||
}
|
||||
|
||||
// Still not found? Maybe we're loading the engine itself.
|
||||
@@ -462,7 +462,7 @@ void QmlInspectorAgent::verifyAndInsertObjectInTree(const ObjectReference &objec
|
||||
int lastIndex = iname.lastIndexOf('.');
|
||||
int secondLastIndex = iname.lastIndexOf('.', lastIndex - 1);
|
||||
if (secondLastIndex != WatchItem::InvalidId)
|
||||
parentId = iname.mid(secondLastIndex + 1, lastIndex - secondLastIndex - 1).toInt();
|
||||
parentId = iname.midRef(secondLastIndex + 1, lastIndex - secondLastIndex - 1).toInt();
|
||||
else
|
||||
parentId = engineId;
|
||||
} else {
|
||||
|
||||
@@ -5503,7 +5503,7 @@ bool FakeVimHandler::Private::handleExSubstituteCommand(const ExCommand &cmd)
|
||||
if (cmd.cmd.isEmpty()) {
|
||||
// keep previous substitution flags on '&&' and '~&'
|
||||
if (line.size() > 1 && line[1] == '&')
|
||||
g.lastSubstituteFlags += line.mid(2);
|
||||
g.lastSubstituteFlags += line.midRef(2);
|
||||
else
|
||||
g.lastSubstituteFlags = line.mid(1);
|
||||
if (line[0] == '~')
|
||||
|
||||
@@ -159,8 +159,8 @@ static QString sanitizeBlameOutput(const QString &b)
|
||||
forever {
|
||||
QTC_CHECK(prevPos < pos);
|
||||
int afterParen = prevPos + parenPos;
|
||||
result.append(b.mid(prevPos, stripPos));
|
||||
result.append(b.mid(afterParen, pos - afterParen));
|
||||
result.append(b.midRef(prevPos, stripPos));
|
||||
result.append(b.midRef(afterParen, pos - afterParen));
|
||||
prevPos = pos;
|
||||
QTC_CHECK(prevPos != 0);
|
||||
if (pos == b.size())
|
||||
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
filePath.remove(0, m_ref.length());
|
||||
single.fileName = m_directory + '/' + filePath;
|
||||
const int textSeparator = line.indexOf(QChar::Null, lineSeparator + 1);
|
||||
single.lineNumber = line.mid(lineSeparator + 1, textSeparator - lineSeparator - 1).toInt();
|
||||
single.lineNumber = line.midRef(lineSeparator + 1, textSeparator - lineSeparator - 1).toInt();
|
||||
QString text = line.mid(textSeparator + 1);
|
||||
QRegularExpression regexp;
|
||||
QVector<Match> matches;
|
||||
|
||||
@@ -355,7 +355,7 @@ PerfConfigEventsModel::EventDescription PerfConfigEventsModel::parseEvent(
|
||||
|
||||
if (event.startsWith('r') && event.length() == 4) {
|
||||
bool ok = false;
|
||||
const uint eventNumber = event.mid(1).toUInt(&ok, 16);
|
||||
const uint eventNumber = event.midRef(1).toUInt(&ok, 16);
|
||||
if (ok) {
|
||||
description.eventType = EventTypeRaw;
|
||||
description.numericEvent = eventNumber;
|
||||
|
||||
@@ -79,7 +79,7 @@ static inline QString xmlFromClassName(const QString &name)
|
||||
if (!name.isEmpty()) {
|
||||
rc += name.left(1).toLower();
|
||||
if (name.size() > 1)
|
||||
rc += name.mid(1);
|
||||
rc += name.midRef(1);
|
||||
}
|
||||
rc += QLatin1String("\">\n</widget>\n");
|
||||
return rc;
|
||||
|
||||
@@ -296,7 +296,7 @@ static QString filterPasswordFromUrls(const QString &input)
|
||||
while ((pos = d->passwordRegExp.indexIn(result, pos)) >= 0) {
|
||||
QString tmp = result.left(pos + 3) + d->passwordRegExp.cap(1) + QLatin1String(":***@");
|
||||
int newStart = tmp.count();
|
||||
tmp += result.mid(pos + d->passwordRegExp.matchedLength());
|
||||
tmp += result.midRef(pos + d->passwordRegExp.matchedLength());
|
||||
result = tmp;
|
||||
pos = newStart;
|
||||
}
|
||||
|
||||
@@ -620,11 +620,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
|
||||
for (const ProString &opt : opts) {
|
||||
opt.toQString(m_tmp3);
|
||||
if (m_tmp3.startsWith(QLatin1String("ibase="))) {
|
||||
ibase = m_tmp3.mid(6).toInt();
|
||||
ibase = m_tmp3.midRef(6).toInt();
|
||||
} else if (m_tmp3.startsWith(QLatin1String("obase="))) {
|
||||
obase = m_tmp3.mid(6).toInt();
|
||||
obase = m_tmp3.midRef(6).toInt();
|
||||
} else if (m_tmp3.startsWith(QLatin1String("width="))) {
|
||||
width = m_tmp3.mid(6).toInt();
|
||||
width = m_tmp3.midRef(6).toInt();
|
||||
} else if (m_tmp3 == QLatin1String("zeropad")) {
|
||||
zeropad = true;
|
||||
} else if (m_tmp3 == QLatin1String("padsign")) {
|
||||
|
||||
Reference in New Issue
Block a user