Error codes are constants, not enum. That fixes another MISRA violation.

This commit is contained in:
Pavel Kirienko
2014-04-19 14:13:55 +04:00
parent 519532da14
commit ace2cf9d0e
2 changed files with 17 additions and 14 deletions
+16 -13
View File
@@ -5,6 +5,7 @@
#pragma once #pragma once
#include <uavcan/impl_constants.hpp> #include <uavcan/impl_constants.hpp>
#include <uavcan/stdint.hpp>
namespace uavcan namespace uavcan
{ {
@@ -13,20 +14,22 @@ namespace uavcan
* Functions that return signed integers may also return inverted error codes, * 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. * i.e. returned value should be inverted back to get the actual error code.
*/ */
enum namespace
{ {
ErrOk,
ErrFailure, const int16_t ErrOk = 0;
ErrInvalidParam, const int16_t ErrFailure = 1;
ErrMemory, const int16_t ErrInvalidParam = 2;
ErrDriver, const int16_t ErrMemory = 3;
ErrUnknownDataType, const int16_t ErrDriver = 4;
ErrInvalidMarshalData, const int16_t ErrUnknownDataType = 5;
ErrInvalidTransferListener, const int16_t ErrInvalidMarshalData = 6;
ErrNotInited, const int16_t ErrInvalidTransferListener = 7;
ErrRecursiveCall, const int16_t ErrNotInited = 8;
ErrLogic const int16_t ErrRecursiveCall = 9;
}; const int16_t ErrLogic = 10;
}
/** /**
* Fatal error handler. * Fatal error handler.
@@ -226,7 +226,7 @@ class SocketCanIface : public uavcan::ICanIface
/* /*
* Flags * Flags
*/ */
loopback = !!(msg.msg_flags & MSG_CONFIRM); loopback = (msg.msg_flags & static_cast<int>(MSG_CONFIRM)) != 0;
return 1; return 1;
} }