| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/network/access/qhttpmultipart.cpp | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | QHttpPart::QHttpPart() : d(new QHttpPartPrivate) | - | ||||||||||||||||||
| 4 | { | - | ||||||||||||||||||
| 5 | } executed 36 times by 2 tests:  end of blockExecuted by: 
 | 36 | ||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | - | |||||||||||||||||||
| 8 | - | |||||||||||||||||||
| 9 | - | |||||||||||||||||||
| 10 | QHttpPart::QHttpPart(const QHttpPart &other) : d(other.d) | - | ||||||||||||||||||
| 11 | { | - | ||||||||||||||||||
| 12 | } executed 51 times by 2 tests:  end of blockExecuted by: 
 | 51 | ||||||||||||||||||
| 13 | - | |||||||||||||||||||
| 14 | - | |||||||||||||||||||
| 15 | - | |||||||||||||||||||
| 16 | - | |||||||||||||||||||
| 17 | QHttpPart::~QHttpPart() | - | ||||||||||||||||||
| 18 | { | - | ||||||||||||||||||
| 19 | d = 0; | - | ||||||||||||||||||
| 20 | } executed 72 times by 2 tests:  end of blockExecuted by: 
 | 72 | ||||||||||||||||||
| 21 | - | |||||||||||||||||||
| 22 | - | |||||||||||||||||||
| 23 | - | |||||||||||||||||||
| 24 | - | |||||||||||||||||||
| 25 | QHttpPart &QHttpPart::operator=(const QHttpPart &other) | - | ||||||||||||||||||
| 26 | { | - | ||||||||||||||||||
| 27 | d = other.d; | - | ||||||||||||||||||
| 28 | return never executed: *this; return *this;never executed:  return *this; | 0 | ||||||||||||||||||
| 29 | } | - | ||||||||||||||||||
| 30 | bool QHttpPart::operator==(const QHttpPart &other) const | - | ||||||||||||||||||
| 31 | { | - | ||||||||||||||||||
| 32 | return never executed: d == other.d || *d == *other.d; return d == other.d || *d == *other.d;never executed:  return d == other.d || *d == *other.d; | 0 | ||||||||||||||||||
| 33 | } | - | ||||||||||||||||||
| 34 | void QHttpPart::setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value) | - | ||||||||||||||||||
| 35 | { | - | ||||||||||||||||||
| 36 | d->setCookedHeader(header, value); | - | ||||||||||||||||||
| 37 | } executed 72 times by 2 tests:  end of blockExecuted by: 
 | 72 | ||||||||||||||||||
| 38 | void QHttpPart::setRawHeader(const QByteArray &headerName, const QByteArray &headerValue) | - | ||||||||||||||||||
| 39 | { | - | ||||||||||||||||||
| 40 | d->setRawHeader(headerName, headerValue); | - | ||||||||||||||||||
| 41 | } executed 26 times by 2 tests:  end of blockExecuted by: 
 | 26 | ||||||||||||||||||
| 42 | void QHttpPart::setBody(const QByteArray &body) | - | ||||||||||||||||||
| 43 | { | - | ||||||||||||||||||
| 44 | d->setBody(body); | - | ||||||||||||||||||
| 45 | } executed 18 times by 1 test:  end of blockExecuted by: 
 | 18 | ||||||||||||||||||
| 46 | void QHttpPart::setBodyDevice(QIODevice *device) | - | ||||||||||||||||||
| 47 | { | - | ||||||||||||||||||
| 48 | d->setBodyDevice(device); | - | ||||||||||||||||||
| 49 | } executed 31 times by 2 tests:  end of blockExecuted by: 
 | 31 | ||||||||||||||||||
| 50 | QHttpMultiPart::QHttpMultiPart(QObject *parent) : QObject(*new QHttpMultiPartPrivate, parent) | - | ||||||||||||||||||
| 51 | { | - | ||||||||||||||||||
| 52 | QHttpMultiPartPrivate * const d = d_func(); | - | ||||||||||||||||||
| 53 | d->contentType = MixedType; | - | ||||||||||||||||||
| 54 | } executed 27 times by 1 test:  end of blockExecuted by: 
 | 27 | ||||||||||||||||||
