mimetypes/qmimemagicrule.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtCore module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42 -
43#define QT_NO_CAST_FROM_ASCII -
44 -
45#include "qmimemagicrule_p.h" -
46 -
47#include <QtCore/QList> -
48#include <QtCore/QDebug> -
49#include <qendian.h> -
50 -
51QT_BEGIN_NAMESPACE -
52 -
53// in the same order as Type! -
54static const char magicRuleTypes_string[] = -
55 "invalid\0" -
56 "string\0" -
57 "host16\0" -
58 "host32\0" -
59 "big16\0" -
60 "big32\0" -
61 "little16\0" -
62 "little32\0" -
63 "byte\0" -
64 "\0"; -
65 -
66static const int magicRuleTypes_indices[] = { -
67 0, 8, 15, 22, 29, 35, 41, 50, 59, 65, 0 -
68}; -
69 -
70QMimeMagicRule::Type QMimeMagicRule::type(const QByteArray &theTypeName) -
71{ -
72 for (int i = String; i <= Byte; ++i) {
never evaluated: i <= Byte
0
73 if (theTypeName == magicRuleTypes_string + magicRuleTypes_indices[i])
never evaluated: theTypeName == magicRuleTypes_string + magicRuleTypes_indices[i]
0
74 return Type(i);
never executed: return Type(i);
0
75 }
never executed: }
0
76 return Invalid;
never executed: return Invalid;
0
77} -
78 -
79QByteArray QMimeMagicRule::typeName(QMimeMagicRule::Type theType) -
80{ -
81 return magicRuleTypes_string + magicRuleTypes_indices[theType];
never executed: return magicRuleTypes_string + magicRuleTypes_indices[theType];
0
82} -
83 -
84class QMimeMagicRulePrivate -
85{ -
86public: -
87 bool operator==(const QMimeMagicRulePrivate &other) const; -
88 -
89 QMimeMagicRule::Type type; -
90 QByteArray value; -
91 int startPos; -
92 int endPos; -
93 QByteArray mask; -
94 -
95 QByteArray pattern; -
96 quint32 number; -
97 quint32 numberMask; -
98 -
99 typedef bool (*MatchFunction)(const QMimeMagicRulePrivate *d, const QByteArray &data); -
100 MatchFunction matchFunction; -
101}; -
102 -
103bool QMimeMagicRulePrivate::operator==(const QMimeMagicRulePrivate &other) const -
104{ -
105 return type == other.type &&
never executed: return type == other.type && value == other.value && startPos == other.startPos && endPos == other.endPos && mask == other.mask && pattern == other.pattern && number == other.number && numberMask == other.numberMask && matchFunction == other.matchFunction;
0
106 value == other.value &&
never executed: return type == other.type && value == other.value && startPos == other.startPos && endPos == other.endPos && mask == other.mask && pattern == other.pattern && number == other.number && numberMask == other.numberMask && matchFunction == other.matchFunction;
0
107 startPos == other.startPos &&
never executed: return type == other.type && value == other.value && startPos == other.startPos && endPos == other.endPos && mask == other.mask && pattern == other.pattern && number == other.number && numberMask == other.numberMask && matchFunction == other.matchFunction;
0
108 endPos == other.endPos &&
never executed: return type == other.type && value == other.value && startPos == other.startPos && endPos == other.endPos && mask == other.mask && pattern == other.pattern && number == other.number && numberMask == other.numberMask && matchFunction == other.matchFunction;
0
109 mask == other.mask &&
never executed: return type == other.type && value == other.value && startPos == other.startPos && endPos == other.endPos && mask == other.mask && pattern == other.pattern && number == other.number && numberMask == other.numberMask && matchFunction == other.matchFunction;
0
110 pattern == other.pattern &&
never executed: return type == other.type && value == other.value && startPos == other.startPos && endPos == other.endPos && mask == other.mask && pattern == other.pattern && number == other.number && numberMask == other.numberMask && matchFunction == other.matchFunction;
0
111 number == other.number &&
never executed: return type == other.type && value == other.value && startPos == other.startPos && endPos == other.endPos && mask == other.mask && pattern == other.pattern && number == other.number && numberMask == other.numberMask && matchFunction == other.matchFunction;
0
112 numberMask == other.numberMask &&
never executed: return type == other.type && value == other.value && startPos == other.startPos && endPos == other.endPos && mask == other.mask && pattern == other.pattern && number == other.number && numberMask == other.numberMask && matchFunction == other.matchFunction;
0
113 matchFunction == other.matchFunction;
never executed: return type == other.type && value == other.value && startPos == other.startPos && endPos == other.endPos && mask == other.mask && pattern == other.pattern && number == other.number && numberMask == other.numberMask && matchFunction == other.matchFunction;
0
114} -
115 -
116// Used by both providers -
117bool QMimeMagicRule::matchSubstring(const char *dataPtr, int dataSize, int rangeStart, int rangeLength, -
118 int valueLength, const char *valueData, const char *mask) -
119{ -
120 // Size of searched data. -
121 // Example: value="ABC", rangeLength=3 -> we need 3+3-1=5 bytes (ABCxx,xABCx,xxABC would match) -
122 const int dataNeeded = qMin(rangeLength + valueLength - 1, dataSize - rangeStart);
executed (the execution status of this line is deduced): const int dataNeeded = qMin(rangeLength + valueLength - 1, dataSize - rangeStart);
-
123 -
124 if (!mask) {
evaluated: !mask
TRUEFALSE
yes
Evaluation Count:8252
yes
Evaluation Count:180
180-8252
125 // callgrind says QByteArray::indexOf is much slower, since our strings are typically too -
126 // short for be worth Boyer-Moore matching (1 to 71 bytes, 11 bytes on average). -
127 bool found = false;
executed (the execution status of this line is deduced): bool found = false;
-
128 for (int i = rangeStart; i < rangeStart + rangeLength; ++i) {
evaluated: i < rangeStart + rangeLength
TRUEFALSE
yes
Evaluation Count:37617
yes
Evaluation Count:5204
5204-37617
129 if (i + valueLength > dataSize)
evaluated: i + valueLength > dataSize
TRUEFALSE
yes
Evaluation Count:3008
yes
Evaluation Count:34609
3008-34609
130 break;
executed: break;
Execution Count:3008
3008
131 -
132 if (memcmp(valueData, dataPtr + i, valueLength) == 0) {
evaluated: memcmp(valueData, dataPtr + i, valueLength) == 0
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:34569
40-34569
133 found = true;
executed (the execution status of this line is deduced): found = true;
-
134 break;
executed: break;
Execution Count:40
40
135 } -
136 }
executed: }
Execution Count:34569
34569
137 if (!found)
evaluated: !found
TRUEFALSE
yes
Evaluation Count:8212
yes
Evaluation Count:40
40-8212
138 return false;
executed: return false;
Execution Count:8212
8212
139 } else {
executed: }
Execution Count:40
40
140 bool found = false;
executed (the execution status of this line is deduced): bool found = false;
-
141 const char *readDataBase = dataPtr + rangeStart;
executed (the execution status of this line is deduced): const char *readDataBase = dataPtr + rangeStart;
-
142 // Example (continued from above): -
143 // deviceSize is 4, so dataNeeded was max'ed to 4. -
144 // maxStartPos = 4 - 3 + 1 = 2, and indeed -
145 // we need to check for a match a positions 0 and 1 (ABCx and xABC). -
146 const int maxStartPos = dataNeeded - valueLength + 1;
executed (the execution status of this line is deduced): const int maxStartPos = dataNeeded - valueLength + 1;
-
147 for (int i = 0; i < maxStartPos; ++i) {
evaluated: i < maxStartPos
TRUEFALSE
yes
Evaluation Count:128
yes
Evaluation Count:180
128-180
148 const char *d = readDataBase + i;
executed (the execution status of this line is deduced): const char *d = readDataBase + i;
-
149 bool valid = true;
executed (the execution status of this line is deduced): bool valid = true;
-
150 for (int idx = 0; idx < valueLength; ++idx) {
partially evaluated: idx < valueLength
TRUEFALSE
yes
Evaluation Count:192
no
Evaluation Count:0
0-192
151 if (((*d++) & mask[idx]) != (valueData[idx] & mask[idx])) {
evaluated: ((*d++) & mask[idx]) != (valueData[idx] & mask[idx])
TRUEFALSE
yes
Evaluation Count:128
yes
Evaluation Count:64
64-128
152 valid = false;
executed (the execution status of this line is deduced): valid = false;
-
153 break;
executed: break;
Execution Count:128
128
154 } -
155 }
executed: }
Execution Count:64
64
156 if (valid)
partially evaluated: valid
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:128
0-128
157 found = true;
never executed: found = true;
0
158 }
executed: }
Execution Count:128
128
159 if (!found)
partially evaluated: !found
TRUEFALSE
yes
Evaluation Count:180
no
Evaluation Count:0
0-180
160 return false;
executed: return false;
Execution Count:180
180
161 }
never executed: }
0
162 //qDebug() << "Found" << value << "in" << searchedData; -
163 return true;
executed: return true;
Execution Count:40
40
164} -
165 -
166static bool matchString(const QMimeMagicRulePrivate *d, const QByteArray &data) -
167{ -
168 const int rangeLength = d->endPos - d->startPos + 1;
never executed (the execution status of this line is deduced): const int rangeLength = d->endPos - d->startPos + 1;
-
169 return QMimeMagicRule::matchSubstring(data.constData(), data.size(), d->startPos, rangeLength, d->pattern.size(), d->pattern.constData(), d->mask.constData());
never executed: return QMimeMagicRule::matchSubstring(data.constData(), data.size(), d->startPos, rangeLength, d->pattern.size(), d->pattern.constData(), d->mask.constData());
0
170} -
171 -
172template <typename T> -
173static bool matchNumber(const QMimeMagicRulePrivate *d, const QByteArray &data) -
174{ -
175 const T value(d->number);
never executed (the execution status of this line is deduced): const T value(d->number);
-
176 const T mask(d->numberMask);
never executed (the execution status of this line is deduced): const T mask(d->numberMask);
-
177 -
178 //qDebug() << "matchNumber" << "0x" << QString::number(d->number, 16) << "size" << sizeof(T); -
179 //qDebug() << "mask" << QString::number(d->numberMask, 16); -
180 -
181 const char *p = data.constData() + d->startPos;
never executed (the execution status of this line is deduced): const char *p = data.constData() + d->startPos;
-
182 const char *e = data.constData() + qMin(data.size() - int(sizeof(T)), d->endPos + 1);
never executed (the execution status of this line is deduced): const char *e = data.constData() + qMin(data.size() - int(sizeof(T)), d->endPos + 1);
-
183 for ( ; p <= e; ++p) {
never evaluated: p <= e
0
184 if ((*reinterpret_cast<const T*>(p) & mask) == (value & mask))
never evaluated: (*reinterpret_cast<const T*>(p) & mask) == (value & mask)
0
185 return true;
never executed: return true;
0
186 }
never executed: }
0
187 -
188 return false;
never executed: return false;
0
189} -
190 -
191static inline QByteArray makePattern(const QByteArray &value) -
192{ -
193 QByteArray pattern(value.size(), Qt::Uninitialized);
never executed (the execution status of this line is deduced): QByteArray pattern(value.size(), Qt::Uninitialized);
-
194 char *data = pattern.data();
never executed (the execution status of this line is deduced): char *data = pattern.data();
-
195 -
196 const char *p = value.constData();
never executed (the execution status of this line is deduced): const char *p = value.constData();
-
197 const char *e = p + value.size();
never executed (the execution status of this line is deduced): const char *e = p + value.size();
-
198 for ( ; p < e; ++p) {
never evaluated: p < e
0
199 if (*p == '\\' && ++p < e) {
never evaluated: *p == '\\'
never evaluated: ++p < e
0
200 if (*p == 'x') { // hex (\\xff)
never evaluated: *p == 'x'
0
201 char c = 0;
never executed (the execution status of this line is deduced): char c = 0;
-
202 for (int i = 0; i < 2 && p + 1 < e; ++i) {
never evaluated: i < 2
never evaluated: p + 1 < e
0
203 ++p;
never executed (the execution status of this line is deduced): ++p;
-
204 if (*p >= '0' && *p <= '9')
never evaluated: *p >= '0'
never evaluated: *p <= '9'
0
205 c = (c << 4) + *p - '0';
never executed: c = (c << 4) + *p - '0';
0
206 else if (*p >= 'a' && *p <= 'f')
never evaluated: *p >= 'a'
never evaluated: *p <= 'f'
0
207 c = (c << 4) + *p - 'a' + 10;
never executed: c = (c << 4) + *p - 'a' + 10;
0
208 else if (*p >= 'A' && *p <= 'F')
never evaluated: *p >= 'A'
never evaluated: *p <= 'F'
0
209 c = (c << 4) + *p - 'A' + 10;
never executed: c = (c << 4) + *p - 'A' + 10;
0
210 else -
211 continue;
never executed: continue;
0
212 } -
213 *data++ = c;
never executed (the execution status of this line is deduced): *data++ = c;
-
214 } else if (*p >= '0' && *p <= '7') { // oct (\\7, or \\77, or \\377)
never executed: }
never evaluated: *p >= '0'
never evaluated: *p <= '7'
0
215 char c = *p - '0';
never executed (the execution status of this line is deduced): char c = *p - '0';
-
216 if (p + 1 < e && p[1] >= '0' && p[1] <= '7') {
never evaluated: p + 1 < e
never evaluated: p[1] >= '0'
never evaluated: p[1] <= '7'
0
217 c = (c << 3) + *(++p) - '0';
never executed (the execution status of this line is deduced): c = (c << 3) + *(++p) - '0';
-
218 if (p + 1 < e && p[1] >= '0' && p[1] <= '7' && p[-1] <= '3')
never evaluated: p + 1 < e
never evaluated: p[1] >= '0'
never evaluated: p[1] <= '7'
never evaluated: p[-1] <= '3'
0
219 c = (c << 3) + *(++p) - '0';
never executed: c = (c << 3) + *(++p) - '0';
0
220 }
never executed: }
0
221 *data++ = c;
never executed (the execution status of this line is deduced): *data++ = c;
-
222 } else if (*p == 'n') {
never executed: }
never evaluated: *p == 'n'
0
223 *data++ = '\n';
never executed (the execution status of this line is deduced): *data++ = '\n';
-
224 } else if (*p == 'r') {
never executed: }
never evaluated: *p == 'r'
0
225 *data++ = '\r';
never executed (the execution status of this line is deduced): *data++ = '\r';
-
226 } else { // escaped
never executed: }
0
227 *data++ = *p;
never executed (the execution status of this line is deduced): *data++ = *p;
-
228 }
never executed: }
0
229 } else { -
230 *data++ = *p;
never executed (the execution status of this line is deduced): *data++ = *p;
-
231 }
never executed: }
0
232 } -
233 pattern.truncate(data - pattern.data());
never executed (the execution status of this line is deduced): pattern.truncate(data - pattern.data());
-
234 -
235 return pattern;
never executed: return pattern;
0
236} -
237 -
238QMimeMagicRule::QMimeMagicRule(QMimeMagicRule::Type theType, -
239 const QByteArray &theValue, -
240 int theStartPos, -
241 int theEndPos, -
242 const QByteArray &theMask) : -
243 d(new QMimeMagicRulePrivate) -
244{ -
245 Q_ASSERT(!theValue.isEmpty());
never executed (the execution status of this line is deduced): qt_noop();
-
246 -
247 d->type = theType;
never executed (the execution status of this line is deduced): d->type = theType;
-
248 d->value = theValue;
never executed (the execution status of this line is deduced): d->value = theValue;
-
249 d->startPos = theStartPos;
never executed (the execution status of this line is deduced): d->startPos = theStartPos;
-
250 d->endPos = theEndPos;
never executed (the execution status of this line is deduced): d->endPos = theEndPos;
-
251 d->mask = theMask;
never executed (the execution status of this line is deduced): d->mask = theMask;
-
252 d->matchFunction = 0;
never executed (the execution status of this line is deduced): d->matchFunction = 0;
-
253 -
254 if (d->type >= Host16 && d->type <= Byte) {
never evaluated: d->type >= Host16
never evaluated: d->type <= Byte
0
255 bool ok;
never executed (the execution status of this line is deduced): bool ok;
-
256 d->number = d->value.toUInt(&ok, 0); // autodetect
never executed (the execution status of this line is deduced): d->number = d->value.toUInt(&ok, 0);
-
257 Q_ASSERT(ok);
never executed (the execution status of this line is deduced): qt_noop();
-
258 d->numberMask = !d->mask.isEmpty() ? d->mask.toUInt(&ok, 0) : 0; // autodetect
never evaluated: !d->mask.isEmpty()
0
259 }
never executed: }
0
260 -
261 switch (d->type) { -
262 case String: -
263 d->pattern = makePattern(d->value);
never executed (the execution status of this line is deduced): d->pattern = makePattern(d->value);
-
264 d->pattern.squeeze();
never executed (the execution status of this line is deduced): d->pattern.squeeze();
-
265 if (!d->mask.isEmpty()) {
never evaluated: !d->mask.isEmpty()
0
266 Q_ASSERT(d->mask.size() >= 4 && d->mask.startsWith("0x"));
never executed (the execution status of this line is deduced): qt_noop();
-
267 d->mask = QByteArray::fromHex(QByteArray::fromRawData(d->mask.constData() + 2, d->mask.size() - 2));
never executed (the execution status of this line is deduced): d->mask = QByteArray::fromHex(QByteArray::fromRawData(d->mask.constData() + 2, d->mask.size() - 2));
-
268 Q_ASSERT(d->mask.size() == d->pattern.size());
never executed (the execution status of this line is deduced): qt_noop();
-
269 } else {
never executed: }
0
270 d->mask.fill(char(-1), d->pattern.size());
never executed (the execution status of this line is deduced): d->mask.fill(char(-1), d->pattern.size());
-
271 }
never executed: }
0
272 d->mask.squeeze();
never executed (the execution status of this line is deduced): d->mask.squeeze();
-
273 d->matchFunction = matchString;
never executed (the execution status of this line is deduced): d->matchFunction = matchString;
-
274 break;
never executed: break;
0
275 case Byte: -
276 if (d->number <= quint8(-1)) {
never evaluated: d->number <= quint8(-1)
0
277 if (d->numberMask == 0)
never evaluated: d->numberMask == 0
0
278 d->numberMask = quint8(-1);
never executed: d->numberMask = quint8(-1);
0
279 d->matchFunction = matchNumber<quint8>;
never executed (the execution status of this line is deduced): d->matchFunction = matchNumber<quint8>;
-
280 }
never executed: }
0
281 break;
never executed: break;
0
282 case Big16: -
283 case Host16: -
284 case Little16: -
285 if (d->number <= quint16(-1)) {
never evaluated: d->number <= quint16(-1)
0
286 d->number = d->type == Little16 ? qFromLittleEndian<quint16>(d->number) : qFromBigEndian<quint16>(d->number);
never evaluated: d->type == Little16
0
287 if (d->numberMask == 0)
never evaluated: d->numberMask == 0
0
288 d->numberMask = quint16(-1);
never executed: d->numberMask = quint16(-1);
0
289 d->matchFunction = matchNumber<quint16>;
never executed (the execution status of this line is deduced): d->matchFunction = matchNumber<quint16>;
-
290 }
never executed: }
0
291 break;
never executed: break;
0
292 case Big32: -
293 case Host32: -
294 case Little32: -
295 if (d->number <= quint32(-1)) {
never evaluated: d->number <= quint32(-1)
0
296 d->number = d->type == Little32 ? qFromLittleEndian<quint32>(d->number) : qFromBigEndian<quint32>(d->number);
never evaluated: d->type == Little32
0
297 if (d->numberMask == 0)
never evaluated: d->numberMask == 0
0
298 d->numberMask = quint32(-1);
never executed: d->numberMask = quint32(-1);
0
299 d->matchFunction = matchNumber<quint32>;
never executed (the execution status of this line is deduced): d->matchFunction = matchNumber<quint32>;
-
300 }
never executed: }
0
301 break;
never executed: break;
0
302 default: -
303 break;
never executed: break;
0
304 } -
305}
never executed: }
0
306 -
307QMimeMagicRule::QMimeMagicRule(const QMimeMagicRule &other) : -
308 d(new QMimeMagicRulePrivate(*other.d)) -
309{ -
310}
never executed: }
0
311 -
312QMimeMagicRule::~QMimeMagicRule() -
313{ -
314} -
315 -
316QMimeMagicRule &QMimeMagicRule::operator=(const QMimeMagicRule &other) -
317{ -
318 *d = *other.d;
never executed (the execution status of this line is deduced): *d = *other.d;
-
319 return *this;
never executed: return *this;
0
320} -
321 -
322bool QMimeMagicRule::operator==(const QMimeMagicRule &other) const -
323{ -
324 return d == other.d ||
never executed: return d == other.d || *d == *other.d;
0
325 *d == *other.d;
never executed: return d == other.d || *d == *other.d;
0
326} -
327 -
328QMimeMagicRule::Type QMimeMagicRule::type() const -
329{ -
330 return d->type;
never executed: return d->type;
0
331} -
332 -
333QByteArray QMimeMagicRule::value() const -
334{ -
335 return d->value;
never executed: return d->value;
0
336} -
337 -
338int QMimeMagicRule::startPos() const -
339{ -
340 return d->startPos;
never executed: return d->startPos;
0
341} -
342 -
343int QMimeMagicRule::endPos() const -
344{ -
345 return d->endPos;
never executed: return d->endPos;
0
346} -
347 -
348QByteArray QMimeMagicRule::mask() const -
349{ -
350 QByteArray result = d->mask;
never executed (the execution status of this line is deduced): QByteArray result = d->mask;
-
351 if (d->type == String) {
never evaluated: d->type == String
0
352 // restore '0x' -
353 result = "0x" + result.toHex();
never executed (the execution status of this line is deduced): result = "0x" + result.toHex();
-
354 }
never executed: }
0
355 return result;
never executed: return result;
0
356} -
357 -
358bool QMimeMagicRule::isValid() const -
359{ -
360 return d->matchFunction;
never executed: return d->matchFunction;
0
361} -
362 -
363bool QMimeMagicRule::matches(const QByteArray &data) const -
364{ -
365 const bool ok = d->matchFunction && d->matchFunction(d.data(), data);
never evaluated: d->matchFunction
never evaluated: d->matchFunction(d.data(), data)
0
366 if (!ok)
never evaluated: !ok
0
367 return false;
never executed: return false;
0
368 -
369 // No submatch? Then we are done. -
370 if (m_subMatches.isEmpty())
never evaluated: m_subMatches.isEmpty()
0
371 return true;
never executed: return true;
0
372 -
373 //qDebug() << "Checking" << m_subMatches.count() << "sub-rules"; -
374 // Check that one of the submatches matches too -
375 for ( QList<QMimeMagicRule>::const_iterator it = m_subMatches.begin(), end = m_subMatches.end() ;
never executed (the execution status of this line is deduced): for ( QList<QMimeMagicRule>::const_iterator it = m_subMatches.begin(), end = m_subMatches.end() ;
-
376 it != end ; ++it ) {
never evaluated: it != end
0
377 if ((*it).matches(data)) {
never evaluated: (*it).matches(data)
0
378 // One of the hierarchies matched -> mimetype recognized. -
379 return true;
never executed: return true;
0
380 } -
381 }
never executed: }
0
382 return false;
never executed: return false;
0
383 -
384 -
385} -
386 -
387QT_END_NAMESPACE -
388 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial