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