From: Matthew Vogt Date: Fri, 24 Aug 2012 00:05:53 +0000 (+1000) Subject: Fix warnings in QtQml X-Git-Tag: 1.0_branch~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e8e3c206ac0d2ff436f7166fb73f33a7e8259b6a;p=profile%2Fivi%2Fqtdeclarative.git Fix warnings in QtQml Change-Id: Ibba3b8e878257f7019bdc90a1344462b77f95a21 Reviewed-by: Martin Jones --- diff --git a/src/qml/qml/qqmlglobal_p.h b/src/qml/qml/qqmlglobal_p.h index e79a91f..342c982 100644 --- a/src/qml/qml/qqmlglobal_p.h +++ b/src/qml/qml/qqmlglobal_p.h @@ -167,7 +167,7 @@ T qmlobject_cast(QObject *object) inline quint16 qmlSourceCoordinate(int n) { - return (n > 0 && n <= USHRT_MAX) ? static_cast(n) : 0; + return (n > 0 && n <= static_cast(USHRT_MAX)) ? static_cast(n) : 0; } inline int qmlSourceCoordinate(quint16 n) diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index 35ff9fd..1b94365 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -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); diff --git a/src/qml/qml/qqmlmetatype_p.h b/src/qml/qml/qqmlmetatype_p.h index 4e60c2d..ad1ceb8 100644 --- a/src/qml/qml/qqmlmetatype_p.h +++ b/src/qml/qml/qqmlmetatype_p.h @@ -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; diff --git a/src/qml/qml/qqmlvaluetype.cpp b/src/qml/qml/qqmlvaluetype.cpp index cd11721..58227a1 100644 --- a/src/qml/qml/qqmlvaluetype.cpp +++ b/src/qml/qml/qqmlvaluetype.cpp @@ -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 diff --git a/src/qml/qml/v4/qv4bindings.cpp b/src/qml/qml/v4/qv4bindings.cpp index 169e60e..bd67a8d 100644 --- a/src/qml/qml/v4/qv4bindings.cpp +++ b/src/qml/qml/v4/qv4bindings.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -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; \ } \