| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | extern QString qDBusGenerateMetaObjectXml(QString interface, const QMetaObject *mo, | - |
| 13 | const QMetaObject *base, int flags); | - |
| 14 | | - |
| 15 | static const char introspectableInterfaceXml[] = | - |
| 16 | " <interface name=\"org.freedesktop.DBus.Introspectable\">\n" | - |
| 17 | " <method name=\"Introspect\">\n" | - |
| 18 | " <arg name=\"xml_data\" type=\"s\" direction=\"out\"/>\n" | - |
| 19 | " </method>\n" | - |
| 20 | " </interface>\n"; | - |
| 21 | | - |
| 22 | static const char propertiesInterfaceXml[] = | - |
| 23 | " <interface name=\"org.freedesktop.DBus.Properties\">\n" | - |
| 24 | " <method name=\"Get\">\n" | - |
| 25 | " <arg name=\"interface_name\" type=\"s\" direction=\"in\"/>\n" | - |
| 26 | " <arg name=\"property_name\" type=\"s\" direction=\"in\"/>\n" | - |
| 27 | " <arg name=\"value\" type=\"v\" direction=\"out\"/>\n" | - |
| 28 | " </method>\n" | - |
| 29 | " <method name=\"Set\">\n" | - |
| 30 | " <arg name=\"interface_name\" type=\"s\" direction=\"in\"/>\n" | - |
| 31 | " <arg name=\"property_name\" type=\"s\" direction=\"in\"/>\n" | - |
| 32 | " <arg name=\"value\" type=\"v\" direction=\"in\"/>\n" | - |
| 33 | " </method>\n" | - |
| 34 | " <method name=\"GetAll\">\n" | - |
| 35 | " <arg name=\"interface_name\" type=\"s\" direction=\"in\"/>\n" | - |
| 36 | " <arg name=\"values\" type=\"a{sv}\" direction=\"out\"/>\n" | - |
| 37 | " <annotation name=\"org.qtproject.QtDBus.QtTypeName.Out0\" value=\"QVariantMap\"/>\n" | - |
| 38 | " </method>\n" | - |
| 39 | " </interface>\n"; | - |
| 40 | | - |
| 41 | static const char peerInterfaceXml[] = | - |
| 42 | " <interface name=\"org.freedesktop.DBus.Peer\">\n" | - |
| 43 | " <method name=\"Ping\"/>\n" | - |
| 44 | " <method name=\"GetMachineId\">\n" | - |
| 45 | " <arg name=\"machine_uuid\" type=\"s\" direction=\"out\"/>\n" | - |
| 46 | " </method>\n" | - |
| 47 | " </interface>\n"; | - |
| 48 | | - |
| 49 | static QString generateSubObjectXml(QObject *object) | - |
| 50 | { | - |
| 51 | QString retval; | - |
| 52 | const QObjectList &objs = object->children(); | - |
| 53 | QObjectList::ConstIterator it = objs.constBegin(); | - |
| 54 | QObjectList::ConstIterator end = objs.constEnd(); | - |
| 55 | for ( ; it != end; ++it) { never evaluated: it != end | 0 |
| 56 | QString name = (*it)->objectName(); | - |
| 57 | if (!name.isEmpty() && QDBusUtil::isValidPartOfObjectPath(name)) never evaluated: !name.isEmpty() never evaluated: QDBusUtil::isValidPartOfObjectPath(name) | 0 |
| 58 | retval += QString::fromLatin1(" <node name=\"%1\"/>\n") | 0 |
| 59 | .arg(name); never executed: retval += QString::fromLatin1(" <node name=\"%1\"/>\n") .arg(name); | 0 |
| 60 | } | 0 |
| 61 | return retval; never executed: return retval; | 0 |
| 62 | } | - |
| 63 | | - |
| 64 | | - |
| 65 | | - |
| 66 | QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node, const QString &path) | - |
| 67 | { | - |
| 68 | | - |
| 69 | | - |
| 70 | QString xml_data(QLatin1String("<!DOCTYPE node PUBLIC \"""-//freedesktop//DTD D-BUS Object Introspection 1.0//EN""\"\n\"""http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd""\">\n")); | - |
| 71 | xml_data += QLatin1String("<node>\n"); | - |
| 72 | | - |
| 73 | if (node.obj) { partially evaluated: node.obj| yes Evaluation Count:55 | no Evaluation Count:0 |
| 0-55 |
| 74 | qt_noop(); | - |
| 75 | | - |
| 76 | | - |
| 77 | | - |
| 78 | if (node.flags & (QDBusConnection::ExportScriptableContents | 9-46 |
| 79 | | QDBusConnection::ExportNonScriptableContents)) { evaluated: node.flags & (QDBusConnection::ExportScriptableContents | QDBusConnection::ExportNonScriptableContents)| yes Evaluation Count:9 | yes Evaluation Count:46 |
| 9-46 |
| 80 | | - |
| 81 | const QMetaObject *mo = node.obj->metaObject(); | - |
| 82 | for ( ; mo != &QObject::staticMetaObject; mo = mo->superClass()) evaluated: mo != &QObject::staticMetaObject| yes Evaluation Count:9 | yes Evaluation Count:9 |
| 9 |
| 83 | xml_data += qDBusGenerateMetaObjectXml(QString(), mo, mo->superClass(), | 9 |
| 84 | node.flags); executed: xml_data += qDBusGenerateMetaObjectXml(QString(), mo, mo->superClass(), node.flags);Execution Count:9 | 9 |
| 85 | } executed: }Execution Count:9 | 9 |
| 86 | | - |
| 87 | | - |
| 88 | QDBusAdaptorConnector *connector; | - |
| 89 | if (node.flags & QDBusConnection::ExportAdaptors && evaluated: node.flags & QDBusConnection::ExportAdaptors| yes Evaluation Count:48 | yes Evaluation Count:7 |
| 7-48 |
| 90 | (connector = qDBusFindAdaptorConnector(node.obj))) { partially evaluated: (connector = qDBusFindAdaptorConnector(node.obj))| yes Evaluation Count:48 | no Evaluation Count:0 |
| 0-48 |
| 91 | | - |
| 92 | | - |
| 93 | QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(); | - |
| 94 | QDBusAdaptorConnector::AdaptorMap::ConstIterator end = connector->adaptors.constEnd(); | - |
| 95 | for ( ; it != end; ++it) { evaluated: it != end| yes Evaluation Count:73 | yes Evaluation Count:48 |
| 48-73 |
| 96 | | - |
| 97 | QString ifaceXml = QDBusAbstractAdaptorPrivate::retrieveIntrospectionXml(it->adaptor); | - |
| 98 | if (ifaceXml.isEmpty()) { evaluated: ifaceXml.isEmpty()| yes Evaluation Count:54 | yes Evaluation Count:19 |
| 19-54 |
| 99 | | - |
| 100 | ifaceXml += qDBusGenerateMetaObjectXml(QString::fromLatin1(it->interface), | - |
| 101 | it->adaptor->metaObject(), | - |
| 102 | &QDBusAbstractAdaptor::staticMetaObject, | - |
| 103 | QDBusConnection::ExportScriptableContents | - |
| 104 | | QDBusConnection::ExportNonScriptableContents); | - |
| 105 | | - |
| 106 | QDBusAbstractAdaptorPrivate::saveIntrospectionXml(it->adaptor, ifaceXml); | - |
| 107 | } executed: }Execution Count:54 | 54 |
| 108 | | - |
| 109 | xml_data += ifaceXml; | - |
| 110 | } executed: }Execution Count:73 | 73 |
| 111 | } executed: }Execution Count:48 | 48 |
| 112 | | - |
| 113 | | - |
| 114 | if (node.flags & QDBusConnectionPrivate::VirtualObject) { evaluated: node.flags & QDBusConnectionPrivate::VirtualObject| yes Evaluation Count:2 | yes Evaluation Count:53 |
| 2-53 |
| 115 | xml_data += node.treeNode->introspect(path); | - |
| 116 | } executed: }Execution Count:2 | 2 |
| 117 | | - |
| 118 | xml_data += QLatin1String( propertiesInterfaceXml ); | - |
| 119 | } executed: }Execution Count:55 | 55 |
| 120 | | - |
| 121 | xml_data += QLatin1String( introspectableInterfaceXml ); | - |
| 122 | xml_data += QLatin1String( peerInterfaceXml ); | - |
| 123 | | - |
| 124 | if (node.flags & QDBusConnection::ExportChildObjects) { partially evaluated: node.flags & QDBusConnection::ExportChildObjects| no Evaluation Count:0 | yes Evaluation Count:55 |
| 0-55 |
| 125 | xml_data += generateSubObjectXml(node.obj); | - |
| 126 | } else { | 0 |
| 127 | | - |
| 128 | QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator it = | - |
| 129 | node.children.constBegin(); | - |
| 130 | QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator end = | - |
| 131 | node.children.constEnd(); | - |
| 132 | for ( ; it != end; ++it) evaluated: it != end| yes Evaluation Count:5 | yes Evaluation Count:55 |
| 5-55 |
| 133 | if (it->obj || !it->children.isEmpty()) partially evaluated: it->obj| no Evaluation Count:0 | yes Evaluation Count:5 |
partially evaluated: !it->children.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
| 134 | xml_data += QString::fromLatin1(" <node name=\"%1\"/>\n") | 0 |
| 135 | .arg(it->name); never executed: xml_data += QString::fromLatin1(" <node name=\"%1\"/>\n") .arg(it->name); | 0 |
| 136 | } executed: }Execution Count:55 | 55 |
| 137 | | - |
| 138 | xml_data += QLatin1String("</node>\n"); | - |
| 139 | return xml_data; executed: return xml_data;Execution Count:55 | 55 |
| 140 | } | - |
| 141 | | - |
| 142 | | - |
| 143 | | - |
| 144 | static inline QDBusMessage interfaceNotFoundError(const QDBusMessage &msg, const QString &interface_name) | - |
| 145 | { | - |
| 146 | return msg.createErrorReply(QDBusError::UnknownInterface, | 4 |
| 147 | QString::fromLatin1("Interface %1 was not found in object %2") | 4 |
| 148 | .arg(interface_name) | 4 |
| 149 | .arg(msg.path())); executed: return msg.createErrorReply(QDBusError::UnknownInterface, QString::fromLatin1("Interface %1 was not found in object %2") .arg(interface_name) .arg(msg.path()));Execution Count:4 | 4 |
| 150 | } | - |
| 151 | | - |
| 152 | static inline QDBusMessage | - |
| 153 | propertyNotFoundError(const QDBusMessage &msg, const QString &interface_name, const QByteArray &property_name) | - |
| 154 | { | - |
| 155 | return msg.createErrorReply(QDBusError::UnknownProperty, | 0 |
| 156 | QString::fromLatin1("Property %1%2%3 was not found in object %4") | 0 |
| 157 | .arg(interface_name, | 0 |
| 158 | QString::fromLatin1(interface_name.isEmpty() ? "" : "."), | 0 |
| 159 | QString::fromLatin1(property_name), | 0 |
| 160 | msg.path())); never executed: return msg.createErrorReply(QDBusError::UnknownProperty, QString::fromLatin1("Property %1%2%3 was not found in object %4") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name), msg.path())); | 0 |
| 161 | } | - |
| 162 | | - |
| 163 | QDBusMessage qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode &node, | - |
| 164 | const QDBusMessage &msg) | - |
| 165 | { | - |
| 166 | qt_noop(); | - |
| 167 | qt_noop(); | - |
| 168 | | - |
| 169 | | - |
| 170 | | - |
| 171 | QString interface_name = msg.arguments().at(0).toString(); | - |
| 172 | QByteArray property_name = msg.arguments().at(1).toString().toUtf8(); | - |
| 173 | | - |
| 174 | QDBusAdaptorConnector *connector; | - |
| 175 | QVariant value; | - |
| 176 | bool interfaceFound = false; | - |
| 177 | if (node.flags & QDBusConnection::ExportAdaptors && evaluated: node.flags & QDBusConnection::ExportAdaptors| yes Evaluation Count:13 | yes Evaluation Count:8 |
| 8-13 |
| 178 | (connector = qDBusFindAdaptorConnector(node.obj))) { partially evaluated: (connector = qDBusFindAdaptorConnector(node.obj))| yes Evaluation Count:13 | no Evaluation Count:0 |
| 0-13 |
| 179 | | - |
| 180 | | - |
| 181 | | - |
| 182 | if (interface_name.isEmpty()) { evaluated: interface_name.isEmpty()| yes Evaluation Count:6 | yes Evaluation Count:7 |
| 6-7 |
| 183 | for (QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(), | - |
| 184 | end = connector->adaptors.constEnd(); it != end; ++it) { evaluated: it != end| yes Evaluation Count:19 | yes Evaluation Count:2 |
| 2-19 |
| 185 | const QMetaObject *mo = it->adaptor->metaObject(); | - |
| 186 | int pidx = mo->indexOfProperty(property_name); | - |
| 187 | if (pidx != -1) { evaluated: pidx != -1| yes Evaluation Count:4 | yes Evaluation Count:15 |
| 4-15 |
| 188 | value = mo->property(pidx).read(it->adaptor); | - |
| 189 | break; executed: break;Execution Count:4 | 4 |
| 190 | } | - |
| 191 | } executed: }Execution Count:15 | 15 |
| 192 | } else { executed: }Execution Count:6 | 6 |
| 193 | QDBusAdaptorConnector::AdaptorMap::ConstIterator it; | - |
| 194 | it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(), | - |
| 195 | interface_name); | - |
| 196 | if (it != connector->adaptors.constEnd() && interface_name == QLatin1String(it->interface)) { partially evaluated: it != connector->adaptors.constEnd()| yes Evaluation Count:7 | no Evaluation Count:0 |
evaluated: interface_name == QLatin1String(it->interface)| yes Evaluation Count:6 | yes Evaluation Count:1 |
| 0-7 |
| 197 | interfaceFound = true; | - |
| 198 | value = it->adaptor->property(property_name); | - |
| 199 | } executed: }Execution Count:6 | 6 |
| 200 | } executed: }Execution Count:7 | 7 |
| 201 | } | - |
| 202 | | - |
| 203 | if (!interfaceFound && !value.isValid() evaluated: !interfaceFound| yes Evaluation Count:15 | yes Evaluation Count:6 |
evaluated: !value.isValid()| yes Evaluation Count:11 | yes Evaluation Count:4 |
| 4-15 |
| 204 | && node.flags & (QDBusConnection::ExportAllProperties | | 3-8 |
| 205 | QDBusConnection::ExportNonScriptableProperties)) { evaluated: node.flags & (QDBusConnection::ExportAllProperties | QDBusConnection::ExportNonScriptableProperties)| yes Evaluation Count:8 | yes Evaluation Count:3 |
| 3-8 |
| 206 | | - |
| 207 | if (!interface_name.isEmpty()) partially evaluated: !interface_name.isEmpty()| yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
| 208 | interfaceFound = qDBusInterfaceInObject(node.obj, interface_name); executed: interfaceFound = qDBusInterfaceInObject(node.obj, interface_name);Execution Count:8 | 8 |
| 209 | | - |
| 210 | if (interfaceFound) { partially evaluated: interfaceFound| yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
| 211 | int pidx = node.obj->metaObject()->indexOfProperty(property_name); | - |
| 212 | if (pidx != -1) { partially evaluated: pidx != -1| yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
| 213 | QMetaProperty mp = node.obj->metaObject()->property(pidx); | - |
| 214 | if ((mp.isScriptable() && (node.flags & QDBusConnection::ExportScriptableProperties)) || partially evaluated: mp.isScriptable()| yes Evaluation Count:8 | no Evaluation Count:0 |
partially evaluated: (node.flags & QDBusConnection::ExportScriptableProperties)| yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
| 215 | (!mp.isScriptable() && (node.flags & QDBusConnection::ExportNonScriptableProperties))) never evaluated: !mp.isScriptable() never evaluated: (node.flags & QDBusConnection::ExportNonScriptableProperties) | 0 |
| 216 | value = mp.read(node.obj); executed: value = mp.read(node.obj);Execution Count:8 | 8 |
| 217 | } executed: }Execution Count:8 | 8 |
| 218 | } executed: }Execution Count:8 | 8 |
| 219 | } executed: }Execution Count:8 | 8 |
| 220 | | - |
| 221 | if (!value.isValid()) { evaluated: !value.isValid()| yes Evaluation Count:3 | yes Evaluation Count:18 |
| 3-18 |
| 222 | | - |
| 223 | if (!interfaceFound) partially evaluated: !interfaceFound| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
| 224 | return interfaceNotFoundError(msg, interface_name); executed: return interfaceNotFoundError(msg, interface_name);Execution Count:3 | 3 |
| 225 | return propertyNotFoundError(msg, interface_name, property_name); never executed: return propertyNotFoundError(msg, interface_name, property_name); | 0 |
| 226 | } | - |
| 227 | | - |
| 228 | return msg.createReply(QVariant::fromValue(QDBusVariant(value))); executed: return msg.createReply(QVariant::fromValue(QDBusVariant(value)));Execution Count:18 | 18 |
| 229 | } | - |
| 230 | | - |
| 231 | enum PropertyWriteResult { | - |
| 232 | PropertyWriteSuccess = 0, | - |
| 233 | PropertyNotFound, | - |
| 234 | PropertyTypeMismatch, | - |
| 235 | PropertyReadOnly, | - |
| 236 | PropertyWriteFailed | - |
| 237 | }; | - |
| 238 | | - |
| 239 | static QDBusMessage propertyWriteReply(const QDBusMessage &msg, const QString &interface_name, | - |
| 240 | const QByteArray &property_name, int status) | - |
| 241 | { | - |
| 242 | switch (status) { | - |
| 243 | case PropertyNotFound: | - |
| 244 | return propertyNotFoundError(msg, interface_name, property_name); never executed: return propertyNotFoundError(msg, interface_name, property_name); | 0 |
| 245 | case PropertyTypeMismatch: | - |
| 246 | return msg.createErrorReply(QDBusError::InvalidArgs, | 0 |
| 247 | QString::fromLatin1("Invalid arguments for writing to property %1%2%3") | 0 |
| 248 | .arg(interface_name, | 0 |
| 249 | QString::fromLatin1(interface_name.isEmpty() ? "" : "."), | 0 |
| 250 | QString::fromLatin1(property_name))); never executed: return msg.createErrorReply(QDBusError::InvalidArgs, QString::fromLatin1("Invalid arguments for writing to property %1%2%3") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name))); | 0 |
| 251 | case PropertyReadOnly: | - |
| 252 | return msg.createErrorReply(QDBusError::PropertyReadOnly, | 3 |
| 253 | QString::fromLatin1("Property %1%2%3 is read-only") | 3 |
| 254 | .arg(interface_name, | 3 |
| 255 | QString::fromLatin1(interface_name.isEmpty() ? "" : "."), | 3 |
| 256 | QString::fromLatin1(property_name))); executed: return msg.createErrorReply(QDBusError::PropertyReadOnly, QString::fromLatin1("Property %1%2%3 is read-only") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name)));Execution Count:3 | 3 |
| 257 | case PropertyWriteFailed: | - |
| 258 | return msg.createErrorReply(QDBusError::InternalError, | 0 |
| 259 | QString::fromLatin1("Internal error")); never executed: return msg.createErrorReply(QDBusError::InternalError, QString::fromLatin1("Internal error")); | 0 |
| 260 | | - |
| 261 | case PropertyWriteSuccess: | - |
| 262 | return msg.createReply(); executed: return msg.createReply();Execution Count:11 | 11 |
| 263 | } | - |
| 264 | qt_noop(); | - |
| 265 | return QDBusMessage(); never executed: return QDBusMessage(); | 0 |
| 266 | } | - |
| 267 | | - |
| 268 | static int writeProperty(QObject *obj, const QByteArray &property_name, QVariant value, | - |
| 269 | int propFlags = QDBusConnection::ExportAllProperties) | - |
| 270 | { | - |
| 271 | const QMetaObject *mo = obj->metaObject(); | - |
| 272 | int pidx = mo->indexOfProperty(property_name); | - |
| 273 | if (pidx == -1) { partially evaluated: pidx == -1| no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
| 274 | | - |
| 275 | return PropertyNotFound; never executed: return PropertyNotFound; | 0 |
| 276 | } | - |
| 277 | | - |
| 278 | QMetaProperty mp = mo->property(pidx); | - |
| 279 | | - |
| 280 | | - |
| 281 | if (!mp.isWritable()) evaluated: !mp.isWritable()| yes Evaluation Count:3 | yes Evaluation Count:11 |
| 3-11 |
| 282 | return PropertyReadOnly; executed: return PropertyReadOnly;Execution Count:3 | 3 |
| 283 | | - |
| 284 | | - |
| 285 | bool isScriptable = mp.isScriptable(); | - |
| 286 | if (!(propFlags & QDBusConnection::ExportScriptableProperties) && isScriptable) partially evaluated: !(propFlags & QDBusConnection::ExportScriptableProperties)| no Evaluation Count:0 | yes Evaluation Count:11 |
never evaluated: isScriptable | 0-11 |
| 287 | return PropertyNotFound; never executed: return PropertyNotFound; | 0 |
| 288 | if (!(propFlags & QDBusConnection::ExportNonScriptableProperties) && !isScriptable) evaluated: !(propFlags & QDBusConnection::ExportNonScriptableProperties)| yes Evaluation Count:6 | yes Evaluation Count:5 |
partially evaluated: !isScriptable| no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
| 289 | return PropertyNotFound; never executed: return PropertyNotFound; | 0 |
| 290 | | - |
| 291 | | - |
| 292 | | - |
| 293 | int id = mp.userType(); | - |
| 294 | if (!id){ partially evaluated: !id| no Evaluation Count:0 | yes Evaluation Count:11 |
| 0-11 |
| 295 | | - |
| 296 | QMessageLogger("qdbusinternalfilters.cpp", 352, __PRETTY_FUNCTION__).warning("QDBusConnection: Unable to handle unregistered datatype '%s' for property '%s::%s'", | - |
| 297 | mp.typeName(), mo->className(), property_name.constData()); | - |
| 298 | return PropertyWriteFailed; never executed: return PropertyWriteFailed; | 0 |
| 299 | } | - |
| 300 | | - |
| 301 | if (id != QMetaType::QVariant && value.userType() == QDBusMetaTypeId::argument()) { partially evaluated: id != QMetaType::QVariant| yes Evaluation Count:11 | no Evaluation Count:0 |
evaluated: value.userType() == QDBusMetaTypeId::argument()| yes Evaluation Count:3 | yes Evaluation Count:8 |
| 0-11 |
| 302 | | - |
| 303 | void *null = 0; | - |
| 304 | QVariant other(id, null); | - |
| 305 | if (!QDBusMetaType::demarshall(qvariant_cast<QDBusArgument>(value), id, other.data())) { partially evaluated: !QDBusMetaType::demarshall(qvariant_cast<QDBusArgument>(value), id, other.data())| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 306 | QMessageLogger("qdbusinternalfilters.cpp", 362, __PRETTY_FUNCTION__).warning("QDBusConnection: type `%s' (%d) is not registered with QtDBus. " | - |
| 307 | "Use qDBusRegisterMetaType to register it", | - |
| 308 | mp.typeName(), id); | - |
| 309 | return PropertyWriteFailed; never executed: return PropertyWriteFailed; | 0 |
| 310 | } | - |
| 311 | | - |
| 312 | value = other; | - |
| 313 | } executed: }Execution Count:3 | 3 |
| 314 | | - |
| 315 | | - |
| 316 | return mp.write(obj, value) ? PropertyWriteSuccess : PropertyWriteFailed; executed: return mp.write(obj, value) ? PropertyWriteSuccess : PropertyWriteFailed;Execution Count:11 | 11 |
| 317 | } | - |
| 318 | | - |
| 319 | QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNode &node, | - |
| 320 | const QDBusMessage &msg) | - |
| 321 | { | - |
| 322 | qt_noop(); | - |
| 323 | qt_noop(); | - |
| 324 | | - |
| 325 | | - |
| 326 | | - |
| 327 | QString interface_name = msg.arguments().at(0).toString(); | - |
| 328 | QByteArray property_name = msg.arguments().at(1).toString().toUtf8(); | - |
| 329 | QVariant value = qvariant_cast<QDBusVariant>(msg.arguments().at(2)).variant(); | - |
| 330 | | - |
| 331 | QDBusAdaptorConnector *connector; | - |
| 332 | if (node.flags & QDBusConnection::ExportAdaptors && evaluated: node.flags & QDBusConnection::ExportAdaptors| yes Evaluation Count:6 | yes Evaluation Count:8 |
| 6-8 |
| 333 | (connector = qDBusFindAdaptorConnector(node.obj))) { partially evaluated: (connector = qDBusFindAdaptorConnector(node.obj))| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 334 | | - |
| 335 | | - |
| 336 | | - |
| 337 | if (interface_name.isEmpty()) { partially evaluated: interface_name.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
| 338 | for (QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(), | - |
| 339 | end = connector->adaptors.constEnd(); it != end; ++it) { never evaluated: it != end | 0 |
| 340 | int status = writeProperty(it->adaptor, property_name, value); | - |
| 341 | if (status == PropertyNotFound) never evaluated: status == PropertyNotFound | 0 |
| 342 | continue; never executed: continue; | 0 |
| 343 | return propertyWriteReply(msg, interface_name, property_name, status); never executed: return propertyWriteReply(msg, interface_name, property_name, status); | 0 |
| 344 | } | - |
| 345 | } else { | 0 |
| 346 | QDBusAdaptorConnector::AdaptorMap::ConstIterator it; | - |
| 347 | it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(), | - |
| 348 | interface_name); | - |
| 349 | if (it != connector->adaptors.end() && interface_name == QLatin1String(it->interface)) { partially evaluated: it != connector->adaptors.end()| yes Evaluation Count:6 | no Evaluation Count:0 |
partially evaluated: interface_name == QLatin1String(it->interface)| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 350 | return propertyWriteReply(msg, interface_name, property_name, | 6 |
| 351 | writeProperty(it->adaptor, property_name, value)); executed: return propertyWriteReply(msg, interface_name, property_name, writeProperty(it->adaptor, property_name, value));Execution Count:6 | 6 |
| 352 | } | - |
| 353 | } | 0 |
| 354 | } | - |
| 355 | | - |
| 356 | if (node.flags & (QDBusConnection::ExportScriptableProperties | | 0-8 |
| 357 | QDBusConnection::ExportNonScriptableProperties)) { partially evaluated: node.flags & (QDBusConnection::ExportScriptableProperties | QDBusConnection::ExportNonScriptableProperties)| yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
| 358 | | - |
| 359 | bool interfaceFound = true; | - |
| 360 | if (!interface_name.isEmpty()) partially evaluated: !interface_name.isEmpty()| yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
| 361 | interfaceFound = qDBusInterfaceInObject(node.obj, interface_name); executed: interfaceFound = qDBusInterfaceInObject(node.obj, interface_name);Execution Count:8 | 8 |
| 362 | | - |
| 363 | if (interfaceFound) { partially evaluated: interfaceFound| yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
| 364 | return propertyWriteReply(msg, interface_name, property_name, | 8 |
| 365 | writeProperty(node.obj, property_name, value, node.flags)); executed: return propertyWriteReply(msg, interface_name, property_name, writeProperty(node.obj, property_name, value, node.flags));Execution Count:8 | 8 |
| 366 | } | - |
| 367 | } | 0 |
| 368 | | - |
| 369 | | - |
| 370 | if (!interface_name.isEmpty()) never evaluated: !interface_name.isEmpty() | 0 |
| 371 | return interfaceNotFoundError(msg, interface_name); never executed: return interfaceNotFoundError(msg, interface_name); | 0 |
| 372 | return propertyWriteReply(msg, interface_name, property_name, PropertyNotFound); never executed: return propertyWriteReply(msg, interface_name, property_name, PropertyNotFound); | 0 |
| 373 | } | - |
| 374 | | - |
| 375 | | - |
| 376 | static QVariantMap &operator+=(QVariantMap &lhs, const QVariantMap &rhs) | - |
| 377 | { | - |
| 378 | QVariantMap::ConstIterator it = rhs.constBegin(), | - |
| 379 | end = rhs.constEnd(); | - |
| 380 | for ( ; it != end; ++it) evaluated: it != end| yes Evaluation Count:16 | yes Evaluation Count:8 |
| 8-16 |
| 381 | lhs.insert(it.key(), it.value()); executed: lhs.insert(it.key(), it.value());Execution Count:16 | 16 |
| 382 | return lhs; executed: return lhs;Execution Count:8 | 8 |
| 383 | } | - |
| 384 | | - |
| 385 | static QVariantMap readAllProperties(QObject *object, int flags) | - |
| 386 | { | - |
| 387 | QVariantMap result; | - |
| 388 | const QMetaObject *mo = object->metaObject(); | - |
| 389 | | - |
| 390 | | - |
| 391 | for (int i = QObject::staticMetaObject.propertyCount(); i < mo->propertyCount(); ++i) { evaluated: i < mo->propertyCount()| yes Evaluation Count:27 | yes Evaluation Count:11 |
| 11-27 |
| 392 | QMetaProperty mp = mo->property(i); | - |
| 393 | | - |
| 394 | | - |
| 395 | if (!mp.isReadable()) partially evaluated: !mp.isReadable()| no Evaluation Count:0 | yes Evaluation Count:27 |
| 0-27 |
| 396 | continue; never executed: continue; | 0 |
| 397 | | - |
| 398 | | - |
| 399 | int typeId = mp.userType(); | - |
| 400 | if (!typeId) partially evaluated: !typeId| no Evaluation Count:0 | yes Evaluation Count:27 |
| 0-27 |
| 401 | continue; never executed: continue; | 0 |
| 402 | const char *signature = QDBusMetaType::typeToSignature(typeId); | - |
| 403 | if (!signature) evaluated: !signature| yes Evaluation Count:3 | yes Evaluation Count:24 |
| 3-24 |
| 404 | continue; executed: continue;Execution Count:3 | 3 |
| 405 | | - |
| 406 | | - |
| 407 | if ((mp.isScriptable() && flags & QDBusConnection::ExportScriptableProperties) || partially evaluated: mp.isScriptable()| yes Evaluation Count:24 | no Evaluation Count:0 |
partially evaluated: flags & QDBusConnection::ExportScriptableProperties| yes Evaluation Count:24 | no Evaluation Count:0 |
| 0-24 |
| 408 | (!mp.isScriptable() && flags & QDBusConnection::ExportNonScriptableProperties)) { never evaluated: !mp.isScriptable() never evaluated: flags & QDBusConnection::ExportNonScriptableProperties | 0 |
| 409 | | - |
| 410 | QVariant value = mp.read(object); | - |
| 411 | if (value.isValid()) partially evaluated: value.isValid()| yes Evaluation Count:24 | no Evaluation Count:0 |
| 0-24 |
| 412 | result.insert(QString::fromLatin1(mp.name()), value); executed: result.insert(QString::fromLatin1(mp.name()), value);Execution Count:24 | 24 |
| 413 | } executed: }Execution Count:24 | 24 |
| 414 | } executed: }Execution Count:24 | 24 |
| 415 | | - |
| 416 | return result; executed: return result;Execution Count:11 | 11 |
| 417 | } | - |
| 418 | | - |
| 419 | QDBusMessage qDBusPropertyGetAll(const QDBusConnectionPrivate::ObjectTreeNode &node, | - |
| 420 | const QDBusMessage &msg) | - |
| 421 | { | - |
| 422 | qt_noop(); | - |
| 423 | qt_noop(); | - |
| 424 | | - |
| 425 | | - |
| 426 | | - |
| 427 | QString interface_name = msg.arguments().at(0).toString(); | - |
| 428 | | - |
| 429 | bool interfaceFound = false; | - |
| 430 | QVariantMap result; | - |
| 431 | | - |
| 432 | QDBusAdaptorConnector *connector; | - |
| 433 | if (node.flags & QDBusConnection::ExportAdaptors && partially evaluated: node.flags & QDBusConnection::ExportAdaptors| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 434 | (connector = qDBusFindAdaptorConnector(node.obj))) { partially evaluated: (connector = qDBusFindAdaptorConnector(node.obj))| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 435 | | - |
| 436 | if (interface_name.isEmpty()) { evaluated: interface_name.isEmpty()| yes Evaluation Count:2 | yes Evaluation Count:4 |
| 2-4 |
| 437 | | - |
| 438 | for (QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(), | - |
| 439 | end = connector->adaptors.constEnd(); it != end; ++it) { evaluated: it != end| yes Evaluation Count:8 | yes Evaluation Count:2 |
| 2-8 |
| 440 | result += readAllProperties(it->adaptor, QDBusConnection::ExportAllProperties); | - |
| 441 | } executed: }Execution Count:8 | 8 |
| 442 | } else { executed: }Execution Count:2 | 2 |
| 443 | | - |
| 444 | QDBusAdaptorConnector::AdaptorMap::ConstIterator it; | - |
| 445 | it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(), | - |
| 446 | interface_name); | - |
| 447 | if (it != connector->adaptors.constEnd() && interface_name == QLatin1String(it->interface)) { partially evaluated: it != connector->adaptors.constEnd()| yes Evaluation Count:4 | no Evaluation Count:0 |
evaluated: interface_name == QLatin1String(it->interface)| yes Evaluation Count:3 | yes Evaluation Count:1 |
| 0-4 |
| 448 | interfaceFound = true; | - |
| 449 | result = readAllProperties(it->adaptor, QDBusConnection::ExportAllProperties); | - |
| 450 | } executed: }Execution Count:3 | 3 |
| 451 | } executed: }Execution Count:4 | 4 |
| 452 | } | - |
| 453 | | - |
| 454 | if (node.flags & QDBusConnection::ExportAllProperties && partially evaluated: node.flags & QDBusConnection::ExportAllProperties| no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
| 455 | (!interfaceFound || interface_name.isEmpty())) { never evaluated: !interfaceFound never evaluated: interface_name.isEmpty() | 0 |
| 456 | | - |
| 457 | result += readAllProperties(node.obj, node.flags); | - |
| 458 | interfaceFound = true; | - |
| 459 | } | 0 |
| 460 | | - |
| 461 | if (!interfaceFound && !interface_name.isEmpty()) { evaluated: !interfaceFound| yes Evaluation Count:3 | yes Evaluation Count:3 |
evaluated: !interface_name.isEmpty()| yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-3 |
| 462 | | - |
| 463 | return interfaceNotFoundError(msg, interface_name); executed: return interfaceNotFoundError(msg, interface_name);Execution Count:1 | 1 |
| 464 | } | - |
| 465 | | - |
| 466 | return msg.createReply(QVariant::fromValue(result)); executed: return msg.createReply(QVariant::fromValue(result));Execution Count:5 | 5 |
| 467 | } | - |
| 468 | | - |
| 469 | | - |
| 470 | | - |
| | |