From b0ddb244bef664a89d252f15fac646caed35d4e5 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Fri, 30 Sep 2016 09:06:30 +0100 Subject: [PATCH] Fix signed conversion warnings. --- .../functional/hash/detail/hash_float.hpp | 2 +- test/hash_complex_test.cpp | 4 +-- test/hash_custom_test.cpp | 2 +- test/hash_friend_test.cpp | 2 +- test/hash_global_namespace_test.cpp | 2 +- test/hash_sequence_test.hpp | 22 ++++++++------- test/hash_set_test.hpp | 28 ++++++++++--------- test/link_ext_test.cpp | 2 +- 8 files changed, 34 insertions(+), 30 deletions(-) diff --git a/include/boost/functional/hash/detail/hash_float.hpp b/include/boost/functional/hash/detail/hash_float.hpp index eb9264f..9fb8168 100644 --- a/include/boost/functional/hash/detail/hash_float.hpp +++ b/include/boost/functional/hash/detail/hash_float.hpp @@ -179,7 +179,7 @@ namespace boost hash_float_combine(seed, part); } - hash_float_combine(seed, exp); + hash_float_combine(seed, static_cast(exp)); return seed; } diff --git a/test/hash_complex_test.cpp b/test/hash_complex_test.cpp index 617b51b..88f3833 100644 --- a/test/hash_complex_test.cpp +++ b/test/hash_complex_test.cpp @@ -84,8 +84,8 @@ void complex_integral_tests(Integer*) generic_complex_tests(complex(15342,124)); generic_complex_tests(complex(25,54356)); generic_complex_tests(complex(5325,2346)); - generic_complex_tests(complex(-243897,-49923874)); - generic_complex_tests(complex(-543,763)); + generic_complex_tests(complex(Integer(-243897),Integer(-49923874))); + generic_complex_tests(complex(Integer(-543),Integer(763))); } int main() diff --git a/test/hash_custom_test.cpp b/test/hash_custom_test.cpp index 75f1c2b..4f125ab 100644 --- a/test/hash_custom_test.cpp +++ b/test/hash_custom_test.cpp @@ -15,7 +15,7 @@ namespace test std::size_t hash() const { - return value_ * 10; + return static_cast(value_ * 10); } #if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) diff --git a/test/hash_friend_test.cpp b/test/hash_friend_test.cpp index 03755a8..4b75f8a 100644 --- a/test/hash_friend_test.cpp +++ b/test/hash_friend_test.cpp @@ -17,7 +17,7 @@ namespace test std::size_t hash() const { - return value_ * 10; + return static_cast(value_ * 10); } #if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) diff --git a/test/hash_global_namespace_test.cpp b/test/hash_global_namespace_test.cpp index 877ff00..7fc7bf6 100644 --- a/test/hash_global_namespace_test.cpp +++ b/test/hash_global_namespace_test.cpp @@ -17,7 +17,7 @@ struct custom std::size_t hash() const { - return value_ * 10; + return static_cast(value_ * 10); } #if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) diff --git a/test/hash_sequence_test.hpp b/test/hash_sequence_test.hpp index e0846b0..30083f9 100644 --- a/test/hash_sequence_test.hpp +++ b/test/hash_sequence_test.hpp @@ -19,6 +19,8 @@ namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests) template void integer_tests(T* = 0) { + typedef typename T::value_type value_type; + const int number_of_containers = 11; T containers[number_of_containers]; @@ -27,16 +29,16 @@ namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests) containers[i].push_back(0); } - containers[5].push_back(1); - containers[6].push_back(1); - containers[6].push_back(1); - containers[7].push_back(-1); - containers[8].push_back(-1); - containers[8].push_back(-1); - containers[9].push_back(1); - containers[9].push_back(-1); - containers[10].push_back(-1); - containers[10].push_back(1); + containers[5].push_back(value_type(1)); + containers[6].push_back(value_type(1)); + containers[6].push_back(value_type(1)); + containers[7].push_back(value_type(-1)); + containers[8].push_back(value_type(-1)); + containers[8].push_back(value_type(-1)); + containers[9].push_back(value_type(1)); + containers[9].push_back(value_type(-1)); + containers[10].push_back(value_type(-1)); + containers[10].push_back(value_type(1)); BOOST_HASH_TEST_NAMESPACE::hash hasher; diff --git a/test/hash_set_test.hpp b/test/hash_set_test.hpp index 31d4909..0a90330 100644 --- a/test/hash_set_test.hpp +++ b/test/hash_set_test.hpp @@ -19,6 +19,8 @@ namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests) template void integer_tests(T* = 0) { + typedef typename T::value_type value_type; + const int number_of_containers = 12; T containers[number_of_containers]; @@ -27,19 +29,19 @@ namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests) containers[i].insert(0); } - containers[6].insert(1); - containers[7].insert(1); - containers[7].insert(1); - containers[8].insert(-1); - containers[9].insert(-1); - containers[9].insert(-1); - containers[10].insert(-1); - containers[10].insert(1); - containers[11].insert(1); - containers[11].insert(2); - containers[11].insert(3); - containers[11].insert(4); - containers[11].insert(5); + containers[6].insert(value_type(1)); + containers[7].insert(value_type(1)); + containers[7].insert(value_type(1)); + containers[8].insert(value_type(-1)); + containers[9].insert(value_type(-1)); + containers[9].insert(value_type(-1)); + containers[10].insert(value_type(-1)); + containers[10].insert(value_type(1)); + containers[11].insert(value_type(1)); + containers[11].insert(value_type(2)); + containers[11].insert(value_type(3)); + containers[11].insert(value_type(4)); + containers[11].insert(value_type(5)); BOOST_HASH_TEST_NAMESPACE::hash hasher; diff --git a/test/link_ext_test.cpp b/test/link_ext_test.cpp index dd895aa..74a4eb5 100644 --- a/test/link_ext_test.cpp +++ b/test/link_ext_test.cpp @@ -20,7 +20,7 @@ int f(std::size_t hash1, int* x1) { // Check that std::vector is avaiable in this file. std::vector x; - x.push_back(*x1); + x.push_back(static_cast(*x1)); BOOST_HASH_TEST_NAMESPACE::hash > vector_hasher; return vector_hasher(x) != BOOST_HASH_TEST_NAMESPACE::hash_value(x);