diff --git a/3rdParty/velocypack/include/velocypack/Buffer.h b/3rdParty/velocypack/include/velocypack/Buffer.h index 14ed4081c3..abb956a3d5 100644 --- a/3rdParty/velocypack/include/velocypack/Buffer.h +++ b/3rdParty/velocypack/include/velocypack/Buffer.h @@ -142,6 +142,13 @@ class Buffer { initWithNone(); } + void resetTo(ValueLength position) { + if (position >= _alloc) { + throw Exception(Exception::IndexOutOfBounds); + } + _pos = position; + } + void clear() { reset(); if (_buffer != _local) { diff --git a/arangod/VocBase/LogicalCollection.cpp b/arangod/VocBase/LogicalCollection.cpp index b5a36d651a..5612508fbf 100644 --- a/arangod/VocBase/LogicalCollection.cpp +++ b/arangod/VocBase/LogicalCollection.cpp @@ -3593,9 +3593,9 @@ void LogicalCollection::mergeObjectsForUpdate( std::unordered_map newValues; { - VPackObjectIterator it(newValue, false); + VPackObjectIterator it(newValue, true); while (it.valid()) { - std::string key = it.key().copyString(); + StringRef key(it.key()); if (!key.empty() && key[0] == '_' && (key == StaticStrings::KeyString || key == StaticStrings::IdString || key == StaticStrings::RevString || @@ -3609,7 +3609,7 @@ void LogicalCollection::mergeObjectsForUpdate( } // else do nothing } else { // regular attribute - newValues.emplace(std::move(key), it.value()); + newValues.emplace(std::string(key.data(), key.size()), it.value()); } it.next(); @@ -3647,7 +3647,7 @@ void LogicalCollection::mergeObjectsForUpdate( // add other attributes after the system attributes { - VPackObjectIterator it(oldValue, false); + VPackObjectIterator it(oldValue, true); while (it.valid()) { std::string key = it.key().copyString(); // exclude system attributes in old value now @@ -3690,15 +3690,15 @@ void LogicalCollection::mergeObjectsForUpdate( } // add remaining values that were only in new object - for (auto& it : newValues) { - auto& s = it.second; + for (auto const& it : newValues) { + VPackSlice const& s = it.second; if (s.isNone()) { continue; } if (!keepNull && s.isNull()) { continue; } - b.add(std::move(it.first), s); + b.add(it.first, s); } b.close();