quuid.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/plugin/quuid.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7template <class Char, class Integral>-
8void _q_toHex(Char *&dst, Integral value)-
9{-
10 value = qToBigEndian(value);-
11-
12 const char* p = reinterpret_cast<const char*>(&value);-
13-
14 for (uint i = 0; i < sizeof(Integral)
i < sizeof(Integral)Description
TRUEevaluated 20576 times by 4 tests
Evaluated by:
  • tst_QRawFont
  • tst_QUuid
  • tst_QVariant
  • tst_quuid - unknown status
FALSEevaluated 14146 times by 4 tests
Evaluated by:
  • tst_QRawFont
  • tst_QUuid
  • tst_QVariant
  • tst_quuid - unknown status
; ++i, dst += 2) {
14146-20576
15 dst[0] = Char(QtMiscUtils::toHexLower((p[i] >> 4) & 0xf));-
16 dst[1] = Char(QtMiscUtils::toHexLower(p[i] & 0xf));-
17 }
executed 20576 times by 4 tests: end of block
Executed by:
  • tst_QRawFont
  • tst_QUuid
  • tst_QVariant
  • tst_quuid - unknown status
20576
18}
executed 14146 times by 4 tests: end of block
Executed by:
  • tst_QRawFont
  • tst_QUuid
  • tst_QVariant
  • tst_quuid - unknown status
14146
19-
20template <class Char, class Integral>-
21bool _q_fromHex(const Char *&src, Integral &value)-
22{-
23 value = 0;-
24-
25 for (uint i = 0; i < sizeof(Integral) * 2
i < sizeof(Integral) * 2Description
TRUEevaluated 810 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
FALSEevaluated 269 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
; ++i) {
269-810
26 uint ch = *src++;-
27 int tmp = QtMiscUtils::fromHex(ch);-
28 if (tmp == -1
tmp == -1Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUuid
FALSEevaluated 807 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
)
3-807
29 return
executed 3 times by 1 test: return false;
Executed by:
  • tst_QUuid
false;
executed 3 times by 1 test: return false;
Executed by:
  • tst_QUuid
3
30-
31 value = value * 16 + tmp;-
32 }
executed 807 times by 2 tests: end of block
Executed by:
  • tst_QUuid
  • tst_QVariant
807
33-
34 return
executed 269 times by 2 tests: return true;
Executed by:
  • tst_QUuid
  • tst_QVariant
true;
executed 269 times by 2 tests: return true;
Executed by:
  • tst_QUuid
  • tst_QVariant
269
35}-
36-
37template <class Char>-
38void _q_uuidToHex(Char *&dst, const uint &d1, const ushort &d2, const ushort &d3, const uchar (&d4)[8])-
39{-
40 *dst++ = Char('{');-
41 _q_toHex(dst, d1);-
42 *dst++ = Char('-');-
43 _q_toHex(dst, d2);-
44 *dst++ = Char('-');-
45 _q_toHex(dst, d3);-
46 *dst++ = Char('-');-
47 for (int i = 0; i < 2
i < 2Description
TRUEevaluated 2572 times by 4 tests
Evaluated by:
  • tst_QRawFont
  • tst_QUuid
  • tst_QVariant
  • tst_quuid - unknown status
FALSEevaluated 1286 times by 4 tests
Evaluated by:
  • tst_QRawFont
  • tst_QUuid
  • tst_QVariant
  • tst_quuid - unknown status
; i++)
1286-2572
48 _q_toHex(dst, d4[i]);
executed 2572 times by 4 tests: _q_toHex(dst, d4[i]);
Executed by:
  • tst_QRawFont
  • tst_QUuid
  • tst_QVariant
  • tst_quuid - unknown status
2572
49 *dst++ = Char('-');-
50 for (int i = 2; i < 8
i < 8Description
TRUEevaluated 7716 times by 4 tests
Evaluated by:
  • tst_QRawFont
  • tst_QUuid
  • tst_QVariant
  • tst_quuid - unknown status
FALSEevaluated 1286 times by 4 tests
Evaluated by:
  • tst_QRawFont
  • tst_QUuid
  • tst_QVariant
  • tst_quuid - unknown status
; i++)
1286-7716
51 _q_toHex(dst, d4[i]);
executed 7716 times by 4 tests: _q_toHex(dst, d4[i]);
Executed by:
  • tst_QRawFont
  • tst_QUuid
  • tst_QVariant
  • tst_quuid - unknown status
7716
52 *dst = Char('}');-
53}
executed 1286 times by 4 tests: end of block
Executed by:
  • tst_QRawFont
  • tst_QUuid
  • tst_QVariant
  • tst_quuid - unknown status
