Fix (most) compilation warnings in Intel C++ Compiler (#38)

* Use BACNET_OBJECT_TYPE for all object type variables.

* Fix ICC "mixing enumerated type" warnings for assignments and parameters.

* Network Port: Use enums for state structs and remove erroneous bounds checks copy-pasted from IP_Subnet_Prefix setter.

* Fix ICC "unreachable statement" warnings.

* Fix ICC "unused variable" warnings when printing is disabled.

* Fix ICC "mixing enumerated type" warnings for struct initializers { 0 } by ensuring the first member is an integer type.

* Send_GetEvent_Global: Return 0 (invalid TSM invoke ID) instead of -1 = 255 (technically valid invoke ID) on failure.

* Fix ICC "pointless comparison" warnings.

* Fix wrong import in objects.c (memset being used).

* Fix signedness warnings and inconsistencies. Include -1 = 255 check in cov_address_get().

* Add some guards for BACAPP_LIGHTING_COMMAND to avoid errors/warnings.

* RPM test fixes

* Address requested changes. (#38)
This commit is contained in:
Geert Linders
2020-01-23 15:18:47 +01:00
committed by Steve Karg
parent 76abcaedd1
commit f8ce70470c
92 changed files with 438 additions and 263 deletions
+11 -9
View File
@@ -216,7 +216,7 @@ static object_functions_t My_Object_Table[] = {
Trend_Log_Write_Property, Trend_Log_Property_Lists, TrendLogGetRRInfo,
NULL /* Iterator */, NULL /* Value_Lists */, NULL /* COV */,
NULL /* COV Clear */, NULL /* Intrinsic Reporting */ },
#if (BACNET_PROTOCOL_REVISION >= 14)
#if (BACNET_PROTOCOL_REVISION >= 14) && defined(BACAPP_LIGHTING_COMMAND)
{ OBJECT_LIGHTING_OUTPUT, Lighting_Output_Init, Lighting_Output_Count,
Lighting_Output_Index_To_Instance, Lighting_Output_Valid_Instance,
Lighting_Output_Object_Name, Lighting_Output_Read_Property,
@@ -827,7 +827,7 @@ unsigned Device_Object_List_Count(void)
* @return True if found, else false.
*/
bool Device_Object_List_Identifier(
uint32_t array_index, int *object_type, uint32_t *instance)
uint32_t array_index, BACNET_OBJECT_TYPE *object_type, uint32_t *instance)
{
bool status = false;
uint32_t count = 0;
@@ -885,11 +885,11 @@ bool Device_Object_List_Identifier(
* @return True on success or else False if not found.
*/
bool Device_Valid_Object_Name(BACNET_CHARACTER_STRING *object_name1,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t *object_instance)
{
bool found = false;
int type = 0;
BACNET_OBJECT_TYPE type = OBJECT_NONE;
uint32_t instance;
uint32_t max_objects = 0, i = 0;
bool check_id = false;
@@ -924,7 +924,8 @@ bool Device_Valid_Object_Name(BACNET_CHARACTER_STRING *object_name1,
* @param object_instance [in] The object instance number to be looked up.
* @return True if found, else False if no such Object in this device.
*/
bool Device_Valid_Object_Id(int object_type, uint32_t object_instance)
bool Device_Valid_Object_Id
(BACNET_OBJECT_TYPE object_type, uint32_t object_instance)
{
bool status = false; /* return value */
struct object_functions *pObject = NULL;
@@ -1072,7 +1073,7 @@ int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata)
BACNET_BIT_STRING bit_string = { 0 };
BACNET_CHARACTER_STRING char_string = { 0 };
uint32_t i = 0;
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t instance = 0;
uint32_t count = 0;
uint8_t *apdu = NULL;
@@ -1183,7 +1184,8 @@ int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata)
pObject = Object_Table;
while (pObject->Object_Type < MAX_BACNET_OBJECT_TYPE) {
if ((pObject->Object_Count) && (pObject->Object_Count() > 0)) {
bitstring_set_bit(&bit_string, pObject->Object_Type, true);
bitstring_set_bit(
&bit_string, (uint8_t)pObject->Object_Type, true);
}
pObject++;
}
@@ -1361,7 +1363,7 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
bool status = false; /* return value */
int len = 0;
BACNET_APPLICATION_DATA_VALUE value;
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t object_instance = 0;
int result = 0;
#if defined(BACNET_TIME_MASTER)
@@ -1758,7 +1760,7 @@ void Device_local_reporting(void)
struct object_functions *pObject;
uint32_t objects_count;
uint32_t object_instance;
int object_type;
BACNET_OBJECT_TYPE object_type;
uint32_t idx;
objects_count = Device_Object_List_Count();