mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-03 00:11:36 +08:00
uavcan::Array<> - compile-time check fix in appendFormatted()
This commit is contained in:
@@ -714,7 +714,8 @@ public:
|
|||||||
StaticAssert<IsDynamic>::check();
|
StaticAssert<IsDynamic>::check();
|
||||||
|
|
||||||
StaticAssert<sizeof(A() >= A(0))>::check(); // This check allows to weed out most compound types
|
StaticAssert<sizeof(A() >= A(0))>::check(); // This check allows to weed out most compound types
|
||||||
StaticAssert<sizeof(A) <= sizeof(long double)>::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)
|
if (!format)
|
||||||
{
|
{
|
||||||
@@ -731,7 +732,7 @@ public:
|
|||||||
using namespace std; // For snprintf()
|
using namespace std; // For snprintf()
|
||||||
const int ret = snprintf(reinterpret_cast<char*>(ptr), SizeType(max_size + 1U), format, value);
|
const int ret = snprintf(reinterpret_cast<char*>(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();
|
Base::grow();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user