From 76836baa8867734076024fef174ec56b7ecbdeb2 Mon Sep 17 00:00:00 2001 From: Steve Karg Date: Tue, 14 Feb 2017 18:35:54 +0100 Subject: [PATCH] [r3120] Merge splint warning fixes. --- src/arf.c | 2 +- src/get_alarm_sum.c | 6 +++--- src/proplist.c | 14 +++++++------- src/vmac.c | 8 ++++---- src/whois.c | 4 ++-- src/wpm.c | 12 ++++++++++++ 6 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/arf.c b/src/arf.c index edfeceb..9a51995 100644 --- a/src/arf.c +++ b/src/arf.c @@ -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; diff --git a/src/get_alarm_sum.c b/src/get_alarm_sum.c index 98d4fac..e6c1b56 100644 --- a/src/get_alarm_sum.c +++ b/src/get_alarm_sum.c @@ -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 { diff --git a/src/proplist.c b/src/proplist.c index 2b9afca..eeaca01 100644 --- a/src/proplist.c +++ b/src/proplist.c @@ -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; } } diff --git a/src/vmac.c b/src/vmac.c index d7fbed7..29c4018 100644 --- a/src/vmac.c +++ b/src/vmac.c @@ -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]) { diff --git a/src/whois.c b/src/whois.c index 5894072..6323e17 100644 --- a/src/whois.c +++ b/src/whois.c @@ -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 diff --git a/src/wpm.c b/src/wpm.c index 7327ab7..7be97c5 100644 --- a/src/wpm.c +++ b/src/wpm.c @@ -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);