Fixed spelling errors detected by code-spell utility. (#895)

* Fixed spelling errors detected by code-spell utility.

* Fixed cppcheck preprocessorErrorDirective. Suppressed new cppcheck warnings until fixed.
This commit is contained in:
Steve Karg
2025-01-21 13:31:43 -06:00
committed by GitHub
parent ece31443b6
commit cfe257fe69
12 changed files with 36 additions and 31 deletions
+5 -1
View File
@@ -410,12 +410,16 @@ CPPCHECK_OPTIONS += --suppress=duplicateCondition
CPPCHECK_OPTIONS += --suppress=funcArgNamesDifferent CPPCHECK_OPTIONS += --suppress=funcArgNamesDifferent
CPPCHECK_OPTIONS += --suppress=unusedStructMember CPPCHECK_OPTIONS += --suppress=unusedStructMember
CPPCHECK_OPTIONS += --suppress=uselessAssignmentPtrArg CPPCHECK_OPTIONS += --suppress=uselessAssignmentPtrArg
CPPCHECK_OPTIONS += --addon=cert.py
CPPCHECK_OPTIONS += --suppress=cert-MSC30-c CPPCHECK_OPTIONS += --suppress=cert-MSC30-c
CPPCHECK_OPTIONS += --suppress=cert-STR05-C CPPCHECK_OPTIONS += --suppress=cert-STR05-C
CPPCHECK_OPTIONS += --suppress=cert-API01-C CPPCHECK_OPTIONS += --suppress=cert-API01-C
CPPCHECK_OPTIONS += --suppress=cert-MSC24-C CPPCHECK_OPTIONS += --suppress=cert-MSC24-C
CPPCHECK_OPTIONS += --suppress=cert-INT31-c CPPCHECK_OPTIONS += --suppress=cert-INT31-c
# new in cppcheck 2.13
CPPCHECK_OPTIONS += --suppress=constParameterCallback
CPPCHECK_OPTIONS += --suppress=constParameterPointer
CPPCHECK_OPTIONS += --suppress=constVariablePointer
# suppress the deprecated warning for the BACnet stack
CPPCHECK_OPTIONS += -DBACNET_STACK_DEPRECATED CPPCHECK_OPTIONS += -DBACNET_STACK_DEPRECATED
#CPPCHECK_OPTIONS += -I./src #CPPCHECK_OPTIONS += -I./src
#CPPCHECK_OPTIONS += --enable=information --check-config #CPPCHECK_OPTIONS += --enable=information --check-config
+3 -3
View File
@@ -3367,19 +3367,19 @@ int bacapp_snprintf_value(
char *str, size_t str_len, const BACNET_OBJECT_PROPERTY_VALUE *object_value) char *str, size_t str_len, const BACNET_OBJECT_PROPERTY_VALUE *object_value)
{ {
size_t len = 0, i = 0; size_t len = 0, i = 0;
#if defined(BACAPP_CHARACTER_STRING)
const char *char_str;
#endif
const BACNET_APPLICATION_DATA_VALUE *value; const BACNET_APPLICATION_DATA_VALUE *value;
BACNET_PROPERTY_ID property = PROP_ALL; BACNET_PROPERTY_ID property = PROP_ALL;
BACNET_OBJECT_TYPE object_type = MAX_BACNET_OBJECT_TYPE; BACNET_OBJECT_TYPE object_type = MAX_BACNET_OBJECT_TYPE;
int ret_val = 0; int ret_val = 0;
int slen = 0; int slen = 0;
#if defined(BACAPP_CHARACTER_STRING)
const char *char_str;
#if (__STDC_VERSION__ >= 199901L) && defined(__STDC_ISO_10646__) #if (__STDC_VERSION__ >= 199901L) && defined(__STDC_ISO_10646__)
/* Wide character (decoded from multi-byte character). */ /* Wide character (decoded from multi-byte character). */
wchar_t wc; wchar_t wc;
/* Wide character length in bytes. */ /* Wide character length in bytes. */
int wclen; int wclen;
#endif
#endif #endif
if (object_value && object_value->value) { if (object_value && object_value->value) {
+1 -1
View File
@@ -755,7 +755,7 @@ int bacnet_destination_to_ascii(
/** /**
* Parse BACnet_Destination from ASCII string (as entered by user) * Parse BACnet_Destination from ASCII string (as entered by user)
* *
* @param bacdest - Destination struct to pupulate with data from the ASCII * @param bacdest - Destination struct to populate with data from the ASCII
* string * string
* @param buf - ASCII string, zero terminated * @param buf - ASCII string, zero terminated
* @return true on success * @return true on success
+2 -2
View File
@@ -76,7 +76,7 @@ static struct Address_Cache_Entry {
*/ */
void address_protected_entry_index_set(uint32_t top_protected_entry_index) void address_protected_entry_index_set(uint32_t top_protected_entry_index)
{ {
if (top_protected_entry_index <= (MAX_ADDRESS_CACHE - 1)) { if (top_protected_entry_index < MAX_ADDRESS_CACHE) {
Top_Protected_Entry = top_protected_entry_index; Top_Protected_Entry = top_protected_entry_index;
} }
} }
@@ -976,7 +976,7 @@ int rr_address_list_encode(uint8_t *apdu, BACNET_READ_RANGE_DATA *pRequest)
/** /**
* Scan the cache and eliminate any expired entries. Should be called * Scan the cache and eliminate any expired entries. Should be called
* periodically to ensure the cache is managed correctly. If this function * periodically to ensure the cache is managed correctly. If this function
* is never called at all the whole cache is effectivly rendered static and * is never called at all the whole cache is effectively rendered static and
* entries never expire unless explicitly deleted. * entries never expire unless explicitly deleted.
* *
* @param uSeconds Approximate number of seconds since last call to this * @param uSeconds Approximate number of seconds since last call to this
+2 -2
View File
@@ -1138,7 +1138,7 @@ uint16_t bacnet_discover_vendor_id(void)
*/ */
void bacnet_discover_seconds_set(unsigned int seconds) void bacnet_discover_seconds_set(unsigned int seconds)
{ {
Discovery_Milliseconds = seconds * 1000; Discovery_Milliseconds = (unsigned long)seconds * 1000UL;
} }
/** /**
@@ -1147,7 +1147,7 @@ void bacnet_discover_seconds_set(unsigned int seconds)
*/ */
unsigned int bacnet_discover_seconds(void) unsigned int bacnet_discover_seconds(void)
{ {
return Discovery_Milliseconds = 1000; return Discovery_Milliseconds = 1000UL;
} }
/** /**
+1 -1
View File
@@ -1113,7 +1113,7 @@ int TL_encode_by_sequence(uint8_t *apdu, BACNET_READ_RANGE_DATA *pRequest)
uint32_t uiIndex = 0; /* Current entry number */ uint32_t uiIndex = 0; /* Current entry number */
uint32_t uiFirst = 0; /* Entry number we started encoding from */ uint32_t uiFirst = 0; /* Entry number we started encoding from */
uint32_t uiLast = 0; /* Entry number we finished encoding on */ uint32_t uiLast = 0; /* Entry number we finished encoding on */
uint32_t uiSequence = 0; /* Tracking sequenc number when encoding */ uint32_t uiSequence = 0; /* Tracking sequence number when encoding */
uint32_t uiRemaining = 0; /* Amount of unused space in packet */ uint32_t uiRemaining = 0; /* Amount of unused space in packet */
uint32_t uiFirstSeq = 0; /* Sequence number for 1st record in log */ uint32_t uiFirstSeq = 0; /* Sequence number for 1st record in log */
+13 -11
View File
@@ -11,12 +11,12 @@
#include "bacnet/bacdcode.h" #include "bacnet/bacdcode.h"
int bacapp_encode_credential_authentication_factor( int bacapp_encode_credential_authentication_factor(
uint8_t *apdu, const BACNET_CREDENTIAL_AUTHENTICATION_FACTOR *caf) uint8_t *apdu, const BACNET_CREDENTIAL_AUTHENTICATION_FACTOR *factor)
{ {
int len; int len;
int apdu_len = 0; int apdu_len = 0;
len = encode_context_enumerated(&apdu[apdu_len], 0, caf->disable); len = encode_context_enumerated(&apdu[apdu_len], 0, factor->disable);
if (len < 0) { if (len < 0) {
return -1; return -1;
} else { } else {
@@ -24,7 +24,7 @@ int bacapp_encode_credential_authentication_factor(
} }
len = bacapp_encode_context_authentication_factor( len = bacapp_encode_context_authentication_factor(
&apdu[apdu_len], 1, &caf->authentication_factor); &apdu[apdu_len], 1, &factor->authentication_factor);
if (len < 0) { if (len < 0) {
return -1; return -1;
} else { } else {
@@ -37,7 +37,7 @@ int bacapp_encode_credential_authentication_factor(
int bacapp_encode_context_credential_authentication_factor( int bacapp_encode_context_credential_authentication_factor(
uint8_t *apdu, uint8_t *apdu,
uint8_t tag, uint8_t tag,
const BACNET_CREDENTIAL_AUTHENTICATION_FACTOR *caf) const BACNET_CREDENTIAL_AUTHENTICATION_FACTOR *factor)
{ {
int len; int len;
int apdu_len = 0; int apdu_len = 0;
@@ -45,7 +45,8 @@ int bacapp_encode_context_credential_authentication_factor(
len = encode_opening_tag(&apdu[apdu_len], tag); len = encode_opening_tag(&apdu[apdu_len], tag);
apdu_len += len; apdu_len += len;
len = bacapp_encode_credential_authentication_factor(&apdu[apdu_len], caf); len =
bacapp_encode_credential_authentication_factor(&apdu[apdu_len], factor);
apdu_len += len; apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], tag); len = encode_closing_tag(&apdu[apdu_len], tag);
@@ -55,11 +56,11 @@ int bacapp_encode_context_credential_authentication_factor(
} }
int bacapp_decode_credential_authentication_factor( int bacapp_decode_credential_authentication_factor(
const uint8_t *apdu, BACNET_CREDENTIAL_AUTHENTICATION_FACTOR *caf) const uint8_t *apdu, BACNET_CREDENTIAL_AUTHENTICATION_FACTOR *factor)
{ {
int len; int len;
int apdu_len = 0; int apdu_len = 0;
uint32_t disable = caf->disable; uint32_t disable = factor->disable;
if (decode_is_context_tag(&apdu[apdu_len], 0)) { if (decode_is_context_tag(&apdu[apdu_len], 0)) {
len = decode_context_enumerated(&apdu[apdu_len], 0, &disable); len = decode_context_enumerated(&apdu[apdu_len], 0, &disable);
@@ -67,7 +68,8 @@ int bacapp_decode_credential_authentication_factor(
return -1; return -1;
} else if (disable < ACCESS_AUTHENTICATION_FACTOR_DISABLE_MAX) { } else if (disable < ACCESS_AUTHENTICATION_FACTOR_DISABLE_MAX) {
apdu_len += len; apdu_len += len;
caf->disable = (BACNET_ACCESS_AUTHENTICATION_FACTOR_DISABLE)disable; factor->disable =
(BACNET_ACCESS_AUTHENTICATION_FACTOR_DISABLE)disable;
} else { } else {
return -1; return -1;
} }
@@ -77,7 +79,7 @@ int bacapp_decode_credential_authentication_factor(
if (decode_is_context_tag(&apdu[apdu_len], 1)) { if (decode_is_context_tag(&apdu[apdu_len], 1)) {
len = bacapp_decode_context_authentication_factor( len = bacapp_decode_context_authentication_factor(
&apdu[apdu_len], 1, &caf->authentication_factor); &apdu[apdu_len], 1, &factor->authentication_factor);
if (len < 0) { if (len < 0) {
return -1; return -1;
} else { } else {
@@ -93,7 +95,7 @@ int bacapp_decode_credential_authentication_factor(
int bacapp_decode_context_credential_authentication_factor( int bacapp_decode_context_credential_authentication_factor(
const uint8_t *apdu, const uint8_t *apdu,
uint8_t tag, uint8_t tag,
BACNET_CREDENTIAL_AUTHENTICATION_FACTOR *caf) BACNET_CREDENTIAL_AUTHENTICATION_FACTOR *factor)
{ {
int len = 0; int len = 0;
int section_length; int section_length;
@@ -101,7 +103,7 @@ int bacapp_decode_context_credential_authentication_factor(
if (decode_is_opening_tag_number(&apdu[len], tag)) { if (decode_is_opening_tag_number(&apdu[len], tag)) {
len++; len++;
section_length = section_length =
bacapp_decode_credential_authentication_factor(&apdu[len], caf); bacapp_decode_credential_authentication_factor(&apdu[len], factor);
if (section_length == -1) { if (section_length == -1) {
len = -1; len = -1;
@@ -28,20 +28,20 @@ extern "C" {
BACNET_STACK_EXPORT BACNET_STACK_EXPORT
int bacapp_encode_credential_authentication_factor( int bacapp_encode_credential_authentication_factor(
uint8_t *apdu, const BACNET_CREDENTIAL_AUTHENTICATION_FACTOR *caf); uint8_t *apdu, const BACNET_CREDENTIAL_AUTHENTICATION_FACTOR *factor);
BACNET_STACK_EXPORT BACNET_STACK_EXPORT
int bacapp_encode_context_credential_authentication_factor( int bacapp_encode_context_credential_authentication_factor(
uint8_t *apdu, uint8_t *apdu,
uint8_t tag, uint8_t tag,
const BACNET_CREDENTIAL_AUTHENTICATION_FACTOR *caf); const BACNET_CREDENTIAL_AUTHENTICATION_FACTOR *factor);
BACNET_STACK_EXPORT BACNET_STACK_EXPORT
int bacapp_decode_credential_authentication_factor( int bacapp_decode_credential_authentication_factor(
const uint8_t *apdu, BACNET_CREDENTIAL_AUTHENTICATION_FACTOR *caf); const uint8_t *apdu, BACNET_CREDENTIAL_AUTHENTICATION_FACTOR *factor);
BACNET_STACK_EXPORT BACNET_STACK_EXPORT
int bacapp_decode_context_credential_authentication_factor( int bacapp_decode_context_credential_authentication_factor(
const uint8_t *apdu, const uint8_t *apdu,
uint8_t tag, uint8_t tag,
BACNET_CREDENTIAL_AUTHENTICATION_FACTOR *caf); BACNET_CREDENTIAL_AUTHENTICATION_FACTOR *factor);
#ifdef __cplusplus #ifdef __cplusplus
} }
+2 -1
View File
@@ -6,6 +6,7 @@
* @copyright SPDX-License-Identifier: MIT * @copyright SPDX-License-Identifier: MIT
*/ */
#include "bacnet/basic/sys/debug.h" #include "bacnet/basic/sys/debug.h"
#include "bacnet/datalink/bsc/bsc-conf.h"
#include "bacnet/datalink/bsc/bsc-node.h" #include "bacnet/datalink/bsc/bsc-node.h"
#include "bacnet/datalink/bsc/bsc-event.h" #include "bacnet/datalink/bsc/bsc-event.h"
#include "bacnet/datalink/bsc/bsc-util.h" #include "bacnet/datalink/bsc/bsc-util.h"
@@ -48,7 +49,7 @@ struct BSC_Node {
BACNET_SC_HUB_FUNCTION_CONNECTION_STATUS *hub_status; BACNET_SC_HUB_FUNCTION_CONNECTION_STATUS *hub_status;
}; };
#if BSC_CONF_NODES_NUM < 1 #if defined(BSC_CONF_NODES_NUM) && (BSC_CONF_NODES_NUM < 1)
#error "BSC_CONF_NODES_NUM must be >= 1" #error "BSC_CONF_NODES_NUM must be >= 1"
#endif #endif
-2
View File
@@ -3274,8 +3274,6 @@ bool property_list_writable_member(
(object_property == PROP_PACKET_REORDER_TIME) || (object_property == PROP_PACKET_REORDER_TIME) ||
(object_property == PROP_LAST_KEY_SERVER) || (object_property == PROP_LAST_KEY_SERVER) ||
(object_property == PROP_SECURITY_PDU_TIMEOUT) || (object_property == PROP_SECURITY_PDU_TIMEOUT) ||
(object_property == PROP_LAST_KEY_SERVER) ||
(object_property == PROP_SECURITY_PDU_TIMEOUT) ||
(object_property == PROP_DO_NOT_HIDE)) { (object_property == PROP_DO_NOT_HIDE)) {
writable = true; writable = true;
} }
+1 -1
View File
@@ -111,7 +111,7 @@ bool write_property_unsigned_decode(
* The WriteProperty service is used by a client BACnet-user to modify the * The WriteProperty service is used by a client BACnet-user to modify the
* value of a single specified property of a BACnet object. This service * value of a single specified property of a BACnet object. This service
* potentially allows write access to any property of any object, whether a * potentially allows write access to any property of any object, whether a
* BACnet-defined object or not. Some implementors may wish to restrict write * BACnet-defined object or not. Some implementers may wish to restrict write
* access to certain properties of certain objects. In such cases, an attempt * access to certain properties of certain objects. In such cases, an attempt
* to modify a restricted property shall result in the return of an error of * to modify a restricted property shall result in the return of an error of
* 'Error Class' PROPERTY and 'Error Code' WRITE_ACCESS_DENIED. * 'Error Class' PROPERTY and 'Error Code' WRITE_ACCESS_DENIED.
+2 -2
View File
@@ -101,11 +101,11 @@ void wpm_write_access_data_link_array(
* parameter, and execution of the service shall continue until all of the * parameter, and execution of the service shall continue until all of the
* specified properties have been written to or a property is encountered that * specified properties have been written to or a property is encountered that
* for some reason cannot be modified as requested. * for some reason cannot be modified as requested.
* Some implementors may wish to restrict write access to certain properties * Some implementers may wish to restrict write access to certain properties
* of certain objects. In such cases, an attempt to modify a restricted property * of certain objects. In such cases, an attempt to modify a restricted property
* shall result in the return of an error of 'Error Class' PROPERTY and 'Error * shall result in the return of an error of 'Error Class' PROPERTY and 'Error
* Code' WRITE_ACCESS_DENIED. Note that these restricted properties may be * Code' WRITE_ACCESS_DENIED. Note that these restricted properties may be
* accessible through the use of Virtual Terminal services or other means at the * accessible through the use of Virtual Terminal services or other means at the
* discretion of the implementor. * discretion of the implementer.
*/ */
#endif #endif