Enabled style and CERT-C addon for CPPCHECK (#869)

* Enabled style and CERT-C addon for CPPCHECK with some suppressions and fixed the defects found..
This commit is contained in:
Steve Karg
2024-12-10 07:56:24 -06:00
committed by GitHub
parent f38b75b389
commit d4cbec91e2
21 changed files with 79 additions and 73 deletions
+7 -13
View File
@@ -1955,12 +1955,10 @@ static void test_BVLC_RESULT(void)
uint8_t error_header_marker = 0xcc;
uint16_t error_class = 0xaa;
uint16_t error_code = 0xdd;
char error_details_string[100];
const uint8_t *error_details_string = "something bad has happened";
const char *err_desc = NULL;
uint8_t *pdu;
sprintf(error_details_string, "%s", "something bad has happend");
memset(origin.address, 0x23, BVLC_SC_VMAC_SIZE);
memset(dest.address, 0x44, BVLC_SC_VMAC_SIZE);
memset(new_origin.address, 0x93, BVLC_SC_VMAC_SIZE);
@@ -2189,8 +2187,7 @@ static void test_BVLC_RESULT(void)
/* nak , details string */
len = bvlc_sc_encode_result(
buf, buf_len, message_id, NULL, NULL, result_bvlc_function, 1,
&error_header_marker, &error_class, &error_code,
(uint8_t *)error_details_string);
&error_header_marker, &error_class, &error_code, error_details_string);
zassert_not_equal(len, 0, NULL);
ret = bvlc_sc_decode_message(buf, len, &message, &error, &class, &err_desc);
zassert_equal(ret, true, NULL);
@@ -2224,8 +2221,7 @@ static void test_BVLC_RESULT(void)
/* dest and origin, nak , details string */
len = bvlc_sc_encode_result(
buf, buf_len, message_id, &origin, &dest, result_bvlc_function, 1,
&error_header_marker, &error_class, &error_code,
(uint8_t *)error_details_string);
&error_header_marker, &error_class, &error_code, error_details_string);
zassert_not_equal(len, 0, NULL);
ret = bvlc_sc_decode_message(buf, len, &message, &error, &class, &err_desc);
zassert_equal(ret, true, NULL);
@@ -2259,8 +2255,7 @@ static void test_BVLC_RESULT(void)
/* truncated message, case 1 */
len = bvlc_sc_encode_result(
buf, buf_len, message_id, NULL, NULL, result_bvlc_function, 1,
&error_header_marker, &error_class, &error_code,
(uint8_t *)error_details_string);
&error_header_marker, &error_class, &error_code, error_details_string);
zassert_not_equal(len, 0, NULL);
ret = bvlc_sc_decode_message(buf, 5, &message, &error, &class, &err_desc);
zassert_equal(ret, false, NULL);
@@ -2330,8 +2325,7 @@ static void test_BVLC_RESULT(void)
/* utf-8 string with zero symbol inside */
len = bvlc_sc_encode_result(
buf, buf_len, message_id, NULL, NULL, result_bvlc_function, 1,
&error_header_marker, &error_class, &error_code,
(uint8_t *)error_details_string);
&error_header_marker, &error_class, &error_code, error_details_string);
zassert_not_equal(len, 0, NULL);
buf[13] = 0;
ret = bvlc_sc_decode_message(buf, len, &message, &error, &class, &err_desc);
@@ -4180,12 +4174,12 @@ static void test_BAD_ENCODE_PARAMS(void)
/* case 13 */
len = bvlc_sc_encode_result(
buf, 7, message_id, NULL, NULL, 1, 1, &error_header_marker, &error_code,
&error_class, (uint8_t *)error_details_string);
&error_class, error_details_string);
zassert_equal(len, 0, NULL);
/* case 13 */
len = bvlc_sc_encode_result(
buf, 12, message_id, NULL, NULL, 1, 1, &error_header_marker,
&error_code, &error_class, (uint8_t *)error_details_string);
&error_code, &error_class, error_details_string);
zassert_equal(len, 0, NULL);
/* case 14 */
len = bvlc_sc_encode_encapsulated_npdu(