diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-10-09 01:00:47 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-10-09 01:00:48 +0200 |
commit | 69b6845edbb43cf7000942d07f3a326383bdf6d2 (patch) | |
tree | 58755c33dfb18a51d194d0f774b1deca6135ce4a /src/corelib/serialization/qcborvalue.cpp | |
parent | e2ab24d36f31395c2239b49ac26f2266b69444bd (diff) | |
parent | 8e5a2f63c3f6ee49d3f2e1985bf73de7769b0e72 (diff) |
Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: I5cbfd39cf728036bbdfdeec8e8739568e0a3025b
Diffstat (limited to 'src/corelib/serialization/qcborvalue.cpp')
-rw-r--r-- | src/corelib/serialization/qcborvalue.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/corelib/serialization/qcborvalue.cpp b/src/corelib/serialization/qcborvalue.cpp index 8673628c69..935f761585 100644 --- a/src/corelib/serialization/qcborvalue.cpp +++ b/src/corelib/serialization/qcborvalue.cpp @@ -859,6 +859,23 @@ QCborContainerPrivate *QCborContainerPrivate::detach(QCborContainerPrivate *d, q return d; } +/*! + Prepare for an insertion at position \a index + + Detaches and ensures there are at least index entries in the array, padding + with Undefined as needed. +*/ +QCborContainerPrivate *QCborContainerPrivate::grow(QCborContainerPrivate *d, qsizetype index) +{ + Q_ASSERT(index >= 0); + d = detach(d, index + 1); + Q_ASSERT(d); + int j = d->elements.size(); + while (j < index) + d->append(Undefined()); + return d; +} + // Copies or moves \a value into element at position \a e. If \a disp is // CopyContainer, then this function increases the reference count of the // container, but otherwise leaves it unmodified. If \a disp is MoveContainer, |