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
+2 -2
View File
@@ -107,7 +107,7 @@ unsigned Device_Object_List_Count(void)
}
bool Device_Object_List_Identifier(uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance)
{
bool status = false;
@@ -166,7 +166,7 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
BACNET_BIT_STRING bit_string;
BACNET_CHARACTER_STRING char_string;
uint32_t i = 0;
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t instance = 0;
uint32_t count = 0;
+3 -3
View File
@@ -67,7 +67,7 @@ extern "C" {
bool Device_Valid_Object_Instance_Number(uint32_t object_id);
unsigned Device_Object_List_Count(void);
bool Device_Object_List_Identifier(uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance);
BACNET_DEVICE_STATUS Device_System_Status(void);
@@ -108,9 +108,9 @@ extern "C" {
void Device_Set_Database_Revision(uint8_t revision);
bool Device_Valid_Object_Name(const char *object_name,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * object_instance);
char *Device_Valid_Object_Id(int object_type,
char *Device_Valid_Object_Id(BACNET_OBJECT_TYPE object_type,
uint32_t object_instance);
int Device_Encode_Property_APDU(uint8_t * apdu,
+5 -5
View File
@@ -542,7 +542,7 @@ unsigned Device_Object_List_Count(
bool Device_Object_List_Identifier(
uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance)
{
bool status = false;
@@ -576,11 +576,11 @@ bool Device_Object_List_Identifier(
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;
@@ -611,7 +611,7 @@ bool Device_Valid_Object_Name(
}
bool Device_Valid_Object_Id(
int object_type,
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance)
{
bool status = false; /* return value */
@@ -650,7 +650,7 @@ int Device_Read_Property_Local(
BACNET_BIT_STRING bit_string;
BACNET_CHARACTER_STRING char_string;
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;
+2 -2
View File
@@ -116,7 +116,7 @@ unsigned Device_Object_List_Count(
bool Device_Object_List_Identifier(
uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance)
{
bool status = false;
@@ -172,7 +172,7 @@ int Device_Read_Property(
BACNET_BIT_STRING bit_string;
BACNET_CHARACTER_STRING char_string;
uint32_t i = 0;
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t instance = 0;
uint32_t count = 0;
+3 -3
View File
@@ -81,7 +81,7 @@ extern "C" {
void);
bool Device_Object_List_Identifier(
uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance);
BACNET_DEVICE_STATUS Device_System_Status(
@@ -143,10 +143,10 @@ extern "C" {
bool Device_Valid_Object_Name(
const char *object_name,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * object_instance);
char *Device_Valid_Object_Id(
int object_type,
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance);
int Device_Encode_Property_APDU(
+2 -2
View File
@@ -94,7 +94,7 @@ bool bacnet_name_set(
bool bacnet_name_write_unique(
uint16_t offset,
int object_type,
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance,
BACNET_CHARACTER_STRING * char_string,
BACNET_ERROR_CLASS * error_class,
@@ -103,7 +103,7 @@ bool bacnet_name_write_unique(
bool status = false;
size_t length = 0;
uint8_t encoding = 0;
int duplicate_type = 0;
BACNET_OBJECT_TYPE duplicate_type = OBJECT_NONE;
uint32_t duplicate_instance = 0;
length = characterstring_length(char_string);
+1 -1
View File
@@ -48,7 +48,7 @@ extern "C" {
char *default_string);
bool bacnet_name_write_unique(
uint16_t offset,
int object_type,
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance,
BACNET_CHARACTER_STRING * char_string,
BACNET_ERROR_CLASS * error_class,
+5 -5
View File
@@ -484,7 +484,7 @@ unsigned Device_Object_List_Count(
bool Device_Object_List_Identifier(
uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance)
{
bool status = false;
@@ -518,11 +518,11 @@ bool Device_Object_List_Identifier(
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;
@@ -553,7 +553,7 @@ bool Device_Valid_Object_Name(
}
bool Device_Valid_Object_Id(
int object_type,
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance)
{
bool status = false; /* return value */
@@ -592,7 +592,7 @@ int Device_Read_Property_Local(
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;
+7 -7
View File
@@ -746,7 +746,7 @@ unsigned Device_Object_List_Count(
*/
bool Device_Object_List_Identifier(
uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance)
{
bool status = false;
@@ -805,11 +805,11 @@ bool Device_Object_List_Identifier(
*/
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;
@@ -845,7 +845,7 @@ bool Device_Valid_Object_Name(
* @return True if found, else False if no such Object in this device.
*/
bool Device_Valid_Object_Id(
int object_type,
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance)
{
bool status = false; /* return value */
@@ -1047,7 +1047,7 @@ int Device_Read_Property_Local(
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;
@@ -1349,7 +1349,7 @@ bool Device_Write_Property_Local(
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 temp;
@@ -1755,7 +1755,7 @@ void Device_local_reporting(
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();
+3 -3
View File
@@ -279,7 +279,7 @@ extern "C" {
void);
bool Device_Object_List_Identifier(
uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance);
unsigned Device_Count(
@@ -358,10 +358,10 @@ extern "C" {
bool Device_Valid_Object_Name(
BACNET_CHARACTER_STRING * object_name,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * object_instance);
bool Device_Valid_Object_Id(
int object_type,
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance);
int Device_Read_Property(
+2 -2
View File
@@ -216,7 +216,7 @@ unsigned Device_Object_List_Count(
/* for discovery, it must be consistent! */
bool Device_Object_List_Identifier(
uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance)
{
bool status = false;
@@ -296,7 +296,7 @@ int Device_Read_Property_Local(
int len = 0; /* apdu len intermediate value */
BACNET_BIT_STRING bit_string;
uint32_t i = 0;
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t instance = 0;
uint32_t count = 0;
BACNET_TIME local_time;
+2 -2
View File
@@ -194,7 +194,7 @@ unsigned Device_Object_List_Count(
/* for discovery, it must be consistent! */
bool Device_Object_List_Identifier(
uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance)
{
bool status = false;
@@ -273,7 +273,7 @@ int Device_Read_Property_Local(
BACNET_BIT_STRING bit_string;
BACNET_CHARACTER_STRING char_string;
uint32_t i = 0;
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t instance = 0;
uint32_t count = 0;
BACNET_TIME local_time;
+5 -5
View File
@@ -520,7 +520,7 @@ unsigned Device_Object_List_Count(
bool Device_Object_List_Identifier(
uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance)
{
bool status = false;
@@ -562,11 +562,11 @@ bool Device_Object_List_Identifier(
*/
bool Device_Valid_Object_Name(
const char *object_name,
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;
@@ -595,7 +595,7 @@ bool Device_Valid_Object_Name(
/* returns the name or NULL if not found */
char *Device_Valid_Object_Id(
int object_type,
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance)
{
char *name = NULL; /* return value */
@@ -618,7 +618,7 @@ int Device_Read_Property_Local(
BACNET_BIT_STRING bit_string;
BACNET_CHARACTER_STRING char_string;
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;
+5 -5
View File
@@ -528,7 +528,7 @@ unsigned Device_Object_List_Count(
bool Device_Object_List_Identifier(
uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance)
{
bool status = false;
@@ -562,11 +562,11 @@ bool Device_Object_List_Identifier(
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;
@@ -597,7 +597,7 @@ bool Device_Valid_Object_Name(
}
bool Device_Valid_Object_Id(
int object_type,
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance)
{
bool status = false; /* return value */
@@ -636,7 +636,7 @@ int Device_Read_Property_Local(
BACNET_BIT_STRING bit_string;
BACNET_CHARACTER_STRING char_string;
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;
+5 -5
View File
@@ -506,7 +506,7 @@ unsigned Device_Object_List_Count(void)
}
bool Device_Object_List_Identifier(uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance)
{
bool status = false;
@@ -539,11 +539,11 @@ bool Device_Object_List_Identifier(uint32_t array_index,
}
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;
@@ -573,7 +573,7 @@ bool Device_Valid_Object_Name(BACNET_CHARACTER_STRING * object_name1,
return found;
}
bool Device_Valid_Object_Id(int object_type,
bool Device_Valid_Object_Id(BACNET_OBJECT_TYPE object_type,
uint32_t object_instance)
{
bool status = false; /* return value */
@@ -610,7 +610,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;