Remove unreachable code paths from QQuickChangeSet.
authorAndrew den Exter <andrew.den-exter@nokia.com>
Thu, 9 Aug 2012 00:24:50 +0000 (10:24 +1000)
committerQt by Nokia <qt-info@nokia.com>
Mon, 27 Aug 2012 00:01:31 +0000 (02:01 +0200)
In any circumstance these if statements would evaluate to true, a
previous branch of the else if block will be taken first.

Change-Id: I7f48769ebfbb1cf5105b875a63530d1c37056c11
Reviewed-by: Martin Jones <martin.jones@nokia.com>
src/quick/util/qquickchangeset.cpp

index 23fa432..8a26e5b 100644 (file)
@@ -303,10 +303,6 @@ void QQuickChangeSet::remove(QVector<Remove> *removes, QVector<Insert> *inserts)
             } else if (rit->count == -offset || rit->count == 0) {
                 insert->index += difference;
                 break;
-            } else if (offset <= 0) {
-                insert->index = index - removeCount;
-                insertCount += insert->count;
-                ++insert;
             } else {
                 insert->index -= removeCount - difference;
                 rit->index -= insert->count;
@@ -351,15 +347,14 @@ void QQuickChangeSet::remove(QVector<Remove> *removes, QVector<Insert> *inserts)
                 // Accumulate all existing non-move removes that are encapsulated by or immediately
                 // follow the current remove into it.
                 int difference = 0;
-                if (rend == m_removes.end())
+                if (rend == m_removes.end()) {
                     difference = rit->count;
-                else if (rit->index + rit->count < rend->index - removeCount)
+                } else if (rit->index + rit->count < rend->index - removeCount) {
                     difference = rit->count;
-                else if (rend->moveId != -1) {
+                else if (rend->moveId != -1) {
                     difference = rend->index - removeCount - rit->index;
                     index += difference;
-                } else if (offset > 0)
-                    difference = offset;
+                }
                 count += difference;
 
                 rit->count -= difference;