mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 01:03:33 +08:00
More warning fixes in the STM32 drvier, STM32 test project and the library core
This commit is contained in:
@@ -56,7 +56,7 @@ protected:
|
||||
throw std::out_of_range("uavcan::Array");
|
||||
#else
|
||||
UAVCAN_ASSERT(0);
|
||||
return Size - 1; // Ha ha
|
||||
return SizeType(Size - 1U); // Ha ha
|
||||
#endif
|
||||
}
|
||||
};
|
||||
@@ -87,7 +87,7 @@ protected:
|
||||
throw std::out_of_range("uavcan::Array");
|
||||
#else
|
||||
UAVCAN_ASSERT(0);
|
||||
return (size_ == 0) ? 0 : (size_ - 1);
|
||||
return SizeType((size_ == 0U) ? 0U : (size_ - 1U));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -42,16 +42,16 @@ public:
|
||||
#if UAVCAN_TINY
|
||||
void add(uint8_t byte)
|
||||
{
|
||||
value_ ^= static_cast<uint16_t>(byte) << 8;
|
||||
value_ ^= uint16_t(uint16_t(byte) << 8);
|
||||
for (uint8_t bit = 8; bit > 0; --bit)
|
||||
{
|
||||
if (value_ & 0x8000U)
|
||||
{
|
||||
value_ = (value_ << 1) ^ 0x1021U;
|
||||
value_ = uint16_t(uint16_t(value_ << 1) ^ 0x1021U);
|
||||
}
|
||||
else
|
||||
{
|
||||
value_ = (value_ << 1);
|
||||
value_ = uint16_t(value_ << 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ bool Frame::compile(CanFrame& out_can_frame) const
|
||||
{
|
||||
case TransferTypeMessageBroadcast:
|
||||
{
|
||||
out_can_frame.dlc = payload_len_;
|
||||
out_can_frame.dlc = uint8_t(payload_len_);
|
||||
(void)copy(payload_, payload_ + payload_len_, out_can_frame.data);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user