From 4025bf033b9c47d2d2c6104732205d70d756f261 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Mon, 17 Mar 2014 19:06:11 +0400 Subject: [PATCH] Fixed C++11 support --- libuavcan/include/uavcan/marshal/array.hpp | 2 +- libuavcan/include/uavcan/marshal/float_spec.hpp | 8 +++++++- libuavcan/test/marshal/bit_stream.cpp | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libuavcan/include/uavcan/marshal/array.hpp b/libuavcan/include/uavcan/marshal/array.hpp index dcc048c9b4..84599734a4 100644 --- a/libuavcan/include/uavcan/marshal/array.hpp +++ b/libuavcan/include/uavcan/marshal/array.hpp @@ -466,7 +466,7 @@ class YamlStreamer > const int c = array.at(i); if (c < 32 || c > 126) { - char nibbles[2] = {(c >> 4) & 0xF, c & 0xF}; + char nibbles[2] = {char((c >> 4) & 0xF), char(c & 0xF)}; for (int i = 0; i < 2; i++) { nibbles[i] += '0'; diff --git a/libuavcan/include/uavcan/marshal/float_spec.hpp b/libuavcan/include/uavcan/marshal/float_spec.hpp index 3d6f96ecc7..87c282ba0f 100644 --- a/libuavcan/include/uavcan/marshal/float_spec.hpp +++ b/libuavcan/include/uavcan/marshal/float_spec.hpp @@ -6,11 +6,15 @@ #include #include -#include // Needed for isfinite #include #include #include #include +#if __cplusplus > 201100 +# include +#else +# include +#endif namespace uavcan { @@ -137,6 +141,7 @@ public: private: static inline void saturate(StorageType& value) { + using namespace std; if (!IsExactRepresentation && isfinite(value)) { if (value > max()) @@ -148,6 +153,7 @@ private: static inline void truncate(StorageType& value) { + using namespace std; if (!IsExactRepresentation && isfinite(value)) { if (value > max()) diff --git a/libuavcan/test/marshal/bit_stream.cpp b/libuavcan/test/marshal/bit_stream.cpp index 9a54a36a7b..f60efc4b33 100644 --- a/libuavcan/test/marshal/bit_stream.cpp +++ b/libuavcan/test/marshal/bit_stream.cpp @@ -142,7 +142,7 @@ TEST(BitStream, BitByBit) { const bool value = counter % 3 == 0; binary_string.push_back(value ? '1' : '0'); - const uint8_t data[] = { value << 7 }; + const uint8_t data[] = { uint8_t(value << 7) }; ASSERT_EQ(1, bs_wr.write(data, 1)); } binary_string.push_back(' ');