summaryrefslogtreecommitdiffstats
path: root/src/corelib/serialization/qcborstream.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-07-22 06:50:42 +0200
committerLiang Qi <liang.qi@qt.io>2019-07-22 06:50:42 +0200
commit261a87f956f345d4064eb2eb64e0cf7c98ec7d92 (patch)
tree53d10a28cdaf526418f4419c99cb26485c047a0d /src/corelib/serialization/qcborstream.cpp
parent0652bdcf5e60461cd9a513d64be00b8830826fad (diff)
parent5f1cf8e0f5da36063202d46463c2d9e79d841a4d (diff)
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts: qmake/generators/makefile.cpp Change-Id: Ib3715e626f2fd32804c75c16ea9aa06a1216e76d
Diffstat (limited to 'src/corelib/serialization/qcborstream.cpp')
-rw-r--r--src/corelib/serialization/qcborstream.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/corelib/serialization/qcborstream.cpp b/src/corelib/serialization/qcborstream.cpp
index 078c14a32d..c598eee213 100644
--- a/src/corelib/serialization/qcborstream.cpp
+++ b/src/corelib/serialization/qcborstream.cpp
@@ -1972,7 +1972,15 @@ inline void QCborStreamReader::preparse()
if (lastError() == QCborError::NoError) {
type_ = cbor_value_get_type(&d->currentElement);
- if (type_ != CborInvalidType) {
+ if (type_ == CborInvalidType) {
+ // We may have reached the end.
+ if (d->device && d->containerStack.isEmpty()) {
+ d->buffer.clear();
+ if (d->bufferStart)
+ d->device->skip(d->bufferStart);
+ d->bufferStart = 0;
+ }
+ } else {
d->lastError = {};
// Undo the type mapping that TinyCBOR does (we have an explicit type
// for negative integer and we don't have separate types for Boolean,