Remove qDBusNameToTypeId function.
The function is redundant and can be replaced by QMetaType::type(). Change-Id: I131a7fd285a60d8bd0f3b958668a43bd5da2d6c4 Reviewed-by: Jonas Gastal <jgastal@profusion.mobi> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
bd5881b460
commit
259388157c
@ -336,7 +336,6 @@ public:
|
||||
|
||||
// in qdbusmisc.cpp
|
||||
extern int qDBusParametersForMethod(const QMetaMethod &mm, QList<int>& metaTypes);
|
||||
extern int qDBusNameToTypeId(const char *name);
|
||||
extern bool qDBusCheckAsyncTag(const char *tag);
|
||||
extern bool qDBusInterfaceInObject(QObject *obj, const QString &interface_name);
|
||||
extern QString qDBusInterfaceFromMetaObject(const QMetaObject *mo);
|
||||
|
@ -645,7 +645,7 @@ static int findSlot(const QMetaObject *mo, const QByteArray &name, int flags,
|
||||
if (paren != name.length() || !slotname.startsWith(name))
|
||||
continue;
|
||||
|
||||
int returnType = qDBusNameToTypeId(mm.typeName());
|
||||
int returnType = QMetaType::type(mm.typeName());
|
||||
bool isAsync = qDBusCheckAsyncTag(mm.tag());
|
||||
bool isScriptable = mm.attributes() & QMetaMethod::Scriptable;
|
||||
|
||||
|
@ -324,19 +324,15 @@ static int writeProperty(QObject *obj, const QByteArray &property_name, QVariant
|
||||
|
||||
// we found our property
|
||||
// do we have the right type?
|
||||
int id = mp.type();
|
||||
if (id == QVariant::UserType) {
|
||||
// dynamic type
|
||||
id = qDBusNameToTypeId(mp.typeName());
|
||||
if (id == -1) {
|
||||
// type not registered?
|
||||
qWarning("QDBusConnection: Unable to handle unregistered datatype '%s' for property '%s::%s'",
|
||||
mp.typeName(), mo->className(), property_name.constData());
|
||||
return PropertyWriteFailed;
|
||||
}
|
||||
int id = mp.userType();
|
||||
if (!id){
|
||||
// type not registered or invalid / void?
|
||||
qWarning("QDBusConnection: Unable to handle unregistered datatype '%s' for property '%s::%s'",
|
||||
mp.typeName(), mo->className(), property_name.constData());
|
||||
return PropertyWriteFailed;
|
||||
}
|
||||
|
||||
if (id != 0xff && value.userType() == QDBusMetaTypeId::argument) {
|
||||
if (id != QMetaType::QVariant && value.userType() == QDBusMetaTypeId::argument) {
|
||||
// we have to demarshall before writing
|
||||
void *null = 0;
|
||||
QVariant other(id, null);
|
||||
@ -434,7 +430,7 @@ static QVariantMap readAllProperties(QObject *object, int flags)
|
||||
continue;
|
||||
|
||||
// is it a registered property?
|
||||
int typeId = qDBusNameToTypeId(mp.typeName());
|
||||
int typeId = mp.userType();
|
||||
if (!typeId)
|
||||
continue;
|
||||
const char *signature = QDBusMetaType::typeToSignature(typeId);
|
||||
|
@ -69,14 +69,6 @@ bool qDBusCheckAsyncTag(const char *tag)
|
||||
return false;
|
||||
}
|
||||
|
||||
int qDBusNameToTypeId(const char *name)
|
||||
{
|
||||
int id = static_cast<int>( QVariant::nameToType(name) );
|
||||
if (id == QVariant::UserType)
|
||||
id = QMetaType::type(name);
|
||||
return id;
|
||||
}
|
||||
|
||||
QString qDBusInterfaceFromMetaObject(const QMetaObject *mo)
|
||||
{
|
||||
QString interface;
|
||||
@ -158,7 +150,7 @@ int qDBusParametersForMethod(const QMetaMethod &mm, QList<int>& metaTypes)
|
||||
QByteArray basictype = type;
|
||||
basictype.truncate(type.length() - 1);
|
||||
|
||||
int id = qDBusNameToTypeId(basictype);
|
||||
int id = QMetaType::type(basictype);
|
||||
if (id == 0) {
|
||||
//qWarning("Could not parse the method '%s'", mm.signature());
|
||||
// invalid type in method parameter list
|
||||
@ -177,7 +169,7 @@ int qDBusParametersForMethod(const QMetaMethod &mm, QList<int>& metaTypes)
|
||||
return -1; // not allowed
|
||||
}
|
||||
|
||||
int id = qDBusNameToTypeId(type);
|
||||
int id = QMetaType::type(type);
|
||||
if (id == 0) {
|
||||
//qWarning("Could not parse the method '%s'", mm.signature());
|
||||
// invalid type in method parameter list
|
||||
|
@ -101,7 +101,7 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method
|
||||
if (mp.isWritable())
|
||||
access |= 2;
|
||||
|
||||
int typeId = qDBusNameToTypeId(mp.typeName());
|
||||
int typeId = mp.userType();
|
||||
if (!typeId)
|
||||
continue;
|
||||
const char *signature = QDBusMetaType::typeToSignature(typeId);
|
||||
@ -150,7 +150,7 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method
|
||||
.arg(QLatin1String(signature.left(paren)));
|
||||
|
||||
// check the return type first
|
||||
int typeId = qDBusNameToTypeId(mm.typeName());
|
||||
int typeId = QMetaType::type(mm.typeName());
|
||||
if (typeId) {
|
||||
const char *typeName = QDBusMetaType::typeToSignature(typeId);
|
||||
if (typeName) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user