1286
54-
55template <class Char>-
56bool _q_uuidFromHex(const Char *&src, uint &d1, ushort &d2, ushort &d3, uchar (&d4)[8])-
57{-
58 if (*
*src == Char('{')Description
TRUEevaluated 19 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QUuid
src == Char('{')
*src == Char('{')Description
TRUEevaluated 19 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QUuid
)
9-19
59 src++;
executed 19 times by 2 tests: src++;
Executed by:
  • tst_QUuid
  • tst_QVariant
19
60 if (!_q_fromHex(src, d1)
!_q_fromHex(src, d1)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUuid
FALSEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
1-27
61 || *
*src++ != Char('-')Description
TRUEnever evaluated
FALSEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
src++ != Char('-')
*src++ != Char('-')Description
TRUEnever evaluated
FALSEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
0-27
62 || !_q_fromHex(src, d2)
!_q_fromHex(src, d2)Description
TRUEnever evaluated
FALSEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
0-27
63 || *
*src++ != Char('-')Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUuid
FALSEevaluated 25 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
src++ != Char('-')
*src++ != Char('-')Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUuid
FALSEevaluated 25 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
2-25
64 || !_q_fromHex(src, d3)
!_q_fromHex(src, d3)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUuid
FALSEevaluated 24 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
1-24
65 || *
*src++ != Char('-')Description
TRUEnever evaluated
FALSEevaluated 24 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
src++ != Char('-')
*src++ != Char('-')Description
TRUEnever evaluated
FALSEevaluated 24 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
0-24
66 || !_q_fromHex(src, d4[0])
!_q_fromHex(src, d4[0])Description
TRUEnever evaluated
FALSEevaluated 24 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
0-24
67 || !_q_fromHex(src, d4[1])
!_q_fromHex(src, d4[1])Description
TRUEnever evaluated
FALSEevaluated 24 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
0-24
68 || *
*src++ != Char('-')Description
TRUEnever evaluated
FALSEevaluated 24 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
src++ != Char('-')
*src++ != Char('-')Description
TRUEnever evaluated
FALSEevaluated 24 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
0-24
69 || !_q_fromHex(src, d4[2])
!_q_fromHex(src, d4[2])Description
TRUEnever evaluated
FALSEevaluated 24 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
0-24
70 || !_q_fromHex(src, d4[3])
!_q_fromHex(src, d4[3])Description
TRUEnever evaluated
FALSEevaluated 24 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
0-24
71 || !_q_fromHex(src, d4[4])
!_q_fromHex(src, d4[4])Description
TRUEnever evaluated
FALSEevaluated 24 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
0-24
72 || !_q_fromHex(src, d4[5])
!_q_fromHex(src, d4[5])Description
TRUEnever evaluated
FALSEevaluated 24 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
0-24
73 || !_q_fromHex(src, d4[6])
!_q_fromHex(src, d4[6])Description
TRUEnever evaluated
FALSEevaluated 24 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
0-24
74 || !_q_fromHex(src, d4[7])
!_q_fromHex(src, d4[7])Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUuid
FALSEevaluated 23 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
) {
1-23
75 return
executed 5 times by 1 test: return false;
Executed by:
  • tst_QUuid
false;
executed 5 times by 1 test: return false;
Executed by:
  • tst_QUuid
5
76 }-
77-
78 return
executed 23 times by 2 tests: return true;
Executed by:
  • tst_QUuid
  • tst_QVariant
true;
executed 23 times by 2 tests: return true;
Executed by:
  • tst_QUuid
  • tst_QVariant
23
79}-
80-
81-
82static QUuid createFromName(const QUuid &ns, const QByteArray &baseData, QCryptographicHash::Algorithm algorithm, int version)-
83{-
84 QByteArray hashResult;-
85-
86-
87 {-
88 QCryptographicHash hash(algorithm);-
89 hash.addData(ns.toRfc4122());-
90 hash.addData(baseData);-
91 hashResult = hash.result();-
92 }-
93 hashResult.resize(16);-
94-
95 QUuid result = QUuid::fromRfc4122(hashResult);-
96-
97 result.data3 &= 0x0FFF;-
98 result.data3 |= (version << 12);-
99 result.data4[0] &= 0x3F;-
100 result.data4[0] |= 0x80;-
101-
102 return
executed 4 times by 1 test: return result;
Executed by:
  • tst_QUuid
result;
executed 4 times by 1 test: return result;
Executed by:
  • tst_QUuid
4
103}-
104QUuid::QUuid(const QString &text)-
105{-
106 if (text.length() < 36
text.length() < 36Description
TRUEnever evaluated
FALSEevaluated 10 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
) {
0-10
107 *this = QUuid();-
108 return;
never executed: return;
0
109 }-
110-
111 const ushort *data = reinterpret_cast<const ushort *>(text.unicode());-
112-
113 if (*
*data == '{'Description
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUuid
data == '{'
*data == '{'Description
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUuid
&& text.length() < 37
text.length() < 37Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUuid
FALSEevaluated 7 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
) {
1-8
114 *this = QUuid();-
115 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QUuid
1
116 }-
117-
118 if (!_q_uuidFromHex(data, data1, data2, data3, data4)
!_q_uuidFromHe... data3, data4)Description
TRUEnever evaluated
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
) {
0-9
119 *this = QUuid();-
120 return;
never executed: return;
0
121 }-
122}
executed 9 times by 2 tests: end of block
Executed by:
  • tst_QUuid
  • tst_QVariant
