OpenCoverage

qtldurl.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qtldurl.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4static bool containsTLDEntry(const QStringRef &entry)-
5{-
6 int index = qt_hash(entry) % tldCount;-
7-
8-
9 short chunk = 0;-
10 uint chunkIndex = tldIndices[index], offset = 0;-
11 while (chunk < tldChunkCount
chunk < tldChunkCountDescription
TRUEevaluated 899 times by 3 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
FALSEnever evaluated
&& tldIndices[index] >= tldChunks[chunk]
tldIndices[ind...dChunks[chunk]Description
TRUEevaluated 135 times by 3 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
FALSEevaluated 764 times by 3 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
) {
0-899
12 chunkIndex -= tldChunks[chunk];-
13 offset += tldChunks[chunk];-
14 chunk++;-
15 }
executed 135 times by 3 tests: end of block
Executed by:
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
135
16-
17-
18 while (chunkIndex < tldIndices[index+1] - offset
chunkIndex < t...ex+1] - offsetDescription
TRUEevaluated 640 times by 3 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
FALSEevaluated 656 times by 3 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
) {
640-656
19 QString currentEntry = QString::fromUtf8(tldData[chunk] + chunkIndex);-
20 if (currentEntry == entry
currentEntry == entryDescription
TRUEevaluated 108 times by 2 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QUrl
FALSEevaluated 532 times by 3 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
)
108-532
21 return
executed 108 times by 2 tests: return true;
Executed by:
  • tst_QNetworkCookieJar
  • tst_QUrl
true;
executed 108 times by 2 tests: return true;
Executed by:
  • tst_QNetworkCookieJar
  • tst_QUrl
108
22 chunkIndex += qstrlen(tldData[chunk] + chunkIndex) + 1;-
23 }
executed 532 times by 3 tests: end of block
Executed by:
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
532
24 return
executed 656 times by 3 tests: return false;
Executed by:
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
false;
executed 656 times by 3 tests: return false;
Executed by:
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
656
25}-
26-
27static inline bool containsTLDEntry(const QString &entry)-
28{-
29 return
executed 336 times by 3 tests: return containsTLDEntry(QStringRef(&entry));
Executed by:
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
containsTLDEntry(QStringRef(&entry));
executed 336 times by 3 tests: return containsTLDEntry(QStringRef(&entry));
Executed by:
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
336
30}-
31__attribute__((visibility("default"))) QString qTopLevelDomain(const QString &domain)-
32{-
33 const QString domainLower = domain.toLower();-
34 QVector<QStringRef> sections = domainLower.splitRef(QLatin1Char('.'), QString::SkipEmptyParts);-
35 if (sections.isEmpty()
sections.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_QUrl
)
0-36
36 return
never executed: return QString();
QString();
never executed: return QString();
0
37-
38 QString level, tld;-
39 for (int j = sections.count() - 1; j >= 0
j >= 0Description
TRUEevaluated 136 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_QUrl
; --j) {
36-136
40 level.prepend(QLatin1Char('.') + sections.at(j));-
41 if (qIsEffectiveTLD(level.rightRef(level.size() - 1))
qIsEffectiveTL...l.size() - 1))Description
TRUEevaluated 74 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 62 times by 1 test
Evaluated by:
  • tst_QUrl
)
62-74
42 tld = level;
executed 74 times by 1 test: tld = level;
Executed by:
  • tst_QUrl
74
43 }
executed 136 times by 1 test: end of block
Executed by:
  • tst_QUrl
136
44 return
executed 36 times by 1 test: return tld;
Executed by:
  • tst_QUrl
tld;
executed 36 times by 1 test: return tld;
Executed by:
  • tst_QUrl
36
45}-
46-
47-
48-
49-
50-
51-
52-
53__attribute__((visibility("default"))) bool qIsEffectiveTLD(const QStringRef &domain)-
54{-
55-
56-
57 if (containsTLDEntry(domain)
containsTLDEntry(domain)Description
TRUEevaluated 98 times by 2 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QUrl
FALSEevaluated 330 times by 3 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
)
98-330
58 return
executed 98 times by 2 tests: return true;
Executed by:
  • tst_QNetworkCookieJar
  • tst_QUrl
true;
executed 98 times by 2 tests: return true;
Executed by:
  • tst_QNetworkCookieJar
  • tst_QUrl
98
59-
60 const int dot = domain.indexOf(QLatin1Char('.'));-
61 if (dot >= 0
dot >= 0Description
TRUEevaluated 327 times by 3 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QNetworkCookieJar
) {
3-327
62 int count = domain.size() - dot;-
63 QString wildCardDomain = QLatin1Char('*') + domain.right(count);-
64-
65-
66 if (containsTLDEntry(wildCardDomain)
containsTLDEnt...ildCardDomain)Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QNetworkCookieJar
FALSEevaluated 318 times by 3 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
) {
9-318
67 QString exceptionDomain = QLatin1Char('!') + domain;-
68 return
executed 9 times by 1 test: return (! containsTLDEntry(exceptionDomain));
Executed by:
  • tst_QNetworkCookieJar
(! containsTLDEntry(exceptionDomain));
executed 9 times by 1 test: return (! containsTLDEntry(exceptionDomain));
Executed by:
  • tst_QNetworkCookieJar
9
69 }-
70 }
executed 318 times by 3 tests: end of block
Executed by:
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
318
71 return
executed 321 times by 3 tests: return false;
Executed by:
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
false;
executed 321 times by 3 tests: return false;
Executed by:
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
321
72}-
73-
74-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9