Skip to content

Commit 5923493

Browse files
committed
Fix -Wsign-conversion
1 parent 1ef175a commit 5923493

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

include/boost/container/deque.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ class deque_iterator
283283
offset > 0 ? (offset / block_size)
284284
: (-difference_type((-offset - 1) / block_size) - 1);
285285
this->m_node += node_offset;
286-
this->m_cur = *this->m_node + (offset - node_offset * block_size);
286+
this->m_cur = *this->m_node + difference_type(offset - node_offset * block_size);
287287
}
288288
}
289289
return *this;
@@ -657,11 +657,11 @@ class deque_base
657657
size_type i = 0;
658658
BOOST_CONTAINER_TRY {
659659
for (; i < n; ++i)
660-
start[i] = this->prot_allocate_node();
660+
start[difference_type(i)] = this->prot_allocate_node();
661661
}
662662
BOOST_CONTAINER_CATCH(...) {
663663
for (size_type j = 0; j < i; ++j)
664-
this->prot_deallocate_node(start[j]);
664+
this->prot_deallocate_node(start[difference_type(j)]);
665665
BOOST_CONTAINER_RETHROW
666666
}
667667
BOOST_CONTAINER_CATCH_END
@@ -768,7 +768,7 @@ class deque_base
768768
static BOOST_CONTAINER_FORCEINLINE val_alloc_ptr prot_node_last(ptr_alloc_ptr idx)
769769
{
770770
BOOST_CONSTEXPR_OR_CONST std::size_t block_size = deque_base::get_block_size();
771-
return *idx + (block_size - 1u);
771+
return *idx + difference_type(block_size - 1u);
772772
}
773773

774774
BOOST_CONTAINER_FORCEINLINE size_type prot_front_free_capacity() const
@@ -816,8 +816,8 @@ class deque_base
816816
BOOST_CONTAINER_FORCEINLINE iterator prot_off_to_it(std::size_t off) const
817817
{
818818
BOOST_CONSTEXPR_OR_CONST std::size_t block_size = deque_base::get_block_size();
819-
const ptr_alloc_ptr node = this->members_.m_map + off/block_size;
820-
return iterator(node ? *node + (off%block_size) : val_alloc_ptr(), node);
819+
const ptr_alloc_ptr node = this->members_.m_map + difference_type(off/block_size);
820+
return iterator(node ? *node + difference_type(off%block_size) : val_alloc_ptr(), node);
821821
}
822822

823823
stored_size_type prot_it_to_start_off(const_iterator it) const
@@ -834,7 +834,7 @@ class deque_base
834834
BOOST_CONTAINER_FORCEINLINE ptr_alloc_ptr prot_off_to_node(std::size_t off) const
835835
{
836836
BOOST_CONSTEXPR_OR_CONST std::size_t block_size = deque_base::get_block_size();
837-
return this->members_.m_map + off/block_size;
837+
return this->members_.m_map + difference_type(off/block_size);
838838
}
839839

840840
BOOST_CONTAINER_FORCEINLINE ptr_alloc_ptr prot_start_node() const
@@ -854,8 +854,8 @@ class deque_base
854854
{
855855
BOOST_ASSERT(!!this->members_.m_map);
856856
BOOST_CONSTEXPR_OR_CONST std::size_t block_size = deque_base::get_block_size();
857-
const ptr_alloc_ptr node = this->members_.m_map + off/block_size;
858-
return *node + off%block_size;
857+
const ptr_alloc_ptr node = this->members_.m_map + difference_type(off/block_size);
858+
return *node + difference_type(off%block_size);
859859
}
860860

861861
BOOST_CONTAINER_FORCEINLINE val_alloc_ptr prot_start_cur_unchecked() const
@@ -982,7 +982,7 @@ class deque_base
982982
const std::size_t off = this->members_.m_finish_off;
983983
const std::size_t rem = off % block_size;
984984
if(BOOST_LIKELY(rem != last_in_block)){
985-
return boost::movelib::to_raw_pointer(map[off/block_size]) + rem;
985+
return boost::movelib::to_raw_pointer(map[difference_type(off/block_size)]) + difference_type(rem);
986986
}
987987
}
988988
return 0;
@@ -995,7 +995,7 @@ class deque_base
995995
const std::size_t off = this->members_.m_start_off;
996996
const std::size_t rem = off % block_size;
997997
if(BOOST_LIKELY(rem != 0u)){
998-
return boost::movelib::to_raw_pointer(this->members_.m_map[off / block_size]) + (rem-1u);
998+
return boost::movelib::to_raw_pointer(this->members_.m_map[difference_type(off/block_size)]) + difference_type(rem-1u);
999999
}
10001000
return 0;
10011001
}
@@ -2931,7 +2931,7 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
29312931
while (n) {
29322932
--current_node;
29332933
cnt = n < block_size ? n: block_size;
2934-
dest_last = ::boost::container::move_backward_n(boost::movelib::to_raw_pointer(*current_node + block_size), cnt, dest_last);
2934+
dest_last = ::boost::container::move_backward_n(boost::movelib::to_raw_pointer(*current_node + difference_type(block_size)), cnt, dest_last);
29352935
n = size_type(n - cnt);
29362936
}
29372937
return dest_last;

0 commit comments

Comments
 (0)