Use more prefix incrementing

parent 0178ae0a
......@@ -103,7 +103,7 @@ protected:
m_hash = 1315423911;
for (unsigned int i = 0; i < len; i++)
for (unsigned int i = 0; i < len; ++i)
{
m_hash ^= (m_hash << 5) + str[i] + (m_hash >> 2);
}
......
......@@ -323,9 +323,9 @@ void DiffModel::applyDifference(bool apply)
return;
}
if (apply && !m_selectedDifference->applied())
m_appliedCount++;
++m_appliedCount;
else if (!apply && m_selectedDifference->applied())
m_appliedCount--;
--m_appliedCount;
m_selectedDifference->apply(apply);
}
......
......@@ -1113,8 +1113,8 @@ bool KompareModelList::blendFile(DiffModel* model, const QString& fileContents)
{
newDiff->addSourceLine(*linesIt);
newDiff->addDestinationLine(*linesIt);
srcLineNo++;
destLineNo++;
++srcLineNo;
++destLineNo;
++linesIt;
}
}
......@@ -1173,8 +1173,8 @@ bool KompareModelList::blendFile(DiffModel* model, const QString& fileContents)
// qCDebug(LIBKOMPAREDIFF2) << "SourceLine = " << srcLineNo << ": " << *linesIt;
newDiff->addSourceLine(*linesIt);
newDiff->addDestinationLine(*linesIt);
srcLineNo++;
destLineNo++;
++srcLineNo;
++destLineNo;
++linesIt;
}
}
......@@ -1183,7 +1183,7 @@ bool KompareModelList::blendFile(DiffModel* model, const QString& fileContents)
{
case Difference::Unchanged:
qCDebug(LIBKOMPAREDIFF2) << "Unchanged";
for (int i = 0; i < diff->sourceLineCount(); i++)
for (int i = 0; i < diff->sourceLineCount(); ++i)
{
if (linesIt != lEnd && *linesIt != diff->sourceLineAt(i)->string())
{
......@@ -1196,8 +1196,8 @@ bool KompareModelList::blendFile(DiffModel* model, const QString& fileContents)
}
// qCDebug(LIBKOMPAREDIFF2) << "SourceLine = " << srcLineNo << ": " << *linesIt;
// qCDebug(LIBKOMPAREDIFF2) << "DiffLine = " << diff->sourceLineNumber() + i << ": " << diff->sourceLineAt( i )->string();
srcLineNo++;
destLineNo++;
++srcLineNo;
++destLineNo;
++linesIt;
}
......@@ -1212,7 +1212,7 @@ bool KompareModelList::blendFile(DiffModel* model, const QString& fileContents)
//QStringListConstIterator saveIt = linesIt;
for (int i = 0; i < diff->sourceLineCount(); i++)
for (int i = 0; i < diff->sourceLineCount(); ++i)
{
if (linesIt != lEnd && *linesIt != diff->sourceLineAt(i)->string())
{
......@@ -1223,8 +1223,8 @@ bool KompareModelList::blendFile(DiffModel* model, const QString& fileContents)
diff->sourceLineAt(i)->setConflictString(*linesIt);
diff->setConflict(true);
}
srcLineNo++;
destLineNo++;
++srcLineNo;
++destLineNo;
++linesIt;
}
......@@ -1249,7 +1249,7 @@ bool KompareModelList::blendFile(DiffModel* model, const QString& fileContents)
case Difference::Delete:
qCDebug(LIBKOMPAREDIFF2) << "Delete";
qCDebug(LIBKOMPAREDIFF2) << "Number of lines in Delete: " << diff->sourceLineCount();
for (int i = 0; i < diff->sourceLineCount(); i++)
for (int i = 0; i < diff->sourceLineCount(); ++i)
{
if (linesIt != lEnd && *linesIt != diff->sourceLineAt(i)->string())
{
......@@ -1263,7 +1263,7 @@ bool KompareModelList::blendFile(DiffModel* model, const QString& fileContents)
// qCDebug(LIBKOMPAREDIFF2) << "SourceLine = " << srcLineNo << ": " << *it;
// qCDebug(LIBKOMPAREDIFF2) << "DiffLine = " << diff->sourceLineNumber() + i << ": " << diff->sourceLineAt( i )->string();
srcLineNo++;
++srcLineNo;
++linesIt;
}
......
......@@ -41,13 +41,13 @@ static QString constructRelativePath(const QString& from, const QString& to)
root = fromURL;
while (root.isValid() && !root.isParentOf(toURL)) {
root = KIO::upUrl(root);
upLevels++;
++upLevels;
}
if (!root.isValid()) return to;
QString relative;
for (; upLevels > 0; upLevels--) {
for (; upLevels > 0; --upLevels) {
relative += QStringLiteral("../");
}
......
......@@ -411,7 +411,7 @@ bool ParserBase::parseContextHunkBody()
{
// qCDebug(LIBKOMPAREDIFF2) << " " << m_contextHunkBodyRemoved.cap( 1 );
diff->addSourceLine(m_contextHunkBodyRemoved.cap(1));
linenoA++;
++linenoA;
}
}
else if (newIt != newLines.end() && m_contextHunkBodyAdded.exactMatch(*newIt))
......@@ -426,7 +426,7 @@ bool ParserBase::parseContextHunkBody()
{
// qCDebug(LIBKOMPAREDIFF2) << " " << m_contextHunkBodyAdded.cap( 1 );
diff->addDestinationLine(m_contextHunkBodyAdded.cap(1));
linenoB++;
++linenoB;
}
}
else if ((oldIt == oldLines.end() || m_contextHunkBodyContext.exactMatch(*oldIt)) &&
......@@ -456,8 +456,8 @@ bool ParserBase::parseContextHunkBody()
}
diff->addSourceLine(l);
diff->addDestinationLine(l);
linenoA++;
linenoB++;
++linenoA;
++linenoB;
}
}
else if ((oldIt != oldLines.end() && m_contextHunkBodyChanged.exactMatch(*oldIt)) ||
......@@ -473,14 +473,14 @@ bool ParserBase::parseContextHunkBody()
{
// qCDebug(LIBKOMPAREDIFF2) << " " << m_contextHunkBodyChanged.cap( 1 );
diff->addSourceLine(m_contextHunkBodyChanged.cap(1));
linenoA++;
++linenoA;
++oldIt;
}
while (newIt != newLines.end() && m_contextHunkBodyChanged.exactMatch(*newIt))
{
// qCDebug(LIBKOMPAREDIFF2) << " " << m_contextHunkBodyChanged.cap( 1 );
diff->addDestinationLine(m_contextHunkBodyChanged.cap(1));
linenoB++;
++linenoB;
++newIt;
}
}
......@@ -592,7 +592,7 @@ bool ParserBase::parseUnifiedHunkBody()
// If a hunk is an insertion or deletion with no context, the line number given
// is the one before the hunk. this isn't what we want, so increment it to fix this.
if (lineCountA == 0)
linenoA++;
++linenoA;
}
linenoB = m_unifiedHunkHeader.cap(4).toInt();
if (!m_unifiedHunkHeader.cap(6).isEmpty()) {
......@@ -601,7 +601,7 @@ bool ParserBase::parseUnifiedHunkBody()
return false;
if (lineCountB == 0) // see above
linenoB++;
++linenoB;
}
QString function = m_unifiedHunkHeader.cap(7);
......@@ -625,8 +625,8 @@ bool ParserBase::parseUnifiedHunkBody()
{
diff->addSourceLine(QString(*m_diffIterator).remove(0, 1));
diff->addDestinationLine(QString(*m_diffIterator).remove(0, 1));
linenoA++;
linenoB++;
++linenoA;
++linenoB;
--lineCountA;
--lineCountB;
}
......@@ -636,13 +636,13 @@ bool ParserBase::parseUnifiedHunkBody()
for (; m_diffIterator != m_diffLinesEnd && (*m_diffIterator).startsWith(removed) && (lineCountA || lineCountB); ++m_diffIterator)
{
diff->addSourceLine(QString(*m_diffIterator).remove(0, 1));
linenoA++;
++linenoA;
--lineCountA;
}
for (; m_diffIterator != m_diffLinesEnd && (*m_diffIterator).startsWith(added) && (lineCountA || lineCountB); ++m_diffIterator)
{
diff->addDestinationLine(QString(*m_diffIterator).remove(0, 1));
linenoB++;
++linenoB;
--lineCountB;
}
if (diff->sourceLineCount() == 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment