qversionnumber.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qversionnumber.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12QVector<int> QVersionNumber::segments() const-
13{-
14 if (m_segments.isUsingPointer()
m_segments.isUsingPointer()Description
TRUEevaluated 135 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 311 times by 1 test
Evaluated by:
  • tst_QVersionNumber
)
135-311
15 return
executed 135 times by 1 test: return *m_segments.pointer_segments;
Executed by:
  • tst_QVersionNumber
*m_segments.pointer_segments;
executed 135 times by 1 test: return *m_segments.pointer_segments;
Executed by:
  • tst_QVersionNumber
135
16-
17 QVector<int> result;-
18 result.resize(segmentCount());-
19 for (int i = 0; i < segmentCount()
i < segmentCount()Description
TRUEevaluated 720 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 311 times by 1 test
Evaluated by:
  • tst_QVersionNumber
; ++i)
311-720
20 result[i] = segmentAt(i);
executed 720 times by 1 test: result[i] = segmentAt(i);
Executed by:
  • tst_QVersionNumber
720
21 return
executed 311 times by 1 test: return result;
Executed by:
  • tst_QVersionNumber
result;
executed 311 times by 1 test: return result;
Executed by:
  • tst_QVersionNumber
311
22}-
23QVersionNumber QVersionNumber::normalized() const-
24{-
25 int i;-
26 for (i = m_segments.size(); i
iDescription
TRUEevaluated 32 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QVersionNumber
; --i)
2-32
27 if (m_segments.at(i - 1) != 0
m_segments.at(i - 1) != 0Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_QVersionNumber
)
16
28 break;
executed 16 times by 1 test: break;
Executed by:
  • tst_QVersionNumber
16
29-
30 QVersionNumber result(*this);-
31 result.m_segments.resize(i);-
32 return
executed 18 times by 1 test: return result;
Executed by:
  • tst_QVersionNumber
result;
executed 18 times by 1 test: return result;
Executed by:
  • tst_QVersionNumber
18
33}-
34bool QVersionNumber::isPrefixOf(const QVersionNumber &other) const noexcept-
35{-
36 if (segmentCount() > other.segmentCount()
segmentCount()...segmentCount()Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 41 times by 1 test
Evaluated by:
  • tst_QVersionNumber
)
10-41
37 return
executed 10 times by 1 test: return false;
Executed by:
  • tst_QVersionNumber
false;
executed 10 times by 1 test: return false;
Executed by:
  • tst_QVersionNumber
10
38 for (int i = 0; i < segmentCount()
i < segmentCount()Description
TRUEevaluated 123 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 17 times by 1 test
Evaluated by:
  • tst_QVersionNumber
; ++i) {
17-123
39 if (segmentAt(i) != other.segmentAt(i)
segmentAt(i) !...r.segmentAt(i)Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 99 times by 1 test
Evaluated by:
  • tst_QVersionNumber
)
24-99
40 return
executed 24 times by 1 test: return false;
Executed by:
  • tst_QVersionNumber
false;
executed 24 times by 1 test: return false;
Executed by:
  • tst_QVersionNumber
24
41 }
executed 99 times by 1 test: end of block
Executed by:
  • tst_QVersionNumber
99
42 return
executed 17 times by 1 test: return true;
Executed by:
  • tst_QVersionNumber
true;
executed 17 times by 1 test: return true;
Executed by:
  • tst_QVersionNumber
17
43}-
44int QVersionNumber::compare(const QVersionNumber &v1, const QVersionNumber &v2) noexcept-
45{-
46 int commonlen;-
47-
48 if (__builtin_expect(!!(!v1.m_segments.isUsingPointer() && !v2.m_segments.isUsingPointer()), true)
__builtin_expe...nter()), true)Description
TRUEevaluated 324 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
FALSEevaluated 190 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
) {
190-324
49-
50 const qint8 *ptr1 = v1.m_segments.inline_segments + InlineSegmentStartIdx;-
51 const qint8 *ptr2 = v2.m_segments.inline_segments + InlineSegmentStartIdx;-
52 commonlen = qMin(v1.m_segments.size(),-
53 v2.m_segments.size());-
54 for (int i = 0; i < commonlen
i < commonlenDescription
TRUEevaluated 498 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
FALSEevaluated 237 times by 1 test
Evaluated by:
  • tst_QVersionNumber
; ++i)
237-498
55 if (int x = ptr1[i] - ptr2[i]
int x = ptr1[i] - ptr2[i]Description
TRUEevaluated 87 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
FALSEevaluated 411 times by 1 test
Evaluated by:
  • tst_QVersionNumber
)
87-411
56 return
executed 87 times by 2 tests: return x;
Executed by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
x;
executed 87 times by 2 tests: return x;
Executed by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
87
57 }
executed 237 times by 1 test: end of block
Executed by:
  • tst_QVersionNumber
