Repository: qpid-proton Updated Branches: refs/heads/master 7c78b145b -> 1d704cb28
PROTON-1246: Fixes to avoid warning under clang++ 3.8 Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/1d704cb2 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/1d704cb2 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/1d704cb2 Branch: refs/heads/master Commit: 1d704cb2887b130d53646091dd25972889be9479 Parents: 7c78b14 Author: Andrew Stitcher <[email protected]> Authored: Mon Jun 27 15:31:01 2016 -0400 Committer: Andrew Stitcher <[email protected]> Committed: Mon Jun 27 15:33:49 2016 -0400 ---------------------------------------------------------------------- proton-c/bindings/cpp/src/decoder.cpp | 2 +- proton-c/bindings/cpp/src/interop_test.cpp | 2 +- proton-c/bindings/cpp/src/scalar_test.hpp | 2 +- proton-c/bindings/cpp/src/test_bits.hpp | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1d704cb2/proton-c/bindings/cpp/src/decoder.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/decoder.cpp b/proton-c/bindings/cpp/src/decoder.cpp index b215539..1caa14a 100644 --- a/proton-c/bindings/cpp/src/decoder.cpp +++ b/proton-c/bindings/cpp/src/decoder.cpp @@ -298,7 +298,7 @@ decoder& decoder::operator>>(double &x) { type_id tid = pre_get(); if (exact_) assert_type_equal(DOUBLE, tid); switch (tid) { - case FLOAT: x = pn_data_get_float(pn_object()); break; + case FLOAT: x = static_cast<double>(pn_data_get_float(pn_object())); break; case DOUBLE: x = pn_data_get_double(pn_object()); break; default: assert_type_equal(DOUBLE, tid); } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1d704cb2/proton-c/bindings/cpp/src/interop_test.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/interop_test.cpp b/proton-c/bindings/cpp/src/interop_test.cpp index ee29bc1..8a9db5d 100644 --- a/proton-c/bindings/cpp/src/interop_test.cpp +++ b/proton-c/bindings/cpp/src/interop_test.cpp @@ -77,7 +77,7 @@ void test_decoder_primitves_exact() { ASSERT_EQUAL(12345u, get< ::uint64_t>(d)); ASSERT_EQUAL(-12345, get< ::int64_t>(d)); try { get<double>(d); FAIL("got float as double"); } catch(conversion_error){} - ASSERT_EQUAL(0.125, get<float>(d)); + ASSERT_EQUAL(0.125f, get<float>(d)); try { get<float>(d); FAIL("got double as float"); } catch(conversion_error){} ASSERT_EQUAL(0.125, get<double>(d)); ASSERT(!d.more()); http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1d704cb2/proton-c/bindings/cpp/src/scalar_test.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/scalar_test.hpp b/proton-c/bindings/cpp/src/scalar_test.hpp index 87a529c..79f66e4 100644 --- a/proton-c/bindings/cpp/src/scalar_test.hpp +++ b/proton-c/bindings/cpp/src/scalar_test.hpp @@ -113,7 +113,7 @@ template<class V> void coerce_test() { ASSERT_EQUAL(0xFFFF, coerce<uint16_t>(V(int8_t(-1)))); // Sign extend. ASSERT_EQUAL(-1, coerce<int32_t>(V(uint64_t(0xFFFFFFFFul)))); // 2s complement - ASSERT_EQUALISH(1.2, coerce<float>(V(double(1.2))), 0.001); + ASSERT_EQUALISH(1.2f, coerce<float>(V(double(1.2))), 0.001f); ASSERT_EQUALISH(3.4, coerce<double>(V(float(3.4))), 0.001); ASSERT_EQUALISH(23.0, coerce<double>(V(uint64_t(23))), 0.001); // int to double. ASSERT_EQUAL(-1945, coerce<int>(V(float(-1945.123)))); // round to int. http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1d704cb2/proton-c/bindings/cpp/src/test_bits.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/test_bits.hpp b/proton-c/bindings/cpp/src/test_bits.hpp index 2079be5..0cfbe1f 100644 --- a/proton-c/bindings/cpp/src/test_bits.hpp +++ b/proton-c/bindings/cpp/src/test_bits.hpp @@ -40,7 +40,8 @@ void assert_equal(const T& want, const U& got, const std::string& what) { throw fail(MSG(what << " " << want << " != " << got)); } -inline void assert_equalish(double want, double got, double delta, const std::string& what) +template <class T> +inline void assert_equalish(T want, T got, T delta, const std::string& what) { if (!(fabs(want-got) <= delta)) throw fail(MSG(what << " " << want << " !=~ " << got)); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
