CppCheck cleanup (#975)
* Add support for inline cppcheck suppressions * Clean out all known cppcheck issues * Terminate toll-gate on found cppcheck issues
This commit is contained in:
committed by
Thomas Mørch
parent
e2ac85afbb
commit
2d5404de97
@@ -49,7 +49,11 @@ MyMessage _ethernetMsg;
|
||||
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
|
||||
|
||||
typedef struct {
|
||||
// Suppress the warning about unused members in this struct because it is used through a complex
|
||||
// set of preprocessor directives
|
||||
// cppcheck-suppress unusedStructMember
|
||||
char string[MY_GATEWAY_MAX_RECEIVE_LENGTH];
|
||||
// cppcheck-suppress unusedStructMember
|
||||
uint8_t idx;
|
||||
} inputBuffer;
|
||||
|
||||
|
||||
@@ -58,7 +58,9 @@ void ledsProcess()
|
||||
}
|
||||
prevTime = hwMillis();
|
||||
|
||||
#if defined(MY_DEFAULT_RX_LED_PIN) || defined(MY_DEFAULT_TX_LED_PIN) || defined(MY_DEFAULT_ERR_LED_PIN)
|
||||
uint8_t state;
|
||||
#endif
|
||||
|
||||
// For an On/Off ratio of 4, the pattern repeated will be [on, on, on, off]
|
||||
// until the counter becomes 0.
|
||||
|
||||
@@ -128,7 +128,6 @@ bool firmwareOTAUpdateProcess(void)
|
||||
MY_SERIALDEVICE.print(prbuf);
|
||||
}
|
||||
OTA_DEBUG(PSTR("\n"));
|
||||
8
|
||||
}
|
||||
#endif
|
||||
_firmwareBlock--;
|
||||
|
||||
@@ -59,7 +59,6 @@ bool protocolParse(MyMessage &message, char *inputString)
|
||||
break;
|
||||
case 5: // Variable value
|
||||
if (command == C_STREAM) {
|
||||
blen = 0;
|
||||
while (*str) {
|
||||
uint8_t val;
|
||||
val = protocolH2i(*str++) << 4;
|
||||
@@ -125,8 +124,6 @@ bool protocolMQTTParse(MyMessage &message, char* topic, uint8_t* payload, unsign
|
||||
{
|
||||
char *str, *p;
|
||||
uint8_t i = 0;
|
||||
uint8_t bvalue[MAX_PAYLOAD];
|
||||
uint8_t blen = 0;
|
||||
uint8_t command = 0;
|
||||
if (topic != strstr(topic, MY_MQTT_SUBSCRIBE_TOPIC_PREFIX)) {
|
||||
// Prefix doesn't match incoming topic
|
||||
@@ -175,9 +172,10 @@ bool protocolMQTTParse(MyMessage &message, char* topic, uint8_t* payload, unsign
|
||||
|
||||
// Add payload
|
||||
if (command == C_STREAM) {
|
||||
blen = 0;
|
||||
uint8_t val;
|
||||
uint8_t bvalue[MAX_PAYLOAD];
|
||||
uint8_t blen = 0;
|
||||
while (*payload) {
|
||||
uint8_t val;
|
||||
val = protocolH2i(*payload++) << 4;
|
||||
val += protocolH2i(*payload++);
|
||||
bvalue[blen] = val;
|
||||
|
||||
@@ -111,6 +111,8 @@ void signerInit(void)
|
||||
#endif
|
||||
#if (defined (MY_ENCRYPTION_FEATURE) || defined (MY_SIGNING_FEATURE)) &&\
|
||||
!defined (MY_SIGNING_SIMPLE_PASSWD)
|
||||
// Suppress this warning since it is only fixed on Linux builds and this keeps the code more tidy
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (!signerInternalValidatePersonalization()) {
|
||||
SIGN_DEBUG(PSTR("!SGN:PER:TAMPERED\n"));
|
||||
#if defined(MY_SIGNING_FEATURE)
|
||||
|
||||
@@ -103,10 +103,8 @@ bool signerAtsha204SoftInit(void)
|
||||
_signing_node_serial_info[8] = getNodeId();
|
||||
}
|
||||
#else
|
||||
if (init_ok) {
|
||||
hwReadConfigBlock((void*)_signing_hmac_key, (void*)EEPROM_SIGNING_SOFT_HMAC_KEY_ADDRESS, 32);
|
||||
hwReadConfigBlock((void*)_signing_node_serial_info, (void*)EEPROM_SIGNING_SOFT_SERIAL_ADDRESS, 9);
|
||||
}
|
||||
hwReadConfigBlock((void*)_signing_hmac_key, (void*)EEPROM_SIGNING_SOFT_HMAC_KEY_ADDRESS, 32);
|
||||
hwReadConfigBlock((void*)_signing_node_serial_info, (void*)EEPROM_SIGNING_SOFT_SERIAL_ADDRESS, 9);
|
||||
#endif
|
||||
if (!memcmp(_signing_node_serial_info, reset_serial, 9)) {
|
||||
unique_id_t uniqueID;
|
||||
|
||||
@@ -940,6 +940,8 @@ void transportProcessMessage(void)
|
||||
|
||||
void transportInvokeSanityCheck(void)
|
||||
{
|
||||
// Suppress this because the function may return a variable value in some configurations
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (!transportSanityCheck()) {
|
||||
TRANSPORT_DEBUG(PSTR("!TSF:SAN:FAIL\n")); // sanity check fail
|
||||
transportSwitchSM(stFailure);
|
||||
|
||||
Reference in New Issue
Block a user