Fix warnings about signed/unsigned comparisons in QtJson.
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>
Tue, 3 Apr 2012 07:40:36 +0000 (09:40 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 3 Apr 2012 19:02:32 +0000 (21:02 +0200)
Change-Id: I92071ea870bf0ebb740fcb360aff19658380a0cd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
src/corelib/json/qjsonarray.cpp
src/corelib/json/qjsonobject.cpp

index 6bae200..d143215 100644 (file)
@@ -275,7 +275,7 @@ void QJsonArray::removeAt(int i)
     detach();
     a->removeItems(i, 1);
     ++d->compactionCounter;
-    if (d->compactionCounter > 32 && d->compactionCounter >= (int)a->length/2)
+    if (d->compactionCounter > 32u && d->compactionCounter >= unsigned(a->length) / 2u)
         compact();
 }
 
@@ -379,7 +379,7 @@ void QJsonArray::replace(int i, const QJsonValue &value)
         QJsonPrivate::Value::copyData(value, (char *)a + valueOffset, compressed);
 
     ++d->compactionCounter;
-    if (d->compactionCounter > 32 && d->compactionCounter >= (int)a->length/2)
+    if (d->compactionCounter > 32u && d->compactionCounter >= unsigned(a->length) / 2u)
         compact();
 }
 
index e14000f..e880078 100644 (file)
@@ -335,7 +335,7 @@ void QJsonObject::remove(const QString &key)
     detach();
     o->removeItems(index, 1);
     ++d->compactionCounter;
-    if (d->compactionCounter > 32 && d->compactionCounter >= (int)o->length/2)
+    if (d->compactionCounter > 32u && d->compactionCounter >= unsigned(o->length) / 2u)
         compact();
 }
 
@@ -361,7 +361,7 @@ QJsonValue QJsonObject::take(const QString &key)
     QJsonPrivate::Entry *e = o->entryAt(index);
     o->removeItems(index, 1);
     ++d->compactionCounter;
-    if (d->compactionCounter > 32 && d->compactionCounter >= (int)o->length/2)
+    if (d->compactionCounter > 32u && d->compactionCounter >= unsigned(o->length) / 2u)
         compact();
 
     return QJsonValue(d, o, e->value);
@@ -432,7 +432,7 @@ QJsonObject::iterator QJsonObject::erase(QJsonObject::iterator it)
 
     o->removeItems(index, 1);
     ++d->compactionCounter;
-    if (d->compactionCounter > 32 && d->compactionCounter >= (int)o->length/2)
+    if (d->compactionCounter > 32u && d->compactionCounter >= unsigned(o->length) / 2u)
         compact();
 
     // iterator hasn't changed