summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsuzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>2011-08-12 20:22:30 +0200
committerQt by Nokia <qt-info@nokia.com>2011-09-12 16:03:47 +0200
commit5dd78ba08f31f9aa3c13d4e05ad4478033f7f4e8 (patch)
tree205d85f7806cbb2495ef3d4a5d043d4ec83f1ef3
parent7b42532100c27280b6ea0658276511d7419742d4 (diff)
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>
-rw-r--r--examples/painting/gradients/gradients.cpp2
-rw-r--r--qmake/generators/makefiledeps.cpp2
-rw-r--r--src/corelib/io/qdir.cpp6
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp4
-rw-r--r--src/gui/painting/qpaintengine_x11.cpp2
-rw-r--r--src/gui/painting/qtessellator.cpp2
-rw-r--r--src/gui/widgets/qtabbar.cpp2
-rw-r--r--src/sql/kernel/qsqlresult.cpp4
-rw-r--r--src/tools/moc/moc.cpp4
9 files changed, 14 insertions, 14 deletions
diff --git a/examples/painting/gradients/gradients.cpp b/examples/painting/gradients/gradients.cpp
index d8b739b3b0..338d8ebabd 100644
--- a/examples/painting/gradients/gradients.cpp
+++ b/examples/painting/gradients/gradients.cpp
@@ -219,7 +219,7 @@ void GradientEditor::pointsUpdated()
for (int i=0; i<points.size(); ++i) {
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;
QColor color((0x00ff0000 & m_red_shade->colorAt(int(x))) >> 16,
(0x0000ff00 & m_green_shade->colorAt(int(x))) >> 8,
diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp
index d6dab0b4e8..f9cbed1465 100644
--- a/qmake/generators/makefiledeps.cpp
+++ b/qmake/generators/makefiledeps.cpp
@@ -499,7 +499,7 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file)
} else if(*(buffer+x) == '*') { //c style comment
for(++x; x < buffer_len; ++x) {
if(*(buffer+x) == '*') {
- if(x < buffer_len-1 && *(buffer + (x+1)) == '/') {
+ if(x+1 < buffer_len && *(buffer + (x+1)) == '/') {
++x;
break;
}
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index d1c9be213b..41278f1b91 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -1970,7 +1970,7 @@ QString QDir::cleanPath(const QString &path)
const QChar *p = name.unicode();
for (int i = 0, last = -1, iwrite = 0; i < len; ++i) {
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 (!i)
break;
@@ -1978,9 +1978,9 @@ QString QDir::cleanPath(const QString &path)
i++;
}
bool eaten = false;
- if (i < len - 1 && p[i+1] == QLatin1Char('.')) {
+ if (i+1 < len && p[i+1] == QLatin1Char('.')) {
int dotcount = 1;
- if (i < len - 2 && p[i+2] == QLatin1Char('.'))
+ if (i+2 < len && p[i+2] == QLatin1Char('.'))
dotcount++;
if (i == len - dotcount - 1) {
if (dotcount == 1) {
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 299f248d2b..45099f92d3 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -3488,7 +3488,7 @@ void QRasterPaintEngine::drawBitmap(const QPointF &pos, const QImage &image, QSp
spans[n].y = y;
spans[n].coverage = 255;
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;
++len;
}
@@ -3514,7 +3514,7 @@ void QRasterPaintEngine::drawBitmap(const QPointF &pos, const QImage &image, QSp
spans[n].y = y;
spans[n].coverage = 255;
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;
++len;
}
diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp
index 5f613ee001..62c1dacf05 100644
--- a/src/gui/painting/qpaintengine_x11.cpp
+++ b/src/gui/painting/qpaintengine_x11.cpp
@@ -2326,7 +2326,7 @@ static QPainterPath path_for_glyphs(const QVarLengthArray<glyph_t> &glyphs,
bool set = src[x >> 3] & (0x80 >> (x & 7));
if (set) {
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;
r.setRight(r.right()+1);
}
diff --git a/src/gui/painting/qtessellator.cpp b/src/gui/painting/qtessellator.cpp
index c46943854d..94a5128d90 100644
--- a/src/gui/painting/qtessellator.cpp
+++ b/src/gui/painting/qtessellator.cpp
@@ -893,7 +893,7 @@ void QTessellatorPrivate::processIntersections()
QDEBUG() << " adding edge on left";
--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";
++max;
}
diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp
index 16e4aad6d0..8faf156608 100644
--- a/src/gui/widgets/qtabbar.cpp
+++ b/src/gui/widgets/qtabbar.cpp
@@ -171,7 +171,7 @@ void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const
if (tabIndex > 0 && tabIndex - 1 == d->currentIndex)
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;
else
option->selectedPosition = QStyleOptionTab::NotAdjacent;
diff --git a/src/sql/kernel/qsqlresult.cpp b/src/sql/kernel/qsqlresult.cpp
index f2b2ccf779..71a81c0a8d 100644
--- a/src/sql/kernel/qsqlresult.cpp
+++ b/src/sql/kernel/qsqlresult.cpp
@@ -183,7 +183,7 @@ QString QSqlResultPrivate::namedToPositionalBinding()
QChar ch = sql.at(i);
if (ch == QLatin1Char(':') && !inQuote
&& (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;
while (pos < n && qIsAlnum(sql.at(pos)))
++pos;
@@ -618,7 +618,7 @@ bool QSqlResult::prepare(const QString& query)
QChar ch = query.at(i);
if (ch == QLatin1Char(':') && !inQuote
&& (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;
while (pos < n && qIsAlnum(query.at(pos)))
++pos;
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index 13f57f592d..9309db1c90 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -216,8 +216,8 @@ Type Moc::parseType()
QByteArray templ = lexemUntil(RANGLE);
for (int i = 0; i < templ.size(); ++i) {
type.name += templ.at(i);
- if ((templ.at(i) == '<' && i < templ.size()-1 && templ.at(i+1) == ':')
- || (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+1 < templ.size() && templ.at(i+1) == '>')) {
type.name += ' ';
}
}