9
123-
124-
125-
126-
127QUuid::QUuid(const char *text)-
128{-
129 if (!text
!textDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUuid
FALSEevaluated 14 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
) {
1-14
130 *this = QUuid();-
131 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QUuid
1
132 }-
133-
134 if (!_q_uuidFromHex(text, data1, data2, data3, data4)
!_q_uuidFromHe... data3, data4)Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QUuid
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QUuid
  • tst_QVariant
) {
5-9
135 *this = QUuid();-
136 return;
executed 5 times by 1 test: return;
Executed by:
  • tst_QUuid
5
137 }-
138}
executed 9 times by 2 tests: end of block
Executed by:
  • tst_QUuid
  • tst_QVariant
9
139QUuid::QUuid(const QByteArray &text)-
140{-
141 if (text.length() < 36
text.length() < 36Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUuid
) {
0-6
142 *this = QUuid();-
143 return;
never executed: return;
0
144 }-
145-
146 const char *data = text.constData();-
147-
148 if (*
*data == '{'Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUuid
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUuid
data == '{'
*data == '{'Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUuid
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUuid
&& text.length() < 37
text.length() < 37Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUuid
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUuid
) {
1-4
149 *this = QUuid();-
150 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QUuid
1
151 }-
152-
153 if (!_q_uuidFromHex(data, data1, data2, data3, data4)
!_q_uuidFromHe... data3, data4)Description
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QUuid
) {
0-5
154 *this = QUuid();-
155 return;
never executed: return;
0
156 }-
157}
executed 5 times by 1 test: end of block
Executed by:
  • tst_QUuid
