1
0
mirror of https://github.com/stargieg/bacnet-stack synced 2025-10-19 23:25:23 +08:00

[r3120] Merge splint warning fixes.

This commit is contained in:
Steve Karg 2017-02-14 18:35:54 +01:00 committed by Patrick Grimm
parent 93aac61ff7
commit 76836baa88
6 changed files with 29 additions and 17 deletions

View File

@ -296,7 +296,7 @@ int arf_ack_decode_service_request(
decoded_len =
decode_octet_string(&apdu[len], len_value_type,
&data->fileData[0]);
if (decoded_len != len_value_type) {
if ((uint32_t)decoded_len != len_value_type) {
return -1;
}
len += decoded_len;

View File

@ -143,7 +143,7 @@ int get_alarm_summary_ack_decode_apdu_data(
/* tag 0 - Object Identifier */
apdu_len +=
bacapp_decode_application_data(&apdu[apdu_len],
max_apdu - apdu_len, &value);
(unsigned int)(max_apdu - apdu_len), &value);
if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) {
get_alarm_data->objectIdentifier = value.type.Object_Id;
} else {
@ -152,7 +152,7 @@ int get_alarm_summary_ack_decode_apdu_data(
/* tag 1 - Alarm State */
apdu_len +=
bacapp_decode_application_data(&apdu[apdu_len],
max_apdu - apdu_len, &value);
(unsigned int)(max_apdu - apdu_len), &value);
if (value.tag == BACNET_APPLICATION_TAG_ENUMERATED) {
get_alarm_data->alarmState =
(BACNET_EVENT_STATE) value.type.Enumerated;
@ -162,7 +162,7 @@ int get_alarm_summary_ack_decode_apdu_data(
/* tag 2 - Acknowledged Transitions */
apdu_len +=
bacapp_decode_application_data(&apdu[apdu_len],
max_apdu - apdu_len, &value);
(unsigned int)(max_apdu - apdu_len), &value);
if (value.tag == BACNET_APPLICATION_TAG_BIT_STRING) {
get_alarm_data->acknowledgedTransitions = value.type.Bit_String;
} else {

View File

@ -1167,7 +1167,7 @@ int property_list_encode(
int apdu_len = 0; /* return value */
uint8_t *apdu = NULL;
int max_apdu_len = 0;
unsigned count = 0;
uint32_t count = 0;
unsigned required_count = 0;
unsigned optional_count = 0;
unsigned proprietary_count = 0;
@ -1207,7 +1207,7 @@ int property_list_encode(
} else {
len =
encode_application_enumerated(&apdu[apdu_len],
pListRequired[i]);
(uint32_t)pListRequired[i]);
}
/* add it if we have room */
if ((apdu_len + len) < max_apdu_len) {
@ -1224,7 +1224,7 @@ int property_list_encode(
for (i = 0; i < optional_count; i++) {
len =
encode_application_enumerated(&apdu[apdu_len],
pListOptional[i]);
(uint32_t)pListOptional[i]);
/* add it if we have room */
if ((apdu_len + len) < max_apdu_len) {
apdu_len += len;
@ -1240,7 +1240,7 @@ int property_list_encode(
for (i = 0; i < proprietary_count; i++) {
len =
encode_application_enumerated(&apdu[apdu_len],
pListProprietary[i]);
(uint32_t)pListProprietary[i]);
/* add it if we have room */
if ((apdu_len + len) < max_apdu_len) {
apdu_len += len;
@ -1267,7 +1267,7 @@ int property_list_encode(
if (count == rpdata->array_index) {
apdu_len = encode_application_enumerated(
&apdu[apdu_len],
pListRequired[i]);
(uint32_t)pListRequired[i]);
break;
}
}
@ -1278,7 +1278,7 @@ int property_list_encode(
if (count == rpdata->array_index) {
apdu_len = encode_application_enumerated(
&apdu[apdu_len],
pListOptional[i]);
(uint32_t)pListOptional[i]);
break;
}
}
@ -1289,7 +1289,7 @@ int property_list_encode(
if (count == rpdata->array_index) {
apdu_len = encode_application_enumerated(
&apdu[apdu_len],
pListProprietary[i]);
(uint32_t)pListProprietary[i]);
break;
}
}

View File

@ -60,7 +60,7 @@ static OS_Keylist VMAC_List;
*/
unsigned int VMAC_Count(void)
{
return Keylist_Count(VMAC_List);
return (unsigned int)Keylist_Count(VMAC_List);
}
/**
@ -76,7 +76,7 @@ bool VMAC_Add(uint32_t device_id, struct vmac_data *src)
bool status = false;
struct vmac_data *pVMAC = NULL;
int index = 0;
unsigned int i = 0;
size_t i = 0;
pVMAC = Keylist_Data(VMAC_List, device_id);
if (!pVMAC) {
@ -155,7 +155,7 @@ bool VMAC_Different(
status = true;
} else {
if (vmac1->mac_len < mac_len) {
mac_len = vmac1->mac_len;
mac_len = (unsigned int)vmac1->mac_len;
}
for (i = 0; i < mac_len; i++) {
if (vmac1->mac[i] != vmac1->mac[i]) {
@ -189,7 +189,7 @@ bool VMAC_Match(
status = false;
} else {
if (vmac1->mac_len < mac_len) {
mac_len = vmac1->mac_len;
mac_len = (unsigned int)vmac1->mac_len;
}
for (i = 0; i < mac_len; i++) {
if (vmac1->mac[i] != vmac1->mac[i]) {

View File

@ -72,7 +72,7 @@ int whois_decode_service_request(
int32_t * pLow_limit,
int32_t * pHigh_limit)
{
int len = 0;
unsigned int len = 0;
uint8_t tag_number = 0;
uint32_t len_value = 0;
uint32_t decoded_value = 0;
@ -123,7 +123,7 @@ int whois_decode_service_request(
len = 0;
}
return len;
return (int)len;
}
#ifdef TEST

View File

@ -288,10 +288,22 @@ int wpm_encode_apdu(
wpdata.array_index = wpm_property->propertyArrayIndex;
wpdata.priority = wpm_property->priority;
<<<<<<< .working
wpdata.application_data_len =
bacapp_encode_data(&apdu_temp[0], &wpm_property->value);
memcpy(&wpdata.application_data[0], &apdu_temp[0],
wpdata.application_data_len);
||||||| .merge-left.r3118
wpdata.application_data_len = bacapp_encode_data(&apdu_temp[0],
&wpm_property->value);
memcpy(&wpdata.application_data[0], &apdu_temp[0],
wpdata.application_data_len);
=======
wpdata.application_data_len = bacapp_encode_data(&apdu_temp[0],
&wpm_property->value);
memcpy(&wpdata.application_data[0], &apdu_temp[0],
(size_t)wpdata.application_data_len);
>>>>>>> .merge-right.r3119
len =
wpm_encode_apdu_object_property(&apdu[apdu_len], &wpdata);