| 55 | - | |||||||||||||||||||
| 56 | - | |||||||||||||||||||
| 57 | - | |||||||||||||||||||
| 58 | - | |||||||||||||||||||
| 59 | - | |||||||||||||||||||
| 60 | - | |||||||||||||||||||
| 61 | - | |||||||||||||||||||
| 62 | QHttpMultiPart::QHttpMultiPart(QHttpMultiPart::ContentType contentType, QObject *parent) : QObject(*new QHttpMultiPartPrivate, parent) | - | ||||||||||||||||||
| 63 | { | - | ||||||||||||||||||
| 64 | QHttpMultiPartPrivate * const d = d_func(); | - | ||||||||||||||||||
| 65 | d->contentType = contentType; | - | ||||||||||||||||||
| 66 | } executed 8 times by 2 tests:  end of blockExecuted by: 
 | 8 | ||||||||||||||||||
| 67 | - | |||||||||||||||||||
| 68 | - | |||||||||||||||||||
| 69 | - | |||||||||||||||||||
| 70 | - | |||||||||||||||||||
| 71 | QHttpMultiPart::~QHttpMultiPart() | - | ||||||||||||||||||
| 72 | { | - | ||||||||||||||||||
| 73 | } | - | ||||||||||||||||||
| 74 | - | |||||||||||||||||||
| 75 | - | |||||||||||||||||||
| 76 | - | |||||||||||||||||||
| 77 | - | |||||||||||||||||||
| 78 | void QHttpMultiPart::append(const QHttpPart &httpPart) | - | ||||||||||||||||||
| 79 | { | - | ||||||||||||||||||
| 80 | d_func()->parts.append(httpPart); | - | ||||||||||||||||||
| 81 | } executed 51 times by 2 tests:  end of blockExecuted by: 
 | 51 | ||||||||||||||||||
| 82 | void QHttpMultiPart::setContentType(QHttpMultiPart::ContentType contentType) | - | ||||||||||||||||||
| 83 | { | - | ||||||||||||||||||
| 84 | d_func()->contentType = contentType; | - | ||||||||||||||||||
| 85 | } executed 21 times by 1 test:  end of blockExecuted by: 
 | 21 | ||||||||||||||||||
