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
+4 -3
View File
@@ -50,6 +50,7 @@
#include "bacnet/config.h" /* the custom stuff */
#include "bacnet/basic/object/device.h"
#include "bacnet/basic/services.h"
#include "bacnet/lighting.h"
#include "bacnet/proplist.h"
#include "bacnet/timestamp.h"
#include "bacnet/basic/object/command.h"
@@ -71,8 +72,7 @@ int cl_encode_apdu(uint8_t *apdu, BACNET_ACTION_LIST *bcl)
int len = 0;
int apdu_len = 0;
if (bcl->Device_Id.instance >= 0 &&
bcl->Device_Id.instance <= BACNET_MAX_INSTANCE) {
if (bcl->Device_Id.instance <= BACNET_MAX_INSTANCE) {
len = encode_context_object_id(
&apdu[apdu_len], 0, bcl->Device_Id.type, bcl->Device_Id.instance);
if (len < 0) {
@@ -269,13 +269,14 @@ int cl_decode_apdu(uint8_t *apdu,
&bcl->Value.type.Object_Id.type,
&bcl->Value.type.Object_Id.instance);
break;
#if defined(BACAPP_LIGHTING_COMMAND)
case BACNET_APPLICATION_TAG_LIGHTING_COMMAND:
len = lighting_command_decode(&apdu[dec_len], apdu_len - dec_len,
&bcl->Value.type.Lighting_Command);
break;
#endif
default:
return BACNET_STATUS_REJECT;
break;
}
if (len > 0) {
dec_len += len;