From 2d3ac94e7604ec6e0c66e69395e1bde061308384 Mon Sep 17 00:00:00 2001 From: Grigoris Pavlakis <grigpavl@ece.auth.gr> Date: Tue, 29 Jan 2019 18:02:20 +0200 Subject: [PATCH] Clean up commented out code of the previous implementation --- src/Services/ParameterService.cpp | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/src/Services/ParameterService.cpp b/src/Services/ParameterService.cpp index e05888eb..f9ea54f4 100644 --- a/src/Services/ParameterService.cpp +++ b/src/Services/ParameterService.cpp @@ -53,14 +53,10 @@ void ParameterService::reportParameterIds(Message paramIds) { reqParam.appendUint16(currId); reqParam.appendUint32(paramsList[currId].settingData); } -// if (currId < CONFIGLENGTH) { // (crappy) check to prevent out-of-bounds access due to -// // invalid id, see numOfValidIds -// reqParam.appendUint16(currId); -// reqParam.appendUint32(paramsList[currId].settingData); -// } + else { // generate failure of execution notification for ST[06] - continue; //ignore the invalid ID + continue; // ignore the invalid ID } } } @@ -80,8 +76,6 @@ void ParameterService::setParameterIds(Message newParamValues) { paramsList[currId].settingData = newParamValues.readUint32(); } -// if (currId < CONFIGLENGTH) { // crappy criterion, see numOfValidIds -// paramsList[currId].settingData = newParamValues.readUint32(); else { // generate failure of execution notification for ST[06] continue; // ignore the invalid ID @@ -105,18 +99,6 @@ uint16_t ParameterService::numOfValidIds(Message idMsg) { idMsg.readUint32(); //skip the 32bit settings blocks, we need only the IDs } - // IMPORTANT TODO: currId < CONFIGLENGTH is a crappy criterion for determining whether an ID - // actually exists! - // COUNTERARGUMENT: Array of 5 structs with only 2 parameters stored => rest exist but - // are filled with garbage => look like valid parameters but they don't actually have any - // useful data => not ignored by numOfValidIds => garbage creeps into messages => tests fail - // (and only on some PCs) - - // FIXES: 1) Implement a linear search - // 2) (possibly better) Rewrite everything to use a hash map, since IDs are unique -// if (currId < CONFIGLENGTH) { -// validIds++; -// } if (paramsList.find(currId) != paramsList.end()) { validIds++; } -- GitLab