| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qnoncontiguousbytedevice.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||||||||
| 3 | QNonContiguousByteDevice::QNonContiguousByteDevice() : QObject((QObject*)0) | - | ||||||||||||||||||||||||||||||
| 4 | { | - | ||||||||||||||||||||||||||||||
| 5 | } executed 494 times by 4 tests: end of blockExecuted by:
| 494 | ||||||||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||||||||
| 7 | QNonContiguousByteDevice::~QNonContiguousByteDevice() | - | ||||||||||||||||||||||||||||||
| 8 | { | - | ||||||||||||||||||||||||||||||
| 9 | } | - | ||||||||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||||||||
| 12 | QNonContiguousByteDeviceBufferImpl::QNonContiguousByteDeviceBufferImpl(QBuffer *b) : QNonContiguousByteDevice() | - | ||||||||||||||||||||||||||||||
| 13 | { | - | ||||||||||||||||||||||||||||||
| 14 | buffer = b; | - | ||||||||||||||||||||||||||||||
| 15 | byteArray = QByteArray::fromRawData(buffer->buffer().constData() + buffer->pos(), buffer->size() - buffer->pos()); | - | ||||||||||||||||||||||||||||||
| 16 | arrayImpl = new QNonContiguousByteDeviceByteArrayImpl(&byteArray); | - | ||||||||||||||||||||||||||||||
| 17 | arrayImpl->setParent(this); | - | ||||||||||||||||||||||||||||||
| 18 | connect(arrayImpl, qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "145"), qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "145")); | - | ||||||||||||||||||||||||||||||
| 19 | connect(arrayImpl, qFlagLocation("2""readProgress(qint64,qint64)" "\0" __FILE__ ":" "146"), qFlagLocation("2""readProgress(qint64,qint64)" "\0" __FILE__ ":" "146")); | - | ||||||||||||||||||||||||||||||
| 20 | } executed 79 times by 3 tests: end of blockExecuted by:
| 79 | ||||||||||||||||||||||||||||||
| 21 | - | |||||||||||||||||||||||||||||||
| 22 | QNonContiguousByteDeviceBufferImpl::~QNonContiguousByteDeviceBufferImpl() | - | ||||||||||||||||||||||||||||||
| 23 | { | - | ||||||||||||||||||||||||||||||
| 24 | } | - | ||||||||||||||||||||||||||||||
| 25 | - | |||||||||||||||||||||||||||||||
| 26 | const char* QNonContiguousByteDeviceBufferImpl::readPointer(qint64 maximumLength, qint64 &len) | - | ||||||||||||||||||||||||||||||
| 27 | { | - | ||||||||||||||||||||||||||||||
| 28 | return executed 1306 times by 3 tests: arrayImpl->readPointer(maximumLength, len);return arrayImpl->readPointer(maximumLength, len);Executed by:
executed 1306 times by 3 tests: return arrayImpl->readPointer(maximumLength, len);Executed by:
| 1306 | ||||||||||||||||||||||||||||||
| 29 | } | - | ||||||||||||||||||||||||||||||
| 30 | - | |||||||||||||||||||||||||||||||
| 31 | bool QNonContiguousByteDeviceBufferImpl::advanceReadPointer(qint64 amount) | - | ||||||||||||||||||||||||||||||
| 32 | { | - | ||||||||||||||||||||||||||||||
| 33 | return executed 1273 times by 2 tests: arrayImpl->advanceReadPointer(amount);return arrayImpl->advanceReadPointer(amount);Executed by:
executed 1273 times by 2 tests: return arrayImpl->advanceReadPointer(amount);Executed by:
| 1273 | ||||||||||||||||||||||||||||||
| 34 | } | - | ||||||||||||||||||||||||||||||
| 35 | - | |||||||||||||||||||||||||||||||
| 36 | bool QNonContiguousByteDeviceBufferImpl::atEnd() const | - | ||||||||||||||||||||||||||||||
| 37 | { | - | ||||||||||||||||||||||||||||||
| 38 | return executed 1051 times by 3 tests: arrayImpl->atEnd();return arrayImpl->atEnd();Executed by:
executed 1051 times by 3 tests: return arrayImpl->atEnd();Executed by:
| 1051 | ||||||||||||||||||||||||||||||
| 39 | } | - | ||||||||||||||||||||||||||||||
| 40 | - | |||||||||||||||||||||||||||||||
| 41 | bool QNonContiguousByteDeviceBufferImpl::reset() | - | ||||||||||||||||||||||||||||||
| 42 | { | - | ||||||||||||||||||||||||||||||
| 43 | return executed 3 times by 1 test: arrayImpl->reset();return arrayImpl->reset();Executed by:
executed 3 times by 1 test: return arrayImpl->reset();Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 44 | } | - | ||||||||||||||||||||||||||||||
| 45 | - | |||||||||||||||||||||||||||||||
| 46 | qint64 QNonContiguousByteDeviceBufferImpl::size() const | - | ||||||||||||||||||||||||||||||
| 47 | { | - | ||||||||||||||||||||||||||||||
| 48 | return executed 1100 times by 3 tests: arrayImpl->size();return arrayImpl->size();Executed by:
executed 1100 times by 3 tests: return arrayImpl->size();Executed by:
| 1100 | ||||||||||||||||||||||||||||||
| 49 | } | - | ||||||||||||||||||||||||||||||
| 50 | - | |||||||||||||||||||||||||||||||
| 51 | QNonContiguousByteDeviceByteArrayImpl::QNonContiguousByteDeviceByteArrayImpl(QByteArray *ba) : QNonContiguousByteDevice(), currentPosition(0) | - | ||||||||||||||||||||||||||||||
| 52 | { | - | ||||||||||||||||||||||||||||||
| 53 | byteArray = ba; | - | ||||||||||||||||||||||||||||||
| 54 | } executed 84 times by 4 tests: end of blockExecuted by:
| 84 | ||||||||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||||||||
| 56 | QNonContiguousByteDeviceByteArrayImpl::~QNonContiguousByteDeviceByteArrayImpl() | - | ||||||||||||||||||||||||||||||
| 57 | { | - | ||||||||||||||||||||||||||||||
| 58 | } | - | ||||||||||||||||||||||||||||||
| 59 | - | |||||||||||||||||||||||||||||||
| 60 | const char* QNonContiguousByteDeviceByteArrayImpl::readPointer(qint64 maximumLength, qint64 &len) | - | ||||||||||||||||||||||||||||||
| 61 | { | - | ||||||||||||||||||||||||||||||
| 62 | if (atEnd()
| 32-1278 | ||||||||||||||||||||||||||||||
| 63 | len = -1; | - | ||||||||||||||||||||||||||||||
| 64 | return executed 32 times by 2 tests: 0;return 0;Executed by:
executed 32 times by 2 tests: return 0;Executed by:
| 32 | ||||||||||||||||||||||||||||||
| 65 | } | - | ||||||||||||||||||||||||||||||
| 66 | - | |||||||||||||||||||||||||||||||
| 67 | if (maximumLength != -1
| 6-1272 | ||||||||||||||||||||||||||||||
| 68 | len = qMin(maximumLength, size() - currentPosition); executed 1272 times by 4 tests: len = qMin(maximumLength, size() - currentPosition);Executed by:
| 1272 | ||||||||||||||||||||||||||||||
| 69 | else | - | ||||||||||||||||||||||||||||||
| 70 | len = size() - currentPosition; executed 6 times by 1 test: len = size() - currentPosition;Executed by:
| 6 | ||||||||||||||||||||||||||||||
| 71 | - | |||||||||||||||||||||||||||||||
| 72 | return executed 1278 times by 4 tests: byteArray->constData() + currentPosition;return byteArray->constData() + currentPosition;Executed by:
executed 1278 times by 4 tests: return byteArray->constData() + currentPosition;Executed by:
| 1278 | ||||||||||||||||||||||||||||||
| 73 | } | - | ||||||||||||||||||||||||||||||
| 74 | - | |||||||||||||||||||||||||||||||
| 75 | bool QNonContiguousByteDeviceByteArrayImpl::advanceReadPointer(qint64 amount) | - | ||||||||||||||||||||||||||||||
| 76 | { | - | ||||||||||||||||||||||||||||||
| 77 | currentPosition += amount; | - | ||||||||||||||||||||||||||||||
| 78 | readProgress(currentPosition, size()); | - | ||||||||||||||||||||||||||||||
| 79 | return executed 1277 times by 3 tests: true;return true;Executed by:
executed 1277 times by 3 tests: return true;Executed by:
| 1277 | ||||||||||||||||||||||||||||||
| 80 | } | - | ||||||||||||||||||||||||||||||
| 81 | - | |||||||||||||||||||||||||||||||
| 82 | bool QNonContiguousByteDeviceByteArrayImpl::atEnd() const | - | ||||||||||||||||||||||||||||||
| 83 | { | - | ||||||||||||||||||||||||||||||
| 84 | return executed 2361 times by 4 tests: currentPosition >= size();return currentPosition >= size();Executed by:
executed 2361 times by 4 tests: return currentPosition >= size();Executed by:
| 2361 | ||||||||||||||||||||||||||||||
| 85 | } | - | ||||||||||||||||||||||||||||||
| 86 | - | |||||||||||||||||||||||||||||||
| 87 | bool QNonContiguousByteDeviceByteArrayImpl::reset() | - | ||||||||||||||||||||||||||||||
| 88 | { | - | ||||||||||||||||||||||||||||||
| 89 | currentPosition = 0; | - | ||||||||||||||||||||||||||||||
| 90 | return executed 3 times by 1 test: true;return true;Executed by:
executed 3 times by 1 test: return true;Executed by:
| 3 | ||||||||||||||||||||||||||||||
| 91 | } | - | ||||||||||||||||||||||||||||||
| 92 | - | |||||||||||||||||||||||||||||||
| 93 | qint64 QNonContiguousByteDeviceByteArrayImpl::size() const | - | ||||||||||||||||||||||||||||||
| 94 | { | - | ||||||||||||||||||||||||||||||
| 95 | return executed 6023 times by 4 tests: byteArray->size();return byteArray->size();Executed by:
executed 6023 times by 4 tests: return byteArray->size();Executed by:
| 6023 | ||||||||||||||||||||||||||||||
| 96 | } | - | ||||||||||||||||||||||||||||||
| 97 | - | |||||||||||||||||||||||||||||||
| 98 | qint64 QNonContiguousByteDeviceByteArrayImpl::pos() const | - | ||||||||||||||||||||||||||||||
| 99 | { | - | ||||||||||||||||||||||||||||||
| 100 | return executed 4 times by 1 test: currentPosition;return currentPosition;Executed by:
executed 4 times by 1 test: return currentPosition;Executed by:
| 4 | ||||||||||||||||||||||||||||||
| 101 | } | - | ||||||||||||||||||||||||||||||
| 102 | - | |||||||||||||||||||||||||||||||
| 103 | QNonContiguousByteDeviceRingBufferImpl::QNonContiguousByteDeviceRingBufferImpl(QSharedPointer<QRingBuffer> rb) | - | ||||||||||||||||||||||||||||||
| 104 | : QNonContiguousByteDevice(), currentPosition(0) | - | ||||||||||||||||||||||||||||||
| 105 | { | - | ||||||||||||||||||||||||||||||
| 106 | ringBuffer = rb; | - | ||||||||||||||||||||||||||||||
| 107 | } executed 99 times by 1 test: end of blockExecuted by:
| 99 | ||||||||||||||||||||||||||||||
| 108 | - | |||||||||||||||||||||||||||||||
| 109 | QNonContiguousByteDeviceRingBufferImpl::~QNonContiguousByteDeviceRingBufferImpl() | - | ||||||||||||||||||||||||||||||
| 110 | { | - | ||||||||||||||||||||||||||||||
| 111 | } | - | ||||||||||||||||||||||||||||||
| 112 | - | |||||||||||||||||||||||||||||||
| 113 | const char* QNonContiguousByteDeviceRingBufferImpl::readPointer(qint64 maximumLength, qint64 &len) | - | ||||||||||||||||||||||||||||||
| 114 | { | - | ||||||||||||||||||||||||||||||
| 115 | if (atEnd()
| 0-892 | ||||||||||||||||||||||||||||||
| 116 | len = -1; | - | ||||||||||||||||||||||||||||||
| 117 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 118 | } | - | ||||||||||||||||||||||||||||||
| 119 | - | |||||||||||||||||||||||||||||||
| 120 | const char *returnValue = ringBuffer->readPointerAtPosition(currentPosition, len); | - | ||||||||||||||||||||||||||||||
| 121 | - | |||||||||||||||||||||||||||||||
| 122 | if (maximumLength != -1
| 0-892 | ||||||||||||||||||||||||||||||
| 123 | len = qMin(len, maximumLength); executed 892 times by 1 test: len = qMin(len, maximumLength);Executed by:
| 892 | ||||||||||||||||||||||||||||||
| 124 | - | |||||||||||||||||||||||||||||||
| 125 | return executed 892 times by 1 test: returnValue;return returnValue;Executed by:
executed 892 times by 1 test: return returnValue;Executed by:
| 892 | ||||||||||||||||||||||||||||||
| 126 | } | - | ||||||||||||||||||||||||||||||
| 127 | - | |||||||||||||||||||||||||||||||
| 128 | bool QNonContiguousByteDeviceRingBufferImpl::advanceReadPointer(qint64 amount) | - | ||||||||||||||||||||||||||||||
| 129 | { | - | ||||||||||||||||||||||||||||||
| 130 | currentPosition += amount; | - | ||||||||||||||||||||||||||||||
| 131 | readProgress(currentPosition, size()); | - | ||||||||||||||||||||||||||||||
| 132 | return executed 892 times by 1 test: true;return true;Executed by:
executed 892 times by 1 test: return true;Executed by:
| 892 | ||||||||||||||||||||||||||||||
| 133 | } | - | ||||||||||||||||||||||||||||||
| 134 | - | |||||||||||||||||||||||||||||||
| 135 | bool QNonContiguousByteDeviceRingBufferImpl::atEnd() const | - | ||||||||||||||||||||||||||||||
| 136 | { | - | ||||||||||||||||||||||||||||||
| 137 | return executed 1126 times by 1 test: currentPosition >= size();return currentPosition >= size();Executed by:
executed 1126 times by 1 test: return currentPosition >= size();Executed by:
| 1126 | ||||||||||||||||||||||||||||||
| 138 | } | - | ||||||||||||||||||||||||||||||
| 139 | - | |||||||||||||||||||||||||||||||
| 140 | qint64 QNonContiguousByteDeviceRingBufferImpl::pos() const | - | ||||||||||||||||||||||||||||||
| 141 | { | - | ||||||||||||||||||||||||||||||
| 142 | return executed 716 times by 1 test: currentPosition;return currentPosition;Executed by:
executed 716 times by 1 test: return currentPosition;Executed by:
| 716 | ||||||||||||||||||||||||||||||
| 143 | } | - | ||||||||||||||||||||||||||||||
| 144 | - | |||||||||||||||||||||||||||||||
| 145 | bool QNonContiguousByteDeviceRingBufferImpl::reset() | - | ||||||||||||||||||||||||||||||
| 146 | { | - | ||||||||||||||||||||||||||||||
| 147 | currentPosition = 0; | - | ||||||||||||||||||||||||||||||
| 148 | return executed 117 times by 1 test: true;return true;Executed by:
executed 117 times by 1 test: return true;Executed by:
| 117 | ||||||||||||||||||||||||||||||
| 149 | } | - | ||||||||||||||||||||||||||||||
| 150 | - | |||||||||||||||||||||||||||||||
| 151 | qint64 QNonContiguousByteDeviceRingBufferImpl::size() const | - | ||||||||||||||||||||||||||||||
| 152 | { | - | ||||||||||||||||||||||||||||||
| 153 | return executed 2293 times by 1 test: ringBuffer->size();return ringBuffer->size();Executed by:
executed 2293 times by 1 test: return ringBuffer->size();Executed by:
| 2293 | ||||||||||||||||||||||||||||||
| 154 | } | - | ||||||||||||||||||||||||||||||
| 155 | - | |||||||||||||||||||||||||||||||
| 156 | QNonContiguousByteDeviceIoDeviceImpl::QNonContiguousByteDeviceIoDeviceImpl(QIODevice *d) | - | ||||||||||||||||||||||||||||||
| 157 | : QNonContiguousByteDevice(), | - | ||||||||||||||||||||||||||||||
| 158 | currentReadBuffer(0), currentReadBufferSize(16*1024), | - | ||||||||||||||||||||||||||||||
| 159 | currentReadBufferAmount(0), currentReadBufferPosition(0), totalAdvancements(0), | - | ||||||||||||||||||||||||||||||
| 160 | eof(false) | - | ||||||||||||||||||||||||||||||
| 161 | { | - | ||||||||||||||||||||||||||||||
| 162 | device = d; | - | ||||||||||||||||||||||||||||||
| 163 | initialPosition = d->pos(); | - | ||||||||||||||||||||||||||||||
| 164 | connect(device, qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "291"), this, qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "291"), Qt::QueuedConnection); | - | ||||||||||||||||||||||||||||||
| 165 | connect(device, qFlagLocation("2""readChannelFinished()" "\0" __FILE__ ":" "292"), this, qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "292"), Qt::QueuedConnection); | - | ||||||||||||||||||||||||||||||
| 166 | } executed 77 times by 2 tests: end of blockExecuted by:
| 77 | ||||||||||||||||||||||||||||||
| 167 | - | |||||||||||||||||||||||||||||||
| 168 | QNonContiguousByteDeviceIoDeviceImpl::~QNonContiguousByteDeviceIoDeviceImpl() | - | ||||||||||||||||||||||||||||||
| 169 | { | - | ||||||||||||||||||||||||||||||
| 170 | delete currentReadBuffer; | - | ||||||||||||||||||||||||||||||
| 171 | } executed 77 times by 2 tests: end of blockExecuted by:
| 77 | ||||||||||||||||||||||||||||||
| 172 | - | |||||||||||||||||||||||||||||||
| 173 | const char* QNonContiguousByteDeviceIoDeviceImpl::readPointer(qint64 maximumLength, qint64 &len) | - | ||||||||||||||||||||||||||||||
| 174 | { | - | ||||||||||||||||||||||||||||||
| 175 | if (eof == true
| 0-2250 | ||||||||||||||||||||||||||||||
| 176 | len = -1; | - | ||||||||||||||||||||||||||||||
| 177 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 178 | } | - | ||||||||||||||||||||||||||||||
| 179 | - | |||||||||||||||||||||||||||||||
| 180 | if (currentReadBuffer == 0
| 77-2173 | ||||||||||||||||||||||||||||||
| 181 | currentReadBuffer = new QByteArray(currentReadBufferSize, '\0'); executed 77 times by 2 tests: currentReadBuffer = new QByteArray(currentReadBufferSize, '\0');Executed by:
| 77 | ||||||||||||||||||||||||||||||
| 182 | - | |||||||||||||||||||||||||||||||
| 183 | if (maximumLength == -1
| 698-1552 | ||||||||||||||||||||||||||||||
| 184 | maximumLength = currentReadBufferSize; executed 698 times by 1 test: maximumLength = currentReadBufferSize;Executed by:
| 698 | ||||||||||||||||||||||||||||||
| 185 | - | |||||||||||||||||||||||||||||||
| 186 | if (currentReadBufferAmount - currentReadBufferPosition > 0
| 0-2250 | ||||||||||||||||||||||||||||||
| 187 | len = currentReadBufferAmount - currentReadBufferPosition; | - | ||||||||||||||||||||||||||||||
| 188 | return never executed: currentReadBuffer->data() + currentReadBufferPosition;return currentReadBuffer->data() + currentReadBufferPosition;never executed: return currentReadBuffer->data() + currentReadBufferPosition; | 0 | ||||||||||||||||||||||||||||||
| 189 | } | - | ||||||||||||||||||||||||||||||
| 190 | - | |||||||||||||||||||||||||||||||
| 191 | qint64 haveRead = device->read(currentReadBuffer->data(), qMin(maximumLength, currentReadBufferSize)); | - | ||||||||||||||||||||||||||||||
| 192 | - | |||||||||||||||||||||||||||||||
| 193 | if ((
| 4-2222 | ||||||||||||||||||||||||||||||
| 194 | eof = true; | - | ||||||||||||||||||||||||||||||
| 195 | len = -1; | - | ||||||||||||||||||||||||||||||
| 196 | - | |||||||||||||||||||||||||||||||
| 197 | if (size() == -1
| 11-28 | ||||||||||||||||||||||||||||||
| 198 | readProgress(totalAdvancements, totalAdvancements); executed 28 times by 1 test: readProgress(totalAdvancements, totalAdvancements);Executed by:
| 28 | ||||||||||||||||||||||||||||||
| 199 | return executed 39 times by 2 tests: 0;return 0;Executed by:
executed 39 times by 2 tests: return 0;Executed by:
| 39 | ||||||||||||||||||||||||||||||
| 200 | } | - | ||||||||||||||||||||||||||||||
| 201 | - | |||||||||||||||||||||||||||||||
| 202 | currentReadBufferAmount = haveRead; | - | ||||||||||||||||||||||||||||||
| 203 | currentReadBufferPosition = 0; | - | ||||||||||||||||||||||||||||||
| 204 | - | |||||||||||||||||||||||||||||||
| 205 | len = haveRead; | - | ||||||||||||||||||||||||||||||
| 206 | return executed 2211 times by 2 tests: currentReadBuffer->data();return currentReadBuffer->data();Executed by:
executed 2211 times by 2 tests: return currentReadBuffer->data();Executed by:
| 2211 | ||||||||||||||||||||||||||||||
| 207 | } | - | ||||||||||||||||||||||||||||||
| 208 | - | |||||||||||||||||||||||||||||||
| 209 | bool QNonContiguousByteDeviceIoDeviceImpl::advanceReadPointer(qint64 amount) | - | ||||||||||||||||||||||||||||||
| 210 | { | - | ||||||||||||||||||||||||||||||
| 211 | totalAdvancements += amount; | - | ||||||||||||||||||||||||||||||
| 212 | - | |||||||||||||||||||||||||||||||
| 213 | - | |||||||||||||||||||||||||||||||
| 214 | currentReadBufferPosition += amount; | - | ||||||||||||||||||||||||||||||
| 215 | - | |||||||||||||||||||||||||||||||
| 216 | if (size() == -1
| 577-1545 | ||||||||||||||||||||||||||||||
| 217 | readProgress(totalAdvancements, totalAdvancements); executed 577 times by 1 test: readProgress(totalAdvancements, totalAdvancements);Executed by:
| 577 | ||||||||||||||||||||||||||||||
| 218 | else | - | ||||||||||||||||||||||||||||||
| 219 | readProgress(totalAdvancements, size()); executed 1545 times by 2 tests: readProgress(totalAdvancements, size());Executed by:
| 1545 | ||||||||||||||||||||||||||||||
| 220 | - | |||||||||||||||||||||||||||||||
| 221 | - | |||||||||||||||||||||||||||||||
| 222 | if (currentReadBufferPosition > currentReadBufferAmount
| 0-2122 | ||||||||||||||||||||||||||||||
| 223 | qint64 i = currentReadBufferPosition - currentReadBufferAmount; | - | ||||||||||||||||||||||||||||||
| 224 | while (i > 0
| 0 | ||||||||||||||||||||||||||||||
| 225 | if (device->getChar(0) == false
| 0 | ||||||||||||||||||||||||||||||
| 226 | readProgress(totalAdvancements - i, size()); | - | ||||||||||||||||||||||||||||||
| 227 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 228 | } | - | ||||||||||||||||||||||||||||||
| 229 | i--; | - | ||||||||||||||||||||||||||||||
| 230 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 231 | - | |||||||||||||||||||||||||||||||
| 232 | currentReadBufferPosition = 0; | - | ||||||||||||||||||||||||||||||
| 233 | currentReadBufferAmount = 0; | - | ||||||||||||||||||||||||||||||
| 234 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 235 | - | |||||||||||||||||||||||||||||||
| 236 | - | |||||||||||||||||||||||||||||||
| 237 | return executed 2122 times by 2 tests: true;return true;Executed by:
executed 2122 times by 2 tests: return true;Executed by:
| 2122 | ||||||||||||||||||||||||||||||
| 238 | } | - | ||||||||||||||||||||||||||||||
| 239 | - | |||||||||||||||||||||||||||||||
| 240 | bool QNonContiguousByteDeviceIoDeviceImpl::atEnd() const | - | ||||||||||||||||||||||||||||||
| 241 | { | - | ||||||||||||||||||||||||||||||
| 242 | return executed 1580 times by 2 tests: eof == true;return eof == true;Executed by:
executed 1580 times by 2 tests: return eof == true;Executed by:
| 1580 | ||||||||||||||||||||||||||||||
| 243 | } | - | ||||||||||||||||||||||||||||||
| 244 | - | |||||||||||||||||||||||||||||||
| 245 | bool QNonContiguousByteDeviceIoDeviceImpl::reset() | - | ||||||||||||||||||||||||||||||
| 246 | { | - | ||||||||||||||||||||||||||||||
| 247 | bool reset = (
| 1-6 | ||||||||||||||||||||||||||||||
| 248 | if (reset
| 1-6 | ||||||||||||||||||||||||||||||
| 249 | eof = false; | - | ||||||||||||||||||||||||||||||
| 250 | totalAdvancements = 0; | - | ||||||||||||||||||||||||||||||
| 251 | if (currentReadBuffer
| 2-4 | ||||||||||||||||||||||||||||||
| 252 | delete currentReadBuffer; | - | ||||||||||||||||||||||||||||||
| 253 | currentReadBuffer = 0; | - | ||||||||||||||||||||||||||||||
| 254 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||||||||
| 255 | currentReadBufferAmount = 0; | - | ||||||||||||||||||||||||||||||
| 256 | currentReadBufferPosition = 0; | - | ||||||||||||||||||||||||||||||
| 257 | return executed 6 times by 1 test: true;return true;Executed by:
executed 6 times by 1 test: return true;Executed by:
| 6 | ||||||||||||||||||||||||||||||
| 258 | } | - | ||||||||||||||||||||||||||||||
| 259 | - | |||||||||||||||||||||||||||||||
| 260 | return executed 1 time by 1 test: false;return false;Executed by:
executed 1 time by 1 test: return false;Executed by:
| 1 | ||||||||||||||||||||||||||||||
| 261 | } | - | ||||||||||||||||||||||||||||||
| 262 | - | |||||||||||||||||||||||||||||||
| 263 | qint64 QNonContiguousByteDeviceIoDeviceImpl::size() const | - | ||||||||||||||||||||||||||||||
| 264 | { | - | ||||||||||||||||||||||||||||||
| 265 | - | |||||||||||||||||||||||||||||||
| 266 | - | |||||||||||||||||||||||||||||||
| 267 | if (device->isSequential()
| 607-4707 | ||||||||||||||||||||||||||||||
| 268 | return executed 607 times by 1 test: -1;return -1;Executed by:
executed 607 times by 1 test: return -1;Executed by:
| 607 | ||||||||||||||||||||||||||||||
| 269 | - | |||||||||||||||||||||||||||||||
| 270 | return executed 4707 times by 2 tests: device->size() - initialPosition;return device->size() - initialPosition;Executed by:
executed 4707 times by 2 tests: return device->size() - initialPosition;Executed by:
| 4707 | ||||||||||||||||||||||||||||||
| 271 | } | - | ||||||||||||||||||||||||||||||
| 272 | - | |||||||||||||||||||||||||||||||
| 273 | qint64 QNonContiguousByteDeviceIoDeviceImpl::pos() const | - | ||||||||||||||||||||||||||||||
| 274 | { | - | ||||||||||||||||||||||||||||||
| 275 | if (device->isSequential()
| 0 | ||||||||||||||||||||||||||||||
| 276 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||
| 277 | - | |||||||||||||||||||||||||||||||
| 278 | return never executed: device->pos();return device->pos();never executed: return device->pos(); | 0 | ||||||||||||||||||||||||||||||
| 279 | } | - | ||||||||||||||||||||||||||||||
| 280 | - | |||||||||||||||||||||||||||||||
| 281 | QByteDeviceWrappingIoDevice::QByteDeviceWrappingIoDevice(QNonContiguousByteDevice *bd) : QIODevice((QObject*)0) | - | ||||||||||||||||||||||||||||||
| 282 | { | - | ||||||||||||||||||||||||||||||
| 283 | byteDevice = bd; | - | ||||||||||||||||||||||||||||||
| 284 | connect(bd, qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "411"), qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "411")); | - | ||||||||||||||||||||||||||||||
| 285 | - | |||||||||||||||||||||||||||||||
| 286 | open(ReadOnly); | - | ||||||||||||||||||||||||||||||
| 287 | } executed 13 times by 1 test: end of blockExecuted by:
| 13 | ||||||||||||||||||||||||||||||
| 288 | - | |||||||||||||||||||||||||||||||
| 289 | QByteDeviceWrappingIoDevice::~QByteDeviceWrappingIoDevice() | - | ||||||||||||||||||||||||||||||
| 290 | { | - | ||||||||||||||||||||||||||||||
| 291 | - | |||||||||||||||||||||||||||||||
| 292 | } | - | ||||||||||||||||||||||||||||||
| 293 | - | |||||||||||||||||||||||||||||||
| 294 | bool QByteDeviceWrappingIoDevice::isSequential() const | - | ||||||||||||||||||||||||||||||
| 295 | { | - | ||||||||||||||||||||||||||||||
| 296 | return executed 55 times by 1 test: (byteDevice->size() == -1);return (byteDevice->size() == -1);Executed by:
executed 55 times by 1 test: return (byteDevice->size() == -1);Executed by:
| 55 | ||||||||||||||||||||||||||||||
| 297 | } | - | ||||||||||||||||||||||||||||||
| 298 | - | |||||||||||||||||||||||||||||||
| 299 | bool QByteDeviceWrappingIoDevice::atEnd() const | - | ||||||||||||||||||||||||||||||
| 300 | { | - | ||||||||||||||||||||||||||||||
| 301 | return never executed: byteDevice->atEnd();return byteDevice->atEnd();never executed: return byteDevice->atEnd(); | 0 | ||||||||||||||||||||||||||||||
| 302 | } | - | ||||||||||||||||||||||||||||||
| 303 | - | |||||||||||||||||||||||||||||||
| 304 | bool QByteDeviceWrappingIoDevice::reset() | - | ||||||||||||||||||||||||||||||
| 305 | { | - | ||||||||||||||||||||||||||||||
| 306 | return never executed: byteDevice->reset();return byteDevice->reset();never executed: return byteDevice->reset(); | 0 | ||||||||||||||||||||||||||||||
| 307 | } | - | ||||||||||||||||||||||||||||||
| 308 | - | |||||||||||||||||||||||||||||||
| 309 | qint64 QByteDeviceWrappingIoDevice::size() const | - | ||||||||||||||||||||||||||||||
| 310 | { | - | ||||||||||||||||||||||||||||||
| 311 | if (isSequential()
| 0-22 | ||||||||||||||||||||||||||||||
| 312 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 313 | - | |||||||||||||||||||||||||||||||
| 314 | return executed 22 times by 1 test: byteDevice->size();return byteDevice->size();Executed by:
executed 22 times by 1 test: return byteDevice->size();Executed by:
| 22 | ||||||||||||||||||||||||||||||
| 315 | } | - | ||||||||||||||||||||||||||||||
| 316 | - | |||||||||||||||||||||||||||||||
| 317 | - | |||||||||||||||||||||||||||||||
| 318 | qint64 QByteDeviceWrappingIoDevice::readData( char * data, qint64 maxSize) | - | ||||||||||||||||||||||||||||||
| 319 | { | - | ||||||||||||||||||||||||||||||
| 320 | qint64 len; | - | ||||||||||||||||||||||||||||||
| 321 | const char *readPointer = byteDevice->readPointer(maxSize, len); | - | ||||||||||||||||||||||||||||||
| 322 | if (len == -1
| 11-147 | ||||||||||||||||||||||||||||||
| 323 | return executed 11 times by 1 test: -1;return -1;Executed by:
executed 11 times by 1 test: return -1;Executed by:
| 11 | ||||||||||||||||||||||||||||||
| 324 | - | |||||||||||||||||||||||||||||||
| 325 | memcpy(data, readPointer, len); | - | ||||||||||||||||||||||||||||||
| 326 | byteDevice->advanceReadPointer(len); | - | ||||||||||||||||||||||||||||||
| 327 | return executed 147 times by 1 test: len;return len;Executed by:
executed 147 times by 1 test: return len;Executed by:
| 147 | ||||||||||||||||||||||||||||||
| 328 | } | - | ||||||||||||||||||||||||||||||
| 329 | - | |||||||||||||||||||||||||||||||
| 330 | qint64 QByteDeviceWrappingIoDevice::writeData( const char* data, qint64 maxSize) | - | ||||||||||||||||||||||||||||||
| 331 | { | - | ||||||||||||||||||||||||||||||
| 332 | (void)data;; | - | ||||||||||||||||||||||||||||||
| 333 | (void)maxSize;; | - | ||||||||||||||||||||||||||||||
| 334 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||
| 335 | } | - | ||||||||||||||||||||||||||||||
| 336 | QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QIODevice *device) | - | ||||||||||||||||||||||||||||||
| 337 | { | - | ||||||||||||||||||||||||||||||
| 338 | - | |||||||||||||||||||||||||||||||
| 339 | if (QBuffer* buffer = qobject_cast<QBuffer*>(device)
| 0 | ||||||||||||||||||||||||||||||
| 340 | return never executed: new QNonContiguousByteDeviceBufferImpl(buffer);return new QNonContiguousByteDeviceBufferImpl(buffer);never executed: return new QNonContiguousByteDeviceBufferImpl(buffer); | 0 | ||||||||||||||||||||||||||||||
| 341 | } | - | ||||||||||||||||||||||||||||||
| 342 | - | |||||||||||||||||||||||||||||||
| 343 | - | |||||||||||||||||||||||||||||||
| 344 | - | |||||||||||||||||||||||||||||||
| 345 | - | |||||||||||||||||||||||||||||||
| 346 | - | |||||||||||||||||||||||||||||||
| 347 | return never executed: new QNonContiguousByteDeviceIoDeviceImpl(device);return new QNonContiguousByteDeviceIoDeviceImpl(device);never executed: return new QNonContiguousByteDeviceIoDeviceImpl(device); | 0 | ||||||||||||||||||||||||||||||
| 348 | } | - | ||||||||||||||||||||||||||||||
| 349 | - | |||||||||||||||||||||||||||||||
| 350 | - | |||||||||||||||||||||||||||||||
| 351 | - | |||||||||||||||||||||||||||||||
| 352 | - | |||||||||||||||||||||||||||||||
| 353 | - | |||||||||||||||||||||||||||||||
| 354 | - | |||||||||||||||||||||||||||||||
| 355 | - | |||||||||||||||||||||||||||||||
| 356 | QSharedPointer<QNonContiguousByteDevice> QNonContiguousByteDeviceFactory::createShared(QIODevice *device) | - | ||||||||||||||||||||||||||||||
| 357 | { | - | ||||||||||||||||||||||||||||||
| 358 | - | |||||||||||||||||||||||||||||||
| 359 | if (QBuffer *buffer = qobject_cast<QBuffer*>(device)
| 77-79 | ||||||||||||||||||||||||||||||
| 360 | return executed 79 times by 3 tests: QSharedPointer<QNonContiguousByteDeviceBufferImpl>::create(buffer);return QSharedPointer<QNonContiguousByteDeviceBufferImpl>::create(buffer);Executed by:
executed 79 times by 3 tests: return QSharedPointer<QNonContiguousByteDeviceBufferImpl>::create(buffer);Executed by:
| 79 | ||||||||||||||||||||||||||||||
| 361 | - | |||||||||||||||||||||||||||||||
| 362 | - | |||||||||||||||||||||||||||||||
| 363 | - | |||||||||||||||||||||||||||||||
| 364 | - | |||||||||||||||||||||||||||||||
| 365 | - | |||||||||||||||||||||||||||||||
| 366 | return executed 77 times by 2 tests: QSharedPointer<QNonContiguousByteDeviceIoDeviceImpl>::create(device);return QSharedPointer<QNonContiguousByteDeviceIoDeviceImpl>::create(device);Executed by:
executed 77 times by 2 tests: return QSharedPointer<QNonContiguousByteDeviceIoDeviceImpl>::create(device);Executed by:
| 77 | ||||||||||||||||||||||||||||||
| 367 | } | - | ||||||||||||||||||||||||||||||
| 368 | QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QSharedPointer<QRingBuffer> ringBuffer) | - | ||||||||||||||||||||||||||||||
| 369 | { | - | ||||||||||||||||||||||||||||||
| 370 | return never executed: new QNonContiguousByteDeviceRingBufferImpl(ringBuffer);return new QNonContiguousByteDeviceRingBufferImpl(ringBuffer);never executed: return new QNonContiguousByteDeviceRingBufferImpl(ringBuffer); | 0 | ||||||||||||||||||||||||||||||
| 371 | } | - | ||||||||||||||||||||||||||||||
| 372 | - | |||||||||||||||||||||||||||||||
| 373 | - | |||||||||||||||||||||||||||||||
| 374 | - | |||||||||||||||||||||||||||||||
| 375 | - | |||||||||||||||||||||||||||||||
| 376 | - | |||||||||||||||||||||||||||||||
| 377 | - | |||||||||||||||||||||||||||||||
| 378 | QSharedPointer<QNonContiguousByteDevice> QNonContiguousByteDeviceFactory::createShared(QSharedPointer<QRingBuffer> ringBuffer) | - | ||||||||||||||||||||||||||||||
| 379 | { | - | ||||||||||||||||||||||||||||||
| 380 | return executed 99 times by 1 test: QSharedPointer<QNonContiguousByteDeviceRingBufferImpl>::create(std::move(ringBuffer));return QSharedPointer<QNonContiguousByteDeviceRingBufferImpl>::create(std::move(ringBuffer));Executed by:
executed 99 times by 1 test: return QSharedPointer<QNonContiguousByteDeviceRingBufferImpl>::create(std::move(ringBuffer));Executed by:
| 99 | ||||||||||||||||||||||||||||||
| 381 | } | - | ||||||||||||||||||||||||||||||
| 382 | QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QByteArray *byteArray) | - | ||||||||||||||||||||||||||||||
| 383 | { | - | ||||||||||||||||||||||||||||||
| 384 | return executed 5 times by 1 test: new QNonContiguousByteDeviceByteArrayImpl(byteArray);return new QNonContiguousByteDeviceByteArrayImpl(byteArray);Executed by:
executed 5 times by 1 test: return new QNonContiguousByteDeviceByteArrayImpl(byteArray);Executed by:
| 5 | ||||||||||||||||||||||||||||||
| 385 | } | - | ||||||||||||||||||||||||||||||
| 386 | - | |||||||||||||||||||||||||||||||
| 387 | - | |||||||||||||||||||||||||||||||
| 388 | - | |||||||||||||||||||||||||||||||
| 389 | - | |||||||||||||||||||||||||||||||
| 390 | - | |||||||||||||||||||||||||||||||
| 391 | - | |||||||||||||||||||||||||||||||
| 392 | QSharedPointer<QNonContiguousByteDevice> QNonContiguousByteDeviceFactory::createShared(QByteArray *byteArray) | - | ||||||||||||||||||||||||||||||
| 393 | { | - | ||||||||||||||||||||||||||||||
| 394 | return never executed: QSharedPointer<QNonContiguousByteDeviceByteArrayImpl>::create(byteArray);return QSharedPointer<QNonContiguousByteDeviceByteArrayImpl>::create(byteArray);never executed: return QSharedPointer<QNonContiguousByteDeviceByteArrayImpl>::create(byteArray); | 0 | ||||||||||||||||||||||||||||||
| 395 | } | - | ||||||||||||||||||||||||||||||
| 396 | QIODevice* QNonContiguousByteDeviceFactory::wrap(QNonContiguousByteDevice* byteDevice) | - | ||||||||||||||||||||||||||||||
| 397 | { | - | ||||||||||||||||||||||||||||||
| 398 | - | |||||||||||||||||||||||||||||||
| 399 | - | |||||||||||||||||||||||||||||||
| 400 | - | |||||||||||||||||||||||||||||||
| 401 | - | |||||||||||||||||||||||||||||||
| 402 | - | |||||||||||||||||||||||||||||||
| 403 | return executed 13 times by 1 test: new QByteDeviceWrappingIoDevice(byteDevice);return new QByteDeviceWrappingIoDevice(byteDevice);Executed by:
executed 13 times by 1 test: return new QByteDeviceWrappingIoDevice(byteDevice);Executed by:
| 13 | ||||||||||||||||||||||||||||||
| 404 | } | - | ||||||||||||||||||||||||||||||
| 405 | - | |||||||||||||||||||||||||||||||
| 406 | - | |||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |