From c8c3893f37594c9e00f75b676d4a0d5bd0324144 Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Thu, 17 Mar 2016 18:26:02 +0200 Subject: [PATCH] QIODevice::read(): remove dead code Program can't continue execution, if QByteArray::resize() fails. Change-Id: I7138cadada0c1ecdb782daa32ab33b16f22291c6 Reviewed-by: Allan Sandfeld Jensen --- src/corelib/io/qiodevice.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index ee004b4293..36616a5236 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -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()); - } - } + result.resize(int(maxSize)); + qint64 readBytes = read(result.data(), result.size()); if (readBytes <= 0) result.clear();