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:
parent
7fc2864dc5
commit
c8c3893f37
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user