Fixed compile error in qqmlscript.cpp due to narrowing conversion.
authorSamuel Rødal <samuel.rodal@nokia.com>
Wed, 6 Jun 2012 06:33:24 +0000 (08:33 +0200)
committerQt by Nokia <qt-info@nokia.com>
Wed, 6 Jun 2012 08:14:01 +0000 (10:14 +0200)
qqmlscript.cpp:917: error: narrowing conversion of ‘6u’ from ‘size_t’
to ‘int’ inside { }

Change-Id: I2dae5b0fb8644b48bfa38bbb7bd173537a03a1a4
Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>
src/qml/qml/qqmlscript.cpp

index cd32c0d..f4a928c 100644 (file)
@@ -894,7 +894,7 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
 {
     static const struct TypeNameToType {
         const char *name;
-        int nameLength;
+        size_t nameLength;
         Object::DynamicProperty::Type type;
     } propTypeNameToTypes[] = {
         { "int", strlen("int"), Object::DynamicProperty::Int },
@@ -939,7 +939,7 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
             const TypeNameToType *type = 0;
             for(int typeIndex = 0; typeIndex < propTypeNameToTypesCount; ++typeIndex) {
                 const TypeNameToType *t = propTypeNameToTypes + typeIndex;
-                if (t->nameLength == memberType.length() && 
+                if (t->nameLength == size_t(memberType.length()) &&
                     QHashedString::compare(memberType.constData(), t->name, t->nameLength)) {
                     type = t;
                     break;
@@ -978,7 +978,7 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
 
         for(int ii = 0; !typeFound && ii < propTypeNameToTypesCount; ++ii) {
             const TypeNameToType *t = propTypeNameToTypes + ii;
-            if (t->nameLength == memberType.length() && 
+            if (t->nameLength == size_t(memberType.length()) &&
                 QHashedString::compare(memberType.constData(), t->name, t->nameLength)) {
                 type = t->type;
                 typeFound = true;