mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 02:33:34 +08:00
Most enums were replaced with constants, according to MISRA
This commit is contained in:
@@ -56,7 +56,7 @@ public:
|
||||
, qos(uint8_t(qos))
|
||||
, flags(flags)
|
||||
{
|
||||
assert(qos == Volatile || qos == Persistent);
|
||||
assert((qos == Volatile) || (qos == Persistent));
|
||||
IsDynamicallyAllocatable<Entry>::check();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
namespace uavcan
|
||||
{
|
||||
|
||||
enum { MaxTransferPayloadLen = 439 }; ///< According to the standard
|
||||
static const unsigned MaxTransferPayloadLen = 439; ///< According to the RFC
|
||||
|
||||
enum { MaxSingleFrameTransferPayloadLen = 7 };
|
||||
static const unsigned MaxSingleFrameTransferPayloadLen = 7;
|
||||
|
||||
enum TransferType
|
||||
{
|
||||
@@ -30,8 +30,8 @@ class UAVCAN_EXPORT TransferID
|
||||
uint8_t value_;
|
||||
|
||||
public:
|
||||
enum { BitLen = 3 };
|
||||
enum { Max = (1 << BitLen) - 1 };
|
||||
static const uint8_t BitLen = 3U;
|
||||
static const uint8_t Max = (1U << BitLen) - 1U;
|
||||
|
||||
TransferID()
|
||||
: value_(0)
|
||||
@@ -67,17 +67,13 @@ public:
|
||||
|
||||
class UAVCAN_EXPORT NodeID
|
||||
{
|
||||
enum
|
||||
{
|
||||
ValueBroadcast = 0,
|
||||
ValueInvalid = 0xFF
|
||||
};
|
||||
static const uint8_t ValueBroadcast = 0;
|
||||
static const uint8_t ValueInvalid = 0xFF;
|
||||
uint8_t value_;
|
||||
|
||||
public:
|
||||
enum { BitLen = 7 };
|
||||
enum { Max = (1 << BitLen) - 1 };
|
||||
|
||||
static const uint8_t BitLen = 7U;
|
||||
static const uint8_t Max = (1U << BitLen) - 1U;
|
||||
static const NodeID Broadcast;
|
||||
|
||||
NodeID() : value_(ValueInvalid) { }
|
||||
|
||||
@@ -94,7 +94,7 @@ class UAVCAN_EXPORT DynamicTransferBufferManagerEntry
|
||||
struct Block : LinkedListNode<Block>
|
||||
{
|
||||
enum { Size = MemPoolBlockSize - sizeof(LinkedListNode<Block>) };
|
||||
uint8_t data[Size];
|
||||
uint8_t data[static_cast<unsigned>(Size)];
|
||||
|
||||
static Block* instantiate(IPoolAllocator& allocator);
|
||||
static void destroy(Block*& obj, IPoolAllocator& allocator);
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
|
||||
private:
|
||||
enum TidRelation { TidSame, TidRepeat, TidFuture };
|
||||
enum { IfaceIndexNotSet = 0xFF };
|
||||
static const uint8_t IfaceIndexNotSet = 0xFF;
|
||||
|
||||
MonotonicTime prev_transfer_ts_;
|
||||
MonotonicTime this_transfer_ts_;
|
||||
|
||||
Reference in New Issue
Block a user