diff --git a/src/3rdparty/cpp-btree/btree.h b/src/3rdparty/cpp-btree/btree.h index 001747eedb..688e9d9c56 100644 --- a/src/3rdparty/cpp-btree/btree.h +++ b/src/3rdparty/cpp-btree/btree.h @@ -510,11 +510,11 @@ class btree_node { // Getter for the position of this node in its parent. int position() const { return fields_.position; } - void set_position(int v) { fields_.position = v; } + void set_position(int v) { fields_.position = static_cast(v); } // Getter/setter for the number of values stored in this node. int count() const { return fields_.count; } - void set_count(int v) { fields_.count = v; } + void set_count(int v) { fields_.count = static_cast(v); } int max_count() const { return fields_.max_count; } // Getter for the parent of this node. @@ -561,7 +561,7 @@ class btree_node { void set_child(int i, btree_node *c) { *mutable_child(i) = c; c->fields_.parent = this; - c->fields_.position = i; + c->fields_.position = static_cast(i); } // Returns the position of the first value whose key is not less than k. @@ -674,7 +674,7 @@ class btree_node { btree_node *n = reinterpret_cast(f); f->leaf = 1; f->position = 0; - f->max_count = max_count; + f->max_count = static_cast(max_count); f->count = 0; f->parent = parent; #ifdef BTREE_DEBUG @@ -935,10 +935,12 @@ class btree : public Params::key_compare { return const_iterator(leftmost(), 0); } iterator end() { - return iterator(rightmost(), rightmost() ? rightmost()->count() : 0); + node_type* const right = rightmost(); + return iterator(right, right ? right->count() : 0); } const_iterator end() const { - return const_iterator(rightmost(), rightmost() ? rightmost()->count() : 0); + const node_type* const right = rightmost(); + return const_iterator(right, right ? right->count() : 0); } reverse_iterator rbegin() { return reverse_iterator(end()); @@ -1752,7 +1754,8 @@ inline typename btree

::iterator btree

::insert_unique(iterator position, const value_type &v) { if (!empty()) { const key_type &key = params_type::key(v); - if (position == end() || compare_keys(key, position.key())) { + const iterator end = this->end(); + if (position == end || compare_keys(key, position.key())) { iterator prev = position; if (position == begin() || compare_keys((--prev).key(), key)) { // prev.key() < key < position.key() @@ -1761,7 +1764,7 @@ btree

::insert_unique(iterator position, const value_type &v) { } else if (compare_keys(position.key(), key)) { iterator next = position; ++next; - if (next == end() || compare_keys(key, next.key())) { + if (next == end || compare_keys(key, next.key())) { // position.key() < key < next.key() return internal_insert(next, v); } @@ -1799,7 +1802,8 @@ typename btree

::iterator btree

::insert_multi(iterator position, const value_type &v) { if (!empty()) { const key_type &key = params_type::key(v); - if (position == end() || !compare_keys(position.key(), key)) { + const iterator end = this->end(); + if (position == end || !compare_keys(position.key(), key)) { iterator prev = position; if (position == begin() || !compare_keys(key, (--prev).key())) { // prev.key() <= key <= position.key() @@ -1808,7 +1812,7 @@ btree

::insert_multi(iterator position, const value_type &v) { } else { iterator next = position; ++next; - if (next == end() || !compare_keys(next.key(), key)) { + if (next == end || !compare_keys(next.key(), key)) { // position.key() < key <= next.key() return internal_insert(next, v); } @@ -1833,7 +1837,7 @@ void btree

::assign(const self_type &x) { // Assignment can avoid key comparisons because we know the order of the // values is the same order we'll store them in. - for (const_iterator iter = x.begin(); iter != x.end(); ++iter) { + for (const_iterator iter = x.begin(), xend = x.end(); iter != xend; ++iter) { if (empty()) { insert_multi(*iter); } else {