| 86 | - | |||||||||||||||||||
| 87 | - | |||||||||||||||||||
| 88 | - | |||||||||||||||||||
| 89 | - | |||||||||||||||||||
| 90 | - | |||||||||||||||||||
| 91 | - | |||||||||||||||||||
| 92 | QByteArray QHttpMultiPart::boundary() const | - | ||||||||||||||||||
| 93 | { | - | ||||||||||||||||||
| 94 | return executed 135 times by 2 tests: d_func()->boundary; return d_func()->boundary;Executed by: 
 executed 135 times by 2 tests:  return d_func()->boundary;Executed by: 
 | 135 | ||||||||||||||||||
| 95 | } | - | ||||||||||||||||||
| 96 | void QHttpMultiPart::setBoundary(const QByteArray &boundary) | - | ||||||||||||||||||
| 97 | { | - | ||||||||||||||||||
| 98 | d_func()->boundary = boundary; | - | ||||||||||||||||||
| 99 | } never executed:  end of block | 0 | ||||||||||||||||||
| 100 | qint64 QHttpPartPrivate::bytesAvailable() const | - | ||||||||||||||||||
| 101 | { | - | ||||||||||||||||||
| 102 | checkHeaderCreated(); | - | ||||||||||||||||||
| 103 | qint64 bytesAvailable = header.count(); | - | ||||||||||||||||||
| 104 | if (bodyDevice 
 | 0 | ||||||||||||||||||
| 105 | bytesAvailable += bodyDevice->bytesAvailable() - readPointer; | - | ||||||||||||||||||
| 106 | } never executed: else { end of block | 0 | ||||||||||||||||||
| 107 | bytesAvailable += body.count() - readPointer; | - | ||||||||||||||||||
| 108 | } never executed:  end of block | 0 | ||||||||||||||||||
| 109 | - | |||||||||||||||||||
| 110 | return never executed: qMax(bytesAvailable, (qint64) 0); return qMax(bytesAvailable, (qint64) 0);never executed:  return qMax(bytesAvailable, (qint64) 0); | 0 | ||||||||||||||||||
| 111 | } | - | ||||||||||||||||||
| 112 | - | |||||||||||||||||||
| 113 | qint64 QHttpPartPrivate::readData(char *data, qint64 maxSize) | - | ||||||||||||||||||
| 114 | { | - | ||||||||||||||||||
| 115 | checkHeaderCreated(); | - | ||||||||||||||||||
| 116 | qint64 bytesRead = 0; | - | ||||||||||||||||||
| 117 | qint64 headerDataCount = header.count(); | - | ||||||||||||||||||
| 118 | - | |||||||||||||||||||
| 119 | - | |||||||||||||||||||
| 120 | if (readPointer < headerDataCount 
 | 36-1004 | ||||||||||||||||||
| 121 | bytesRead = qMin(headerDataCount - readPointer, maxSize); | - | ||||||||||||||||||
| 122 | const char *headerData = header.constData(); | - | ||||||||||||||||||
| 123 | memcpy(data, headerData + readPointer, bytesRead); | - | ||||||||||||||||||
| 124 | readPointer += bytesRead; | - | ||||||||||||||||||
| 125 | } executed 36 times by 2 tests:  end of blockExecuted by: 
 | 36 | ||||||||||||||||||
| 126 | - | |||||||||||||||||||
| 127 | if (bytesRead < maxSize 
 | 0-1040 | ||||||||||||||||||
| 128 | if (bodyDevice 
 | 152-888 | ||||||||||||||||||
| 129 | qint64 dataBytesRead = bodyDevice->read(data + bytesRead, maxSize - bytesRead); | - | ||||||||||||||||||
| 130 | if (dataBytesRead == -1 
 | 0-888 | ||||||||||||||||||
| 131 | return never executed: -1; return -1;never executed:  return -1; | 0 | ||||||||||||||||||
| 132 | bytesRead += dataBytesRead; | - | ||||||||||||||||||
| 133 | readPointer += dataBytesRead; | - | ||||||||||||||||||
| 134 | } executed 888 times by 2 tests: else { end of blockExecuted by: 
 | 888 | ||||||||||||||||||
| 135 | qint64 contentBytesRead = qMin(body.count() - readPointer + headerDataCount, maxSize - bytesRead); | - | ||||||||||||||||||
| 136 | const char *contentData = body.constData(); | - | ||||||||||||||||||
| 137 | - | |||||||||||||||||||
| 138 | - | |||||||||||||||||||
| 139 | memcpy(data + bytesRead, contentData + readPointer - headerDataCount, contentBytesRead); | - | ||||||||||||||||||
| 140 | bytesRead += contentBytesRead; | - | ||||||||||||||||||
| 141 | readPointer += contentBytesRead; | - | ||||||||||||||||||
| 142 | } executed 152 times by 1 test:  end of blockExecuted by: 
 | 152 | ||||||||||||||||||
| 143 | } | - | ||||||||||||||||||
| 144 | return executed 1040 times by 2 tests: bytesRead; return bytesRead;Executed by: 
 executed 1040 times by 2 tests:  return bytesRead;Executed by: 
 | 1040 | ||||||||||||||||||
| 145 | } | - | ||||||||||||||||||
| 146 | - | |||||||||||||||||||
| 147 | qint64 QHttpPartPrivate::size() const | - | ||||||||||||||||||
| 148 | { | - | ||||||||||||||||||
| 149 | checkHeaderCreated(); | - | ||||||||||||||||||
| 150 | qint64 size = header.count(); | - | ||||||||||||||||||
| 151 | if (bodyDevice 
 | 576-2396 | ||||||||||||||||||
| 152 | size += bodyDevice->size(); | - | ||||||||||||||||||
| 153 | } executed 2396 times by 2 tests: else { end of blockExecuted by: 
 | 2396 | ||||||||||||||||||
| 154 | size += body.count(); | - | ||||||||||||||||||
| 155 | } executed 576 times by 1 test:  end of blockExecuted by: 
 | 576 | ||||||||||||||||||
| 156 | return executed 2972 times by 2 tests: size; return size;Executed by: 
 executed 2972 times by 2 tests:  return size;Executed by: 
 | 2972 | ||||||||||||||||||
| 157 | } | - | ||||||||||||||||||
| 158 | - | |||||||||||||||||||
| 159 | bool QHttpPartPrivate::reset() | - | ||||||||||||||||||
| 160 | { | - | ||||||||||||||||||
| 161 | bool ret = true; | - | ||||||||||||||||||
| 162 | if (bodyDevice 
 | 0 | ||||||||||||||||||
| 163 | if (!bodyDevice->reset() 
 | 0 | ||||||||||||||||||
| 164 | ret = false; never executed:  ret = false; | 0 | ||||||||||||||||||
| 165 | readPointer = 0; | - | ||||||||||||||||||
| 166 | return never executed: ret; return ret;never executed:  return ret; | 0 | ||||||||||||||||||
| 167 | } | - | ||||||||||||||||||
| 168 | void QHttpPartPrivate::checkHeaderCreated() const | - | ||||||||||||||||||
| 169 | { | - | ||||||||||||||||||
| 170 | if (!headerCreated 
 | 26-3986 | ||||||||||||||||||
| 171 | - | |||||||||||||||||||
| 172 | QList<QPair<QByteArray, QByteArray> > fields = allRawHeaders(); | - | ||||||||||||||||||
| 173 | QList<QPair<QByteArray, QByteArray> >::const_iterator it = fields.constBegin(); | - | ||||||||||||||||||
| 174 | for (; it != fields.constEnd() 
 | 26-70 | ||||||||||||||||||
| 175 | header += it->first + ": " + it->second + "\r\n"; executed 70 times by 2 tests:  header += it->first + ": " + it->second + "\r\n";Executed by: 
 | 70 | ||||||||||||||||||
| 176 | header += "\r\n"; | - | ||||||||||||||||||
| 177 | headerCreated = true; | - | ||||||||||||||||||
| 178 | } executed 26 times by 2 tests:  end of blockExecuted by: 
 | 26 | ||||||||||||||||||
| 179 | } executed 4012 times by 2 tests:  end of blockExecuted by: 
 | 4012 | ||||||||||||||||||
| 180 | - | |||||||||||||||||||
| 181 | namespace { namespace Q_QGS_seedCreatedStorage { typedef QThreadStorage<bool *> Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized 
 executed 1 time by 1 test: } guard.store(QtGlobalStatic::Destroyed);Executed by: 
 executed 1 time by 1 test: }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return end of blockExecuted by: 
 executed 37 times by 2 tests: &holder.value; return &holder.value;Executed by: 
 executed 37 times by 2 tests: } } } static QGlobalStatic<QThreadStorage<bool *>, Q_QGS_seedCreatedStorage::innerFunction, Q_QGS_seedCreatedStorage::guard> seedCreatedStorage;; return &holder.value;Executed by: 
 | 0-37 | ||||||||||||||||||
| 182 | - | |||||||||||||||||||
| 183 | QHttpMultiPartPrivate::QHttpMultiPartPrivate() : contentType(QHttpMultiPart::MixedType), device(new QHttpMultiPartIODevice(this)) | - | ||||||||||||||||||
| 184 | { | - | ||||||||||||||||||
| 185 | if (!seedCreatedStorage()->hasLocalData() 
 | 2-33 | ||||||||||||||||||
| 186 | qsrand(QTime(0,0,0).msecsTo(QTime::currentTime()) ^ reinterpret_cast<quintptr>(this)); | - | ||||||||||||||||||
| 187 | seedCreatedStorage()->setLocalData(new bool(true)); | - | ||||||||||||||||||
| 188 | } executed 2 times by 2 tests:  end of blockExecuted by: 
 | 2 | ||||||||||||||||||
| 189 | - | |||||||||||||||||||
| 190 | boundary = QByteArray("boundary_.oOo._") | - | ||||||||||||||||||
| 191 | + QByteArray::number(qrand()).toBase64() | - | ||||||||||||||||||
| 192 | + QByteArray::number(qrand()).toBase64() | - | ||||||||||||||||||
| 193 | + QByteArray::number(qrand()).toBase64(); | - | ||||||||||||||||||
| 194 | - | |||||||||||||||||||
| 195 | - | |||||||||||||||||||
| 196 | if (boundary.count() > 70 
 | 0-35 | ||||||||||||||||||
| 197 | boundary = boundary.left(70); never executed:  boundary = boundary.left(70); | 0 | ||||||||||||||||||
| 198 | } executed 35 times by 2 tests:  end of blockExecuted by: 
 | 35 | ||||||||||||||||||
| 199 | - | |||||||||||||||||||
| 200 | qint64 QHttpMultiPartIODevice::size() const | - | ||||||||||||||||||
| 201 | { | - | ||||||||||||||||||
| 202 | - | |||||||||||||||||||
| 203 | - | |||||||||||||||||||
| 204 | if (deviceSize == -1 
 | 24-3638 | ||||||||||||||||||
| 205 | qint64 currentSize = 0; | - | ||||||||||||||||||
| 206 | qint64 boundaryCount = multiPart->boundary.count(); | - | ||||||||||||||||||
| 207 | for (int a = 0; a < multiPart->parts.count() 
 | 24-36 | ||||||||||||||||||
| 208 | partOffsets.append(currentSize); | - | ||||||||||||||||||
| 209 | - | |||||||||||||||||||
| 210 | - | |||||||||||||||||||
| 211 | currentSize += boundaryCount + 4 + multiPart->parts.at(a).d->size() + 2; | - | ||||||||||||||||||
| 212 | } executed 36 times by 2 tests:  end of blockExecuted by: 
 | 36 | ||||||||||||||||||
| 213 | currentSize += boundaryCount + 6; | - | ||||||||||||||||||
| 214 | deviceSize = currentSize; | - | ||||||||||||||||||
| 215 | } executed 24 times by 2 tests:  end of blockExecuted by: 
 | 24 | ||||||||||||||||||
| 216 | return executed 3662 times by 2 tests: deviceSize; return deviceSize;Executed by: 
 executed 3662 times by 2 tests:  return deviceSize;Executed by: 
 | 3662 | ||||||||||||||||||
| 217 | } | - | ||||||||||||||||||
| 218 | - | |||||||||||||||||||
| 219 | bool QHttpMultiPartIODevice::isSequential() const | - | ||||||||||||||||||
| 220 | { | - | ||||||||||||||||||
| 221 | for (int a = 0; a < multiPart->parts.count() 
 | 3684-9288 | ||||||||||||||||||
| 222 | QIODevice *device = multiPart->parts.at(a).d->bodyDevice; | - | ||||||||||||||||||
| 223 | - | |||||||||||||||||||
| 224 | - | |||||||||||||||||||
| 225 | if (device 
 
 | 0-8016 | ||||||||||||||||||
| 226 | return never executed: true; return true;never executed:  return true; | 0 | ||||||||||||||||||
| 227 | } executed 9288 times by 2 tests:  end of blockExecuted by: 
 | 9288 | ||||||||||||||||||
| 228 | return executed 3684 times by 2 tests: false; return false;Executed by: 
 executed 3684 times by 2 tests:  return false;Executed by: 
 | 3684 | ||||||||||||||||||
| 229 | } | - | ||||||||||||||||||
| 230 | - | |||||||||||||||||||
| 231 | bool QHttpMultiPartIODevice::reset() | - | ||||||||||||||||||
| 232 | { | - | ||||||||||||||||||
| 233 | for (int a = 0; a < multiPart->parts.count() 
 | 0 | ||||||||||||||||||
| 234 | if (!multiPart->parts[a].d->reset() 
 | 0 | ||||||||||||||||||
| 235 | return never executed: false; return false;never executed:  return false; | 0 | ||||||||||||||||||
| 236 | readPointer = 0; | - | ||||||||||||||||||
| 237 | return never executed: true; return true;never executed:  return true; | 0 | ||||||||||||||||||
| 238 | } | - | ||||||||||||||||||
| 239 | qint64 QHttpMultiPartIODevice::readData(char *data, qint64 maxSize) | - | ||||||||||||||||||
| 240 | { | - | ||||||||||||||||||
| 241 | qint64 bytesRead = 0, index = 0; | - | ||||||||||||||||||
| 242 | - | |||||||||||||||||||
| 243 | - | |||||||||||||||||||
| 244 | while (index < multiPart->parts.count() 
 | 8-1860 | ||||||||||||||||||
| 245 | readPointer >= partOffsets.at(index) + multiPart->parts.at(index).d->size() 
 | 838-1022 | ||||||||||||||||||
| 246 | + multiPart->boundary.count() + 6 
 | 838-1022 | ||||||||||||||||||
| 247 | index++; executed 838 times by 2 tests:  index++;Executed by: 
 | 838 | ||||||||||||||||||
| 248 | - | |||||||||||||||||||
| 249 | - | |||||||||||||||||||
| 250 | while (bytesRead < maxSize 
 
 | 26-1066 | ||||||||||||||||||
| 251 | - | |||||||||||||||||||
| 252 | - | |||||||||||||||||||
| 253 | QByteArray boundaryData = "--" + multiPart->boundary + "\r\n"; | - | ||||||||||||||||||
| 254 | qint64 boundaryCount = boundaryData.count(); | - | ||||||||||||||||||
| 255 | qint64 partIndex = readPointer - partOffsets.at(index); | - | ||||||||||||||||||
| 256 | if (partIndex < boundaryCount 
 | 36-1004 | ||||||||||||||||||
| 257 | qint64 boundaryBytesRead = qMin(boundaryCount - partIndex, maxSize - bytesRead); | - | ||||||||||||||||||
| 258 | memcpy(data + bytesRead, boundaryData.constData() + partIndex, boundaryBytesRead); | - | ||||||||||||||||||
| 259 | bytesRead += boundaryBytesRead; | - | ||||||||||||||||||
| 260 | readPointer += boundaryBytesRead; | - | ||||||||||||||||||
| 261 | partIndex += boundaryBytesRead; | - | ||||||||||||||||||
| 262 | } executed 36 times by 2 tests:  end of blockExecuted by: 
 | 36 | ||||||||||||||||||
| 263 | - | |||||||||||||||||||
| 264 | - | |||||||||||||||||||
| 265 | if (bytesRead < maxSize 
 
 
 | 0-1040 | ||||||||||||||||||
| 266 | qint64 dataBytesRead = multiPart->parts[index].d->readData(data + bytesRead, maxSize - bytesRead); | - | ||||||||||||||||||
| 267 | if (dataBytesRead == -1 
 | 0-1040 | ||||||||||||||||||
| 268 | return never executed: -1; return -1;never executed:  return -1; | 0 | ||||||||||||||||||
| 269 | bytesRead += dataBytesRead; | - | ||||||||||||||||||
| 270 | readPointer += dataBytesRead; | - | ||||||||||||||||||
| 271 | partIndex += dataBytesRead; | - | ||||||||||||||||||
| 272 | } executed 1040 times by 2 tests:  end of blockExecuted by: 
 | 1040 | ||||||||||||||||||
| 273 | - | |||||||||||||||||||
| 274 | - | |||||||||||||||||||
| 275 | if (bytesRead < maxSize 
 
 | 0-1004 | ||||||||||||||||||
| 276 | if (bytesRead == maxSize - 1 
 | 0-36 | ||||||||||||||||||
| 277 | return never executed: bytesRead; return bytesRead;never executed:  return bytesRead; | 0 | ||||||||||||||||||
| 278 | memcpy(data + bytesRead, "\r\n", 2); | - | ||||||||||||||||||
| 279 | bytesRead += 2; | - | ||||||||||||||||||
| 280 | readPointer += 2; | - | ||||||||||||||||||
| 281 | index++; | - | ||||||||||||||||||
| 282 | } executed 36 times by 2 tests:  end of blockExecuted by: 
 | 36 | ||||||||||||||||||
| 283 | } executed 1040 times by 2 tests:  end of blockExecuted by: 
 | 1040 | ||||||||||||||||||
| 284 | - | |||||||||||||||||||
| 285 | if (bytesRead < maxSize 
 
 | 0-1004 | ||||||||||||||||||
| 286 | QByteArray finalBoundary = "--" + multiPart->boundary + "--\r\n"; | - | ||||||||||||||||||
| 287 | qint64 boundaryIndex = readPointer + finalBoundary.count() - size(); | - | ||||||||||||||||||
| 288 | qint64 lastBoundaryBytesRead = qMin(finalBoundary.count() - boundaryIndex, maxSize - bytesRead); | - | ||||||||||||||||||
| 289 | memcpy(data + bytesRead, finalBoundary.constData() + boundaryIndex, lastBoundaryBytesRead); | - | ||||||||||||||||||
| 290 | bytesRead += lastBoundaryBytesRead; | - | ||||||||||||||||||
| 291 | readPointer += lastBoundaryBytesRead; | - | ||||||||||||||||||
| 292 | } executed 26 times by 2 tests:  end of blockExecuted by: 
 | 26 | ||||||||||||||||||
| 293 | return executed 1030 times by 2 tests: bytesRead; return bytesRead;Executed by: 
 executed 1030 times by 2 tests:  return bytesRead;Executed by: 
 | 1030 | ||||||||||||||||||
| 294 | } | - | ||||||||||||||||||
| 295 | - | |||||||||||||||||||
| 296 | qint64 QHttpMultiPartIODevice::writeData(const char *data, qint64 maxSize) | - | ||||||||||||||||||
| 297 | { | - | ||||||||||||||||||
| 298 | (void)data;; | - | ||||||||||||||||||
| 299 | (void)maxSize;; | - | ||||||||||||||||||
| 300 | return never executed: -1; return -1;never executed:  return -1; | 0 | ||||||||||||||||||
| 301 | } | - | ||||||||||||||||||
| 302 | - | |||||||||||||||||||
| 303 | - | |||||||||||||||||||
| 304 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |