Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | bool qDBusCheckAsyncTag(const char *tag) | - |
11 | { | - |
12 | static const char noReplyTag[] = "Q_NOREPLY"; | - |
13 | if (!tag || !*tag) partially evaluated: !tag no Evaluation Count:0 | yes Evaluation Count:1018 |
partially evaluated: !*tag yes Evaluation Count:1018 | no Evaluation Count:0 |
| 0-1018 |
14 | return false; executed: return false; Execution Count:1018 | 1018 |
15 | | - |
16 | const char *p = strstr(tag, noReplyTag); | - |
17 | if (p != __null && never evaluated: p != __null | 0 |
18 | (p == tag || *(p-1) == ' ') && never evaluated: p == tag never evaluated: *(p-1) == ' ' | 0 |
19 | (p[sizeof noReplyTag - 1] == '\0' || p[sizeof noReplyTag - 1] == ' ')) never evaluated: p[sizeof noReplyTag - 1] == '\0' never evaluated: p[sizeof noReplyTag - 1] == ' ' | 0 |
20 | return true; never executed: return true; | 0 |
21 | | - |
22 | return false; never executed: return false; | 0 |
23 | } | - |
24 | | - |
25 | | - |
26 | | - |
27 | QString qDBusInterfaceFromMetaObject(const QMetaObject *mo) | - |
28 | { | - |
29 | QString interface; | - |
30 | | - |
31 | int idx = mo->indexOfClassInfo("D-Bus Interface"); | - |
32 | if (idx >= mo->classInfoOffset()) { evaluated: idx >= mo->classInfoOffset() yes Evaluation Count:144 | yes Evaluation Count:2 |
| 2-144 |
33 | interface = QLatin1String(mo->classInfo(idx).value()); | - |
34 | } else { executed: } Execution Count:144 | 144 |
35 | interface = QLatin1String(mo->className()); | - |
36 | interface.replace(QLatin1String("::"), QLatin1String(".")); | - |
37 | | - |
38 | if (interface.startsWith(QLatin1String("QDBus"))) { partially evaluated: interface.startsWith(QLatin1String("QDBus")) no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
39 | interface.prepend(QLatin1String("org.qtproject.QtDBus.")); | - |
40 | } else if (interface.startsWith(QLatin1Char('Q')) && partially evaluated: interface.startsWith(QLatin1Char('Q')) no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
41 | interface.length() >= 2 && interface.at(1).isUpper()) { never evaluated: interface.length() >= 2 never evaluated: interface.at(1).isUpper() | 0 |
42 | | - |
43 | interface.prepend(QLatin1String("org.qtproject.Qt.")); | - |
44 | } else if (!QCoreApplication::instance()|| partially evaluated: !QCoreApplication::instance() no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
45 | QCoreApplication::instance()->applicationName().isEmpty()) { partially evaluated: QCoreApplication::instance()->applicationName().isEmpty() no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
46 | interface.prepend(QLatin1String("local.")); | - |
47 | } else { | 0 |
48 | interface.prepend(QLatin1Char('.')).prepend(QCoreApplication::instance()->applicationName()); | - |
49 | QStringList domainName = | - |
50 | QCoreApplication::instance()->organizationDomain().split(QLatin1Char('.'), | - |
51 | QString::SkipEmptyParts); | - |
52 | if (domainName.isEmpty()) partially evaluated: domainName.isEmpty() yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
53 | interface.prepend(QLatin1String("local.")); executed: interface.prepend(QLatin1String("local.")); Execution Count:2 | 2 |
54 | else | - |
55 | for (int i = 0; i < domainName.count(); ++i) never evaluated: i < domainName.count() | 0 |
56 | interface.prepend(QLatin1Char('.')).prepend(domainName.at(i)); never executed: interface.prepend(QLatin1Char('.')).prepend(domainName.at(i)); | 0 |
57 | } | - |
58 | } | - |
59 | | - |
60 | return interface; executed: return interface; Execution Count:146 | 146 |
61 | } | - |
62 | | - |
63 | bool qDBusInterfaceInObject(QObject *obj, const QString &interface_name) | - |
64 | { | - |
65 | const QMetaObject *mo = obj->metaObject(); | - |
66 | for ( ; mo != &QObject::staticMetaObject; mo = mo->superClass()) partially evaluated: mo != &QObject::staticMetaObject yes Evaluation Count:45 | no Evaluation Count:0 |
| 0-45 |
67 | if (interface_name == qDBusInterfaceFromMetaObject(mo)) evaluated: interface_name == qDBusInterfaceFromMetaObject(mo) yes Evaluation Count:44 | yes Evaluation Count:1 |
| 1-44 |
68 | return true; executed: return true; Execution Count:44 | 44 |
69 | return false; never executed: return false; | 0 |
70 | } | - |
71 | int qDBusParametersForMethod(const QMetaMethod &mm, QVector<int> &metaTypes) | - |
72 | { | - |
73 | return qDBusParametersForMethod(mm.parameterTypes(), metaTypes); executed: return qDBusParametersForMethod(mm.parameterTypes(), metaTypes); Execution Count:1414 | 1414 |
74 | } | - |
75 | | - |
76 | | - |
77 | | - |
78 | int qDBusParametersForMethod(const QList<QByteArray> ¶meterTypes, QVector<int>& metaTypes) | - |
79 | { | - |
80 | QDBusMetaTypeId::init(); | - |
81 | metaTypes.clear(); | - |
82 | | - |
83 | metaTypes.append(0); | - |
84 | int inputCount = 0; | - |
85 | bool seenMessage = false; | - |
86 | QList<QByteArray>::ConstIterator it = parameterTypes.constBegin(); | - |
87 | QList<QByteArray>::ConstIterator end = parameterTypes.constEnd(); | - |
88 | for ( ; it != end; ++it) { evaluated: it != end yes Evaluation Count:904 | yes Evaluation Count:1409 |
| 904-1409 |
89 | const QByteArray &type = *it; | - |
90 | if (type.endsWith('*')) { partially evaluated: type.endsWith('*') no Evaluation Count:0 | yes Evaluation Count:904 |
| 0-904 |
91 | | - |
92 | | - |
93 | return -1; never executed: return -1; | 0 |
94 | } | - |
95 | | - |
96 | if (type.endsWith('&')) { evaluated: type.endsWith('&') yes Evaluation Count:12 | yes Evaluation Count:892 |
| 12-892 |
97 | QByteArray basictype = type; | - |
98 | basictype.truncate(type.length() - 1); | - |
99 | | - |
100 | int id = QMetaType::type(basictype); | - |
101 | if (id == 0) { partially evaluated: id == 0 no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
102 | | - |
103 | | - |
104 | return -1; never executed: return -1; | 0 |
105 | } else if (QDBusMetaType::typeToSignature(id) == 0) partially evaluated: QDBusMetaType::typeToSignature(id) == 0 no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
106 | return -1; never executed: return -1; | 0 |
107 | | - |
108 | metaTypes.append( id ); | - |
109 | seenMessage = true; | - |
110 | continue; executed: continue; Execution Count:12 | 12 |
111 | } | - |
112 | | - |
113 | if (seenMessage) { partially evaluated: seenMessage no Evaluation Count:0 | yes Evaluation Count:892 |
| 0-892 |
114 | | - |
115 | | - |
116 | return -1; never executed: return -1; | 0 |
117 | } | - |
118 | | - |
119 | int id = QMetaType::type(type); | - |
120 | if (id == QMetaType::UnknownType) { evaluated: id == QMetaType::UnknownType yes Evaluation Count:5 | yes Evaluation Count:887 |
| 5-887 |
121 | | - |
122 | | - |
123 | return -1; executed: return -1; Execution Count:5 | 5 |
124 | } | - |
125 | | - |
126 | if (id == QDBusMetaTypeId::message()) evaluated: id == QDBusMetaTypeId::message() yes Evaluation Count:204 | yes Evaluation Count:683 |
| 204-683 |
127 | seenMessage = true; executed: seenMessage = true; Execution Count:204 | 204 |
128 | else if (QDBusMetaType::typeToSignature(id) == 0) partially evaluated: QDBusMetaType::typeToSignature(id) == 0 no Evaluation Count:0 | yes Evaluation Count:683 |
| 0-683 |
129 | return -1; never executed: return -1; | 0 |
130 | | - |
131 | metaTypes.append(id); | - |
132 | ++inputCount; | - |
133 | } executed: } Execution Count:887 | 887 |
134 | | - |
135 | return inputCount; executed: return inputCount; Execution Count:1409 | 1409 |
136 | } | - |
137 | | - |
138 | | - |
139 | | - |
| | |