| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | | - |
| 13 | class QHostAddressPrivate | - |
| 14 | { | - |
| 15 | public: | - |
| 16 | QHostAddressPrivate(); | - |
| 17 | | - |
| 18 | void setAddress(quint32 a_ = 0); | - |
| 19 | void setAddress(const quint8 *a_); | - |
| 20 | void setAddress(const Q_IPV6ADDR &a_); | - |
| 21 | | - |
| 22 | bool parse(); | - |
| 23 | void clear(); | - |
| 24 | | - |
| 25 | QString ipString; | - |
| 26 | QString scopeId; | - |
| 27 | | - |
| 28 | quint32 a; | - |
| 29 | Q_IPV6ADDR a6; | - |
| 30 | QAbstractSocket::NetworkLayerProtocol protocol; | - |
| 31 | | - |
| 32 | bool isParsed; | - |
| 33 | | - |
| 34 | friend class QHostAddress; | - |
| 35 | }; | - |
| 36 | | - |
| 37 | QHostAddressPrivate::QHostAddressPrivate() | - |
| 38 | : a(0), protocol(QAbstractSocket::UnknownNetworkLayerProtocol), isParsed(true) | - |
| 39 | { | - |
| 40 | memset(&a6, 0, sizeof(a6)); | - |
| 41 | } executed: }Execution Count:434211 | 434211 |
| 42 | | - |
| 43 | void QHostAddressPrivate::setAddress(quint32 a_) | - |
| 44 | { | - |
| 45 | a = a_; | - |
| 46 | | - |
| 47 | memset(&a6, 0, sizeof(a6)); | - |
| 48 | int i; | - |
| 49 | for (i=15; a_ != 0; i--) { evaluated: a_ != 0| yes Evaluation Count:114188 | yes Evaluation Count:29938 |
| 29938-114188 |
| 50 | a6[i] = a_ & 0xFF; | - |
| 51 | a_ >>=8; | - |
| 52 | } executed: }Execution Count:114188 | 114188 |
| 53 | qt_noop(); | - |
| 54 | a6[11] = 0xFF; | - |
| 55 | a6[10] = 0xFF; | - |
| 56 | protocol = QAbstractSocket::IPv4Protocol; | - |
| 57 | isParsed = true; | - |
| 58 | } executed: }Execution Count:29938 | 29938 |
| 59 | | - |
| 60 | static bool parseMappedAddress(quint32& a, const Q_IPV6ADDR &a6) | - |
| 61 | { | - |
| 62 | int i; | - |
| 63 | for (i=0;i<10;i++) evaluated: i<10| yes Evaluation Count:135222 | yes Evaluation Count:13389 |
| 13389-135222 |
| 64 | if (a6[i]) return false; evaluated: a6[i]| yes Evaluation Count:1302 | yes Evaluation Count:133920 |
executed: return false;Execution Count:1302 | 1302-133920 |
| 65 | for (;i<12;i++) evaluated: i<12| yes Evaluation Count:20391 | yes Evaluation Count:7002 |
| 7002-20391 |
| 66 | if (a6[i] != 0xFF) return false; evaluated: a6[i] != 0xFF| yes Evaluation Count:6387 | yes Evaluation Count:14004 |
executed: return false;Execution Count:6387 | 6387-14004 |
| 67 | a=(a6[12] << 24) | (a6[13] << 16) | (a6[14] << 8) | a6[15]; | - |
| 68 | return true; executed: return true;Execution Count:7002 | 7002 |
| 69 | } | - |
| 70 | | - |
| 71 | void QHostAddressPrivate::setAddress(const quint8 *a_) | - |
| 72 | { | - |
| 73 | for (int i = 0; i < 16; i++) evaluated: i < 16| yes Evaluation Count:23984 | yes Evaluation Count:1499 |
| 1499-23984 |
| 74 | a6[i] = a_[i]; executed: a6[i] = a_[i];Execution Count:23984 | 23984 |
| 75 | a = 0; | - |
| 76 | if (parseMappedAddress(a, a6)) evaluated: parseMappedAddress(a, a6)| yes Evaluation Count:12 | yes Evaluation Count:1487 |
| 12-1487 |
| 77 | protocol = QAbstractSocket::IPv4Protocol; executed: protocol = QAbstractSocket::IPv4Protocol;Execution Count:12 | 12 |
| 78 | else | - |
| 79 | protocol = QAbstractSocket::IPv6Protocol; executed: protocol = QAbstractSocket::IPv6Protocol;Execution Count:1487 | 1487 |
| 80 | isParsed = true; | - |
| 81 | } executed: }Execution Count:1499 | 1499 |
| 82 | | - |
| 83 | void QHostAddressPrivate::setAddress(const Q_IPV6ADDR &a_) | - |
| 84 | { | - |
| 85 | a6 = a_; | - |
| 86 | a = 0; | - |
| 87 | if (parseMappedAddress(a, a6)) evaluated: parseMappedAddress(a, a6)| yes Evaluation Count:6990 | yes Evaluation Count:6202 |
| 6202-6990 |
| 88 | protocol = QAbstractSocket::IPv4Protocol; executed: protocol = QAbstractSocket::IPv4Protocol;Execution Count:6990 | 6990 |
| 89 | else | - |
| 90 | protocol = QAbstractSocket::IPv6Protocol; executed: protocol = QAbstractSocket::IPv6Protocol;Execution Count:6202 | 6202 |
| 91 | isParsed = true; | - |
| 92 | } executed: }Execution Count:13192 | 13192 |
| 93 | | - |
| 94 | static bool parseIp6(const QString &address, QIPAddressUtils::IPv6Address &addr, QString *scopeId) | - |
| 95 | { | - |
| 96 | QString tmp = address; | - |
| 97 | int scopeIdPos = tmp.lastIndexOf(QLatin1Char('%')); | - |
| 98 | if (scopeIdPos != -1) { evaluated: scopeIdPos != -1| yes Evaluation Count:8 | yes Evaluation Count:227 |
| 8-227 |
| 99 | *scopeId = tmp.mid(scopeIdPos + 1); | - |
| 100 | tmp.chop(tmp.size() - scopeIdPos); | - |
| 101 | } else { executed: }Execution Count:8 | 8 |
| 102 | scopeId->clear(); | - |
| 103 | } executed: }Execution Count:227 | 227 |
| 104 | return QIPAddressUtils::parseIp6(addr, tmp.constBegin(), tmp.constEnd()); executed: return QIPAddressUtils::parseIp6(addr, tmp.constBegin(), tmp.constEnd());Execution Count:235 | 235 |
| 105 | } | - |
| 106 | | - |
| 107 | bool QHostAddressPrivate::parse() | - |
| 108 | { | - |
| 109 | isParsed = true; | - |
| 110 | protocol = QAbstractSocket::UnknownNetworkLayerProtocol; | - |
| 111 | QString a = ipString.simplified(); | - |
| 112 | if (a.isEmpty()) evaluated: a.isEmpty()| yes Evaluation Count:1509 | yes Evaluation Count:4875 |
| 1509-4875 |
| 113 | return false; executed: return false;Execution Count:1509 | 1509 |
| 114 | | - |
| 115 | | - |
| 116 | if (a.contains(QLatin1Char(':'))) { evaluated: a.contains(QLatin1Char(':'))| yes Evaluation Count:235 | yes Evaluation Count:4640 |
| 235-4640 |
| 117 | quint8 maybeIp6[16]; | - |
| 118 | if (parseIp6(a, maybeIp6, &scopeId)) { evaluated: parseIp6(a, maybeIp6, &scopeId)| yes Evaluation Count:192 | yes Evaluation Count:43 |
| 43-192 |
| 119 | setAddress(maybeIp6); | - |
| 120 | protocol = QAbstractSocket::IPv6Protocol; | - |
| 121 | return true; executed: return true;Execution Count:192 | 192 |
| 122 | } | - |
| 123 | } executed: }Execution Count:43 | 43 |
| 124 | | - |
| 125 | quint32 maybeIp4 = 0; | - |
| 126 | if (QIPAddressUtils::parseIp4(maybeIp4, a.constBegin(), a.constEnd())) { evaluated: QIPAddressUtils::parseIp4(maybeIp4, a.constBegin(), a.constEnd())| yes Evaluation Count:1096 | yes Evaluation Count:3586 |
| 1096-3586 |
| 127 | setAddress(maybeIp4); | - |
| 128 | protocol = QAbstractSocket::IPv4Protocol; | - |
| 129 | return true; executed: return true;Execution Count:1096 | 1096 |
| 130 | } | - |
| 131 | | - |
| 132 | return false; executed: return false;Execution Count:3586 | 3586 |
| 133 | } | - |
| 134 | | - |
| 135 | void QHostAddressPrivate::clear() | - |
| 136 | { | - |
| 137 | a = 0; | - |
| 138 | protocol = QAbstractSocket::UnknownNetworkLayerProtocol; | - |
| 139 | isParsed = true; | - |
| 140 | memset(&a6, 0, sizeof(a6)); | - |
| 141 | } executed: }Execution Count:361595 | 361595 |
| 142 | | - |
| 143 | | - |
| 144 | bool QNetmaskAddress::setAddress(const QString &address) | - |
| 145 | { | - |
| 146 | length = -1; | - |
| 147 | QHostAddress other; | - |
| 148 | return other.setAddress(address) && setAddress(other); executed: return other.setAddress(address) && setAddress(other);Execution Count:16 | 16 |
| 149 | } | - |
| 150 | | - |
| 151 | bool QNetmaskAddress::setAddress(const QHostAddress &address) | - |
| 152 | { | - |
| 153 | static const quint8 zeroes[16] = { 0 }; | - |
| 154 | union { | - |
| 155 | quint32 v4; | - |
| 156 | quint8 v6[16]; | - |
| 157 | } ip; | - |
| 158 | | - |
| 159 | int netmask = 0; | - |
| 160 | quint8 *ptr = ip.v6; | - |
| 161 | quint8 *end; | - |
| 162 | length = -1; | - |
| 163 | | - |
| 164 | QHostAddress::operator=(address); | - |
| 165 | | - |
| 166 | if (d->protocol == QAbstractSocket::IPv4Protocol) { evaluated: d->protocol == QAbstractSocket::IPv4Protocol| yes Evaluation Count:674 | yes Evaluation Count:665 |
| 665-674 |
| 167 | ip.v4 = qToBigEndian(d->a); | - |
| 168 | end = ptr + 4; | - |
| 169 | } else if (d->protocol == QAbstractSocket::IPv6Protocol) { evaluated: d->protocol == QAbstractSocket::IPv6Protocol| yes Evaluation Count:661 | yes Evaluation Count:4 |
executed: }Execution Count:674 | 4-674 |
| 170 | memcpy(ip.v6, d->a6.c, 16); | - |
| 171 | end = ptr + 16; | - |
| 172 | } else { executed: }Execution Count:661 | 661 |
| 173 | d->clear(); | - |
| 174 | return false; executed: return false;Execution Count:4 | 4 |
| 175 | } | - |
| 176 | | - |
| 177 | while (ptr < end) { evaluated: ptr < end| yes Evaluation Count:9400 | yes Evaluation Count:166 |
| 166-9400 |
| 178 | switch (*ptr) { | - |
| 179 | case 255: | - |
| 180 | netmask += 8; | - |
| 181 | ++ptr; | - |
| 182 | continue; executed: continue;Execution Count:8231 | 8231 |
| 183 | | - |
| 184 | default: | - |
| 185 | d->clear(); | - |
| 186 | return false; executed: return false;Execution Count:4 | 4 |
| 187 | | - |
| 188 | | - |
| 189 | case 254: | - |
| 190 | ++netmask; | - |
| 191 | case 252: code before this statement executed: case 252:Execution Count:4 | 4 |
| 192 | ++netmask; | - |
| 193 | case 248: code before this statement executed: case 248:Execution Count:5 | 5 |
| 194 | ++netmask; | - |
| 195 | case 240: code before this statement executed: case 240:Execution Count:6 | 6 |
| 196 | ++netmask; | - |
| 197 | case 224: code before this statement executed: case 224:Execution Count:9 | 9 |
| 198 | ++netmask; | - |
| 199 | case 192: code before this statement executed: case 192:Execution Count:11 | 11 |
| 200 | ++netmask; | - |
| 201 | case 128: code before this statement executed: case 128:Execution Count:12 | 12 |
| 202 | ++netmask; | - |
| 203 | case 0: | - |
| 204 | break; executed: break;Execution Count:1165 | 1165 |
| 205 | } | - |
| 206 | break; executed: break;Execution Count:1165 | 1165 |
| 207 | } | - |
| 208 | | - |
| 209 | | - |
| 210 | if (ptr < end && memcmp(ptr + 1, zeroes, end - ptr - 1) != 0) { evaluated: ptr < end| yes Evaluation Count:1165 | yes Evaluation Count:166 |
evaluated: memcmp(ptr + 1, zeroes, end - ptr - 1) != 0| yes Evaluation Count:2 | yes Evaluation Count:1163 |
| 2-1165 |
| 211 | d->clear(); | - |
| 212 | return false; executed: return false;Execution Count:2 | 2 |
| 213 | } | - |
| 214 | | - |
| 215 | length = netmask; | - |
| 216 | return true; executed: return true;Execution Count:1329 | 1329 |
| 217 | } | - |
| 218 | | - |
| 219 | static void clearBits(quint8 *where, int start, int end) | - |
| 220 | { | - |
| 221 | qt_noop(); | - |
| 222 | if (start == end) evaluated: start == end| yes Evaluation Count:2 | yes Evaluation Count:43 |
| 2-43 |
| 223 | return; executed: return;Execution Count:2 | 2 |
| 224 | | - |
| 225 | | - |
| 226 | quint8 bytemask = 256 - (1 << (8 - (start & 7))); | - |
| 227 | where[start / 8] &= bytemask; | - |
| 228 | | - |
| 229 | | - |
| 230 | memset(where + (start + 7) / 8, 0, end / 8 - (start + 7) / 8); | - |
| 231 | } executed: }Execution Count:43 | 43 |
| 232 | | - |
| 233 | int QNetmaskAddress::prefixLength() const | - |
| 234 | { | - |
| 235 | return length; executed: return length;Execution Count:122 | 122 |
| 236 | } | - |
| 237 | | - |
| 238 | void QNetmaskAddress::setPrefixLength(QAbstractSocket::NetworkLayerProtocol proto, int newLength) | - |
| 239 | { | - |
| 240 | length = newLength; | - |
| 241 | if (length < 0 || length > (proto == QAbstractSocket::IPv4Protocol ? 32 : evaluated: length < 0| yes Evaluation Count:32 | yes Evaluation Count:28 |
| 12-32 |
| 242 | proto == QAbstractSocket::IPv6Protocol ? 128 : -1)) { evaluated: length > (proto == QAbstractSocket::IPv4Protocol ? 32 : proto == QAbstractSocket::IPv6Protocol ? 128 : -1)| yes Evaluation Count:16 | yes Evaluation Count:12 |
| 12-16 |
| 243 | | - |
| 244 | d->protocol = QAbstractSocket::UnknownNetworkLayerProtocol; | - |
| 245 | length = -1; | - |
| 246 | return; executed: return;Execution Count:48 | 48 |
| 247 | } | - |
| 248 | | - |
| 249 | d->protocol = proto; | - |
| 250 | if (d->protocol == QAbstractSocket::IPv4Protocol) { evaluated: d->protocol == QAbstractSocket::IPv4Protocol| yes Evaluation Count:5 | yes Evaluation Count:7 |
| 5-7 |
| 251 | if (length == 0) { evaluated: length == 0| yes Evaluation Count:1 | yes Evaluation Count:4 |
| 1-4 |
| 252 | d->a = 0; | - |
| 253 | } else if (length == 32) { evaluated: length == 32| yes Evaluation Count:1 | yes Evaluation Count:3 |
executed: }Execution Count:1 | 1-3 |
| 254 | d->a = quint32(0xffffffff); | - |
| 255 | } else { executed: }Execution Count:1 | 1 |
| 256 | d->a = quint32(0xffffffff) >> (32 - length) << (32 - length); | - |
| 257 | } executed: }Execution Count:3 | 3 |
| 258 | } else { | - |
| 259 | memset(d->a6.c, 0xFF, sizeof(d->a6)); | - |
| 260 | clearBits(d->a6.c, length, 128); | - |
| 261 | } executed: }Execution Count:7 | 7 |
| 262 | } | - |
| 263 | QHostAddress::QHostAddress() | - |
| 264 | : d(new QHostAddressPrivate) | - |
| 265 | { | - |
| 266 | } executed: }Execution Count:104596 | 104596 |
| 267 | | - |
| 268 | | - |
| 269 | | - |
| 270 | | - |
| 271 | QHostAddress::QHostAddress(quint32 ip4Addr) | - |
| 272 | : d(new QHostAddressPrivate) | - |
| 273 | { | - |
| 274 | setAddress(ip4Addr); | - |
| 275 | } executed: }Execution Count:216 | 216 |
| 276 | | - |
| 277 | | - |
| 278 | | - |
| 279 | | - |
| 280 | | - |
| 281 | | - |
| 282 | | - |
| 283 | QHostAddress::QHostAddress(quint8 *ip6Addr) | - |
| 284 | : d(new QHostAddressPrivate) | - |
| 285 | { | - |
| 286 | setAddress(ip6Addr); | - |
| 287 | } | 0 |
| 288 | | - |
| 289 | | - |
| 290 | | - |
| 291 | | - |
| 292 | QHostAddress::QHostAddress(const Q_IPV6ADDR &ip6Addr) | - |
| 293 | : d(new QHostAddressPrivate) | - |
| 294 | { | - |
| 295 | setAddress(ip6Addr); | - |
| 296 | } | 0 |
| 297 | | - |
| 298 | | - |
| 299 | | - |
| 300 | | - |
| 301 | | - |
| 302 | | - |
| 303 | | - |
| 304 | QHostAddress::QHostAddress(const QString &address) | - |
| 305 | : d(new QHostAddressPrivate) | - |
| 306 | { | - |
| 307 | d->ipString = address; | - |
| 308 | d->isParsed = false; | - |
| 309 | } executed: }Execution Count:207 | 207 |
| 310 | QHostAddress::QHostAddress(const struct sockaddr *sockaddr) | - |
| 311 | : d(new QHostAddressPrivate) | - |
| 312 | { | - |
| 313 | if (sockaddr->sa_family == 2) never evaluated: sockaddr->sa_family == 2 | 0 |
| 314 | setAddress((__extension__ ({ register unsigned int __v, __x = (((sockaddr_in *)sockaddr)->sin_addr.s_addr); if (__builtin_constant_p (__x)) __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); else __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); __v; }))); never evaluated: __builtin_constant_p (__x) never executed: setAddress((__extension__ ({ register unsigned int __v, __x = (((sockaddr_in *)sockaddr)->sin_addr.s_addr); if (__builtin_constant_p (__x)) __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); else __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); __v; }))); never executed: __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); never executed: __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); | 0 |
| 315 | else if (sockaddr->sa_family == 10) never evaluated: sockaddr->sa_family == 10 | 0 |
| 316 | setAddress(((sockaddr_in6 *)sockaddr)->sin6_addr.__in6_u.__u6_addr8); never executed: setAddress(((sockaddr_in6 *)sockaddr)->sin6_addr.__in6_u.__u6_addr8); | 0 |
| 317 | } | - |
| 318 | | - |
| 319 | | - |
| 320 | | - |
| 321 | | - |
| 322 | QHostAddress::QHostAddress(const QHostAddress &address) | - |
| 323 | : d(new QHostAddressPrivate(*address.d.data())) | - |
| 324 | { | - |
| 325 | } executed: }Execution Count:75283 | 75283 |
| 326 | | - |
| 327 | | - |
| 328 | | - |
| 329 | | - |
| 330 | QHostAddress::QHostAddress(SpecialAddress address) | - |
| 331 | : d(new QHostAddressPrivate) | - |
| 332 | { | - |
| 333 | Q_IPV6ADDR ip6; | - |
| 334 | memset(&ip6, 0, sizeof ip6); | - |
| 335 | | - |
| 336 | switch (address) { | - |
| 337 | case Null: | - |
| 338 | break; executed: break;Execution Count:16 | 16 |
| 339 | case Broadcast: | - |
| 340 | d->setAddress(quint32(-1)); | - |
| 341 | break; executed: break;Execution Count:1618 | 1618 |
| 342 | case LocalHost: | - |
| 343 | d->setAddress(0x7f000001); | - |
| 344 | break; executed: break;Execution Count:146 | 146 |
| 345 | case LocalHostIPv6: | - |
| 346 | ip6[15] = 1; | - |
| 347 | d->setAddress(ip6); | - |
| 348 | break; executed: break;Execution Count:66 | 66 |
| 349 | case AnyIPv4: | - |
| 350 | setAddress(0u); | - |
| 351 | break; executed: break;Execution Count:1001 | 1001 |
| 352 | case AnyIPv6: | - |
| 353 | d->setAddress(ip6); | - |
| 354 | break; executed: break;Execution Count:826 | 826 |
| 355 | case Any: | - |
| 356 | d->clear(); | - |
| 357 | d->protocol = QAbstractSocket::AnyIPProtocol; | - |
| 358 | break; executed: break;Execution Count:325519 | 325519 |
| 359 | } | - |
| 360 | } executed: }Execution Count:329192 | 329192 |
| 361 | | - |
| 362 | | - |
| 363 | | - |
| 364 | | - |
| 365 | QHostAddress::~QHostAddress() | - |
| 366 | { | - |
| 367 | } | - |
| 368 | | - |
| 369 | | - |
| 370 | | - |
| 371 | | - |
| 372 | | - |
| 373 | QHostAddress &QHostAddress::operator=(const QHostAddress &address) | - |
| 374 | { | - |
| 375 | *d.data() = *address.d.data(); | - |
| 376 | return *this; executed: return *this;Execution Count:53025 | 53025 |
| 377 | } | - |
| 378 | | - |
| 379 | | - |
| 380 | | - |
| 381 | | - |
| 382 | | - |
| 383 | | - |
| 384 | | - |
| 385 | QHostAddress &QHostAddress::operator=(const QString &address) | - |
| 386 | { | - |
| 387 | setAddress(address); | - |
| 388 | return *this; executed: return *this;Execution Count:2 | 2 |
| 389 | } | - |
| 390 | void QHostAddress::clear() | - |
| 391 | { | - |
| 392 | d->clear(); | - |
| 393 | } executed: }Execution Count:36066 | 36066 |
| 394 | | - |
| 395 | | - |
| 396 | | - |
| 397 | | - |
| 398 | void QHostAddress::setAddress(quint32 ip4Addr) | - |
| 399 | { | - |
| 400 | d->setAddress(ip4Addr); | - |
| 401 | } executed: }Execution Count:27078 | 27078 |
| 402 | void QHostAddress::setAddress(quint8 *ip6Addr) | - |
| 403 | { | - |
| 404 | d->setAddress(ip6Addr); | - |
| 405 | } executed: }Execution Count:1307 | 1307 |
| 406 | | - |
| 407 | | - |
| 408 | | - |
| 409 | | - |
| 410 | | - |
| 411 | | - |
| 412 | void QHostAddress::setAddress(const Q_IPV6ADDR &ip6Addr) | - |
| 413 | { | - |
| 414 | d->setAddress(ip6Addr); | - |
| 415 | } executed: }Execution Count:12300 | 12300 |
| 416 | bool QHostAddress::setAddress(const QString &address) | - |
| 417 | { | - |
| 418 | d->ipString = address; | - |
| 419 | return d->parse(); executed: return d->parse();Execution Count:6174 | 6174 |
| 420 | } | - |
| 421 | void QHostAddress::setAddress(const struct sockaddr *sockaddr) | - |
| 422 | { | - |
| 423 | clear(); | - |
| 424 | if (sockaddr->sa_family == 2) partially evaluated: sockaddr->sa_family == 2| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 425 | setAddress((__extension__ ({ register unsigned int __v, __x = (((sockaddr_in *)sockaddr)->sin_addr.s_addr); if (__builtin_constant_p (__x)) __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); else __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); __v; }))); partially evaluated: __builtin_constant_p (__x)| no Evaluation Count:0 | yes Evaluation Count:1 |
executed: setAddress((__extension__ ({ register unsigned int __v, __x = (((sockaddr_in *)sockaddr)->sin_addr.s_addr); if (__builtin_constant_p (__x)) __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); else __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); __v; })));Execution Count:1 never executed: __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); executed: __asm__ ("bswap %0" : "=r" (__v) : "0" (__x));Execution Count:1 | 0-1 |
| 426 | else if (sockaddr->sa_family == 10) never evaluated: sockaddr->sa_family == 10 | 0 |
| 427 | setAddress(((sockaddr_in6 *)sockaddr)->sin6_addr.__in6_u.__u6_addr8); never executed: setAddress(((sockaddr_in6 *)sockaddr)->sin6_addr.__in6_u.__u6_addr8); | 0 |
| 428 | } | - |
| 429 | quint32 QHostAddress::toIPv4Address() const | - |
| 430 | { | - |
| 431 | do { if (!(this)->d->isParsed) (this)->d->parse(); } while (0); evaluated: !(this)->d->isParsed| yes Evaluation Count:1 | yes Evaluation Count:630716 |
partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:630717 |
executed: (this)->d->parse();Execution Count:1 executed: }Execution Count:630717 | 0-630717 |
| 432 | return d->a; executed: return d->a;Execution Count:630717 | 630717 |
| 433 | } | - |
| 434 | | - |
| 435 | | - |
| 436 | | - |
| 437 | | - |
| 438 | QAbstractSocket::NetworkLayerProtocol QHostAddress::protocol() const | - |
| 439 | { | - |
| 440 | do { if (!(this)->d->isParsed) (this)->d->parse(); } while (0); evaluated: !(this)->d->isParsed| yes Evaluation Count:105 | yes Evaluation Count:1293667 |
partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:1293772 |
executed: (this)->d->parse();Execution Count:105 executed: }Execution Count:1293772 | 0-1293772 |
| 441 | return d->protocol; executed: return d->protocol;Execution Count:1293772 | 1293772 |
| 442 | } | - |
| 443 | Q_IPV6ADDR QHostAddress::toIPv6Address() const | - |
| 444 | { | - |
| 445 | do { if (!(this)->d->isParsed) (this)->d->parse(); } while (0); partially evaluated: !(this)->d->isParsed| no Evaluation Count:0 | yes Evaluation Count:11852 |
partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:11852 |
never executed: (this)->d->parse(); executed: }Execution Count:11852 | 0-11852 |
| 446 | return d->a6; executed: return d->a6;Execution Count:11852 | 11852 |
| 447 | } | - |
| 448 | QString QHostAddress::toString() const | - |
| 449 | { | - |
| 450 | do { if (!(this)->d->isParsed) (this)->d->parse(); } while (0); evaluated: !(this)->d->isParsed| yes Evaluation Count:2 | yes Evaluation Count:652 |
partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:654 |
executed: (this)->d->parse();Execution Count:2 executed: }Execution Count:654 | 0-654 |
| 451 | if (d->protocol == QAbstractSocket::IPv4Protocol evaluated: d->protocol == QAbstractSocket::IPv4Protocol| yes Evaluation Count:199 | yes Evaluation Count:455 |
| 199-455 |
| 452 | || d->protocol == QAbstractSocket::AnyIPProtocol) { evaluated: d->protocol == QAbstractSocket::AnyIPProtocol| yes Evaluation Count:21 | yes Evaluation Count:434 |
| 21-434 |
| 453 | quint32 i = toIPv4Address(); | - |
| 454 | QString s; | - |
| 455 | QIPAddressUtils::toString(s, i); | - |
| 456 | return s; executed: return s;Execution Count:220 | 220 |
| 457 | } | - |
| 458 | | - |
| 459 | if (d->protocol == QAbstractSocket::IPv6Protocol) { evaluated: d->protocol == QAbstractSocket::IPv6Protocol| yes Evaluation Count:148 | yes Evaluation Count:286 |
| 148-286 |
| 460 | QString s; | - |
| 461 | QIPAddressUtils::toString(s, d->a6.c); | - |
| 462 | | - |
| 463 | if (!d->scopeId.isEmpty()) evaluated: !d->scopeId.isEmpty()| yes Evaluation Count:29 | yes Evaluation Count:119 |
| 29-119 |
| 464 | s.append(QLatin1Char('%') + d->scopeId); executed: s.append(QLatin1Char('%') + d->scopeId);Execution Count:29 | 29 |
| 465 | return s; executed: return s;Execution Count:148 | 148 |
| 466 | } | - |
| 467 | | - |
| 468 | return QString(); executed: return QString();Execution Count:286 | 286 |
| 469 | } | - |
| 470 | QString QHostAddress::scopeId() const | - |
| 471 | { | - |
| 472 | do { if (!(this)->d->isParsed) (this)->d->parse(); } while (0); evaluated: !(this)->d->isParsed| yes Evaluation Count:2 | yes Evaluation Count:11850 |
partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:11852 |
executed: (this)->d->parse();Execution Count:2 executed: }Execution Count:11852 | 0-11852 |
| 473 | return (d->protocol == QAbstractSocket::IPv6Protocol) ? d->scopeId : QString(); executed: return (d->protocol == QAbstractSocket::IPv6Protocol) ? d->scopeId : QString();Execution Count:11852 | 11852 |
| 474 | } | - |
| 475 | | - |
| 476 | | - |
| 477 | | - |
| 478 | | - |
| 479 | | - |
| 480 | | - |
| 481 | | - |
| 482 | void QHostAddress::setScopeId(const QString &id) | - |
| 483 | { | - |
| 484 | do { if (!(this)->d->isParsed) (this)->d->parse(); } while (0); partially evaluated: !(this)->d->isParsed| no Evaluation Count:0 | yes Evaluation Count:12790 |
partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:12790 |
never executed: (this)->d->parse(); executed: }Execution Count:12790 | 0-12790 |
| 485 | if (d->protocol == QAbstractSocket::IPv6Protocol) evaluated: d->protocol == QAbstractSocket::IPv6Protocol| yes Evaluation Count:5800 | yes Evaluation Count:6990 |
| 5800-6990 |
| 486 | d->scopeId = id; executed: d->scopeId = id;Execution Count:5800 | 5800 |
| 487 | } executed: }Execution Count:12790 | 12790 |
| 488 | | - |
| 489 | | - |
| 490 | | - |
| 491 | | - |
| 492 | | - |
| 493 | bool QHostAddress::operator==(const QHostAddress &other) const | - |
| 494 | { | - |
| 495 | do { if (!(this)->d->isParsed) (this)->d->parse(); } while (0); partially evaluated: !(this)->d->isParsed| no Evaluation Count:0 | yes Evaluation Count:254 |
partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:254 |
never executed: (this)->d->parse(); executed: }Execution Count:254 | 0-254 |
| 496 | do { if (!(&other)->d->isParsed) (&other)->d->parse(); } while (0); partially evaluated: !(&other)->d->isParsed| no Evaluation Count:0 | yes Evaluation Count:254 |
partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:254 |
never executed: (&other)->d->parse(); executed: }Execution Count:254 | 0-254 |
| 497 | | - |
| 498 | if (d->protocol == QAbstractSocket::IPv4Protocol) evaluated: d->protocol == QAbstractSocket::IPv4Protocol| yes Evaluation Count:152 | yes Evaluation Count:102 |
| 102-152 |
| 499 | return other.d->protocol == QAbstractSocket::IPv4Protocol && d->a == other.d->a; executed: return other.d->protocol == QAbstractSocket::IPv4Protocol && d->a == other.d->a;Execution Count:152 | 152 |
| 500 | if (d->protocol == QAbstractSocket::IPv6Protocol) { evaluated: d->protocol == QAbstractSocket::IPv6Protocol| yes Evaluation Count:65 | yes Evaluation Count:37 |
| 37-65 |
| 501 | return other.d->protocol == QAbstractSocket::IPv6Protocol | 65 |
| 502 | && memcmp(&d->a6, &other.d->a6, sizeof(Q_IPV6ADDR)) == 0; executed: return other.d->protocol == QAbstractSocket::IPv6Protocol && memcmp(&d->a6, &other.d->a6, sizeof(Q_IPV6ADDR)) == 0;Execution Count:65 | 65 |
| 503 | } | - |
| 504 | return d->protocol == other.d->protocol; executed: return d->protocol == other.d->protocol;Execution Count:37 | 37 |
| 505 | } | - |
| 506 | | - |
| 507 | | - |
| 508 | | - |
| 509 | | - |
| 510 | | - |
| 511 | bool QHostAddress::operator ==(SpecialAddress other) const | - |
| 512 | { | - |
| 513 | do { if (!(this)->d->isParsed) (this)->d->parse(); } while (0); evaluated: !(this)->d->isParsed| yes Evaluation Count:15 | yes Evaluation Count:1588 |
partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:1603 |
executed: (this)->d->parse();Execution Count:15 executed: }Execution Count:1603 | 0-1603 |
| 514 | QHostAddress otherAddress(other); | - |
| 515 | do { if (!(&otherAddress)->d->isParsed) (&otherAddress)->d->parse(); } while (0); never executed: (&otherAddress)->d->parse(); executed: }Execution Count:1603 partially evaluated: !(&otherAddress)->d->isParsed| no Evaluation Count:0 | yes Evaluation Count:1603 |
partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:1603 |
| 0-1603 |
| 516 | | - |
| 517 | if (d->protocol == QAbstractSocket::IPv4Protocol) evaluated: d->protocol == QAbstractSocket::IPv4Protocol| yes Evaluation Count:592 | yes Evaluation Count:1011 |
| 592-1011 |
| 518 | return otherAddress.d->protocol == QAbstractSocket::IPv4Protocol && d->a == otherAddress.d->a; executed: return otherAddress.d->protocol == QAbstractSocket::IPv4Protocol && d->a == otherAddress.d->a;Execution Count:592 | 592 |
| 519 | if (d->protocol == QAbstractSocket::IPv6Protocol) { evaluated: d->protocol == QAbstractSocket::IPv6Protocol| yes Evaluation Count:963 | yes Evaluation Count:48 |
| 48-963 |
| 520 | return otherAddress.d->protocol == QAbstractSocket::IPv6Protocol | 963 |
| 521 | && memcmp(&d->a6, &otherAddress.d->a6, sizeof(Q_IPV6ADDR)) == 0; executed: return otherAddress.d->protocol == QAbstractSocket::IPv6Protocol && memcmp(&d->a6, &otherAddress.d->a6, sizeof(Q_IPV6ADDR)) == 0;Execution Count:963 | 963 |
| 522 | } | - |
| 523 | if (d->protocol == QAbstractSocket::AnyIPProtocol) evaluated: d->protocol == QAbstractSocket::AnyIPProtocol| yes Evaluation Count:40 | yes Evaluation Count:8 |
| 8-40 |
| 524 | return other == QHostAddress::Any; executed: return other == QHostAddress::Any;Execution Count:40 | 40 |
| 525 | return int(other) == int(Null); executed: return int(other) == int(Null);Execution Count:8 | 8 |
| 526 | } | - |
| 527 | | - |
| 528 | | - |
| 529 | | - |
| 530 | | - |
| 531 | | - |
| 532 | | - |
| 533 | bool QHostAddress::isNull() const | - |
| 534 | { | - |
| 535 | do { if (!(this)->d->isParsed) (this)->d->parse(); } while (0); executed: (this)->d->parse();Execution Count:55 executed: }Execution Count:3727 evaluated: !(this)->d->isParsed| yes Evaluation Count:55 | yes Evaluation Count:3672 |
partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:3727 |
| 0-3727 |
| 536 | return d->protocol == QAbstractSocket::UnknownNetworkLayerProtocol; executed: return d->protocol == QAbstractSocket::UnknownNetworkLayerProtocol;Execution Count:3727 | 3727 |
| 537 | } | - |
| 538 | bool QHostAddress::isInSubnet(const QHostAddress &subnet, int netmask) const | - |
| 539 | { | - |
| 540 | do { if (!(this)->d->isParsed) (this)->d->parse(); } while (0); executed: (this)->d->parse();Execution Count:12 executed: }Execution Count:96 evaluated: !(this)->d->isParsed| yes Evaluation Count:12 | yes Evaluation Count:84 |
partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:96 |
| 0-96 |
| 541 | if (subnet.protocol() != d->protocol || netmask < 0) evaluated: subnet.protocol() != d->protocol| yes Evaluation Count:34 | yes Evaluation Count:62 |
evaluated: netmask < 0| yes Evaluation Count:1 | yes Evaluation Count:61 |
| 1-62 |
| 542 | return false; executed: return false;Execution Count:35 | 35 |
| 543 | | - |
| 544 | union { | - |
| 545 | quint32 ip; | - |
| 546 | quint8 data[4]; | - |
| 547 | } ip4, net4; | - |
| 548 | const quint8 *ip; | - |
| 549 | const quint8 *net; | - |
| 550 | if (d->protocol == QAbstractSocket::IPv4Protocol) { evaluated: d->protocol == QAbstractSocket::IPv4Protocol| yes Evaluation Count:33 | yes Evaluation Count:28 |
| 28-33 |
| 551 | if (netmask > 32) partially evaluated: netmask > 32| no Evaluation Count:0 | yes Evaluation Count:33 |
| 0-33 |
| 552 | netmask = 32; never executed: netmask = 32; | 0 |
| 553 | ip4.ip = qToBigEndian(d->a); | - |
| 554 | net4.ip = qToBigEndian(subnet.d->a); | - |
| 555 | ip = ip4.data; | - |
| 556 | net = net4.data; | - |
| 557 | } else if (d->protocol == QAbstractSocket::IPv6Protocol) { executed: }Execution Count:33 evaluated: d->protocol == QAbstractSocket::IPv6Protocol| yes Evaluation Count:27 | yes Evaluation Count:1 |
| 1-33 |
| 558 | if (netmask > 128) partially evaluated: netmask > 128| no Evaluation Count:0 | yes Evaluation Count:27 |
| 0-27 |
| 559 | netmask = 128; never executed: netmask = 128; | 0 |
| 560 | ip = d->a6.c; | - |
| 561 | net = subnet.d->a6.c; | - |
| 562 | } else { executed: }Execution Count:27 | 27 |
| 563 | return false; executed: return false;Execution Count:1 | 1 |
| 564 | } | - |
| 565 | | - |
| 566 | if (netmask >= 8 && memcmp(ip, net, netmask / 8) != 0) evaluated: netmask >= 8| yes Evaluation Count:44 | yes Evaluation Count:16 |
evaluated: memcmp(ip, net, netmask / 8) != 0| yes Evaluation Count:21 | yes Evaluation Count:23 |
| 16-44 |
| 567 | return false; executed: return false;Execution Count:21 | 21 |
| 568 | if ((netmask & 7) == 0) evaluated: (netmask & 7) == 0| yes Evaluation Count:18 | yes Evaluation Count:21 |
| 18-21 |
| 569 | return true; executed: return true;Execution Count:18 | 18 |
| 570 | | - |
| 571 | | - |
| 572 | quint8 bytemask = 256 - (1 << (8 - (netmask & 7))); | - |
| 573 | quint8 ipbyte = ip[netmask / 8]; | - |
| 574 | quint8 netbyte = net[netmask / 8]; | - |
| 575 | return (ipbyte & bytemask) == (netbyte & bytemask); executed: return (ipbyte & bytemask) == (netbyte & bytemask);Execution Count:21 | 21 |
| 576 | } | - |
| 577 | bool QHostAddress::isInSubnet(const QPair<QHostAddress, int> &subnet) const | - |
| 578 | { | - |
| 579 | return isInSubnet(subnet.first, subnet.second); executed: return isInSubnet(subnet.first, subnet.second);Execution Count:26 | 26 |
| 580 | } | - |
| 581 | QPair<QHostAddress, int> QHostAddress::parseSubnet(const QString &subnet) | - |
| 582 | { | - |
| 583 | const QPair<QHostAddress, int> invalid = qMakePair(QHostAddress(), -1); | - |
| 584 | if (subnet.isEmpty()) evaluated: subnet.isEmpty()| yes Evaluation Count:1 | yes Evaluation Count:101 |
| 1-101 |
| 585 | return invalid; executed: return invalid;Execution Count:1 | 1 |
| 586 | | - |
| 587 | int slash = subnet.indexOf(QLatin1Char('/')); | - |
| 588 | QString netStr = subnet; | - |
| 589 | if (slash != -1) evaluated: slash != -1| yes Evaluation Count:88 | yes Evaluation Count:13 |
| 13-88 |
| 590 | netStr.truncate(slash); executed: netStr.truncate(slash);Execution Count:88 | 88 |
| 591 | | - |
| 592 | int netmask = -1; | - |
| 593 | bool isIpv6 = netStr.contains(QLatin1Char(':')); | - |
| 594 | | - |
| 595 | if (slash != -1) { evaluated: slash != -1| yes Evaluation Count:88 | yes Evaluation Count:13 |
| 13-88 |
| 596 | | - |
| 597 | if (!isIpv6 && subnet.indexOf(QLatin1Char('.'), slash + 1) != -1) { evaluated: !isIpv6| yes Evaluation Count:46 | yes Evaluation Count:42 |
evaluated: subnet.indexOf(QLatin1Char('.'), slash + 1) != -1| yes Evaluation Count:16 | yes Evaluation Count:30 |
| 16-46 |
| 598 | | - |
| 599 | QNetmaskAddress parser; | - |
| 600 | if (!parser.setAddress(subnet.mid(slash + 1))) evaluated: !parser.setAddress(subnet.mid(slash + 1))| yes Evaluation Count:3 | yes Evaluation Count:13 |
| 3-13 |
| 601 | return invalid; executed: return invalid;Execution Count:3 | 3 |
| 602 | netmask = parser.prefixLength(); | - |
| 603 | } else { executed: }Execution Count:13 | 13 |
| 604 | bool ok; | - |
| 605 | netmask = subnet.mid(slash + 1).toUInt(&ok); | - |
| 606 | if (!ok) evaluated: !ok| yes Evaluation Count:4 | yes Evaluation Count:68 |
| 4-68 |
| 607 | return invalid; executed: return invalid;Execution Count:4 | 4 |
| 608 | } executed: }Execution Count:68 | 68 |
| 609 | } | - |
| 610 | | - |
| 611 | if (isIpv6) { evaluated: isIpv6| yes Evaluation Count:40 | yes Evaluation Count:54 |
| 40-54 |
| 612 | | - |
| 613 | if (netmask > 128) evaluated: netmask > 128| yes Evaluation Count:1 | yes Evaluation Count:39 |
| 1-39 |
| 614 | return invalid; executed: return invalid;Execution Count:1 | 1 |
| 615 | if (netmask < 0) evaluated: netmask < 0| yes Evaluation Count:1 | yes Evaluation Count:38 |
| 1-38 |
| 616 | netmask = 128; executed: netmask = 128;Execution Count:1 | 1 |
| 617 | | - |
| 618 | QHostAddress net; | - |
| 619 | if (!net.setAddress(netStr)) evaluated: !net.setAddress(netStr)| yes Evaluation Count:1 | yes Evaluation Count:38 |
| 1-38 |
| 620 | return invalid; executed: return invalid;Execution Count:1 | 1 |
| 621 | | - |
| 622 | clearBits(net.d->a6.c, netmask, 128); | - |
| 623 | return qMakePair(net, netmask); executed: return qMakePair(net, netmask);Execution Count:38 | 38 |
| 624 | } | - |
| 625 | | - |
| 626 | if (netmask > 32) evaluated: netmask > 32| yes Evaluation Count:1 | yes Evaluation Count:53 |
| 1-53 |
| 627 | return invalid; executed: return invalid;Execution Count:1 | 1 |
| 628 | | - |
| 629 | | - |
| 630 | QStringList parts = netStr.split(QLatin1Char('.')); | - |
| 631 | if (parts.isEmpty() || parts.count() > 4) partially evaluated: parts.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:53 |
evaluated: parts.count() > 4| yes Evaluation Count:2 | yes Evaluation Count:51 |
| 0-53 |
| 632 | return invalid; executed: return invalid;Execution Count:2 | 2 |
| 633 | | - |
| 634 | if (parts.last().isEmpty()) evaluated: parts.last().isEmpty()| yes Evaluation Count:2 | yes Evaluation Count:49 |
| 2-49 |
| 635 | parts.removeLast(); executed: parts.removeLast();Execution Count:2 | 2 |
| 636 | | - |
| 637 | quint32 addr = 0; | - |
| 638 | for (int i = 0; i < parts.count(); ++i) { evaluated: i < parts.count()| yes Evaluation Count:166 | yes Evaluation Count:48 |
| 48-166 |
| 639 | bool ok; | - |
| 640 | uint byteValue = parts.at(i).toUInt(&ok); | - |
| 641 | if (!ok || byteValue > 255) evaluated: !ok| yes Evaluation Count:3 | yes Evaluation Count:163 |
partially evaluated: byteValue > 255| no Evaluation Count:0 | yes Evaluation Count:163 |
| 0-163 |
| 642 | return invalid; executed: return invalid;Execution Count:3 | 3 |
| 643 | | - |
| 644 | addr <<= 8; | - |
| 645 | addr += byteValue; | - |
| 646 | } executed: }Execution Count:163 | 163 |
| 647 | addr <<= 8 * (4 - parts.count()); | - |
| 648 | if (netmask == -1) { evaluated: netmask == -1| yes Evaluation Count:7 | yes Evaluation Count:41 |
| 7-41 |
| 649 | netmask = 8 * parts.count(); | - |
| 650 | } else if (netmask == 0) { executed: }Execution Count:7 evaluated: netmask == 0| yes Evaluation Count:3 | yes Evaluation Count:38 |
| 3-38 |
| 651 | | - |
| 652 | | - |
| 653 | | - |
| 654 | addr = 0; | - |
| 655 | } else if (netmask != 32) { executed: }Execution Count:3 evaluated: netmask != 32| yes Evaluation Count:36 | yes Evaluation Count:2 |
| 2-36 |
| 656 | | - |
| 657 | quint32 mask = quint32(0xffffffff) >> (32 - netmask) << (32 - netmask); | - |
| 658 | addr &= mask; | - |
| 659 | } executed: }Execution Count:36 | 36 |
| 660 | | - |
| 661 | return qMakePair(QHostAddress(addr), netmask); executed: return qMakePair(QHostAddress(addr), netmask);Execution Count:48 | 48 |
| 662 | } | - |
| 663 | | - |
| 664 | | - |
| 665 | | - |
| 666 | | - |
| 667 | | - |
| 668 | | - |
| 669 | | - |
| 670 | bool QHostAddress::isLoopback() const | - |
| 671 | { | - |
| 672 | do { if (!(this)->d->isParsed) (this)->d->parse(); } while (0); executed: (this)->d->parse();Execution Count:18 executed: }Execution Count:4803 evaluated: !(this)->d->isParsed| yes Evaluation Count:18 | yes Evaluation Count:4785 |
partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:4803 |
| 0-4803 |
| 673 | if ((d->a & 0xFF000000) == 0x7F000000) evaluated: (d->a & 0xFF000000) == 0x7F000000| yes Evaluation Count:2140 | yes Evaluation Count:2663 |
| 2140-2663 |
| 674 | return true; executed: return true;Execution Count:2140 | 2140 |
| 675 | if (d->protocol == QAbstractSocket::IPv6Protocol) { evaluated: d->protocol == QAbstractSocket::IPv6Protocol| yes Evaluation Count:135 | yes Evaluation Count:2528 |
| 135-2528 |
| 676 | if (d->a6.c[15] != 1) evaluated: d->a6.c[15] != 1| yes Evaluation Count:67 | yes Evaluation Count:68 |
| 67-68 |
| 677 | return false; executed: return false;Execution Count:67 | 67 |
| 678 | for (int i = 0; i < 15; i++) evaluated: i < 15| yes Evaluation Count:908 | yes Evaluation Count:60 |
| 60-908 |
| 679 | if (d->a6[i] != 0) evaluated: d->a6[i] != 0| yes Evaluation Count:8 | yes Evaluation Count:900 |
| 8-900 |
| 680 | return false; executed: return false;Execution Count:8 | 8 |
| 681 | return true; executed: return true;Execution Count:60 | 60 |
| 682 | } | - |
| 683 | return false; executed: return false;Execution Count:2528 | 2528 |
| 684 | } | - |
| 685 | | - |
| 686 | | - |
| 687 | QDebug operator<<(QDebug d, const QHostAddress &address) | - |
| 688 | { | - |
| 689 | d.maybeSpace() << "QHostAddress(" << address.toString() << ')'; | - |
| 690 | return d.space(); executed: return d.space();Execution Count:6 | 6 |
| 691 | } | - |
| 692 | | - |
| 693 | | - |
| 694 | uint qHash(const QHostAddress &key, uint seed) | - |
| 695 | { | - |
| 696 | | - |
| 697 | do { if (!(&key)->d->isParsed) (&key)->d->parse(); } while (0); never executed: (&key)->d->parse(); executed: }Execution Count:10 partially evaluated: !(&key)->d->isParsed| no Evaluation Count:0 | yes Evaluation Count:10 |
partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
| 698 | return qHash(QByteArray::fromRawData(reinterpret_cast<const char *>(key.d->a6.c), 16), seed); executed: return qHash(QByteArray::fromRawData(reinterpret_cast<const char *>(key.d->a6.c), 16), seed);Execution Count:10 | 10 |
| 699 | } | - |
| 700 | QDataStream &operator<<(QDataStream &out, const QHostAddress &address) | - |
| 701 | { | - |
| 702 | qint8 prot; | - |
| 703 | prot = qint8(address.protocol()); | - |
| 704 | out << prot; | - |
| 705 | switch (address.protocol()) { | - |
| 706 | case QAbstractSocket::UnknownNetworkLayerProtocol: | - |
| 707 | case QAbstractSocket::AnyIPProtocol: | - |
| 708 | break; executed: break;Execution Count:4 | 4 |
| 709 | case QAbstractSocket::IPv4Protocol: | - |
| 710 | out << address.toIPv4Address(); | - |
| 711 | break; executed: break;Execution Count:5 | 5 |
| 712 | case QAbstractSocket::IPv6Protocol: | - |
| 713 | { | - |
| 714 | Q_IPV6ADDR ipv6 = address.toIPv6Address(); | - |
| 715 | for (int i = 0; i < 16; ++i) evaluated: i < 16| yes Evaluation Count:64 | yes Evaluation Count:4 |
| 4-64 |
| 716 | out << ipv6[i]; executed: out << ipv6[i];Execution Count:64 | 64 |
| 717 | out << address.scopeId(); | - |
| 718 | } | - |
| 719 | break; executed: break;Execution Count:4 | 4 |
| 720 | } | - |
| 721 | return out; executed: return out;Execution Count:13 | 13 |
| 722 | } | - |
| 723 | QDataStream &operator>>(QDataStream &in, QHostAddress &address) | - |
| 724 | { | - |
| 725 | qint8 prot; | - |
| 726 | in >> prot; | - |
| 727 | switch (QAbstractSocket::NetworkLayerProtocol(prot)) { | - |
| 728 | case QAbstractSocket::UnknownNetworkLayerProtocol: | - |
| 729 | address.clear(); | - |
| 730 | break; executed: break;Execution Count:3 | 3 |
| 731 | case QAbstractSocket::IPv4Protocol: | - |
| 732 | { | - |
| 733 | quint32 ipv4; | - |
| 734 | in >> ipv4; | - |
| 735 | address.setAddress(ipv4); | - |
| 736 | } | - |
| 737 | break; executed: break;Execution Count:5 | 5 |
| 738 | case QAbstractSocket::IPv6Protocol: | - |
| 739 | { | - |
| 740 | Q_IPV6ADDR ipv6; | - |
| 741 | for (int i = 0; i < 16; ++i) evaluated: i < 16| yes Evaluation Count:64 | yes Evaluation Count:4 |
| 4-64 |
| 742 | in >> ipv6[i]; executed: in >> ipv6[i];Execution Count:64 | 64 |
| 743 | address.setAddress(ipv6); | - |
| 744 | | - |
| 745 | QString scope; | - |
| 746 | in >> scope; | - |
| 747 | address.setScopeId(scope); | - |
| 748 | } | - |
| 749 | break; executed: break;Execution Count:4 | 4 |
| 750 | case QAbstractSocket::AnyIPProtocol: | - |
| 751 | address = QHostAddress::Any; | - |
| 752 | break; executed: break;Execution Count:1 | 1 |
| 753 | default: | - |
| 754 | address.clear(); | - |
| 755 | in.setStatus(QDataStream::ReadCorruptData); | - |
| 756 | } | 0 |
| 757 | return in; executed: return in;Execution Count:13 | 13 |
| 758 | } | - |
| 759 | | - |
| 760 | | - |
| 761 | | - |
| 762 | | - |
| 763 | | - |
| | |