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:
@@ -395,11 +395,26 @@ SPLINT_FIND_OPTIONS := ./src -path ./src/bacnet/basic/ucix -prune -o -name "*.c"
|
||||
splint:
|
||||
find $(SPLINT_FIND_OPTIONS) -exec splint $(SPLINT_OPTIONS) {} \;
|
||||
|
||||
CPPCHECK_OPTIONS = --enable=warning,portability
|
||||
CPPCHECK_OPTIONS = --enable=warning,portability,style
|
||||
CPPCHECK_OPTIONS += --template=gcc
|
||||
CPPCHECK_OPTIONS += --inline-suppr
|
||||
CPPCHECK_OPTIONS += --inconclusive
|
||||
CPPCHECK_OPTIONS += --suppress=selfAssignment
|
||||
CPPCHECK_OPTIONS += --suppress=integerOverflow
|
||||
CPPCHECK_OPTIONS += --suppress=variableScope
|
||||
CPPCHECK_OPTIONS += --suppress=unreadVariable
|
||||
CPPCHECK_OPTIONS += --suppress=knownConditionTrueFalse
|
||||
CPPCHECK_OPTIONS += --suppress=constParameter
|
||||
CPPCHECK_OPTIONS += --suppress=redundantAssignment
|
||||
CPPCHECK_OPTIONS += --suppress=duplicateCondition
|
||||
CPPCHECK_OPTIONS += --suppress=funcArgNamesDifferent
|
||||
CPPCHECK_OPTIONS += --suppress=unusedStructMember
|
||||
CPPCHECK_OPTIONS += --addon=cert.py
|
||||
CPPCHECK_OPTIONS += --suppress=cert-MSC30-c
|
||||
CPPCHECK_OPTIONS += --suppress=cert-STR05-C
|
||||
CPPCHECK_OPTIONS += --suppress=cert-API01-C
|
||||
CPPCHECK_OPTIONS += --suppress=cert-MSC24-C
|
||||
CPPCHECK_OPTIONS += --suppress=cert-INT31-c
|
||||
CPPCHECK_OPTIONS += -DBACNET_STACK_DEPRECATED
|
||||
#CPPCHECK_OPTIONS += -I./src
|
||||
#CPPCHECK_OPTIONS += --enable=information --check-config
|
||||
|
||||
@@ -3367,7 +3367,9 @@ int bacapp_snprintf_value(
|
||||
char *str, size_t str_len, const BACNET_OBJECT_PROPERTY_VALUE *object_value)
|
||||
{
|
||||
size_t len = 0, i = 0;
|
||||
#if defined(BACAPP_CHARACTER_STRING)
|
||||
const char *char_str;
|
||||
#endif
|
||||
const BACNET_APPLICATION_DATA_VALUE *value;
|
||||
BACNET_PROPERTY_ID property = PROP_ALL;
|
||||
BACNET_OBJECT_TYPE object_type = MAX_BACNET_OBJECT_TYPE;
|
||||
@@ -4190,8 +4192,12 @@ bool bacapp_parse_application_data(
|
||||
char *argv,
|
||||
BACNET_APPLICATION_DATA_VALUE *value)
|
||||
{
|
||||
#if defined(BACAPP_TIME)
|
||||
int hour, min, sec, hundredths;
|
||||
#endif
|
||||
#if defined(BACAPP_DATE)
|
||||
int year, month, day, wday;
|
||||
#endif
|
||||
int object_type = 0;
|
||||
uint32_t instance = 0;
|
||||
bool status = false;
|
||||
|
||||
@@ -726,7 +726,7 @@ int bacapp_decode_obj_property_ref(
|
||||
&object_identifier.instance);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
} else if (len <= 0) {
|
||||
} else {
|
||||
return BACNET_STATUS_ERROR;
|
||||
}
|
||||
/* property-identifier [1] BACnetPropertyIdentifier */
|
||||
@@ -734,7 +734,7 @@ int bacapp_decode_obj_property_ref(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, 1, &property_identifier);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
} else if (len <= 0) {
|
||||
} else {
|
||||
return BACNET_STATUS_ERROR;
|
||||
}
|
||||
if (reference) {
|
||||
|
||||
@@ -1409,9 +1409,9 @@ int Analog_Input_Event_Information(
|
||||
(TO-OFFNORMAL, TO-FAULT, TONORMAL) set to FALSE. */
|
||||
IsNotAckedTransitions =
|
||||
(pObject->Acked_Transitions[TRANSITION_TO_OFFNORMAL].bIsAcked ==
|
||||
false) |
|
||||
false) ||
|
||||
(pObject->Acked_Transitions[TRANSITION_TO_FAULT].bIsAcked ==
|
||||
false) |
|
||||
false) ||
|
||||
(pObject->Acked_Transitions[TRANSITION_TO_NORMAL].bIsAcked ==
|
||||
false);
|
||||
} else {
|
||||
|
||||
@@ -1465,9 +1465,9 @@ int Analog_Value_Event_Information(
|
||||
(TO-OFFNORMAL, TO-FAULT, TONORMAL) set to FALSE. */
|
||||
IsNotAckedTransitions =
|
||||
(pObject->Acked_Transitions[TRANSITION_TO_OFFNORMAL].bIsAcked ==
|
||||
false) |
|
||||
false) ||
|
||||
(pObject->Acked_Transitions[TRANSITION_TO_FAULT].bIsAcked ==
|
||||
false) |
|
||||
false) ||
|
||||
(pObject->Acked_Transitions[TRANSITION_TO_NORMAL].bIsAcked ==
|
||||
false);
|
||||
} else {
|
||||
|
||||
@@ -348,9 +348,9 @@ bool Integer_Value_Description_Set(
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @return description text or NULL if not found
|
||||
*/
|
||||
char *Integer_Value_Description_ANSI(uint32_t object_instance)
|
||||
const char *Integer_Value_Description_ANSI(uint32_t object_instance)
|
||||
{
|
||||
char *name = NULL;
|
||||
const char *name = NULL;
|
||||
struct integer_object *pObject;
|
||||
|
||||
pObject = Integer_Value_Object(object_instance);
|
||||
@@ -358,7 +358,7 @@ char *Integer_Value_Description_ANSI(uint32_t object_instance)
|
||||
if (pObject->Description == NULL) {
|
||||
name = "";
|
||||
} else {
|
||||
name = (char *)pObject->Description;
|
||||
name = pObject->Description;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ bool Integer_Value_Description(
|
||||
BACNET_STACK_EXPORT
|
||||
bool Integer_Value_Description_Set(uint32_t instance, const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
char *Integer_Value_Description_ANSI(uint32_t object_instance);
|
||||
const char *Integer_Value_Description_ANSI(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t Integer_Value_Units(uint32_t instance);
|
||||
|
||||
@@ -401,9 +401,7 @@ void Life_Safety_Point_Out_Of_Service_Set(uint32_t object_instance, bool value)
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
if (pObject->Out_Of_Service != value) {
|
||||
pObject->Out_Of_Service = value;
|
||||
}
|
||||
pObject->Out_Of_Service = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -412,9 +412,7 @@ void Life_Safety_Zone_Out_Of_Service_Set(uint32_t object_instance, bool value)
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
if (pObject->Out_Of_Service != value) {
|
||||
pObject->Out_Of_Service = value;
|
||||
}
|
||||
pObject->Out_Of_Service = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -614,9 +612,7 @@ void Life_Safety_Zone_Maintenance_Required_Set(
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
if (pObject->Maintenance_Required != value) {
|
||||
pObject->Maintenance_Required = value;
|
||||
}
|
||||
pObject->Maintenance_Required = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3286,7 +3286,7 @@ int Network_Port_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
BACNET_OCTET_STRING octet_string;
|
||||
BACNET_CHARACTER_STRING char_string;
|
||||
#if defined(BACDL_BIP) && (BBMD_ENABLED || BBMD_CLIENT_ENABLED)
|
||||
BACNET_IP_ADDRESS ip_address;
|
||||
BACNET_IP_ADDRESS ip_address = { 0 };
|
||||
#endif
|
||||
#if defined(BACDL_BIP6) && (BBMD_CLIENT_ENABLED)
|
||||
BACNET_IP6_ADDRESS ip6_address;
|
||||
@@ -3918,9 +3918,9 @@ bool Network_Port_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
#else
|
||||
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
||||
wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
case PROP_FD_SUBSCRIPTION_LIFETIME:
|
||||
#if (BBMD_CLIENT_ENABLED)
|
||||
if (write_property_type_valid(
|
||||
|
||||
@@ -1997,16 +1997,12 @@ void Network_Port_SC_Pending_Params_Apply(uint32_t object_instance)
|
||||
void Network_Port_SC_Pending_Params_Discard(uint32_t object_instance)
|
||||
{
|
||||
BACNET_SC_PARAMS *params = Network_Port_SC_Params(object_instance);
|
||||
uint16_t port;
|
||||
char *ifname;
|
||||
uint16_t port = 0;
|
||||
char *ifname = NULL;
|
||||
|
||||
if (!params) {
|
||||
return;
|
||||
}
|
||||
|
||||
(void)port;
|
||||
(void)ifname;
|
||||
|
||||
params->Max_BVLC_Length_Accepted_dirty = params->Max_BVLC_Length_Accepted;
|
||||
params->Max_NPDU_Length_Accepted_dirty = params->Max_NPDU_Length_Accepted;
|
||||
params->SC_Minimum_Reconnect_Time_dirty = params->SC_Minimum_Reconnect_Time;
|
||||
@@ -2015,7 +2011,6 @@ void Network_Port_SC_Pending_Params_Discard(uint32_t object_instance)
|
||||
params->SC_Disconnect_Wait_Timeout_dirty =
|
||||
params->SC_Disconnect_Wait_Timeout;
|
||||
params->SC_Heartbeat_Timeout_dirty = params->SC_Heartbeat_Timeout;
|
||||
|
||||
#if BSC_CONF_HUB_FUNCTIONS_NUM != 0
|
||||
memcpy(
|
||||
params->SC_Primary_Hub_URI_dirty, params->SC_Primary_Hub_URI,
|
||||
@@ -2035,6 +2030,9 @@ void Network_Port_SC_Pending_Params_Discard(uint32_t object_instance)
|
||||
snprintf(
|
||||
params->SC_Hub_Function_Binding_dirty,
|
||||
sizeof(params->SC_Hub_Function_Binding_dirty), "%s:%d", ifname, port);
|
||||
#else
|
||||
(void)port;
|
||||
(void)ifname;
|
||||
#endif /* BSC_CONF_HUB_FUNCTIONS_NUM!=0 */
|
||||
|
||||
#if BSC_CONF_HUB_CONNECTORS_NUM != 0
|
||||
|
||||
@@ -84,10 +84,13 @@ static SCHEDULE_DESCR *Schedule_Object(uint32_t object_instance)
|
||||
*/
|
||||
void Schedule_Init(void)
|
||||
{
|
||||
unsigned i, j, e;
|
||||
unsigned i, j;
|
||||
BACNET_DATE start_date = { 0 }, end_date = { 0 };
|
||||
BACNET_SPECIAL_EVENT *event;
|
||||
SCHEDULE_DESCR *psched;
|
||||
#if BACNET_EXCEPTION_SCHEDULE_SIZE
|
||||
unsigned e;
|
||||
BACNET_SPECIAL_EVENT *event;
|
||||
#endif
|
||||
|
||||
/* whole year, change as necessary */
|
||||
datetime_set_date(&start_date, 0, 1, 1);
|
||||
|
||||
@@ -37,9 +37,8 @@ uint8_t days_per_month(uint16_t year, uint8_t month)
|
||||
{
|
||||
/* note: start with a zero in the first element to save us from a
|
||||
month - 1 calculation in the lookup */
|
||||
uint8_t month_days[13] = {
|
||||
0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
|
||||
};
|
||||
const uint8_t month_days[13] = { 0, 31, 28, 31, 30, 31, 30,
|
||||
31, 31, 30, 31, 30, 31 };
|
||||
|
||||
if ((month == 2) && days_is_leap_year(year)) {
|
||||
return (29);
|
||||
|
||||
@@ -446,19 +446,16 @@ BSC_SC_RET bsc_hub_connector_start(
|
||||
"bsc_hub_connector_start() <<< ret = BSC_SC_NO_RESOURCES\n");
|
||||
return BSC_SC_NO_RESOURCES;
|
||||
}
|
||||
|
||||
c->reconnect_timeout_s = reconnect_timeout_s;
|
||||
c->primary_url[0] = 0;
|
||||
c->failover_url[0] = 0;
|
||||
c->user_arg = user_arg;
|
||||
strcpy((char *)c->primary_url, primaryURL);
|
||||
|
||||
strncpy((char *)c->primary_url, primaryURL, sizeof(c->primary_url) - 1);
|
||||
if (failoverURL) {
|
||||
strcpy((char *)c->failover_url, failoverURL);
|
||||
strncpy(
|
||||
(char *)c->failover_url, failoverURL, sizeof(c->failover_url) - 1);
|
||||
}
|
||||
|
||||
c->event_func = event_func;
|
||||
|
||||
bsc_init_ctx_cfg(
|
||||
BSC_SOCKET_CTX_INITIATOR, &c->cfg, BSC_WEBSOCKET_HUB_PROTOCOL, 0, NULL,
|
||||
ca_cert_chain, ca_cert_chain_size, cert_chain, cert_chain_size, key,
|
||||
|
||||
@@ -267,9 +267,10 @@ copy_urls(BSC_NODE_SWITCH_CTX *ctx, int index, BSC_ADDRESS_RESOLUTION *r)
|
||||
int i;
|
||||
for (i = 0; i < r->urls_num; i++) {
|
||||
ctx->initiator.urls[index].utf8_urls[i][0] = 0;
|
||||
strcpy(
|
||||
strncpy(
|
||||
(char *)&ctx->initiator.urls[index].utf8_urls[i][0],
|
||||
(char *)&r->utf8_urls[i][0]);
|
||||
(char *)&r->utf8_urls[i][0],
|
||||
sizeof(ctx->initiator.urls[index].utf8_urls[i]) - 1);
|
||||
}
|
||||
ctx->initiator.urls[index].urls_cnt = r->urls_num;
|
||||
}
|
||||
@@ -287,7 +288,9 @@ copy_urls2(BSC_NODE_SWITCH_CTX *ctx, int index, char **urls, size_t urls_cnt)
|
||||
size_t i;
|
||||
for (i = 0; i < urls_cnt; i++) {
|
||||
ctx->initiator.urls[index].utf8_urls[i][0] = 0;
|
||||
strcpy((char *)&ctx->initiator.urls[index].utf8_urls[i][0], urls[i]);
|
||||
strncpy(
|
||||
(char *)&ctx->initiator.urls[index].utf8_urls[i][0], urls[i],
|
||||
sizeof(ctx->initiator.urls[index].utf8_urls[i]) - 1);
|
||||
}
|
||||
ctx->initiator.urls[index].urls_cnt = urls_cnt;
|
||||
}
|
||||
|
||||
@@ -470,8 +470,7 @@ static void bsc_node_process_received(
|
||||
buf, sizeof(buf), decoded_pdu->hdr.message_id, NULL,
|
||||
decoded_pdu->hdr.origin, decoded_pdu->hdr.bvlc_function, 1,
|
||||
&decoded_pdu->dest_options[i].packed_header_marker,
|
||||
&error_class, &error_code,
|
||||
(uint8_t *)ERROR_STR_OPTION_NOT_UNDERSTOOD);
|
||||
&error_class, &error_code, ERROR_STR_OPTION_NOT_UNDERSTOOD);
|
||||
if (bufsize) {
|
||||
ret = bsc_node_send(node, buf, bufsize);
|
||||
#if DEBUG_ENABLED == 1
|
||||
@@ -587,7 +586,7 @@ static void bsc_node_process_received(
|
||||
buf, sizeof(buf), decoded_pdu->hdr.message_id, NULL,
|
||||
decoded_pdu->hdr.origin, decoded_pdu->hdr.bvlc_function, 1,
|
||||
NULL, &error_class, &error_code,
|
||||
(uint8_t *)ERROR_STR_DIRECT_CONNECTIONS_NOT_SUPPORTED);
|
||||
ERROR_STR_DIRECT_CONNECTIONS_NOT_SUPPORTED);
|
||||
if (bufsize) {
|
||||
ret = bsc_node_send(node, buf, bufsize);
|
||||
#if DEBUG_ENABLED == 1
|
||||
|
||||
@@ -240,7 +240,7 @@ static bool bsc_prepare_error_extended(
|
||||
uint8_t *error_header_marker,
|
||||
BACNET_ERROR_CLASS error_class,
|
||||
BACNET_ERROR_CODE error_code,
|
||||
uint8_t *utf8_details_string)
|
||||
const uint8_t *utf8_details_string)
|
||||
{
|
||||
uint16_t eclass = (uint16_t)error_class;
|
||||
uint16_t ecode = (uint16_t)error_code;
|
||||
@@ -318,7 +318,7 @@ static bool bsc_prepare_protocol_error_extended(
|
||||
uint8_t *error_header_marker,
|
||||
BACNET_ERROR_CLASS error_class,
|
||||
BACNET_ERROR_CODE error_code,
|
||||
uint8_t *utf8_details_string)
|
||||
const uint8_t *utf8_details_string)
|
||||
{
|
||||
if (bvlc_sc_need_send_bvlc_result(dm)) {
|
||||
return bsc_prepare_error_extended(
|
||||
@@ -346,7 +346,7 @@ static bool bsc_prepare_protocol_error(
|
||||
BACNET_SC_VMAC_ADDRESS *dest,
|
||||
BACNET_ERROR_CLASS error_class,
|
||||
BACNET_ERROR_CODE error_code,
|
||||
uint8_t *utf8_details_string)
|
||||
const uint8_t *utf8_details_string)
|
||||
{
|
||||
return bsc_prepare_protocol_error_extended(
|
||||
c, dm, origin, dest, NULL, error_class, error_code,
|
||||
@@ -588,8 +588,7 @@ static void bsc_process_socket_state(
|
||||
if ((code != ERROR_CODE_DISCARD) &&
|
||||
(class != ERROR_CLASS_COMMUNICATION)) {
|
||||
*need_send = bsc_prepare_protocol_error(
|
||||
c, dm, dm->hdr.origin, dm->hdr.dest, class, code,
|
||||
(uint8_t *)err_desc);
|
||||
c, dm, dm->hdr.origin, dm->hdr.dest, class, code, err_desc);
|
||||
}
|
||||
#if DEBUG_BSC_SOCKET == 1
|
||||
else {
|
||||
@@ -620,7 +619,7 @@ static void bsc_process_socket_state(
|
||||
|
||||
*need_send = bsc_prepare_protocol_error(
|
||||
c, dm, NULL, &c->vmac, class, code,
|
||||
(uint8_t *)s_error_no_origin);
|
||||
s_error_no_origin);
|
||||
valid = false;
|
||||
} else if (
|
||||
dm->hdr.dest != NULL &&
|
||||
@@ -629,7 +628,7 @@ static void bsc_process_socket_state(
|
||||
code = ERROR_CODE_HEADER_ENCODING_ERROR;
|
||||
*need_send = bsc_prepare_protocol_error(
|
||||
c, dm, NULL, &c->vmac, class, code,
|
||||
(uint8_t *)s_error_dest_presented);
|
||||
s_error_dest_presented);
|
||||
valid = false;
|
||||
}
|
||||
} else if (
|
||||
@@ -642,15 +641,14 @@ static void bsc_process_socket_state(
|
||||
code = ERROR_CODE_HEADER_ENCODING_ERROR;
|
||||
|
||||
*need_send = bsc_prepare_protocol_error(
|
||||
c, dm, NULL, NULL, class, code,
|
||||
(uint8_t *)s_error_no_dest);
|
||||
c, dm, NULL, NULL, class, code, s_error_no_dest);
|
||||
valid = false;
|
||||
} else if (dm->hdr.origin != NULL) {
|
||||
class = ERROR_CLASS_COMMUNICATION;
|
||||
code = ERROR_CODE_HEADER_ENCODING_ERROR;
|
||||
*need_send = bsc_prepare_protocol_error(
|
||||
c, dm, NULL, NULL, class, code,
|
||||
(uint8_t *)s_error_origin_presented);
|
||||
s_error_origin_presented);
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -738,7 +738,7 @@ size_t bvlc_sc_encode_result(
|
||||
uint8_t *error_header_marker,
|
||||
uint16_t *error_class,
|
||||
uint16_t *error_code,
|
||||
uint8_t *utf8_details_string)
|
||||
const uint8_t *utf8_details_string)
|
||||
{
|
||||
size_t offs;
|
||||
|
||||
@@ -1803,7 +1803,7 @@ static bool bvlc_sc_decode_hdr(
|
||||
offs += hdr_opt_len;
|
||||
}
|
||||
|
||||
if (message_len - offs <= 0) {
|
||||
if (offs >= message_len) {
|
||||
/* no payload */
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ size_t bvlc_sc_encode_result(
|
||||
uint8_t *error_header_marker,
|
||||
uint16_t *error_class,
|
||||
uint16_t *error_code,
|
||||
uint8_t *utf8_details_string);
|
||||
const uint8_t *utf8_details_string);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
size_t bvlc_sc_encode_encapsulated_npdu(
|
||||
|
||||
@@ -1587,7 +1587,7 @@ static void MSTP_Zero_Config_State_Confirm(struct mstp_port_struct_t *mstp_port)
|
||||
if (dst == mstp_port->Zero_Config_Station) {
|
||||
match = true;
|
||||
}
|
||||
if (match & (mstp_port->DataLength < MSTP_UUID_SIZE)) {
|
||||
if (match && (mstp_port->DataLength < MSTP_UUID_SIZE)) {
|
||||
match = false;
|
||||
}
|
||||
if (match &&
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user