Fixed ports/xplained conversion of double warning. (#1004)

* Fixed ports/xplained conversion of double warning.

* Fixed BACNET_USE_DOUBLE usage in AVR ports.

* Fixed integer out-of-range in AVR port.

* Fixed missing function prototype for whois_request_encode().
This commit is contained in:
Steve Karg
2025-05-26 22:13:06 -05:00
committed by GitHub
parent f983df7fae
commit f5b5db445c
10 changed files with 53 additions and 19 deletions
+1
View File
@@ -112,6 +112,7 @@ BFLAGS += -DBACAPP_OBJECT_ID
BFLAGS += -DBACAPP_UNSIGNED
BFLAGS += -DBACAPP_ENUMERATED
BFLAGS += -DBACAPP_CHARACTER_STRING
BFLAGS += -DBACNET_USE_DOUBLE=0
BFLAGS += -DWRITE_PROPERTY
BFLAGS += -DBACNET_PROTOCOL_REVISION=9
ifeq (${LEGACY},true)
+1
View File
@@ -223,6 +223,7 @@ BFLAGS += -DBACAPP_UNSIGNED
BFLAGS += -DBACAPP_ENUMERATED
BFLAGS += -DBACAPP_CHARACTER_STRING
BFLAGS += -DBACAPP_OCTET_STRING
BFLAGS += -DBACNET_USE_DOUBLE=0
BFLAGS += -DWRITE_PROPERTY
ifeq (${LEGACY},true)
# disable deprecated function warnings for legacy builds
+1
View File
@@ -186,6 +186,7 @@ BFLAGS += -DMAX_ADDRESS_CACHE=32
BFLAGS += -DMAX_ANALOG_INPUTS=8
BFLAGS += -DBACNET_PROTOCOL_REVISION=9
BFLAGS += -DBACAPP_MINIMAL
BFLAGS += -DBACNET_USE_DOUBLE=0
ifeq (${LEGACY},true)
# disable deprecated function warnings for legacy builds
BFLAGS += -DBACNET_STACK_DEPRECATED_DISABLE
+3
View File
@@ -231,6 +231,7 @@
<Value>MSTP_PDU_PACKET_COUNT=2</Value>
<Value>MAX_ADDRESS_CACHE=32</Value>
<Value>MAX_ANALOG_INPUTS=8</Value>
<Value>BACNET_USE_DOUBLE=0</Value>
<Value>BACNET_PROTOCOL_REVISION=9</Value>
<Value>BOARD=XMEGA_A3BU_XPLAINED</Value>
<Value>NDEBUG</Value>
@@ -337,6 +338,7 @@
<Value>MSTP_PDU_PACKET_COUNT=2</Value>
<Value>MAX_ADDRESS_CACHE=32</Value>
<Value>MAX_ANALOG_INPUTS=8</Value>
<Value>BACNET_USE_DOUBLE=0</Value>
<Value>BACNET_PROTOCOL_REVISION=9</Value>
<Value>DEBUG</Value>
</ListValues>
@@ -444,6 +446,7 @@
<Value>MSTP_PDU_PACKET_COUNT=2</Value>
<Value>MAX_ADDRESS_CACHE=32</Value>
<Value>MAX_ANALOG_INPUTS=8</Value>
<Value>BACNET_USE_DOUBLE=0</Value>
<Value>BACNET_PROTOCOL_REVISION=9</Value>
<Value>BOARD=XMEGA_A3BU_XPLAINED</Value>
<Value>CONF_BOARD_ENABLE_RS485_XPLAINED</Value>
+4
View File
@@ -13,6 +13,10 @@
/* BACnet Stack API */
#include "bacnet/bacint.h"
#ifndef BACNET_USE_SIGNED
#define BACNET_USE_SIGNED 1
#endif
int encode_unsigned16(uint8_t *apdu, uint16_t value)
{
if (apdu) {
-1
View File
@@ -90,7 +90,6 @@ int encode_bacnet_real(float value, uint8_t *apdu)
}
#if BACNET_USE_DOUBLE
/* from clause 20.2.7 Encoding of a Double Precision Real Number Value */
/* returns the number of apdu bytes consumed */
int decode_double(const uint8_t *apdu, double *double_value)
+4
View File
@@ -19,6 +19,10 @@
/* BACnet Stack API */
#include "bacnet/bacstr.h"
#ifndef BACNET_USE_OCTETSTRING /* Do we need any octet strings? */
#define BACNET_USE_OCTETSTRING 1
#endif
#ifndef BACNET_STRING_UTF8_VALIDATION
#define BACNET_STRING_UTF8_VALIDATION 1
#endif
+34 -17
View File
@@ -331,6 +331,34 @@
#define MAX_OCTET_STRING_BYTES (MAX_APDU - 6)
#endif
/* Do we need any octet strings? */
#ifndef BACNET_USE_OCTETSTRING
#define BACNET_USE_OCTETSTRING 1
#endif
/* Do we need any doubles? */
#ifndef BACNET_USE_DOUBLE
#define BACNET_USE_DOUBLE 1
#endif
/* Do we need any signed integers */
#ifndef BACNET_USE_SIGNED
#define BACNET_USE_SIGNED 1
#endif
/* if a datatype is not enabled, the BACapp helper cannot use it */
#if (BACNET_USE_OCTETSTRING == 0)
#undef BACAPP_OCTET_STRING
#endif
#if (BACNET_USE_DOUBLE == 0)
#undef BACAPP_DOUBLE
#endif
#if (BACNET_USE_SIGNED == 0)
#undef BACAPP_SIGNED
#endif
/**
* @note Control the selection of services etc to enable code size reduction
* for those compiler suites which do not handle removing of unused functions
@@ -339,12 +367,16 @@
* We will start with the A type services code first as these are least likely
* to be required in embedded systems using the stack.
*/
#ifndef BACNET_SVC_SERVER
#if !( \
defined(BACNET_SVC_I_HAVE_A) || defined(BACNET_SVC_WP_A) || \
defined(BACNET_SVC_RP_A) || defined(BACNET_SVC_RPM_A) || \
defined(BACNET_SVC_DCC_A) || defined(BACNET_SVC_RD_A) || \
defined(BACNET_SVC_TS_A) || defined(BACNET_SVC_SERVER))
/* default to client-server device for the example apps to build. */
#define BACNET_SVC_SERVER 0
#endif
#if (BACNET_SVC_SERVER == 0)
#if defined(BACNET_SVC_SERVER) && (BACNET_SVC_SERVER == 0)
/* client-server device */
#define BACNET_SVC_I_HAVE_A 1
#define BACNET_SVC_WP_A 1
@@ -353,9 +385,6 @@
#define BACNET_SVC_DCC_A 1
#define BACNET_SVC_RD_A 1
#define BACNET_SVC_TS_A 1
#define BACNET_USE_OCTETSTRING 1
#define BACNET_USE_DOUBLE 1
#define BACNET_USE_SIGNED 1
#endif
/* Do them one by one */
@@ -383,16 +412,4 @@
#define BACNET_SVC_RD_A 0
#endif
#ifndef BACNET_USE_OCTETSTRING /* Do we need any octet strings? */
#define BACNET_USE_OCTETSTRING 0
#endif
#ifndef BACNET_USE_DOUBLE /* Do we need any doubles? */
#define BACNET_USE_DOUBLE 0
#endif
#ifndef BACNET_USE_SIGNED /* Do we need any signed integers */
#define BACNET_USE_SIGNED 0
#endif
#endif
+3 -1
View File
@@ -378,9 +378,11 @@ static const int Properties_BACnetARRAY[] = {
PROP_EXCEPTION_SCHEDULE,
PROP_TAGS,
PROP_ISSUER_CERTIFICATE_FILES,
PROP_SC_HUB_FUNCTION_ACCEPT_URIS,
PROP_NEGATIVE_ACCESS_RULES,
PROP_POSITIVE_ACCESS_RULES,
#if (INT_MAX > 0xFFFF)
PROP_SC_HUB_FUNCTION_ACCEPT_URIS,
#endif
-1
};
+2
View File
@@ -19,6 +19,8 @@ extern "C" {
/* encode service - use -1 for limit if you want unlimited */
BACNET_STACK_EXPORT
int whois_request_encode(uint8_t *apdu, int32_t low_limit, int32_t high_limit);
BACNET_STACK_EXPORT
int whois_encode_apdu(uint8_t *apdu, int32_t low_limit, int32_t high_limit);
BACNET_STACK_EXPORT