Replace 'i < len-1 && func(i+1)' by 'i+1 < len && func(i+1)'
Merge-request: 1299 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> (cherry picked from commit 81f0c44f6a4fd4cfa41af5d5b292008185bf3981) Conflicts: src/qt3support/itemviews/q3listbox.cpp src/qt3support/sql/q3datatable.cpp src/qt3support/text/q3richtext.cpp src/scripttools/debugging/qscriptcompletiontask.cpp src/scripttools/debugging/qscriptdebuggercodeview.cpp Change-Id: Ie70590e77e69fbb9b2322c48c3963fd9cbba19e6 Reviewed-on: http://codereview.qt-project.org/4581 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
parent
7b42532100
commit
5dd78ba08f
@ -219,7 +219,7 @@ void GradientEditor::pointsUpdated()
|
|||||||
|
|
||||||
for (int i=0; i<points.size(); ++i) {
|
for (int i=0; i<points.size(); ++i) {
|
||||||
qreal x = int(points.at(i).x());
|
qreal x = int(points.at(i).x());
|
||||||
if (i < points.size() - 1 && x == points.at(i+1).x())
|
if (i+1 < points.size() && x == points.at(i+1).x())
|
||||||
continue;
|
continue;
|
||||||
QColor color((0x00ff0000 & m_red_shade->colorAt(int(x))) >> 16,
|
QColor color((0x00ff0000 & m_red_shade->colorAt(int(x))) >> 16,
|
||||||
(0x0000ff00 & m_green_shade->colorAt(int(x))) >> 8,
|
(0x0000ff00 & m_green_shade->colorAt(int(x))) >> 8,
|
||||||
|
@ -499,7 +499,7 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file)
|
|||||||
} else if(*(buffer+x) == '*') { //c style comment
|
} else if(*(buffer+x) == '*') { //c style comment
|
||||||
for(++x; x < buffer_len; ++x) {
|
for(++x; x < buffer_len; ++x) {
|
||||||
if(*(buffer+x) == '*') {
|
if(*(buffer+x) == '*') {
|
||||||
if(x < buffer_len-1 && *(buffer + (x+1)) == '/') {
|
if(x+1 < buffer_len && *(buffer + (x+1)) == '/') {
|
||||||
++x;
|
++x;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1970,7 +1970,7 @@ QString QDir::cleanPath(const QString &path)
|
|||||||
const QChar *p = name.unicode();
|
const QChar *p = name.unicode();
|
||||||
for (int i = 0, last = -1, iwrite = 0; i < len; ++i) {
|
for (int i = 0, last = -1, iwrite = 0; i < len; ++i) {
|
||||||
if (p[i] == QLatin1Char('/')) {
|
if (p[i] == QLatin1Char('/')) {
|
||||||
while (i < len-1 && p[i+1] == QLatin1Char('/')) {
|
while (i+1 < len && p[i+1] == QLatin1Char('/')) {
|
||||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) //allow unc paths
|
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) //allow unc paths
|
||||||
if (!i)
|
if (!i)
|
||||||
break;
|
break;
|
||||||
@ -1978,9 +1978,9 @@ QString QDir::cleanPath(const QString &path)
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
bool eaten = false;
|
bool eaten = false;
|
||||||
if (i < len - 1 && p[i+1] == QLatin1Char('.')) {
|
if (i+1 < len && p[i+1] == QLatin1Char('.')) {
|
||||||
int dotcount = 1;
|
int dotcount = 1;
|
||||||
if (i < len - 2 && p[i+2] == QLatin1Char('.'))
|
if (i+2 < len && p[i+2] == QLatin1Char('.'))
|
||||||
dotcount++;
|
dotcount++;
|
||||||
if (i == len - dotcount - 1) {
|
if (i == len - dotcount - 1) {
|
||||||
if (dotcount == 1) {
|
if (dotcount == 1) {
|
||||||
|
@ -3488,7 +3488,7 @@ void QRasterPaintEngine::drawBitmap(const QPointF &pos, const QImage &image, QSp
|
|||||||
spans[n].y = y;
|
spans[n].y = y;
|
||||||
spans[n].coverage = 255;
|
spans[n].coverage = 255;
|
||||||
int len = 1;
|
int len = 1;
|
||||||
while (src_x < w-1 && src[(src_x+1) >> 3] & (0x1 << ((src_x+1) & 7))) {
|
while (src_x+1 < w && src[(src_x+1) >> 3] & (0x1 << ((src_x+1) & 7))) {
|
||||||
++src_x;
|
++src_x;
|
||||||
++len;
|
++len;
|
||||||
}
|
}
|
||||||
@ -3514,7 +3514,7 @@ void QRasterPaintEngine::drawBitmap(const QPointF &pos, const QImage &image, QSp
|
|||||||
spans[n].y = y;
|
spans[n].y = y;
|
||||||
spans[n].coverage = 255;
|
spans[n].coverage = 255;
|
||||||
int len = 1;
|
int len = 1;
|
||||||
while (src_x < w-1 && src[(src_x+1) >> 3] & (0x80 >> ((src_x+1) & 7))) {
|
while (src_x+1 < w && src[(src_x+1) >> 3] & (0x80 >> ((src_x+1) & 7))) {
|
||||||
++src_x;
|
++src_x;
|
||||||
++len;
|
++len;
|
||||||
}
|
}
|
||||||
|
@ -2326,7 +2326,7 @@ static QPainterPath path_for_glyphs(const QVarLengthArray<glyph_t> &glyphs,
|
|||||||
bool set = src[x >> 3] & (0x80 >> (x & 7));
|
bool set = src[x >> 3] & (0x80 >> (x & 7));
|
||||||
if (set) {
|
if (set) {
|
||||||
QRect r(xp + x, yp - h, 1, 1);
|
QRect r(xp + x, yp - h, 1, 1);
|
||||||
while (x < glyph->width-1 && src[(x+1) >> 3] & (0x80 >> ((x+1) & 7))) {
|
while (x+1 < glyph->width && src[(x+1) >> 3] & (0x80 >> ((x+1) & 7))) {
|
||||||
++x;
|
++x;
|
||||||
r.setRight(r.right()+1);
|
r.setRight(r.right()+1);
|
||||||
}
|
}
|
||||||
|
@ -893,7 +893,7 @@ void QTessellatorPrivate::processIntersections()
|
|||||||
QDEBUG() << " adding edge on left";
|
QDEBUG() << " adding edge on left";
|
||||||
--min;
|
--min;
|
||||||
}
|
}
|
||||||
while (max < scanline.size - 1 && scanline.edges[max + 1]->positionAt(y) <= xmax) {
|
while (max + 1 < scanline.size && scanline.edges[max + 1]->positionAt(y) <= xmax) {
|
||||||
QDEBUG() << " adding edge on right";
|
QDEBUG() << " adding edge on right";
|
||||||
++max;
|
++max;
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const
|
|||||||
|
|
||||||
if (tabIndex > 0 && tabIndex - 1 == d->currentIndex)
|
if (tabIndex > 0 && tabIndex - 1 == d->currentIndex)
|
||||||
option->selectedPosition = QStyleOptionTab::PreviousIsSelected;
|
option->selectedPosition = QStyleOptionTab::PreviousIsSelected;
|
||||||
else if (tabIndex < totalTabs - 1 && tabIndex + 1 == d->currentIndex)
|
else if (tabIndex + 1 < totalTabs && tabIndex + 1 == d->currentIndex)
|
||||||
option->selectedPosition = QStyleOptionTab::NextIsSelected;
|
option->selectedPosition = QStyleOptionTab::NextIsSelected;
|
||||||
else
|
else
|
||||||
option->selectedPosition = QStyleOptionTab::NotAdjacent;
|
option->selectedPosition = QStyleOptionTab::NotAdjacent;
|
||||||
|
@ -183,7 +183,7 @@ QString QSqlResultPrivate::namedToPositionalBinding()
|
|||||||
QChar ch = sql.at(i);
|
QChar ch = sql.at(i);
|
||||||
if (ch == QLatin1Char(':') && !inQuote
|
if (ch == QLatin1Char(':') && !inQuote
|
||||||
&& (i == 0 || sql.at(i - 1) != QLatin1Char(':'))
|
&& (i == 0 || sql.at(i - 1) != QLatin1Char(':'))
|
||||||
&& (i < n - 1 && qIsAlnum(sql.at(i + 1)))) {
|
&& (i + 1 < n && qIsAlnum(sql.at(i + 1)))) {
|
||||||
int pos = i + 2;
|
int pos = i + 2;
|
||||||
while (pos < n && qIsAlnum(sql.at(pos)))
|
while (pos < n && qIsAlnum(sql.at(pos)))
|
||||||
++pos;
|
++pos;
|
||||||
@ -618,7 +618,7 @@ bool QSqlResult::prepare(const QString& query)
|
|||||||
QChar ch = query.at(i);
|
QChar ch = query.at(i);
|
||||||
if (ch == QLatin1Char(':') && !inQuote
|
if (ch == QLatin1Char(':') && !inQuote
|
||||||
&& (i == 0 || query.at(i - 1) != QLatin1Char(':'))
|
&& (i == 0 || query.at(i - 1) != QLatin1Char(':'))
|
||||||
&& (i < n - 1 && qIsAlnum(query.at(i + 1)))) {
|
&& (i + 1 < n && qIsAlnum(query.at(i + 1)))) {
|
||||||
int pos = i + 2;
|
int pos = i + 2;
|
||||||
while (pos < n && qIsAlnum(query.at(pos)))
|
while (pos < n && qIsAlnum(query.at(pos)))
|
||||||
++pos;
|
++pos;
|
||||||
|
@ -216,8 +216,8 @@ Type Moc::parseType()
|
|||||||
QByteArray templ = lexemUntil(RANGLE);
|
QByteArray templ = lexemUntil(RANGLE);
|
||||||
for (int i = 0; i < templ.size(); ++i) {
|
for (int i = 0; i < templ.size(); ++i) {
|
||||||
type.name += templ.at(i);
|
type.name += templ.at(i);
|
||||||
if ((templ.at(i) == '<' && i < templ.size()-1 && templ.at(i+1) == ':')
|
if ((templ.at(i) == '<' && i+1 < templ.size() && templ.at(i+1) == ':')
|
||||||
|| (templ.at(i) == '>' && i < templ.size()-1 && templ.at(i+1) == '>')) {
|
|| (templ.at(i) == '>' && i+1 < templ.size() && templ.at(i+1) == '>')) {
|
||||||
type.name += ' ';
|
type.name += ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user