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

View File

@ -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.

View File

@ -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;
}