diff options
author | Alex Trotsenko <alex1973tr@gmail.com> | 2016-03-17 18:26:02 +0200 |
---|---|---|
committer | Alex Trotsenko <alex1973tr@gmail.com> | 2016-03-30 15:20:31 +0000 |
commit | c8c3893f37594c9e00f75b676d4a0d5bd0324144 (patch) | |
tree | 362fe01b4f3daccfec8a78714ab05ba9df10317d /src/corelib/io/qiodevice.cpp | |
parent | 7fc2864dc5391096a19c2d5f80695129c24cc303 (diff) |
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>
Diffstat (limited to 'src/corelib/io/qiodevice.cpp')
-rw-r--r-- | src/corelib/io/qiodevice.cpp | 18 |
1 files 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(); |