5
158QUuid QUuid::createUuidV3(const QUuid &ns, const QByteArray &baseData)-
159{-
160 return
executed 2 times by 1 test: return createFromName(ns, baseData, QCryptographicHash::Md5, 3);
Executed by:
  • tst_QUuid
createFromName(ns, baseData, QCryptographicHash::Md5, 3);
executed 2 times by 1 test: return createFromName(ns, baseData, QCryptographicHash::Md5, 3);
Executed by:
  • tst_QUuid
2
161}-
162-
163QUuid QUuid::createUuidV5(const QUuid &ns, const QByteArray &baseData)-
164{-
165 return
executed 2 times by 1 test: return createFromName(ns, baseData, QCryptographicHash::Sha1, 5);
Executed by:
  • tst_QUuid
createFromName(ns, baseData, QCryptographicHash::Sha1, 5);
executed 2 times by 1 test: return createFromName(ns, baseData, QCryptographicHash::Sha1, 5);
Executed by:
  • tst_QUuid
2
166}-
167QUuid QUuid::fromRfc4122(const QByteArray &bytes)-
168{-
169 if (bytes.isEmpty()
bytes.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 10 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QUuid
  • tst_QVariant
|| bytes.length() != 16
bytes.length() != 16Description
TRUEnever evaluated
FALSEevaluated 10 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QUuid
  • tst_QVariant
)
0-10
170 return
never executed: return QUuid();
QUuid();
never executed: return QUuid();
0
171-
172 uint d1;-
173 ushort d2, d3;-
174 uchar d4[8];-
175-
176 const uchar *data = reinterpret_cast<const uchar *>(bytes.constData());-
177-
178 d1 = qFromBigEndian<quint32>(data);-
179 data += sizeof(quint32);-
180 d2 = qFromBigEndian<quint16>(data);-
181 data += sizeof(quint16);-
182 d3 = qFromBigEndian<quint16>(data);-
183 data += sizeof(quint16);-
184-
185 for (int i = 0; i < 8
i < 8Description
TRUEevaluated 80 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QUuid
  • tst_QVariant
FALSEevaluated 10 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QUuid
  • tst_QVariant
; ++i) {
10-80
186 d4[i] = *(data);-
187 data++;-
188 }
executed 80 times by 3 tests: end of block
Executed by:
  • tst_QMetaType
  • tst_QUuid
  • tst_QVariant
80
189-
190 return
executed 10 times by 3 tests: return QUuid(d1, d2, d3, d4[0], d4[1], d4[2], d4[3], d4[4], d4[5], d4[6], d4[7]);
Executed by:
  • tst_QMetaType
  • tst_QUuid
  • tst_QVariant
QUuid(d1, d2, d3, d4[0], d4[1], d4[2], d4[3], d4[4], d4[5], d4[6], d4[7]);
executed 10 times by 3 tests: return QUuid(d1, d2, d3, d4[0], d4[1], d4[2], d4[3], d4[4], d4[5], d4[6], d4[7]);
Executed by:
  • tst_QMetaType
  • tst_QUuid
  • tst_QVariant
10
191}-
192QString QUuid::toString() const-
193{-
194 QString result(38, Qt::Uninitialized);-
195 ushort *data = (ushort *)result.data();-
196-
197 _q_uuidToHex(data, data1, data2, data3, data4);-
198-
199 return
executed 34 times by 3 tests: return result;
Executed by:
  • tst_QUuid
  • tst_QVariant
  • tst_quuid - unknown status
result;
executed 34 times by 3 tests: return result;
Executed by:
  • tst_QUuid
  • tst_QVariant
  • tst_quuid - unknown status
34
200}-
201QByteArray QUuid::toByteArray() const-
202{-
203 QByteArray result(38, Qt::Uninitialized);-
204 char *data = result.data();-
205-
206 _q_uuidToHex(data, data1, data2, data3, data4);-
207-
208 return
executed 1252 times by 2 tests: return result;
Executed by:
  • tst_QRawFont
  • tst_QUuid
result;
executed 1252 times by 2 tests: return result;
Executed by:
  • tst_QRawFont
  • tst_QUuid
1252
209}-
210QByteArray QUuid::toRfc4122() const-
211{-
212-
213 QByteArray bytes(16, Qt::Uninitialized);-
214 uchar *data = reinterpret_cast<uchar*>(bytes.data());-
215-
216 qToBigEndian(data1, data);-
217 data += sizeof(quint32);-
218 qToBigEndian(data2, data);-
219 data += sizeof(quint16);-
220 qToBigEndian(data3, data);-
221 data += sizeof(quint16);-
222-
223 for (int i = 0; i < 8
i < 8Description
TRUEevaluated 72 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QUuid
  • tst_QVariant
FALSEevaluated 9 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QUuid
  • tst_QVariant
; ++i) {
9-72
224 *(data) = data4[i];-
225 data++;-
226 }
executed 72 times by 3 tests: end of block
Executed by:
  • tst_QMetaType
  • tst_QUuid
  • tst_QVariant
72
227-
228 return
executed 9 times by 3 tests: return bytes;
Executed by:
  • tst_QMetaType
  • tst_QUuid
  • tst_QVariant
bytes;
executed 9 times by 3 tests: return bytes;
Executed by:
  • tst_QMetaType
  • tst_QUuid
  • tst_QVariant
9
229}-
230-
231-
232-
233-
234-
235-
236QDataStream &operator<<(QDataStream &s, const QUuid &id)-
237{-
238 QByteArray bytes;-
239 if (s.byteOrder() == QDataStream::BigEndian
s.byteOrder() ...eam::BigEndianDescription
TRUEevaluated 3 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QUuid
  • tst_QVariant
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUuid
) {
1-3
240 bytes = id.toRfc4122();-
241 }
executed 3 times by 3 tests: end of block
Executed by:
  • tst_QMetaType
  • tst_QUuid
  • tst_QVariant
else {
3
242-
243 bytes = QByteArray(16, Qt::Uninitialized);-
244 uchar *data = reinterpret_cast<uchar*>(bytes.data());-
245-
246 qToLittleEndian(id.data1, data);-
247 data += sizeof(quint32);-
248 qToLittleEndian(id.data2, data);-
249 data += sizeof(quint16);-
250 qToLittleEndian(id.data3, data);-
251 data += sizeof(quint16);-
252-
253 for (int i = 0; i < 8
i < 8Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QUuid
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUuid
; ++i) {
1-8
254 *(data) = id.data4[i];-
255 data++;-
256 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_QUuid
8
257 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QUuid
1
258-
259 if (s.writeRawData(bytes.data(), 16) != 16
s.writeRawData...a(), 16) != 16Description
TRUEnever evaluated
FALSEevaluated 4 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QUuid
  • tst_QVariant
) {
0-4
260 s.setStatus(QDataStream::WriteFailed);-
261 }
never executed: end of block
0
262 return
executed 4 times by 3 tests: return s;
Executed by:
  • tst_QMetaType
  • tst_QUuid
  • tst_QVariant
s;
executed 4 times by 3 tests: return s;
Executed by:
  • tst_QMetaType
  • tst_QUuid
  • tst_QVariant
4
263}-
264-
265-
266-
267-
268-
269QDataStream &operator>>(QDataStream &s, QUuid &id)-
270{-
271 QByteArray bytes(16, Qt::Uninitialized);-
272 if (s.readRawData(bytes.data(), 16) != 16
s.readRawData(...a(), 16) != 16Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QMetaType
FALSEevaluated 5 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QUuid
  • tst_QVariant
) {
2-5
273 s.setStatus(QDataStream::ReadPastEnd);-
274 return
executed 2 times by 1 test: return s;
Executed by:
  • tst_QMetaType
s;
executed 2 times by 1 test: return s;
Executed by:
  • tst_QMetaType
2
275 }-
276-
277 if (s.byteOrder() == QDataStream::BigEndian
s.byteOrder() ...eam::BigEndianDescription
TRUEevaluated 4 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QUuid
  • tst_QVariant
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUuid
) {
1-4
278 id = QUuid::fromRfc4122(bytes);-
279 }
executed 4 times by 3 tests: end of block
Executed by:
  • tst_QMetaType
  • tst_QUuid
  • tst_QVariant
else {
4
280 const uchar *data = reinterpret_cast<const uchar *>(bytes.constData());-
281-
282 id.data1 = qFromLittleEndian<quint32>(data);-
283 data += sizeof(quint32);-
284 id.data2 = qFromLittleEndian<quint16>(data);-
285 data += sizeof(quint16);-
286 id.data3 = qFromLittleEndian<quint16>(data);-
287 data += sizeof(quint16);-
288-
289 for (int i = 0; i < 8
i < 8Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QUuid
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUuid
; ++i) {
1-8
290 id.data4[i] = *(data);-
291 data++;-
292 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_QUuid
8
293 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QUuid
1
294-
295 return
executed 5 times by 3 tests: return s;
Executed by:
  • tst_QMetaType
  • tst_QUuid
  • tst_QVariant
s;
executed 5 times by 3 tests: return s;
Executed by:
  • tst_QMetaType
  • tst_QUuid
  • tst_QVariant
5
296}-
297-
298-
299-
300-
301-
302-
303bool QUuid::isNull() const noexcept-
304{-
305 return
executed 58 times by 2 tests: return data4[0] == 0 && data4[1] == 0 && data4[2] == 0 && data4[3] == 0 && data4[4] == 0 && data4[5] == 0 && data4[6] == 0 && data4[7] == 0 && data1 == 0 && data2 == 0 && data3 == 0;
Executed by:
  • tst_QUuid
  • tst_QVariant
data4[0] == 0 && data4[1] == 0 && data4[2] == 0 && data4[3] == 0 &&
executed 58 times by 2 tests: return data4[0] == 0 && data4[1] == 0 && data4[2] == 0 && data4[3] == 0 && data4[4] == 0 && data4[5] == 0 && data4[6] == 0 && data4[7] == 0 && data1 == 0 && data2 == 0 && data3 == 0;
Executed by:
  • tst_QUuid
  • tst_QVariant
58
306 data4[4] == 0 && data4[5] == 0 && data4[6] == 0 && data4[7] == 0 &&
executed 58 times by 2 tests: return data4[0] == 0 && data4[1] == 0 && data4[2] == 0 && data4[3] == 0 && data4[4] == 0 && data4[5] == 0 && data4[6] == 0 && data4[7] == 0 && data1 == 0 && data2 == 0 && data3 == 0;
Executed by:
  • tst_QUuid
  • tst_QVariant
58
307 data1 == 0 && data2 == 0 && data3 == 0;
executed 58 times by 2 tests: return data4[0] == 0 && data4[1] == 0 && data4[2] == 0 && data4[3] == 0 && data4[4] == 0 && data4[5] == 0 && data4[6] == 0 && data4[7] == 0 && data1 == 0 && data2 == 0 && data3 == 0;
Executed by:
  • tst_QUuid
  • tst_QVariant
58
308}-
309QUuid::Variant QUuid::variant() const noexcept-
310{-
311 if (isNull()
isNull()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QUuid
FALSEevaluated 35 times by 1 test
Evaluated by:
  • tst_QUuid
)
12-35
312 return
executed 12 times by 1 test: return VarUnknown;
Executed by:
  • tst_QUuid
VarUnknown;
executed 12 times by 1 test: return VarUnknown;
Executed by:
  • tst_QUuid
12
313-
314 if ((
(data4[0] & 0x80) == 0x00Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUuid
FALSEevaluated 33 times by 1 test
Evaluated by:
  • tst_QUuid
data4[0] & 0x80) == 0x00
(data4[0] & 0x80) == 0x00Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUuid
FALSEevaluated 33 times by 1 test
Evaluated by:
  • tst_QUuid
) return
executed 2 times by 1 test: return NCS;
Executed by:
  • tst_QUuid
NCS;
executed 2 times by 1 test: return NCS;
Executed by:
  • tst_QUuid
2-33
315 else if ((
(data4[0] & 0xC0) == 0x80Description
TRUEevaluated 33 times by 1 test
Evaluated by:
  • tst_QUuid
FALSEnever evaluated
data4[0] & 0xC0) == 0x80
(data4[0] & 0xC0) == 0x80Description
TRUEevaluated 33 times by 1 test
Evaluated by:
  • tst_QUuid
FALSEnever evaluated
) return
executed 33 times by 1 test: return DCE;
Executed by:
  • tst_QUuid
DCE;
executed 33 times by 1 test: return DCE;
Executed by:
  • tst_QUuid
0-33
316 else if ((
(data4[0] & 0xE0) == 0xC0Description
TRUEnever evaluated
FALSEnever evaluated
data4[0] & 0xE0) == 0xC0
(data4[0] & 0xE0) == 0xC0Description
TRUEnever evaluated
FALSEnever evaluated
) return
never executed: return Microsoft;
Microsoft;
never executed: return Microsoft;
0
317 else if ((
(data4[0] & 0xE0) == 0xE0Description
TRUEnever evaluated
FALSEnever evaluated
data4[0] & 0xE0) == 0xE0
(data4[0] & 0xE0) == 0xE0Description
TRUEnever evaluated
FALSEnever evaluated
) return
never executed: return Reserved;
Reserved;
never executed: return Reserved;
0
318 return
never executed: return VarUnknown;
VarUnknown;
never executed: return VarUnknown;
0
319}-
320QUuid::Version QUuid::version() const noexcept-
321{-
322-
323 Version ver = (Version)(data3>>12);-
324 if (isNull()
isNull()Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUuid
0-4
325 || (
(variant() != DCE)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUuid
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUuid
variant() != DCE)
(variant() != DCE)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUuid
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUuid
1-3
326 || ver < Time
ver < TimeDescription
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUuid
0-3
327 || ver > Sha1
ver > Sha1Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUuid
)
0-3
328 return
executed 1 time by 1 test: return VerUnknown;
Executed by:
  • tst_QUuid
VerUnknown;
executed 1 time by 1 test: return VerUnknown;
Executed by:
  • tst_QUuid
1
329 return
executed 3 times by 1 test: return ver;
Executed by:
  • tst_QUuid
ver;
executed 3 times by 1 test: return ver;
Executed by:
  • tst_QUuid
3
330}-
331bool QUuid::operator<(const QUuid &other) const noexcept-
332{-
333 if (variant() != other.variant()
variant() != other.variant()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUuid
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QUuid
)
4-12
334 return
executed 4 times by 1 test: return variant() < other.variant();
Executed by:
  • tst_QUuid
variant() < other.variant();
executed 4 times by 1 test: return variant() < other.variant();
Executed by:
  • tst_QUuid
4
335-
336-
337 if (data1!=other.data1
data1!=other.data1Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QUuid
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUuid
) return
executed 8 times by 1 test: return (data1<other.data1);
Executed by:
  • tst_QUuid
(data1<other.data1);
executed 8 times by 1 test: return (data1<other.data1);
Executed by:
  • tst_QUuid
;
4-8
338 if (data2!=other.data2
data2!=other.data2Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUuid
) return
never executed: return (data2<other.data2);
(data2<other.data2);
never executed: return (data2<other.data2);
;
0-4
339 if (data3!=other.data3
data3!=other.data3Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUuid
) return
never executed: return (data3<other.data3);
(data3<other.data3);
never executed: return (data3<other.data3);
;
0-4
340 for (int n = 0; n < 8
n < 8Description
TRUEevaluated 32 times by 1 test
Evaluated by:
  • tst_QUuid
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUuid
; n++) {
4-32
341 if (data4[n]!=other.data4[n]
data4[n]!=other.data4[n]Description
TRUEnever evaluated
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_QUuid
) return
never executed: return (data4[n]<other.data4[n]);
(data4[n]<other.data4[n]);
never executed: return (data4[n]<other.data4[n]);
;
0-32
342 }
executed 32 times by 1 test: end of block
Executed by:
  • tst_QUuid
32
343-
344 return
executed 4 times by 1 test: return false;
Executed by:
  • tst_QUuid
false;
executed 4 times by 1 test: return false;
Executed by:
  • tst_QUuid
4
345}-
346bool QUuid::operator>(const QUuid &other) const noexcept-
347{-
348 return
executed 3 times by 1 test: return other < *this;
Executed by:
  • tst_QUuid
other < *this;
executed 3 times by 1 test: return other < *this;
Executed by:
  • tst_QUuid
3
349}-
350-
351-
352-
353-
354-
355namespace { namespace Q_QGS_devUrandomStorage { typedef QThreadStorage<QFile *> Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_qrawfont - unknown status
  • tst_quuid - unknown status
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
executed 4 times by 2 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_qrawfont - unknown status
  • tst_quuid - unknown status
}
executed 4 times by 2 tests: end of block
Executed by:
  • tst_qrawfont - unknown status
  • tst_quuid - unknown status
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return
executed 1268 times by 3 tests: return &holder.value;
Executed by:
  • tst_QRawFont
  • tst_QUuid
  • tst_quuid - unknown status
&holder.value;
executed 1268 times by 3 tests: return &holder.value;
Executed by:
  • tst_QRawFont
  • tst_QUuid
  • tst_quuid - unknown status
} } } static QGlobalStatic<QThreadStorage<QFile *>, Q_QGS_devUrandomStorage::innerFunction, Q_QGS_devUrandomStorage::guard> devUrandomStorage;;
0-1268
356-
357-
358QUuid QUuid::createUuid()-
359{-
360 QUuid result;-
361 uint *data = &(result.data1);-
362-
363-
364 QFile *devUrandom;-
365-
366 devUrandom = devUrandomStorage()->localData();-
367 if (!devUrandom
!devUrandomDescription
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_QRawFont
  • tst_QUuid
  • tst_quuid - unknown status
FALSEevaluated 1256 times by 3 tests
Evaluated by:
  • tst_QRawFont
  • tst_QUuid
  • tst_quuid - unknown status
) {
6-1256
368 devUrandom = new QFile(QLatin1String("/dev/urandom"));-
369 devUrandom->open(QIODevice::ReadOnly | QIODevice::Unbuffered);-
370 devUrandomStorage()->setLocalData(devUrandom);-
371 }
executed 6 times by 3 tests: end of block
Executed by:
  • tst_QRawFont
  • tst_QUuid
  • tst_quuid - unknown status
6
372-
373-
374-
375-
376-
377 enum { AmountToRead = 4 * sizeof(uint) };-
378 if (devUrandom->isOpen()
devUrandom->isOpen()Description
TRUEevaluated 1262 times by 3 tests
Evaluated by:
  • tst_QRawFont
  • tst_QUuid
  • tst_quuid - unknown status
FALSEnever evaluated
0-1262
379 && devUrandom->read((char *) data, AmountToRead) == AmountToRead
devUrandom->re...= AmountToReadDescription
TRUEevaluated 1262 times by 3 tests
Evaluated by:
  • tst_QRawFont
  • tst_QUuid
  • tst_quuid - unknown status
FALSEnever evaluated
) {
0-1262
380-
381 ;-
382 }
executed 1262 times by 3 tests: end of block
Executed by:
  • tst_QRawFont
  • tst_QUuid
  • tst_quuid - unknown status
else
1262
383-
384 {-
385 static const int intbits = sizeof(int)*8;-
386 static int randbits = 0;-
387 if (!randbits
!randbitsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
388 int r = 0;-
389 int max = 2147483647;-
390 do { ++r; }
never executed: end of block
while ((
(max=max>>1)Description
TRUEnever evaluated
FALSEnever evaluated
max=max>>1)
(max=max>>1)Description
TRUEnever evaluated
FALSEnever evaluated
);
0
391 randbits = r;-
392 }
never executed: end of block
0
393-
394-
395-
396-
397-
398 static QThreadStorage<int *> uuidseed;-
399 if (!uuidseed.hasLocalData()
!uuidseed.hasLocalData()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
400 {-
401 int *pseed = new int;-
402 static QBasicAtomicInt serial = { 2 };-
403 qsrand(*pseed = QDateTime::currentDateTimeUtc().toTime_t()-
404 + quintptr(&pseed)-
405 + serial.fetchAndAddRelaxed(1));-
406 uuidseed.setLocalData(pseed);-
407 }
never executed: end of block
0
408-
409-
410-
411-
412-
413-
414-
415 int chunks = 16 / sizeof(uint);-
416 while (chunks--
chunks--Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
417 uint randNumber = 0;-
418 for (int filled = 0; filled < intbits
filled < intbitsDescription
TRUEnever evaluated
FALSEnever evaluated
; filled += randbits)
0
419 randNumber |= qrand()<<filled;
never executed: randNumber |= qrand()<<filled;
0
420 *(data+chunks) = randNumber;-
421 }
never executed: end of block
0
422 }
never executed: end of block
0
423-
424 result.data4[0] = (result.data4[0] & 0x3F) | 0x80;-
425 result.data3 = (result.data3 & 0x0FFF) | 0x4000;-
426-
427 return
executed 1262 times by 3 tests: return result;
Executed by:
  • tst_QRawFont
  • tst_QUuid
  • tst_quuid - unknown status
result;
executed 1262 times by 3 tests: return result;
Executed by:
  • tst_QRawFont
  • tst_QUuid
  • tst_quuid - unknown status
1262
428}-
429QDebug operator<<(QDebug dbg, const QUuid &id)-
430{-
431 QDebugStateSaver saver(dbg);-
432 dbg.nospace() << "QUuid(" << id.toString() << ')';-
433 return
executed 1 time by 1 test: return dbg;
Executed by:
  • tst_QVariant
dbg;
executed 1 time by 1 test: return dbg;
Executed by:
  • tst_QVariant
1
434}-
435-
436-
437-
438-
439-
440-
441-
442uint qHash(const QUuid &uuid, uint seed) noexcept-
443{-
444 return
executed 3 times by 1 test: return uuid.data1 ^ uuid.data2 ^ (uuid.data3 << 16) ^ ((uuid.data4[0] << 24) | (uuid.data4[1] << 16) | (uuid.data4[2] << 8) | uuid.data4[3]) ^ ((uuid.data4[4] << 24) | (uuid.data4[5] << 16) | (uuid.data4[6] << 8) | uuid.data4[7]) ^ seed;
Executed by:
  • tst_QUuid
uuid.data1 ^ uuid.data2 ^ (uuid.data3 << 16)
executed 3 times by 1 test: return uuid.data1 ^ uuid.data2 ^ (uuid.data3 << 16) ^ ((uuid.data4[0] << 24) | (uuid.data4[1] << 16) | (uuid.data4[2] << 8) | uuid.data4[3]) ^ ((uuid.data4[4] << 24) | (uuid.data4[5] << 16) | (uuid.data4[6] << 8) | uuid.data4[7]) ^ seed;
Executed by:
  • tst_QUuid
3
445 ^ ((uuid.data4[0] << 24) | (uuid.data4[1] << 16) | (uuid.data4[2] << 8) | uuid.data4[3])
executed 3 times by 1 test: return uuid.data1 ^ uuid.data2 ^ (uuid.data3 << 16) ^ ((uuid.data4[0] << 24) | (uuid.data4[1] << 16) | (uuid.data4[2] << 8) | uuid.data4[3]) ^ ((uuid.data4[4] << 24) | (uuid.data4[5] << 16) | (uuid.data4[6] << 8) | uuid.data4[7]) ^ seed;
Executed by:
  • tst_QUuid
3
446 ^ ((uuid.data4[4] << 24) | (uuid.data4[5] << 16) | (uuid.data4[6] << 8) | uuid.data4[7])
executed 3 times by 1 test: return uuid.data1 ^ uuid.data2 ^ (uuid.data3 << 16) ^ ((uuid.data4[0] << 24) | (uuid.data4[1] << 16) | (uuid.data4[2] << 8) | uuid.data4[3]) ^ ((uuid.data4[4] << 24) | (uuid.data4[5] << 16) | (uuid.data4[6] << 8) | uuid.data4[7]) ^ seed;
Executed by:
  • tst_QUuid
3
447 ^ seed;
executed 3 times by 1 test: return uuid.data1 ^ uuid.data2 ^ (uuid.data3 << 16) ^ ((uuid.data4[0] << 24) | (uuid.data4[1] << 16) | (uuid.data4[2] << 8) | uuid.data4[3]) ^ ((uuid.data4[4] << 24) | (uuid.data4[5] << 16) | (uuid.data4[6] << 8) | uuid.data4[7]) ^ seed;
Executed by:
  • tst_QUuid
3
448}-
449-
450-
451-
Switch to Source codePreprocessed file

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