forked from qt-creator/qt-creator
Avoid a few unnecessary non-const QString::operator[]() accesses
Change-Id: I44cbc418ce073da9b70df0e2d0851006140aaaf9 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -98,7 +98,7 @@ QList<FormattedText> AnsiEscapeCodeHandler::parseText(const FormattedText &input
|
||||
|
||||
while (!strippedText.isEmpty()) {
|
||||
QTC_ASSERT(m_pendingText.isEmpty(), break);
|
||||
const int escapePos = strippedText.indexOf(escape[0]);
|
||||
const int escapePos = strippedText.indexOf(escape.at(0));
|
||||
if (escapePos < 0) {
|
||||
outputData << FormattedText(strippedText, charFormat);
|
||||
break;
|
||||
@@ -106,9 +106,9 @@ QList<FormattedText> AnsiEscapeCodeHandler::parseText(const FormattedText &input
|
||||
outputData << FormattedText(strippedText.left(escapePos), charFormat);
|
||||
strippedText.remove(0, escapePos);
|
||||
}
|
||||
QTC_ASSERT(strippedText[0] == escape[0], break);
|
||||
QTC_ASSERT(strippedText.at(0) == escape.at(0), break);
|
||||
|
||||
while (!strippedText.isEmpty() && escape[0] == strippedText[0]) {
|
||||
while (!strippedText.isEmpty() && escape.at(0) == strippedText.at(0)) {
|
||||
if (escape.startsWith(strippedText)) {
|
||||
// control secquence is not complete
|
||||
m_pendingText += strippedText;
|
||||
|
@@ -1516,9 +1516,9 @@ QList<Diff> Differ::cleanupSemanticsLossless(const QList<Diff> &diffList)
|
||||
+ cleanupSemanticsScore(edit, equality2);
|
||||
|
||||
while (!edit.isEmpty() && !equality2.isEmpty()
|
||||
&& edit[0] == equality2[0]) {
|
||||
equality1 += edit[0];
|
||||
edit = edit.mid(1) + equality2[0];
|
||||
&& edit.at(0) == equality2.at(0)) {
|
||||
equality1 += edit.at(0);
|
||||
edit = edit.mid(1) + equality2.at(0);
|
||||
equality2 = equality2.mid(1);
|
||||
const int score = cleanupSemanticsScore(equality1, edit)
|
||||
+ cleanupSemanticsScore(edit, equality2);
|
||||
|
Reference in New Issue
Block a user