Use prefix instead of postfix for iterators

The postfix increment(decrement) creates a temp copy of *this before the
modification and then returns that copy. It's needed only when using the
old iterator and then incrementing it.

Change-Id: I7f6702de78f5f987cec3556047e76049b4ee063a
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Maks Naumov 2015-02-07 12:10:41 +02:00
parent 163b852951
commit c2f26d6d0b
6 changed files with 9 additions and 7 deletions

View File

@ -781,7 +781,7 @@ static QStringList fallbackFamilies(const QString &family, QFont::Style style, Q
}
if (!contains) {
i = retList.erase(i);
i--;
--i;
}
}
return retList;

View File

@ -2084,7 +2084,7 @@ QFontEngine *QFontEngineMulti::createMultiFontEngine(QFontEngine *fe, int script
fc->updateHitCountAndTimeStamp(it.value());
break;
}
it++;
++it;
}
if (!engine) {
engine = QGuiApplicationPrivate::instance()->platformIntegration()->fontDatabase()->fontEngineMulti(fe, QChar::Script(script));

View File

@ -278,7 +278,7 @@ void QTextOdfWriter::writeBlock(QXmlStreamWriter &writer, const QTextBlock &bloc
writer.writeStartElement(textNS, QString::fromLatin1("p"));
writer.writeAttribute(textNS, QString::fromLatin1("style-name"), QString::fromLatin1("p%1")
.arg(block.blockFormatIndex()));
for (QTextBlock::Iterator frag= block.begin(); !frag.atEnd(); frag++) {
for (QTextBlock::Iterator frag = block.begin(); !frag.atEnd(); ++frag) {
writer.writeCharacters(QString()); // Trick to make sure that the span gets no linefeed in front of it.
writer.writeStartElement(textNS, QString::fromLatin1("span"));

View File

@ -307,11 +307,12 @@ bool QNetworkCookieJar::deleteCookie(const QNetworkCookie &cookie)
{
Q_D(QNetworkCookieJar);
QList<QNetworkCookie>::Iterator it;
for (it = d->allCookies.begin(); it != d->allCookies.end(); it++)
for (it = d->allCookies.begin(); it != d->allCookies.end(); ++it) {
if (it->hasSameIdentifier(cookie)) {
d->allCookies.erase(it);
return true;
}
}
return false;
}

View File

@ -153,8 +153,8 @@ QByteArray QSslKeyPrivate::pemFromDer(const QByteArray &der, const QMap<QByteArr
if (!headers.isEmpty()) {
QMap<QByteArray, QByteArray>::const_iterator it = headers.constEnd();
do {
it--;
extra += it.key() + ": " + it.value() + '\n';
--it;
extra += it.key() + ": " + it.value() + '\n';
} while (it != headers.constBegin());
extra += '\n';
}

View File

@ -501,9 +501,10 @@ bool QSqlTableModel::isDirty() const
Q_D(const QSqlTableModel);
QSqlTableModelPrivate::CacheMap::ConstIterator i = d->cache.constBegin();
const QSqlTableModelPrivate::CacheMap::ConstIterator e = d->cache.constEnd();
for (; i != e; i++)
for (; i != e; ++i) {
if (!i.value().submitted())
return true;
}
return false;
}