mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Error codes are constants, not enum. That fixes another MISRA violation.
This commit is contained in:
parent
519532da14
commit
ace2cf9d0e
@ -5,6 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <uavcan/impl_constants.hpp>
|
||||
#include <uavcan/stdint.hpp>
|
||||
|
||||
namespace uavcan
|
||||
{
|
||||
@ -13,20 +14,22 @@ namespace uavcan
|
||||
* Functions that return signed integers may also return inverted error codes,
|
||||
* i.e. returned value should be inverted back to get the actual error code.
|
||||
*/
|
||||
enum
|
||||
namespace
|
||||
{
|
||||
ErrOk,
|
||||
ErrFailure,
|
||||
ErrInvalidParam,
|
||||
ErrMemory,
|
||||
ErrDriver,
|
||||
ErrUnknownDataType,
|
||||
ErrInvalidMarshalData,
|
||||
ErrInvalidTransferListener,
|
||||
ErrNotInited,
|
||||
ErrRecursiveCall,
|
||||
ErrLogic
|
||||
};
|
||||
|
||||
const int16_t ErrOk = 0;
|
||||
const int16_t ErrFailure = 1;
|
||||
const int16_t ErrInvalidParam = 2;
|
||||
const int16_t ErrMemory = 3;
|
||||
const int16_t ErrDriver = 4;
|
||||
const int16_t ErrUnknownDataType = 5;
|
||||
const int16_t ErrInvalidMarshalData = 6;
|
||||
const int16_t ErrInvalidTransferListener = 7;
|
||||
const int16_t ErrNotInited = 8;
|
||||
const int16_t ErrRecursiveCall = 9;
|
||||
const int16_t ErrLogic = 10;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Fatal error handler.
|
||||
|
||||
@ -226,7 +226,7 @@ class SocketCanIface : public uavcan::ICanIface
|
||||
/*
|
||||
* Flags
|
||||
*/
|
||||
loopback = !!(msg.msg_flags & MSG_CONFIRM);
|
||||
loopback = (msg.msg_flags & static_cast<int>(MSG_CONFIRM)) != 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user