else {
237
58 commonlen = qMin(v1.segmentCount(), v2.segmentCount());-
59 for (int i = 0; i < commonlen
i < commonlenDescription
TRUEevaluated 997 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
FALSEevaluated 104 times by 1 test
Evaluated by:
  • tst_QVersionNumber
; ++i) {
104-997
60 if (v1.segmentAt(i) != v2.segmentAt(i)
v1.segmentAt(i...2.segmentAt(i)Description
TRUEevaluated 86 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
FALSEevaluated 911 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
)
86-911
61 return
executed 86 times by 2 tests: return v1.segmentAt(i) - v2.segmentAt(i);
Executed by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
v1.segmentAt(i) - v2.segmentAt(i);
executed 86 times by 2 tests: return v1.segmentAt(i) - v2.segmentAt(i);
Executed by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
86
62 }
executed 911 times by 2 tests: end of block
Executed by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
911
63 }
executed 104 times by 1 test: end of block
Executed by:
  • tst_QVersionNumber
104
64-
65-
66-
67 if (v1.segmentCount() > commonlen
v1.segmentCount() > commonlenDescription
TRUEevaluated 70 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 271 times by 1 test
Evaluated by:
  • tst_QVersionNumber
) {
70-271
68-
69 if (v1.segmentAt(commonlen) != 0
v1.segmentAt(commonlen) != 0Description
TRUEevaluated 56 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_QVersionNumber
)
14-56
70 return
executed 56 times by 1 test: return v1.segmentAt(commonlen);
Executed by:
  • tst_QVersionNumber
v1.segmentAt(commonlen);
executed 56 times by 1 test: return v1.segmentAt(commonlen);
Executed by:
  • tst_QVersionNumber
56
71 else-
72 return
executed 14 times by 1 test: return 1;
Executed by:
  • tst_QVersionNumber
1;
executed 14 times by 1 test: return 1;
Executed by:
  • tst_QVersionNumber
14
73 } else if (v2.segmentCount() > commonlen
v2.segmentCount() > commonlenDescription
TRUEevaluated 70 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 201 times by 1 test
Evaluated by:
  • tst_QVersionNumber
) {
70-201
74-
75 if (v2.segmentAt(commonlen) != 0
v2.segmentAt(commonlen) != 0Description
TRUEevaluated 56 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_QVersionNumber
)
14-56
76 return
executed 56 times by 1 test: return -v2.segmentAt(commonlen);
Executed by:
  • tst_QVersionNumber
-v2.segmentAt(commonlen);
executed 56 times by 1 test: return -v2.segmentAt(commonlen);
Executed by:
  • tst_QVersionNumber
56
77 else-
78 return
executed 14 times by 1 test: return -1;
Executed by:
  • tst_QVersionNumber
-1;
executed 14 times by 1 test: return -1;
Executed by:
  • tst_QVersionNumber
14
79 }-
80-
81-
82 return
executed 201 times by 1 test: return 0;
Executed by:
  • tst_QVersionNumber
0;
executed 201 times by 1 test: return 0;
Executed by:
  • tst_QVersionNumber
201
83}-
84QVersionNumber QVersionNumber::commonPrefix(const QVersionNumber &v1,-
85 const QVersionNumber &v2)-
86{-
87 int commonlen = qMin(v1.segmentCount(), v2.segmentCount());-
88 int i;-
89 for (i = 0; i < commonlen
i < commonlenDescription
TRUEevaluated 150 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 27 times by 1 test
Evaluated by:
  • tst_QVersionNumber
; ++i) {
27-150
90 if (v1.segmentAt(i) != v2.segmentAt(i)
v1.segmentAt(i...2.segmentAt(i)Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 126 times by 1 test
Evaluated by:
  • tst_QVersionNumber
)
24-126
91 break;
executed 24 times by 1 test: break;
Executed by:
  • tst_QVersionNumber
24
92 }
executed 126 times by 1 test: end of block
Executed by:
  • tst_QVersionNumber
126
93-
94 if (i == 0
i == 0Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_QVersionNumber
)
15-36
95 return
executed 15 times by 1 test: return QVersionNumber();
Executed by:
  • tst_QVersionNumber
QVersionNumber();
executed 15 times by 1 test: return QVersionNumber();
Executed by:
  • tst_QVersionNumber
15
96-
97-
98 QVersionNumber result(!v1.m_segments.isUsingPointer() ? v1 : v2);-
99 result.m_segments.resize(i);-
100 return
executed 36 times by 1 test: return result;
Executed by:
  • tst_QVersionNumber
result;
executed 36 times by 1 test: return result;
Executed by:
  • tst_QVersionNumber
36
101}-
102QString QVersionNumber::toString() const-
103{-
104 QString version;-
105 version.reserve(qMax(segmentCount() * 2 - 1, 0));-
106 bool first = true;-
107 for (int i = 0; i < segmentCount()
i < segmentCount()Description
TRUEevaluated 140 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 40 times by 1 test
Evaluated by:
  • tst_QVersionNumber
; ++i) {
40-140
108 if (!first
!firstDescription
TRUEevaluated 105 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 35 times by 1 test
Evaluated by:
  • tst_QVersionNumber
)
35-105
109 version += QLatin1Char('.');
executed 105 times by 1 test: version += QLatin1Char('.');
Executed by:
  • tst_QVersionNumber
105
110 version += QString::number(segmentAt(i));-
111 first = false;-
112 }
executed 140 times by 1 test: end of block
Executed by:
  • tst_QVersionNumber
140
113 return
executed 40 times by 1 test: return version;
Executed by:
  • tst_QVersionNumber
version;
executed 40 times by 1 test: return version;
Executed by:
  • tst_QVersionNumber
40
114}-
115QVersionNumber QVersionNumber::fromString(const QString &string, int *suffixIndex)-
116{-
117 QVector<int> seg;-
118-
119 const QByteArray cString(string.toLatin1());-
120-
121 const char *start = cString.constData();-
122 const char *end = start;-
123 const char *lastGoodEnd = start;-
124 const char *endOfString = cString.constData() + cString.size();-
125-
126 do {-
127 bool ok = false;-
128 const qulonglong value = qstrtoull(start, &end, 10, &ok);-
129 if (!ok
!okDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 296 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
|| value > qulonglong(std::numeric_limits<int>::max())
value > qulong...s<int>::max())Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 292 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
)
4-296
130 break;
executed 28 times by 1 test: break;
Executed by:
  • tst_QVersionNumber
28
131 seg.append(int(value));-
132 start = end + 1;-
133 lastGoodEnd = end;-
134 }
executed 292 times by 2 tests: end of block
Executed by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
while (start < endOfString
start < endOfStringDescription
TRUEevaluated 267 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
FALSEevaluated 25 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
&& (end < endOfString
end < endOfStringDescription
TRUEevaluated 267 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
FALSEnever evaluated
&& *
*end == '.'Description
TRUEevaluated 231 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_QVersionNumber
end == '.'
*end == '.'Description
TRUEevaluated 231 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_QVersionNumber
));
0-292
135-
136 if (suffixIndex
suffixIndexDescription
TRUEevaluated 41 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 48 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
)
41-48
137 *
executed 41 times by 1 test: *suffixIndex = int(lastGoodEnd - cString.constData());
Executed by:
  • tst_QVersionNumber
suffixIndex = int(lastGoodEnd - cString.constData());
executed 41 times by 1 test: *suffixIndex = int(lastGoodEnd - cString.constData());
Executed by:
  • tst_QVersionNumber
41
138-
139 return
executed 89 times by 2 tests: return QVersionNumber(std::move(seg));
Executed by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
QVersionNumber(std::move(seg));
executed 89 times by 2 tests: return QVersionNumber(std::move(seg));
Executed by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
89
140}-
141-
142void QVersionNumber::SegmentStorage::setVector(int len, int maj, int min, int mic)-
143{-
144 pointer_segments = new QVector<int>;-
145 pointer_segments->resize(len);-
146 pointer_segments->data()[0] = maj;-
147 if (len > 1
len > 1Description
TRUEevaluated 171 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_QVersionNumber
) {
36-171
148 pointer_segments->data()[1] = min;-
149 if (len > 2
len > 2Description
TRUEevaluated 81 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 90 times by 1 test
Evaluated by:
  • tst_QVersionNumber
) {
81-90
150 pointer_segments->data()[2] = mic;-
151 }
executed 81 times by 1 test: end of block
Executed by:
  • tst_QVersionNumber
81
152 }
executed 171 times by 1 test: end of block
Executed by:
  • tst_QVersionNumber
171
153}
executed 207 times by 1 test: end of block
Executed by:
  • tst_QVersionNumber
