Skip to content
Snippets Groups Projects
Commit f39e52ee authored by Grigoris Pavlakis's avatar Grigoris Pavlakis Committed by kongr45gpen
Browse files

Replace assert() statements with proper error handler call

Fix a missing semicolon

Attempt #1 at fixing Vera

Attempt #2 at fixing vera
parent b666fba1
Branches
No related tags found
No related merge requests found
...@@ -3,25 +3,6 @@ ...@@ -3,25 +3,6 @@
<option name="RIGHT_MARGIN" value="100" /> <option name="RIGHT_MARGIN" value="100" />
<option name="WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN" value="true" /> <option name="WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN" value="true" />
<Objective-C-extensions> <Objective-C-extensions>
<file>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
</file>
<class>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
</class>
<extensions> <extensions>
<pair source="cpp" header="hpp" fileNamingConvention="PASCAL_CASE" /> <pair source="cpp" header="hpp" fileNamingConvention="PASCAL_CASE" />
<pair source="c" header="h" fileNamingConvention="NONE" /> <pair source="c" header="h" fileNamingConvention="NONE" />
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
/** /**
* @todo: Undef TESTMODE before flight!!!! * @todo: Undef TESTMODE before flight!!!!
* @todo: Replace this with error handler code checking
*/ */
#define TESTMODE // REMOVE BEFORE FLIGHT!(used by Catch to gain visibility @ test) #define TESTMODE // REMOVE BEFORE FLIGHT!(used by Catch to gain visibility @ test)
...@@ -54,11 +55,11 @@ public: FunctionMap funcPtrIndex; ...@@ -54,11 +55,11 @@ public: FunctionMap funcPtrIndex;
public: public:
/** /**
* Constructs the function pointer index with all the necessary functions at initialization time * Constructs the function pointer index with all the necessary functions at initialization time
* These functions need to be in scope. Uncomment when needed. * These functions need to be in scope. Un-default when needed.
* *
* @param None * @param None
*/ */
//FunctionManagementService(); FunctionManagementService() = default;
/** /**
* Calls the function described in the TC[8,1] message *msg*, passing the arguments contained * Calls the function described in the TC[8,1] message *msg*, passing the arguments contained
......
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
*/ */
int FunctionManagementService::call(Message msg) { int FunctionManagementService::call(Message msg) {
assert(msg.messageType == 1); ErrorHandler::assertInternal(msg.messageType == 1 && msg.serviceType == 8,
assert(msg.serviceType == 8); ErrorHandler::InternalErrorType::UnacceptablePacket);
uint8_t funcName[FUNCNAMELENGTH]; // the function's name uint8_t funcName[FUNCNAMELENGTH]; // the function's name
uint8_t funcArgs[MAXARGLENGTH]; // arguments for the function uint8_t funcArgs[MAXARGLENGTH]; // arguments for the function
...@@ -44,18 +44,17 @@ int FunctionManagementService::call(Message msg) { ...@@ -44,18 +44,17 @@ int FunctionManagementService::call(Message msg) {
/** /**
* @todo Send failed start of execution (too long message) * @todo Send failed start of execution (too long message)
*/ */
return 4; // arbitrary return 4; // arbitrary
} }
// locate the appropriate function pointer // locate the appropriate function pointer
String<FUNCNAMELENGTH> name(funcName); String<FUNCNAMELENGTH> name(funcName);
FunctionMap::iterator iter = funcPtrIndex.find(name); FunctionMap::iterator iter = funcPtrIndex.find(name);
void(*selected)(String<MAXARGLENGTH>); void (*selected)(String<MAXARGLENGTH>);
if (iter != funcPtrIndex.end()) { if (iter != funcPtrIndex.end()) {
selected = *iter->second; selected = *iter->second;
} } else {
else {
/** /**
* @todo Send failed start of execution (function not found) * @todo Send failed start of execution (function not found)
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment