diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2020-06-22 11:23:43 +0200 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2020-06-25 22:31:13 +0200 |
commit | 48c8322a613f58d19ad9e0262bbac437ce2598f8 (patch) | |
tree | 88ffed3a9617f3b8eb40f08dd1aafeb33cb3a0c2 /src/dbus | |
parent | 0475460102411979ab51c365cb2bec2c05b69cb4 (diff) |
Use QList instead of QVector in dbus
Omitted type replacement in qDBusParametersForMethod() for now.
Task-number: QTBUG-84469
Change-Id: Ieb9fbb30b431c5e4183ad57acd35640e9556bf6c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/dbus')
-rw-r--r-- | src/dbus/qdbusabstractadaptor.cpp | 2 | ||||
-rw-r--r-- | src/dbus/qdbusabstractadaptor_p.h | 6 | ||||
-rw-r--r-- | src/dbus/qdbusargument.cpp | 8 | ||||
-rw-r--r-- | src/dbus/qdbusconnection.cpp | 1 | ||||
-rw-r--r-- | src/dbus/qdbusconnection_p.h | 24 | ||||
-rw-r--r-- | src/dbus/qdbusintegrator.cpp | 19 | ||||
-rw-r--r-- | src/dbus/qdbusintegrator_p.h | 16 | ||||
-rw-r--r-- | src/dbus/qdbusintrospection_p.h | 8 | ||||
-rw-r--r-- | src/dbus/qdbusmetatype.cpp | 24 | ||||
-rw-r--r-- | src/dbus/qdbusmisc.cpp | 9 | ||||
-rw-r--r-- | src/dbus/qdbuspendingcall_p.h | 8 | ||||
-rw-r--r-- | src/dbus/qdbusutil.cpp | 2 | ||||
-rw-r--r-- | src/dbus/qdbusxmlgenerator.cpp | 2 | ||||
-rw-r--r-- | src/dbus/qtdbusglobal.h | 1 |
14 files changed, 63 insertions, 67 deletions
diff --git a/src/dbus/qdbusabstractadaptor.cpp b/src/dbus/qdbusabstractadaptor.cpp index 671f7f25d0..0a4a23d780 100644 --- a/src/dbus/qdbusabstractadaptor.cpp +++ b/src/dbus/qdbusabstractadaptor.cpp @@ -305,7 +305,7 @@ void QDBusAdaptorConnector::relay(QObject *senderObj, int lastSignalIdx, void ** realObject = realObject->parent(); // break down the parameter list - QVector<int> types; + QList<int> types; QString errorMsg; int inputCount = qDBusParametersForMethod(mm, types, errorMsg); if (inputCount == -1) { diff --git a/src/dbus/qdbusabstractadaptor_p.h b/src/dbus/qdbusabstractadaptor_p.h index 404901381b..212878c29b 100644 --- a/src/dbus/qdbusabstractadaptor_p.h +++ b/src/dbus/qdbusabstractadaptor_p.h @@ -55,11 +55,11 @@ #include <QtDBus/private/qtdbusglobal_p.h> #include <qdbusabstractadaptor.h> -#include <QtCore/qobject.h> +#include <QtCore/qlist.h> #include <QtCore/qmap.h> +#include <QtCore/qobject.h> #include <QtCore/qreadwritelock.h> #include <QtCore/qvariant.h> -#include <QtCore/qvector.h> #include "private/qobject_p.h" #define QCLASSINFO_DBUS_INTERFACE "D-Bus Interface" @@ -107,7 +107,7 @@ public: // typedefs inline bool operator<(const QByteArray &other) const { return interface < other; } }; - typedef QVector<AdaptorData> AdaptorMap; + typedef QList<AdaptorData> AdaptorMap; public: // methods explicit QDBusAdaptorConnector(QObject *parent); diff --git a/src/dbus/qdbusargument.cpp b/src/dbus/qdbusargument.cpp index 7e1d847982..9e1230c330 100644 --- a/src/dbus/qdbusargument.cpp +++ b/src/dbus/qdbusargument.cpp @@ -247,8 +247,8 @@ bool QDBusArgumentPrivate::checkReadAndDetach(QDBusArgumentPrivate *&d) \value VariantType The variant element (QDBusVariant) - \value ArrayType An array element, usually represented by QList<T> - or QVector<T>. Note: QByteArray and associative maps are not + \value ArrayType An array element, usually represented by QList<T>. + Note: QByteArray and associative maps are not considered arrays, even if the D-Bus protocol transports them as such. \value StructureType A custom type represented by a structure, @@ -869,7 +869,7 @@ void QDBusArgument::endStructure() \snippet code/src_qdbus_qdbusargument.cpp 6 - If the type you want to marshall is a QList, QVector or any of the + If the type you want to marshall is a QList or any of the Qt's \l {Container Classes} that take one template parameter, you need not declare an \c{operator<<} function for it, since Qt D-Bus provides generic templates to do the job of marshalling @@ -997,7 +997,7 @@ void QDBusArgument::endStructure() const \snippet code/src_qdbus_qdbusargument.cpp 9 - If the type you want to demarshall is a QList, QVector or any of the + If the type you want to demarshall is a QList or any of the Qt's \l {Container Classes} that take one template parameter, you need not declare an \c{operator>>} function for it, since Qt D-Bus provides generic templates to do the job of demarshalling the data. diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index 0334b1156d..f690e52247 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -44,7 +44,6 @@ #include <qdebug.h> #include <qcoreapplication.h> #include <qstringlist.h> -#include <qvector.h> #include <qtimer.h> #include <qthread.h> #include <QtCore/private/qlocking_p.h> diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h index e909914dd8..d3b46153cb 100644 --- a/src/dbus/qdbusconnection_p.h +++ b/src/dbus/qdbusconnection_p.h @@ -59,12 +59,12 @@ #include <QtCore/qatomic.h> #include <QtCore/qhash.h> +#include <QtCore/qlist.h> #include <QtCore/qobject.h> #include <QtCore/qpointer.h> #include <QtCore/qreadwritelock.h> #include <QtCore/qstringlist.h> #include <QtCore/qvarlengtharray.h> -#include <QtCore/qvector.h> #include "qdbus_symbols_p.h" @@ -137,7 +137,7 @@ public: QString service, path, signature; QObject* obj; int midx; - QVector<int> params; + QList<int> params; ArgMatchRules argumentMatch; QByteArray matchRule; }; @@ -149,7 +149,7 @@ public: struct ObjectTreeNode { - typedef QVector<ObjectTreeNode> DataList; + typedef QList<ObjectTreeNode> DataList; inline ObjectTreeNode() : obj(nullptr), flags(0) { } inline ObjectTreeNode(const QString &n) // intentionally implicit @@ -176,12 +176,12 @@ public: // typedefs typedef QMultiHash<qintptr, Watcher> WatcherHash; typedef QHash<int, DBusTimeout *> TimeoutHash; - typedef QVector<QDBusMessage> PendingMessageList; + typedef QList<QDBusMessage> PendingMessageList; typedef QMultiHash<QString, SignalHook> SignalHookHash; typedef QHash<QString, QDBusMetaObject* > MetaObjectHash; typedef QHash<QByteArray, int> MatchRefCountHash; - typedef QVector<QDBusPendingCallPrivate*> PendingCallList; + typedef QList<QDBusPendingCallPrivate *> PendingCallList; struct WatchedServiceData { WatchedServiceData() : refcount(0) {} @@ -264,7 +264,7 @@ private: void sendInternal(QDBusPendingCallPrivate *pcall, void *msg, int timeout); void sendError(const QDBusMessage &msg, QDBusError::ErrorType code); void deliverCall(QObject *object, int flags, const QDBusMessage &msg, - const QVector<int> &metaTypes, int slotIdx); + const QList<int> &metaTypes, int slotIdx); SignalHookHash::Iterator removeSignalHookNoLock(SignalHookHash::Iterator it); void collectAllObjects(ObjectTreeNode &node, QSet<QObject *> &set); @@ -345,7 +345,7 @@ public: public: // static methods - static int findSlot(QObject *obj, const QByteArray &normalizedName, QVector<int> ¶ms); + static int findSlot(QObject *obj, const QByteArray &normalizedName, QList<int> ¶ms); static bool prepareHook(QDBusConnectionPrivate::SignalHook &hook, QString &key, const QString &service, const QString &path, const QString &interface, const QString &name, @@ -354,7 +354,7 @@ public: bool buildSignature); static DBusHandlerResult messageFilter(DBusConnection *, DBusMessage *, void *); static QDBusCallDeliveryEvent *prepareReply(QDBusConnectionPrivate *target, QObject *object, - int idx, const QVector<int> &metaTypes, + int idx, const QList<int> &metaTypes, const QDBusMessage &msg); static void processFinishedCall(QDBusPendingCallPrivate *call); @@ -367,9 +367,11 @@ public: }; // in qdbusmisc.cpp -extern int qDBusParametersForMethod(const QMetaMethod &mm, QVector<int> &metaTypes, QString &errorMsg); -#endif // QT_BOOTSTRAPPED -extern Q_DBUS_EXPORT int qDBusParametersForMethod(const QList<QByteArray> ¶meters, QVector<int>& metaTypes, QString &errorMsg); +extern int qDBusParametersForMethod(const QMetaMethod &mm, QList<int> &metaTypes, + QString &errorMsg); +# endif // QT_BOOTSTRAPPED +extern Q_DBUS_EXPORT int qDBusParametersForMethod(const QList<QByteArray> ¶meters, + QList<int> &metaTypes, QString &errorMsg); extern Q_DBUS_EXPORT bool qDBusCheckAsyncTag(const char *tag); #ifndef QT_BOOTSTRAPPED extern bool qDBusInterfaceInObject(QObject *obj, const QString &interface_name); diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 0ac39c07ed..1db1ebf4e5 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -412,7 +412,7 @@ static bool findObject(const QDBusConnectionPrivate::ObjectTreeNode *root, result = *node; else // there really is no object here - // we're just looking at an unused space in the QVector + // we're just looking at an unused space in the QList node = nullptr; } return node; @@ -604,7 +604,8 @@ static void huntAndDestroy(QObject *needle, QDBusConnectionPrivate::ObjectTreeNo } } -static void huntAndUnregister(const QVector<QStringView> &pathComponents, int i, QDBusConnection::UnregisterMode mode, +static void huntAndUnregister(const QList<QStringView> &pathComponents, int i, + QDBusConnection::UnregisterMode mode, QDBusConnectionPrivate::ObjectTreeNode *node) { if (pathComponents.count() == i) { @@ -666,7 +667,7 @@ static void huntAndEmit(DBusConnection *connection, DBusMessage *msg, } static int findSlot(const QMetaObject *mo, const QByteArray &name, int flags, - const QString &signature_, QVector<int> &metaTypes) + const QString &signature_, QList<int> &metaTypes) { QByteArray msgSignature = signature_.toLatin1(); @@ -777,9 +778,9 @@ void QDBusConnectionPrivate::setDispatchEnabled(bool enable) static QDBusCallDeliveryEvent * const DIRECT_DELIVERY = (QDBusCallDeliveryEvent *)1; -QDBusCallDeliveryEvent* QDBusConnectionPrivate::prepareReply(QDBusConnectionPrivate *target, +QDBusCallDeliveryEvent *QDBusConnectionPrivate::prepareReply(QDBusConnectionPrivate *target, QObject *object, int idx, - const QVector<int> &metaTypes, + const QList<int> &metaTypes, const QDBusMessage &msg) { Q_ASSERT(object); @@ -915,7 +916,7 @@ bool QDBusConnectionPrivate::activateCall(QObject* object, int flags, const QDBu } void QDBusConnectionPrivate::deliverCall(QObject *object, int /*flags*/, const QDBusMessage &msg, - const QVector<int> &metaTypes, int slotIdx) + const QList<int> &metaTypes, int slotIdx) { Q_ASSERT_X(!object || QThread::currentThread() == object->thread(), "QDBusConnection: internal threading error", @@ -1303,8 +1304,8 @@ void QDBusConnectionPrivate::serviceOwnerChangedNoLock(const QString &name, it->owner = newOwner; } -int QDBusConnectionPrivate::findSlot(QObject* obj, const QByteArray &normalizedName, - QVector<int> ¶ms) +int QDBusConnectionPrivate::findSlot(QObject *obj, const QByteArray &normalizedName, + QList<int> ¶ms) { int midx = obj->metaObject()->indexOfMethod(normalizedName); if (midx == -1) @@ -2410,7 +2411,7 @@ void QDBusConnectionPrivate::registerObject(const ObjectTreeNode *node) void QDBusConnectionPrivate::unregisterObject(const QString &path, QDBusConnection::UnregisterMode mode) { QDBusConnectionPrivate::ObjectTreeNode *node = &rootNode; - QVector<QStringView> pathComponents; + QList<QStringView> pathComponents; int i; if (path == QLatin1String("/")) { i = 0; diff --git a/src/dbus/qdbusintegrator_p.h b/src/dbus/qdbusintegrator_p.h index 87db910d25..be6efa4027 100644 --- a/src/dbus/qdbusintegrator_p.h +++ b/src/dbus/qdbusintegrator_p.h @@ -84,7 +84,7 @@ struct QDBusSlotCache { int flags; int slotIdx; - QVector<int> metaTypes; + QList<int> metaTypes; void swap(Data &other) noexcept { @@ -105,9 +105,15 @@ class QDBusCallDeliveryEvent: public QAbstractMetaCallEvent { public: QDBusCallDeliveryEvent(const QDBusConnection &c, int id, QObject *sender, - const QDBusMessage &msg, const QVector<int> &types, int f = 0) - : QAbstractMetaCallEvent(sender, -1), connection(c), message(msg), metaTypes(types), id(id), flags(f) - { } + const QDBusMessage &msg, const QList<int> &types, int f = 0) + : QAbstractMetaCallEvent(sender, -1), + connection(c), + message(msg), + metaTypes(types), + id(id), + flags(f) + { + } void placeMetaCall(QObject *object) override { @@ -117,7 +123,7 @@ public: private: QDBusConnection connection; // just for refcounting QDBusMessage message; - QVector<int> metaTypes; + QList<int> metaTypes; int id; int flags; }; diff --git a/src/dbus/qdbusintrospection_p.h b/src/dbus/qdbusintrospection_p.h index e60900b162..9afa0a3420 100644 --- a/src/dbus/qdbusintrospection_p.h +++ b/src/dbus/qdbusintrospection_p.h @@ -52,12 +52,12 @@ // #include <QtDBus/private/qtdbusglobal_p.h> -#include <QtCore/qstring.h> -#include <QtCore/qvector.h> -#include <QtCore/qstringlist.h> +#include <QtCore/qlist.h> #include <QtCore/qmap.h> #include <QtCore/qpair.h> #include <QtCore/qshareddata.h> +#include <QtCore/qstring.h> +#include <QtCore/qstringlist.h> #ifndef QT_NO_DBUS @@ -77,7 +77,7 @@ public: // typedefs typedef QMap<QString, QString> Annotations; - typedef QVector<Argument> Arguments; + typedef QList<Argument> Arguments; typedef QMultiMap<QString, Method> Methods; typedef QMultiMap<QString, Signal> Signals; typedef QMap<QString, Property> Properties; diff --git a/src/dbus/qdbusmetatype.cpp b/src/dbus/qdbusmetatype.cpp index bcbb22fba6..699e1d5076 100644 --- a/src/dbus/qdbusmetatype.cpp +++ b/src/dbus/qdbusmetatype.cpp @@ -45,8 +45,8 @@ #include <qbytearray.h> #include <qglobal.h> +#include <qlist.h> #include <qreadwritelock.h> -#include <qvector.h> #include "qdbusargument_p.h" #include "qdbusutil_p.h" @@ -131,25 +131,13 @@ void QDBusMetaTypeId::init() qDBusRegisterMetaType<QList<QDBusObjectPath> >(); qDBusRegisterMetaType<QList<QDBusSignature> >(); qDBusRegisterMetaType<QList<QDBusUnixFileDescriptor> >(); - - qDBusRegisterMetaType<QVector<bool> >(); - qDBusRegisterMetaType<QVector<short> >(); - qDBusRegisterMetaType<QVector<ushort> >(); - qDBusRegisterMetaType<QVector<int> >(); - qDBusRegisterMetaType<QVector<uint> >(); - qDBusRegisterMetaType<QVector<qlonglong> >(); - qDBusRegisterMetaType<QVector<qulonglong> >(); - qDBusRegisterMetaType<QVector<double> >(); - qDBusRegisterMetaType<QVector<QDBusObjectPath> >(); - qDBusRegisterMetaType<QVector<QDBusSignature> >(); - qDBusRegisterMetaType<QVector<QDBusUnixFileDescriptor> >(); #endif initialized.storeRelaxed(true); } } -Q_GLOBAL_STATIC(QVector<QDBusCustomTypeInfo>, customTypes) +Q_GLOBAL_STATIC(QList<QDBusCustomTypeInfo>, customTypes) Q_GLOBAL_STATIC(QReadWriteLock, customTypesLock) /*! @@ -228,7 +216,7 @@ Q_GLOBAL_STATIC(QReadWriteLock, customTypesLock) void QDBusMetaType::registerMarshallOperators(int id, MarshallFunction mf, DemarshallFunction df) { - QVector<QDBusCustomTypeInfo> *ct = customTypes(); + QList<QDBusCustomTypeInfo> *ct = customTypes(); if (id < 0 || !mf || !df || !ct) return; // error! @@ -253,7 +241,7 @@ bool QDBusMetaType::marshall(QDBusArgument &arg, int id, const void *data) MarshallFunction mf; { QReadLocker locker(customTypesLock()); - QVector<QDBusCustomTypeInfo> *ct = customTypes(); + QList<QDBusCustomTypeInfo> *ct = customTypes(); if (id >= ct->size()) return false; // non-existent @@ -282,7 +270,7 @@ bool QDBusMetaType::demarshall(const QDBusArgument &arg, int id, void *data) DemarshallFunction df; { QReadLocker locker(customTypesLock()); - QVector<QDBusCustomTypeInfo> *ct = customTypes(); + QList<QDBusCustomTypeInfo> *ct = customTypes(); if (id >= ct->size()) return false; // non-existent @@ -456,7 +444,7 @@ const char *QDBusMetaType::typeToSignature(int type) return DBUS_TYPE_UNIX_FD_AS_STRING; // try the database - QVector<QDBusCustomTypeInfo> *ct = customTypes(); + QList<QDBusCustomTypeInfo> *ct = customTypes(); { QReadLocker locker(customTypesLock()); if (type >= ct->size()) diff --git a/src/dbus/qdbusmisc.cpp b/src/dbus/qdbusmisc.cpp index 887f649e5d..1925331eae 100644 --- a/src/dbus/qdbusmisc.cpp +++ b/src/dbus/qdbusmisc.cpp @@ -41,14 +41,14 @@ #ifndef QT_BOOTSTRAPPED #include <QtCore/qcoreapplication.h> -#include <QtCore/qvariant.h> +#include <QtCore/qlist.h> #include <QtCore/qmetaobject.h> +#include <QtCore/qvariant.h> #include "qdbusutil_p.h" #include "qdbusconnection_p.h" #include "qdbusabstractadaptor_p.h" // for QCLASSINFO_DBUS_* #endif -#include <QtCore/qvector.h> #include "qdbusmetatype_p.h" #ifndef QT_NO_DBUS @@ -135,14 +135,15 @@ bool qDBusInterfaceInObject(QObject *obj, const QString &interface_name) // metaTypes.count() >= retval + 1 in all cases // // sig must be the normalised signature for the method -int qDBusParametersForMethod(const QMetaMethod &mm, QVector<int> &metaTypes, QString &errorMsg) +int qDBusParametersForMethod(const QMetaMethod &mm, QList<int> &metaTypes, QString &errorMsg) { return qDBusParametersForMethod(mm.parameterTypes(), metaTypes, errorMsg); } #endif // QT_BOOTSTRAPPED -int qDBusParametersForMethod(const QList<QByteArray> ¶meterTypes, QVector<int>& metaTypes, QString &errorMsg) +int qDBusParametersForMethod(const QList<QByteArray> ¶meterTypes, QList<int> &metaTypes, + QString &errorMsg) { QDBusMetaTypeId::init(); metaTypes.clear(); diff --git a/src/dbus/qdbuspendingcall_p.h b/src/dbus/qdbuspendingcall_p.h index e1f6240f3e..0921d7c4f3 100644 --- a/src/dbus/qdbuspendingcall_p.h +++ b/src/dbus/qdbuspendingcall_p.h @@ -54,10 +54,10 @@ #define QDBUSPENDINGCALL_P_H #include <QtDBus/private/qtdbusglobal_p.h> -#include <qshareddata.h> -#include <qpointer.h> -#include <qvector.h> +#include <qlist.h> #include <qmutex.h> +#include <qpointer.h> +#include <qshareddata.h> #include <qwaitcondition.h> #include "qdbusmessage.h" @@ -82,7 +82,7 @@ public: // for the callback mechanism (see setReplyCallback and QDBusConnectionPrivate::sendWithReplyAsync) QPointer<QObject> receiver; - QVector<int> metaTypes; + QList<int> metaTypes; int methodIdx; // } diff --git a/src/dbus/qdbusutil.cpp b/src/dbus/qdbusutil.cpp index d4f0eccc38..e04910b1d1 100644 --- a/src/dbus/qdbusutil.cpp +++ b/src/dbus/qdbusutil.cpp @@ -41,8 +41,8 @@ #include "qdbus_symbols_p.h" +#include <QtCore/qlist.h> #include <QtCore/qstringlist.h> -#include <QtCore/qvector.h> #include "qdbusargument.h" #include "qdbusunixfiledescriptor.h" diff --git a/src/dbus/qdbusxmlgenerator.cpp b/src/dbus/qdbusxmlgenerator.cpp index f11b71dadf..97ce3dc910 100644 --- a/src/dbus/qdbusxmlgenerator.cpp +++ b/src/dbus/qdbusxmlgenerator.cpp @@ -175,7 +175,7 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method } QList<QByteArray> names = mm.parameterNames(); - QVector<int> types; + QList<int> types; QString errorMsg; int inputCount = qDBusParametersForMethod(mm, types, errorMsg); if (inputCount == -1) { diff --git a/src/dbus/qtdbusglobal.h b/src/dbus/qtdbusglobal.h index 633cc352bb..7606edf740 100644 --- a/src/dbus/qtdbusglobal.h +++ b/src/dbus/qtdbusglobal.h @@ -54,7 +54,6 @@ #if QT_DEPRECATED_SINCE(5, 5) #include <QtCore/qhash.h> #endif -#include <QtCore/qvector.h> #endif QT_BEGIN_NAMESPACE |