207
154QDataStream& operator<<(QDataStream &out, const QVersionNumber &version)-
155{-
156 out << version.segments();-
157 return
executed 37 times by 1 test: return out;
Executed by:
  • tst_QVersionNumber
out;
executed 37 times by 1 test: return out;
Executed by:
  • tst_QVersionNumber
37
158}-
159QDataStream& operator>>(QDataStream &in, QVersionNumber &version)-
160{-
161 if (!version.m_segments.isUsingPointer()
!version.m_seg...UsingPointer()Description
TRUEevaluated 37 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEnever evaluated
)
0-37
162 version.m_segments.pointer_segments = new QVector<int>;
executed 37 times by 1 test: version.m_segments.pointer_segments = new QVector<int>;
Executed by:
  • tst_QVersionNumber
37
163 in >> *version.m_segments.pointer_segments;-
164 return
executed 37 times by 1 test: return in;
Executed by:
  • tst_QVersionNumber
in;
executed 37 times by 1 test: return in;
Executed by:
  • tst_QVersionNumber
37
165}-
166-
167-
168-
169QDebug operator<<(QDebug debug, const QVersionNumber &version)-
170{-
171 QDebugStateSaver saver(debug);-
172 debug.noquote() << version.toString();-
173 return
never executed: return debug;
debug;
never executed: return debug;
0
174}-
175uint qHash(const QVersionNumber &key, uint seed)-
176{-
177 QtPrivate::QHashCombine hash;-
178 for (int i = 0; i < key.segmentCount()
i < key.segmentCount()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
179 seed = hash(seed, key.segmentAt(i));
never executed: seed = hash(seed, key.segmentAt(i));
0
180 return
never executed: return seed;
seed;
never executed: return seed;
0
181}-
182-
183-
Switch to Source codePreprocessed file

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