From kde-commits Wed Feb 22 10:47:46 2006 From: Thiago Macieira Date: Wed, 22 Feb 2006 10:47:46 +0000 To: kde-commits Subject: branches/work/kde4/playground/libs/qt-dbus Message-Id: <1140605266.255255.31678.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=114060533609334 SVN commit 512356 by thiago: Simplify and remove unused code. M +10 -19 qdbusintegrator.cpp --- branches/work/kde4/playground/libs/qt-dbus/qdbusintegrator.cpp #512355:512356 @@ -329,14 +329,6 @@ } } -static int returnTypeId(const char *name) -{ - if (!name || !*name) - return QMetaType::Void; - - return qDBusNameToTypeId(name); -} - // calculates the metatypes for the method // the slot must have the parameters in the following form: // - zero or more value or const-ref parameters of any kind @@ -408,14 +400,14 @@ } static int findSlot(const QMetaObject *mo, const QByteArray &name, int flags, - const QDBusTypeList &types, QList& metaTypes, int &msgPos) + const QDBusTypeList &types, QList& metaTypes) { // find the first slot const QMetaObject *super = mo; - while (qstrcmp(super->className(), "QObject") != 0 && - qstrcmp(super->className(), "QDBusAbstractAdaptor") != 0) + while (super != &QObject::staticMetaObject && + super != &QDBusAbstractAdaptor::staticMetaObject) super = super->superClass(); - + int attributeMask = (flags & QDBusConnection::ExportNonScriptableSlots) ? 0 : QMetaMethod::Scriptable; @@ -437,7 +429,7 @@ if (paren != name.length() || !sig.startsWith( name )) continue; - int returnType = returnTypeId(mm.typeName()); + int returnType = qDBusNameToTypeId(mm.typeName()); bool isAsync = qDBusCheckAsyncTag(mm.tag()); // consistency check: @@ -449,11 +441,11 @@ continue; // problem parsing metaTypes[0] = returnType; - msgPos = 0; + bool hasMessage = false; if (inputCount > 0 && metaTypes.at(inputCount) == QDBusConnectionPrivate::messageMetaType) { - // no input parameters is allowed as long as the message meta type is there - msgPos = inputCount; + // "no input parameters" is allowed as long as the message meta type is there + hasMessage = true; --inputCount; } @@ -478,7 +470,7 @@ continue; } - if (!msgPos && (mm.attributes() & attributeMask) != attributeMask) + if (hasMessage && (mm.attributes() & attributeMask) != attributeMask) continue; // not exported // if we got here, this slot matched @@ -570,14 +562,13 @@ QList metaTypes; int idx; - int msgPos; { const QMetaObject *mo = object->metaObject(); QDBusTypeList typeList(msg.signature().toUtf8()); // find a slot that matches according to the rules above - idx = ::findSlot(mo, msg.name().toUtf8(), flags, typeList, metaTypes, msgPos); + idx = ::findSlot(mo, msg.name().toUtf8(), flags, typeList, metaTypes); if (idx == -1) // no match return false;