Fix warnings in QtQml
authorMatthew Vogt <matthew.vogt@nokia.com>
Fri, 24 Aug 2012 00:05:53 +0000 (10:05 +1000)
committerQt by Nokia <qt-info@nokia.com>
Fri, 24 Aug 2012 05:07:56 +0000 (07:07 +0200)
Change-Id: Ibba3b8e878257f7019bdc90a1344462b77f95a21
Reviewed-by: Martin Jones <martin.jones@nokia.com>
src/qml/qml/qqmlglobal_p.h
src/qml/qml/qqmlmetatype.cpp
src/qml/qml/qqmlmetatype_p.h
src/qml/qml/qqmlvaluetype.cpp
src/qml/qml/v4/qv4bindings.cpp

index e79a91f..342c982 100644 (file)
@@ -167,7 +167,7 @@ T qmlobject_cast(QObject *object)
 
 inline quint16 qmlSourceCoordinate(int n)
 {
-    return (n > 0 && n <= USHRT_MAX) ? static_cast<quint16>(n) : 0;
+    return (n > 0 && n <= static_cast<int>(USHRT_MAX)) ? static_cast<quint16>(n) : 0;
 }
 
 inline int qmlSourceCoordinate(quint16 n)
index 35ff9fd..1b94365 100644 (file)
@@ -264,11 +264,11 @@ QQmlType::QQmlType(int index, const QQmlPrivate::RegisterInterface &interface)
     d->m_version_min = 0;
 }
 
-QQmlType::QQmlType(int index, const QQmlPrivate::RegisterType &type)
+QQmlType::QQmlType(int index, const QString &elementName, const QQmlPrivate::RegisterType &type)
 : d(new QQmlTypePrivate)
 {
+    d->m_elementName = elementName;
     d->m_module = moduleFromUtf8(type.uri);
-    d->m_elementName = QString::fromUtf8(type.elementName);
 
     d->m_version_maj = type.versionMajor;
     d->m_version_min = type.versionMinor;
@@ -943,11 +943,13 @@ int registerType(const QQmlPrivate::RegisterType &type)
     QWriteLocker lock(metaTypeDataLock());
     QQmlMetaTypeData *data = metaTypeData();
 
+    QString elementName = QString::fromUtf8(type.elementName);
+
     if (type.uri && type.elementName) {
         QString nameSpace = moduleFromUtf8(type.uri);
 
-        if (data->singletonTypeExists(nameSpace, type.elementName, type.versionMajor, type.versionMinor)) {
-            qWarning("Cannot register type %s in uri %s %d.%d (a conflicting singleton type already exists)", qPrintable(type.elementName), qPrintable(nameSpace), type.versionMajor, type.versionMinor);
+        if (data->singletonTypeExists(nameSpace, elementName, type.versionMajor, type.versionMinor)) {
+            qWarning("Cannot register type %s in uri %s %d.%d (a conflicting singleton type already exists)", qPrintable(elementName), qPrintable(nameSpace), type.versionMajor, type.versionMinor);
             return -1;
         }
 
@@ -956,7 +958,7 @@ int registerType(const QQmlPrivate::RegisterType &type)
             if (nameSpace != data->typeRegistrationNamespace) {
                 QString failure(QCoreApplication::translate("qmlRegisterType",
                                                             "Cannot install element '%1' into unregistered namespace '%2'"));
-                data->typeRegistrationFailures.append(failure.arg(QString::fromUtf8(type.elementName)).arg(nameSpace));
+                data->typeRegistrationFailures.append(failure.arg(elementName).arg(nameSpace));
                 return -1;
             }
         } else if (data->typeRegistrationNamespace != nameSpace) {
@@ -964,7 +966,7 @@ int registerType(const QQmlPrivate::RegisterType &type)
             if (data->protectedNamespaces.contains(nameSpace)) {
                 QString failure(QCoreApplication::translate("qmlRegisterType",
                                                             "Cannot install element '%1' into protected namespace '%2'"));
-                data->typeRegistrationFailures.append(failure.arg(QString::fromUtf8(type.elementName)).arg(nameSpace));
+                data->typeRegistrationFailures.append(failure.arg(elementName).arg(nameSpace));
                 return -1;
             }
         }
@@ -972,7 +974,7 @@ int registerType(const QQmlPrivate::RegisterType &type)
 
     int index = data->types.count();
 
-    QQmlType *dtype = new QQmlType(index, type);
+    QQmlType *dtype = new QQmlType(index, elementName, type);
 
     data->types.append(dtype);
     data->idToType.insert(dtype->typeId(), dtype);
index 4e60c2d..ad1ceb8 100644 (file)
@@ -213,7 +213,7 @@ private:
     friend int registerType(const QQmlPrivate::RegisterType &);
     friend int registerInterface(const QQmlPrivate::RegisterInterface &);
     QQmlType(int, const QQmlPrivate::RegisterInterface &);
-    QQmlType(int, const QQmlPrivate::RegisterType &);
+    QQmlType(int, const QString &, const QQmlPrivate::RegisterType &);
     ~QQmlType();
 
     QQmlTypePrivate *d;
index cd11721..58227a1 100644 (file)
@@ -78,7 +78,7 @@ QQmlValueTypeFactoryImpl::~QQmlValueTypeFactoryImpl()
 
 bool QQmlValueTypeFactoryImpl::isValueType(int idx)
 {
-    if (idx >= QVariant::UserType) {
+    if (idx >= (int)QVariant::UserType) {
         return (valueType(idx) != 0);
     } else if (idx >= 0
             && idx != QVariant::StringList
index 169e60e..bd67a8d 100644 (file)
@@ -52,6 +52,7 @@
 #include <private/qjsconverter_p.h>
 #include <private/qjsconverter_impl_p.h>
 #include <private/qjsvalue_impl_p.h>
+#include <private/qjsvalueiterator_impl_p.h>
 #include <private/qv8engine_impl_p.h>
 
 #include <private/qqmlaccessors_p.h>
@@ -864,7 +865,7 @@ inline quint32 QV4Bindings::toUint32(double n)
         QQmlPropertyData *prop = (data && data->propertyCache) ? data->propertyCache->property((index)) : 0; \
         if (prop && prop->isOverridden()) { \
             int resolvedIndex = data->propertyCache->property(prop->name(obj))->coreIndex; \
-            if (index < resolvedIndex) { \
+            if ((int)index < resolvedIndex) { \
                 *(inv) = true; \
                 goto programExit; \
             } \