QIODevice::read(): remove dead code

Program can't continue execution, if QByteArray::resize() fails.

Change-Id: I7138cadada0c1ecdb782daa32ab33b16f22291c6
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
This commit is contained in:
Alex Trotsenko 2016-03-17 18:26:02 +02:00
parent 7fc2864dc5
commit c8c3893f37

View File

@ -1171,22 +1171,8 @@ QByteArray QIODevice::read(qint64 maxSize)
maxSize = MaxByteArraySize - 1;
}
qint64 readBytes = 0;
if (maxSize) {
result.resize(int(maxSize));
if (!result.size()) {
// If resize fails, read incrementally.
qint64 readResult;
do {
result.resize(int(qMin(maxSize, qint64(result.size() + d->readBufferChunkSize))));
readResult = read(result.data() + readBytes, result.size() - readBytes);
if (readResult > 0 || readBytes == 0)
readBytes += readResult;
} while (readResult == d->readBufferChunkSize);
} else {
readBytes = read(result.data(), result.size());
}
}
qint64 readBytes = read(result.data(), result.size());
if (readBytes <= 0)
result.clear();