summaryrefslogtreecommitdiffstats
path: root/src/xml/sax/qxml.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-02-14 15:49:08 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2018-02-14 15:49:08 +0000
commit7bc1d6effaae8f5aa1bef92cb1094ec3b3f4fb95 (patch)
treecde8deeea717fc25d64640d96cf13a4fd44d9db1 /src/xml/sax/qxml.cpp
parent2aeb2bcef48d7bca2186c262dde433737956a539 (diff)
parent305dd1b61f657474d751cc3b24f58249ec21b61b (diff)
Merge "Merge remote-tracking branch 'origin/5.9' into 5.11" into refs/staging/5.11
Diffstat (limited to 'src/xml/sax/qxml.cpp')
-rw-r--r--src/xml/sax/qxml.cpp14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp
index b781176e13..168e8c3cb4 100644
--- a/src/xml/sax/qxml.cpp
+++ b/src/xml/sax/qxml.cpp
@@ -1270,18 +1270,8 @@ void QXmlInputSource::fetchData()
} else if (device->isOpen() || device->open(QIODevice::ReadOnly)) {
rawData.resize(BufferSize);
qint64 size = device->read(rawData.data(), BufferSize);
-
- if (size != -1) {
- // We don't want to give fromRawData() less than four bytes if we can avoid it.
- while (size < 4) {
- if (!device->waitForReadyRead(-1))
- break;
- int ret = device->read(rawData.data() + size, BufferSize - size);
- if (ret <= 0)
- break;
- size += ret;
- }
- }
+ if (size == 0 && device->waitForReadyRead(-1))
+ size = device->read(rawData.data(), BufferSize);
rawData.resize(qMax(qint64(0), size));
}