From 6e15a541e65b2f7aecc1596497e5dcd6bda44e94 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Sat, 21 Mar 2015 13:06:40 +0300 Subject: [PATCH] uavcan::Array<> - compile-time check fix in appendFormatted() --- libuavcan/include/uavcan/marshal/array.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libuavcan/include/uavcan/marshal/array.hpp b/libuavcan/include/uavcan/marshal/array.hpp index 46215e311b..2248a161bd 100644 --- a/libuavcan/include/uavcan/marshal/array.hpp +++ b/libuavcan/include/uavcan/marshal/array.hpp @@ -714,7 +714,8 @@ public: StaticAssert::check(); StaticAssert= A(0))>::check(); // This check allows to weed out most compound types - StaticAssert::check(); // Another stupid check to catch non-primitive types + StaticAssert<(sizeof(A) <= sizeof(long double)) || + (sizeof(A) <= sizeof(long long))>::check(); // Another stupid check to catch non-primitive types if (!format) { @@ -731,7 +732,7 @@ public: using namespace std; // For snprintf() const int ret = snprintf(reinterpret_cast(ptr), SizeType(max_size + 1U), format, value); - for (int i = 0; i < min(ret, int(max_size)); i++) + for (int i = 0; i < ::uavcan::min(ret, int(max_size)); i++) { Base::grow(); }