| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | enum { | - |
| 9 | DefaultStreamVersion = QDataStream::Qt_5_0 | - |
| 10 | }; | - |
| 11 | | - |
| 12 | | - |
| 13 | | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | QDataStream::QDataStream() | - |
| 19 | { | - |
| 20 | dev = 0; | - |
| 21 | owndev = false; | - |
| 22 | byteorder = BigEndian; | - |
| 23 | ver = DefaultStreamVersion; | - |
| 24 | noswap = QSysInfo::ByteOrder == QSysInfo::BigEndian; | - |
| 25 | q_status = Ok; | - |
| 26 | } executed: }Execution Count:275 | 275 |
| 27 | QDataStream::QDataStream(QIODevice *d) | - |
| 28 | { | - |
| 29 | dev = d; | - |
| 30 | owndev = false; | - |
| 31 | byteorder = BigEndian; | - |
| 32 | ver = DefaultStreamVersion; | - |
| 33 | noswap = QSysInfo::ByteOrder == QSysInfo::BigEndian; | - |
| 34 | q_status = Ok; | - |
| 35 | } executed: }Execution Count:3342 | 3342 |
| 36 | QDataStream::QDataStream(QByteArray *a, QIODevice::OpenMode flags) | - |
| 37 | { | - |
| 38 | QBuffer *buf = new QBuffer(a); | - |
| 39 | | - |
| 40 | buf->blockSignals(true); | - |
| 41 | | - |
| 42 | buf->open(flags); | - |
| 43 | dev = buf; | - |
| 44 | owndev = true; | - |
| 45 | byteorder = BigEndian; | - |
| 46 | ver = DefaultStreamVersion; | - |
| 47 | noswap = QSysInfo::ByteOrder == QSysInfo::BigEndian; | - |
| 48 | q_status = Ok; | - |
| 49 | } executed: }Execution Count:3168 | 3168 |
| 50 | QDataStream::QDataStream(const QByteArray &a) | - |
| 51 | { | - |
| 52 | QBuffer *buf = new QBuffer; | - |
| 53 | | - |
| 54 | buf->blockSignals(true); | - |
| 55 | | - |
| 56 | buf->setData(a); | - |
| 57 | buf->open(QIODevice::ReadOnly); | - |
| 58 | dev = buf; | - |
| 59 | owndev = true; | - |
| 60 | byteorder = BigEndian; | - |
| 61 | ver = DefaultStreamVersion; | - |
| 62 | noswap = QSysInfo::ByteOrder == QSysInfo::BigEndian; | - |
| 63 | q_status = Ok; | - |
| 64 | } executed: }Execution Count:33 | 33 |
| 65 | QDataStream::~QDataStream() | - |
| 66 | { | - |
| 67 | if (owndev) evaluated: owndev| yes Evaluation Count:3201 | yes Evaluation Count:3617 |
| 3201-3617 |
| 68 | delete dev; executed: delete dev;Execution Count:3201 | 3201 |
| 69 | } executed: }Execution Count:6818 | 6818 |
| 70 | void QDataStream::setDevice(QIODevice *d) | - |
| 71 | { | - |
| 72 | if (owndev) { partially evaluated: owndev| no Evaluation Count:0 | yes Evaluation Count:67 |
| 0-67 |
| 73 | delete dev; | - |
| 74 | owndev = false; | - |
| 75 | } | 0 |
| 76 | dev = d; | - |
| 77 | } executed: }Execution Count:67 | 67 |
| 78 | | - |
| 79 | | - |
| 80 | | - |
| 81 | | - |
| 82 | | - |
| 83 | | - |
| 84 | | - |
| 85 | void QDataStream::unsetDevice() | - |
| 86 | { | - |
| 87 | setDevice(0); | - |
| 88 | } executed: }Execution Count:20 | 20 |
| 89 | bool QDataStream::atEnd() const | - |
| 90 | { | - |
| 91 | return dev ? dev->atEnd() : true; executed: return dev ? dev->atEnd() : true;Execution Count:1406 | 1406 |
| 92 | } | - |
| 93 | QDataStream::FloatingPointPrecision QDataStream::floatingPointPrecision() const | - |
| 94 | { | - |
| 95 | return d == 0 ? QDataStream::DoublePrecision : d->floatingPointPrecision; executed: return d == 0 ? QDataStream::DoublePrecision : d->floatingPointPrecision;Execution Count:9593 | 9593 |
| 96 | } | - |
| 97 | void QDataStream::setFloatingPointPrecision(QDataStream::FloatingPointPrecision precision) | - |
| 98 | { | - |
| 99 | if (d == 0) partially evaluated: d == 0| yes Evaluation Count:58 | no Evaluation Count:0 |
| 0-58 |
| 100 | d.reset(new QDataStreamPrivate()); executed: d.reset(new QDataStreamPrivate());Execution Count:58 | 58 |
| 101 | d->floatingPointPrecision = precision; | - |
| 102 | } executed: }Execution Count:58 | 58 |
| 103 | | - |
| 104 | | - |
| 105 | | - |
| 106 | | - |
| 107 | | - |
| 108 | | - |
| 109 | | - |
| 110 | QDataStream::Status QDataStream::status() const | - |
| 111 | { | - |
| 112 | return q_status; executed: return q_status;Execution Count:14753 | 14753 |
| 113 | } | - |
| 114 | | - |
| 115 | | - |
| 116 | | - |
| 117 | | - |
| 118 | | - |
| 119 | | - |
| 120 | void QDataStream::resetStatus() | - |
| 121 | { | - |
| 122 | q_status = Ok; | - |
| 123 | } executed: }Execution Count:465 | 465 |
| 124 | void QDataStream::setStatus(Status status) | - |
| 125 | { | - |
| 126 | if (q_status == Ok) evaluated: q_status == Ok| yes Evaluation Count:336 | yes Evaluation Count:125 |
| 125-336 |
| 127 | q_status = status; executed: q_status = status;Execution Count:336 | 336 |
| 128 | } executed: }Execution Count:461 | 461 |
| 129 | void QDataStream::setByteOrder(ByteOrder bo) | - |
| 130 | { | - |
| 131 | byteorder = bo; | - |
| 132 | if (QSysInfo::ByteOrder == QSysInfo::BigEndian) partially evaluated: QSysInfo::ByteOrder == QSysInfo::BigEndian| no Evaluation Count:0 | yes Evaluation Count:875 |
| 0-875 |
| 133 | noswap = (byteorder == BigEndian); never executed: noswap = (byteorder == BigEndian); | 0 |
| 134 | else | - |
| 135 | noswap = (byteorder == LittleEndian); executed: noswap = (byteorder == LittleEndian);Execution Count:875 | 875 |
| 136 | } | - |
| 137 | QDataStream &QDataStream::operator>>(qint8 &i) | - |
| 138 | { | - |
| 139 | i = 0; | - |
| 140 | if (!dev) { return *this; } partially evaluated: !dev| no Evaluation Count:0 | yes Evaluation Count:17825 |
never executed: return *this; | 0-17825 |
| 141 | char c; | - |
| 142 | if (!dev->getChar(&c)) evaluated: !dev->getChar(&c)| yes Evaluation Count:28 | yes Evaluation Count:17797 |
| 28-17797 |
| 143 | setStatus(ReadPastEnd); executed: setStatus(ReadPastEnd);Execution Count:28 | 28 |
| 144 | else | - |
| 145 | i = qint8(c); executed: i = qint8(c);Execution Count:17797 | 17797 |
| 146 | return *this; executed: return *this;Execution Count:17825 | 17825 |
| 147 | } | - |
| 148 | QDataStream &QDataStream::operator>>(qint16 &i) | - |
| 149 | { | - |
| 150 | i = 0; | - |
| 151 | if (!dev) { return *this; } partially evaluated: !dev| no Evaluation Count:0 | yes Evaluation Count:6818 |
never executed: return *this; | 0-6818 |
| 152 | if (dev->read((char *)&i, 2) != 2) { evaluated: dev->read((char *)&i, 2) != 2| yes Evaluation Count:58 | yes Evaluation Count:6760 |
| 58-6760 |
| 153 | i = 0; | - |
| 154 | setStatus(ReadPastEnd); | - |
| 155 | } else { executed: }Execution Count:58 | 58 |
| 156 | if (!noswap) { evaluated: !noswap| yes Evaluation Count:5464 | yes Evaluation Count:1296 |
| 1296-5464 |
| 157 | i = qbswap(i); | - |
| 158 | } executed: }Execution Count:5464 | 5464 |
| 159 | } executed: }Execution Count:6760 | 6760 |
| 160 | return *this; executed: return *this;Execution Count:6818 | 6818 |
| 161 | } | - |
| 162 | QDataStream &QDataStream::operator>>(qint32 &i) | - |
| 163 | { | - |
| 164 | i = 0; | - |
| 165 | if (!dev) { return *this; } partially evaluated: !dev| no Evaluation Count:0 | yes Evaluation Count:52588 |
never executed: return *this; | 0-52588 |
| 166 | if (dev->read((char *)&i, 4) != 4) { evaluated: dev->read((char *)&i, 4) != 4| yes Evaluation Count:185 | yes Evaluation Count:52403 |
| 185-52403 |
| 167 | i = 0; | - |
| 168 | setStatus(ReadPastEnd); | - |
| 169 | } else { executed: }Execution Count:185 | 185 |
| 170 | if (!noswap) { evaluated: !noswap| yes Evaluation Count:48860 | yes Evaluation Count:3543 |
| 3543-48860 |
| 171 | i = qbswap(i); | - |
| 172 | } executed: }Execution Count:48860 | 48860 |
| 173 | } executed: }Execution Count:52403 | 52403 |
| 174 | return *this; executed: return *this;Execution Count:52588 | 52588 |
| 175 | } | - |
| 176 | QDataStream &QDataStream::operator>>(qint64 &i) | - |
| 177 | { | - |
| 178 | i = qint64(0); | - |
| 179 | if (!dev) { return *this; } partially evaluated: !dev| no Evaluation Count:0 | yes Evaluation Count:600 |
never executed: return *this; | 0-600 |
| 180 | if (version() < 6) { partially evaluated: version() < 6| no Evaluation Count:0 | yes Evaluation Count:600 |
| 0-600 |
| 181 | quint32 i1, i2; | - |
| 182 | *this >> i2 >> i1; | - |
| 183 | i = ((quint64)i1 << 32) + i2; | - |
| 184 | } else { | 0 |
| 185 | if (dev->read((char *)&i, 8) != 8) { evaluated: dev->read((char *)&i, 8) != 8| yes Evaluation Count:50 | yes Evaluation Count:550 |
| 50-550 |
| 186 | i = qint64(0); | - |
| 187 | setStatus(ReadPastEnd); | - |
| 188 | } else { executed: }Execution Count:50 | 50 |
| 189 | if (!noswap) { evaluated: !noswap| yes Evaluation Count:538 | yes Evaluation Count:12 |
| 12-538 |
| 190 | i = qbswap(i); | - |
| 191 | } executed: }Execution Count:538 | 538 |
| 192 | } executed: }Execution Count:550 | 550 |
| 193 | } | - |
| 194 | return *this; executed: return *this;Execution Count:600 | 600 |
| 195 | } | - |
| 196 | | - |
| 197 | | - |
| 198 | | - |
| 199 | | - |
| 200 | | - |
| 201 | QDataStream &QDataStream::operator>>(bool &i) | - |
| 202 | { | - |
| 203 | qint8 v; | - |
| 204 | *this >> v; | - |
| 205 | i = !!v; | - |
| 206 | return *this; executed: return *this;Execution Count:1260 | 1260 |
| 207 | } | - |
| 208 | QDataStream &QDataStream::operator>>(float &f) | - |
| 209 | { | - |
| 210 | if (version() >= QDataStream::Qt_4_6 partially evaluated: version() >= QDataStream::Qt_4_6| yes Evaluation Count:38 | no Evaluation Count:0 |
| 0-38 |
| 211 | && floatingPointPrecision() == QDataStream::DoublePrecision) { evaluated: floatingPointPrecision() == QDataStream::DoublePrecision| yes Evaluation Count:12 | yes Evaluation Count:26 |
| 12-26 |
| 212 | double d; | - |
| 213 | *this >> d; | - |
| 214 | f = d; | - |
| 215 | return *this; executed: return *this;Execution Count:12 | 12 |
| 216 | } | - |
| 217 | | - |
| 218 | f = 0.0f; | - |
| 219 | if (!dev) { return *this; } partially evaluated: !dev| no Evaluation Count:0 | yes Evaluation Count:26 |
never executed: return *this; | 0-26 |
| 220 | if (dev->read((char *)&f, 4) != 4) { evaluated: dev->read((char *)&f, 4) != 4| yes Evaluation Count:10 | yes Evaluation Count:16 |
| 10-16 |
| 221 | f = 0.0f; | - |
| 222 | setStatus(ReadPastEnd); | - |
| 223 | } else { executed: }Execution Count:10 | 10 |
| 224 | if (!noswap) { evaluated: !noswap| yes Evaluation Count:10 | yes Evaluation Count:6 |
| 6-10 |
| 225 | union { | - |
| 226 | float val1; | - |
| 227 | quint32 val2; | - |
| 228 | } x; | - |
| 229 | x.val2 = qbswap(*reinterpret_cast<quint32 *>(&f)); | - |
| 230 | f = x.val1; | - |
| 231 | } executed: }Execution Count:10 | 10 |
| 232 | } executed: }Execution Count:16 | 16 |
| 233 | return *this; executed: return *this;Execution Count:26 | 26 |
| 234 | } | - |
| 235 | QDataStream &QDataStream::operator>>(double &f) | - |
| 236 | { | - |
| 237 | if (version() >= QDataStream::Qt_4_6 evaluated: version() >= QDataStream::Qt_4_6| yes Evaluation Count:4812 | yes Evaluation Count:3220 |
| 3220-4812 |
| 238 | && floatingPointPrecision() == QDataStream::SinglePrecision) { evaluated: floatingPointPrecision() == QDataStream::SinglePrecision| yes Evaluation Count:1 | yes Evaluation Count:4811 |
| 1-4811 |
| 239 | float d; | - |
| 240 | *this >> d; | - |
| 241 | f = d; | - |
| 242 | return *this; executed: return *this;Execution Count:1 | 1 |
| 243 | } | - |
| 244 | | - |
| 245 | f = 0.0; | - |
| 246 | if (!dev) { return *this; } partially evaluated: !dev| no Evaluation Count:0 | yes Evaluation Count:8031 |
never executed: return *this; | 0-8031 |
| 247 | if (dev->read((char *)&f, 8) != 8) { evaluated: dev->read((char *)&f, 8) != 8| yes Evaluation Count:46 | yes Evaluation Count:7985 |
| 46-7985 |
| 248 | f = 0.0; | - |
| 249 | setStatus(ReadPastEnd); | - |
| 250 | } else { executed: }Execution Count:46 | 46 |
| 251 | if (!noswap) { evaluated: !noswap| yes Evaluation Count:7978 | yes Evaluation Count:7 |
| 7-7978 |
| 252 | union { | - |
| 253 | double val1; | - |
| 254 | quint64 val2; | - |
| 255 | } x; | - |
| 256 | x.val2 = qbswap(*reinterpret_cast<quint64 *>(&f)); | - |
| 257 | f = x.val1; | - |
| 258 | } executed: }Execution Count:7978 | 7978 |
| 259 | } executed: }Execution Count:7985 | 7985 |
| 260 | return *this; executed: return *this;Execution Count:8031 | 8031 |
| 261 | } | - |
| 262 | QDataStream &QDataStream::operator>>(char *&s) | - |
| 263 | { | - |
| 264 | uint len = 0; | - |
| 265 | return readBytes(s, len); executed: return readBytes(s, len);Execution Count:28 | 28 |
| 266 | } | - |
| 267 | QDataStream &QDataStream::readBytes(char *&s, uint &l) | - |
| 268 | { | - |
| 269 | s = 0; | - |
| 270 | l = 0; | - |
| 271 | if (!dev) { return *this; } partially evaluated: !dev| no Evaluation Count:0 | yes Evaluation Count:56 |
never executed: return *this; | 0-56 |
| 272 | | - |
| 273 | quint32 len; | - |
| 274 | *this >> len; | - |
| 275 | if (len == 0) evaluated: len == 0| yes Evaluation Count:10 | yes Evaluation Count:46 |
| 10-46 |
| 276 | return *this; executed: return *this;Execution Count:10 | 10 |
| 277 | | - |
| 278 | const quint32 Step = 1024 * 1024; | - |
| 279 | quint32 allocated = 0; | - |
| 280 | char *prevBuf = 0; | - |
| 281 | char *curBuf = 0; | - |
| 282 | | - |
| 283 | do { | - |
| 284 | int blockSize = qMin(Step, len - allocated); | - |
| 285 | prevBuf = curBuf; | - |
| 286 | curBuf = new char[allocated + blockSize + 1]; | - |
| 287 | if (prevBuf) { evaluated: prevBuf| yes Evaluation Count:28 | yes Evaluation Count:46 |
| 28-46 |
| 288 | memcpy(curBuf, prevBuf, allocated); | - |
| 289 | delete [] prevBuf; | - |
| 290 | } executed: }Execution Count:28 | 28 |
| 291 | if (dev->read(curBuf + allocated, blockSize) != blockSize) { evaluated: dev->read(curBuf + allocated, blockSize) != blockSize| yes Evaluation Count:24 | yes Evaluation Count:50 |
| 24-50 |
| 292 | delete [] curBuf; | - |
| 293 | setStatus(ReadPastEnd); | - |
| 294 | return *this; executed: return *this;Execution Count:24 | 24 |
| 295 | } | - |
| 296 | allocated += blockSize; | - |
| 297 | } while (allocated < len); evaluated: allocated < len| yes Evaluation Count:28 | yes Evaluation Count:22 |
executed: }Execution Count:50 | 22-50 |
| 298 | | - |
| 299 | s = curBuf; | - |
| 300 | s[len] = '\0'; | - |
| 301 | l = (uint)len; | - |
| 302 | return *this; executed: return *this;Execution Count:22 | 22 |
| 303 | } | - |
| 304 | int QDataStream::readRawData(char *s, int len) | - |
| 305 | { | - |
| 306 | if (!dev) { return -1; } partially evaluated: !dev| no Evaluation Count:0 | yes Evaluation Count:15407 |
never executed: return -1; | 0-15407 |
| 307 | return dev->read(s, len); executed: return dev->read(s, len);Execution Count:15407 | 15407 |
| 308 | } | - |
| 309 | QDataStream &QDataStream::operator<<(qint8 i) | - |
| 310 | { | - |
| 311 | if (!dev) { return *this; } if (q_status != Ok) return *this; partially evaluated: !dev| no Evaluation Count:0 | yes Evaluation Count:16668 |
evaluated: q_status != Ok| yes Evaluation Count:2 | yes Evaluation Count:16666 |
never executed: return *this; executed: return *this;Execution Count:2 | 0-16668 |
| 312 | if (!dev->putChar(i)) evaluated: !dev->putChar(i)| yes Evaluation Count:2 | yes Evaluation Count:16664 |
| 2-16664 |
| 313 | q_status = WriteFailed; executed: q_status = WriteFailed;Execution Count:2 | 2 |
| 314 | return *this; executed: return *this;Execution Count:16666 | 16666 |
| 315 | } | - |
| 316 | QDataStream &QDataStream::operator<<(qint16 i) | - |
| 317 | { | - |
| 318 | if (!dev) { return *this; } if (q_status != Ok) return *this; partially evaluated: !dev| no Evaluation Count:0 | yes Evaluation Count:5757 |
evaluated: q_status != Ok| yes Evaluation Count:2 | yes Evaluation Count:5755 |
never executed: return *this; executed: return *this;Execution Count:2 | 0-5757 |
| 319 | if (!noswap) { evaluated: !noswap| yes Evaluation Count:5627 | yes Evaluation Count:128 |
| 128-5627 |
| 320 | i = qbswap(i); | - |
| 321 | } executed: }Execution Count:5627 | 5627 |
| 322 | if (dev->write((char *)&i, sizeof(qint16)) != sizeof(qint16)) evaluated: dev->write((char *)&i, sizeof(qint16)) != sizeof(qint16)| yes Evaluation Count:2 | yes Evaluation Count:5753 |
| 2-5753 |
| 323 | q_status = WriteFailed; executed: q_status = WriteFailed;Execution Count:2 | 2 |
| 324 | return *this; executed: return *this;Execution Count:5755 | 5755 |
| 325 | } | - |
| 326 | QDataStream &QDataStream::operator<<(qint32 i) | - |
| 327 | { | - |
| 328 | if (!dev) { return *this; } if (q_status != Ok) return *this; partially evaluated: !dev| no Evaluation Count:0 | yes Evaluation Count:53180 |
evaluated: q_status != Ok| yes Evaluation Count:3 | yes Evaluation Count:53177 |
never executed: return *this; executed: return *this;Execution Count:3 | 0-53180 |
| 329 | if (!noswap) { evaluated: !noswap| yes Evaluation Count:52825 | yes Evaluation Count:352 |
| 352-52825 |
| 330 | i = qbswap(i); | - |
| 331 | } executed: }Execution Count:52825 | 52825 |
| 332 | if (dev->write((char *)&i, sizeof(qint32)) != sizeof(qint32)) evaluated: dev->write((char *)&i, sizeof(qint32)) != sizeof(qint32)| yes Evaluation Count:3 | yes Evaluation Count:53174 |
| 3-53174 |
| 333 | q_status = WriteFailed; executed: q_status = WriteFailed;Execution Count:3 | 3 |
| 334 | return *this; executed: return *this;Execution Count:53177 | 53177 |
| 335 | } | - |
| 336 | QDataStream &QDataStream::operator<<(qint64 i) | - |
| 337 | { | - |
| 338 | if (!dev) { return *this; } if (q_status != Ok) return *this; partially evaluated: !dev| no Evaluation Count:0 | yes Evaluation Count:536 |
evaluated: q_status != Ok| yes Evaluation Count:2 | yes Evaluation Count:534 |
never executed: return *this; executed: return *this;Execution Count:2 | 0-536 |
| 339 | if (version() < 6) { partially evaluated: version() < 6| no Evaluation Count:0 | yes Evaluation Count:534 |
| 0-534 |
| 340 | quint32 i1 = i & 0xffffffff; | - |
| 341 | quint32 i2 = i >> 32; | - |
| 342 | *this << i2 << i1; | - |
| 343 | } else { | 0 |
| 344 | if (!noswap) { partially evaluated: !noswap| yes Evaluation Count:534 | no Evaluation Count:0 |
| 0-534 |
| 345 | i = qbswap(i); | - |
| 346 | } executed: }Execution Count:534 | 534 |
| 347 | if (dev->write((char *)&i, sizeof(qint64)) != sizeof(qint64)) evaluated: dev->write((char *)&i, sizeof(qint64)) != sizeof(qint64)| yes Evaluation Count:2 | yes Evaluation Count:532 |
| 2-532 |
| 348 | q_status = WriteFailed; executed: q_status = WriteFailed;Execution Count:2 | 2 |
| 349 | } executed: }Execution Count:534 | 534 |
| 350 | return *this; executed: return *this;Execution Count:534 | 534 |
| 351 | } | - |
| 352 | QDataStream &QDataStream::operator<<(bool i) | - |
| 353 | { | - |
| 354 | if (!dev) { return *this; } if (q_status != Ok) return *this; partially evaluated: !dev| no Evaluation Count:0 | yes Evaluation Count:1966 |
evaluated: q_status != Ok| yes Evaluation Count:1 | yes Evaluation Count:1965 |
never executed: return *this; executed: return *this;Execution Count:1 | 0-1966 |
| 355 | if (!dev->putChar(qint8(i))) evaluated: !dev->putChar(qint8(i))| yes Evaluation Count:1 | yes Evaluation Count:1964 |
| 1-1964 |
| 356 | q_status = WriteFailed; executed: q_status = WriteFailed;Execution Count:1 | 1 |
| 357 | return *this; executed: return *this;Execution Count:1965 | 1965 |
| 358 | } | - |
| 359 | QDataStream &QDataStream::operator<<(float f) | - |
| 360 | { | - |
| 361 | if (version() >= QDataStream::Qt_4_6 partially evaluated: version() >= QDataStream::Qt_4_6| yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
| 362 | && floatingPointPrecision() == QDataStream::DoublePrecision) { evaluated: floatingPointPrecision() == QDataStream::DoublePrecision| yes Evaluation Count:10 | yes Evaluation Count:4 |
| 4-10 |
| 363 | *this << double(f); | - |
| 364 | return *this; executed: return *this;Execution Count:10 | 10 |
| 365 | } | - |
| 366 | | - |
| 367 | if (!dev) { return *this; } if (q_status != Ok) return *this; partially evaluated: !dev| no Evaluation Count:0 | yes Evaluation Count:4 |
partially evaluated: q_status != Ok| no Evaluation Count:0 | yes Evaluation Count:4 |
never executed: return *this; never executed: return *this; | 0-4 |
| 368 | float g = f; | - |
| 369 | if (!noswap) { partially evaluated: !noswap| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 370 | union { | - |
| 371 | float val1; | - |
| 372 | quint32 val2; | - |
| 373 | } x; | - |
| 374 | x.val1 = g; | - |
| 375 | x.val2 = qbswap(x.val2); | - |
| 376 | | - |
| 377 | if (dev->write((char *)&x.val2, sizeof(float)) != sizeof(float)) partially evaluated: dev->write((char *)&x.val2, sizeof(float)) != sizeof(float)| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 378 | q_status = WriteFailed; never executed: q_status = WriteFailed; | 0 |
| 379 | return *this; executed: return *this;Execution Count:4 | 4 |
| 380 | } | - |
| 381 | | - |
| 382 | if (dev->write((char *)&g, sizeof(float)) != sizeof(float)) never evaluated: dev->write((char *)&g, sizeof(float)) != sizeof(float) | 0 |
| 383 | q_status = WriteFailed; never executed: q_status = WriteFailed; | 0 |
| 384 | return *this; never executed: return *this; | 0 |
| 385 | } | - |
| 386 | QDataStream &QDataStream::operator<<(double f) | - |
| 387 | { | - |
| 388 | if (version() >= QDataStream::Qt_4_6 evaluated: version() >= QDataStream::Qt_4_6| yes Evaluation Count:4728 | yes Evaluation Count:3607 |
| 3607-4728 |
| 389 | && floatingPointPrecision() == QDataStream::SinglePrecision) { evaluated: floatingPointPrecision() == QDataStream::SinglePrecision| yes Evaluation Count:1 | yes Evaluation Count:4727 |
| 1-4727 |
| 390 | *this << float(f); | - |
| 391 | return *this; executed: return *this;Execution Count:1 | 1 |
| 392 | } | - |
| 393 | | - |
| 394 | if (!dev) { return *this; } if (q_status != Ok) return *this; partially evaluated: !dev| no Evaluation Count:0 | yes Evaluation Count:8334 |
evaluated: q_status != Ok| yes Evaluation Count:2 | yes Evaluation Count:8332 |
never executed: return *this; executed: return *this;Execution Count:2 | 0-8334 |
| 395 | if (noswap) { partially evaluated: noswap| no Evaluation Count:0 | yes Evaluation Count:8332 |
| 0-8332 |
| 396 | if (dev->write((char *)&f, sizeof(double)) != sizeof(double)) never evaluated: dev->write((char *)&f, sizeof(double)) != sizeof(double) | 0 |
| 397 | q_status = WriteFailed; never executed: q_status = WriteFailed; | 0 |
| 398 | } else { | 0 |
| 399 | union { | - |
| 400 | double val1; | - |
| 401 | quint64 val2; | - |
| 402 | } x; | - |
| 403 | x.val1 = f; | - |
| 404 | x.val2 = qbswap(x.val2); | - |
| 405 | if (dev->write((char *)&x.val2, sizeof(double)) != sizeof(double)) evaluated: dev->write((char *)&x.val2, sizeof(double)) != sizeof(double)| yes Evaluation Count:2 | yes Evaluation Count:8330 |
| 2-8330 |
| 406 | q_status = WriteFailed; executed: q_status = WriteFailed;Execution Count:2 | 2 |
| 407 | } executed: }Execution Count:8332 | 8332 |
| 408 | return *this; executed: return *this;Execution Count:8332 | 8332 |
| 409 | } | - |
| 410 | QDataStream &QDataStream::operator<<(const char *s) | - |
| 411 | { | - |
| 412 | if (!s) { partially evaluated: !s| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 413 | *this << (quint32)0; | - |
| 414 | return *this; never executed: return *this; | 0 |
| 415 | } | - |
| 416 | uint len = qstrlen(s) + 1; | - |
| 417 | *this << (quint32)len; | - |
| 418 | writeRawData(s, len); | - |
| 419 | return *this; executed: return *this;Execution Count:4 | 4 |
| 420 | } | - |
| 421 | QDataStream &QDataStream::writeBytes(const char *s, uint len) | - |
| 422 | { | - |
| 423 | if (!dev) { return *this; } if (q_status != Ok) return *this; never executed: return *this; never executed: return *this; partially evaluated: !dev| no Evaluation Count:0 | yes Evaluation Count:15342 |
partially evaluated: q_status != Ok| no Evaluation Count:0 | yes Evaluation Count:15342 |
| 0-15342 |
| 424 | *this << (quint32)len; | - |
| 425 | if (len) evaluated: len| yes Evaluation Count:15121 | yes Evaluation Count:221 |
| 221-15121 |
| 426 | writeRawData(s, len); executed: writeRawData(s, len);Execution Count:15121 | 15121 |
| 427 | return *this; executed: return *this;Execution Count:15342 | 15342 |
| 428 | } | - |
| 429 | int QDataStream::writeRawData(const char *s, int len) | - |
| 430 | { | - |
| 431 | if (!dev) { return -1; } if (q_status != Ok) return -1; never executed: return -1; executed: return -1;Execution Count:3 partially evaluated: !dev| no Evaluation Count:0 | yes Evaluation Count:16514 |
evaluated: q_status != Ok| yes Evaluation Count:3 | yes Evaluation Count:16511 |
| 0-16514 |
| 432 | int ret = dev->write(s, len); | - |
| 433 | if (ret != len) evaluated: ret != len| yes Evaluation Count:1 | yes Evaluation Count:16510 |
| 1-16510 |
| 434 | q_status = WriteFailed; executed: q_status = WriteFailed;Execution Count:1 | 1 |
| 435 | return ret; executed: return ret;Execution Count:16511 | 16511 |
| 436 | } | - |
| 437 | int QDataStream::skipRawData(int len) | - |
| 438 | { | - |
| 439 | if (!dev) { return -1; } never executed: return -1; partially evaluated: !dev| no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
| 440 | | - |
| 441 | if (dev->isSequential()) { evaluated: dev->isSequential()| yes Evaluation Count:3 | yes Evaluation Count:3 |
| 3 |
| 442 | char buf[4096]; | - |
| 443 | int sumRead = 0; | - |
| 444 | | - |
| 445 | while (len > 0) { evaluated: len > 0| yes Evaluation Count:9 | yes Evaluation Count:3 |
| 3-9 |
| 446 | int blockSize = qMin(len, (int)sizeof(buf)); | - |
| 447 | int n = dev->read(buf, blockSize); | - |
| 448 | if (n == -1) partially evaluated: n == -1| no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
| 449 | return -1; never executed: return -1; | 0 |
| 450 | if (n == 0) partially evaluated: n == 0| no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
| 451 | return sumRead; never executed: return sumRead; | 0 |
| 452 | | - |
| 453 | sumRead += n; | - |
| 454 | len -= blockSize; | - |
| 455 | } executed: }Execution Count:9 | 9 |
| 456 | return sumRead; executed: return sumRead;Execution Count:3 | 3 |
| 457 | } else { | - |
| 458 | qint64 pos = dev->pos(); | - |
| 459 | qint64 size = dev->size(); | - |
| 460 | if (pos + len > size) evaluated: pos + len > size| yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
| 461 | len = size - pos; executed: len = size - pos;Execution Count:1 | 1 |
| 462 | if (!dev->seek(pos + len)) partially evaluated: !dev->seek(pos + len)| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 463 | return -1; never executed: return -1; | 0 |
| 464 | return len; executed: return len;Execution Count:3 | 3 |
| 465 | } | - |
| 466 | } | - |
| 467 | | - |
| 468 | | - |
| 469 | | - |
| | |