Issue 10 ci add support for code spelling checks (#231)

* added make targets spell and codespell for spelling checks

* fix spelling errors detected by codespell

* added codespell to github workflow

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
Steve Karg
2022-02-27 16:02:17 -06:00
committed by GitHub
parent b31cb43e22
commit 5e70eeecfc
32 changed files with 79 additions and 58 deletions
+11 -1
View File
@@ -30,5 +30,15 @@ jobs:
sudo apt-get install -qq cppcheck
- name: cppcheck
run: make clean cppcheck
codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Create Build Environment
run: |
sudo apt-get update -qq
sudo apt-get install -qq codespell
- name: codespell
run: make spell
+12
View File
@@ -230,6 +230,18 @@ CPPCHECK_OPTIONS += --suppress=selfAssignment
cppcheck:
cppcheck $(CPPCHECK_OPTIONS) --quiet --force ./src/
IGNORE_WORDS = ba
CODESPELL_OPTIONS = --write-changes --interactive 3 --enable-colors
CODESPELL_OPTIONS += --ignore-words-list $(IGNORE_WORDS)
.PHONY: codespell
codespell:
codespell $(CODESPELL_OPTIONS) ./src
SPELL_OPTIONS = --enable-colors --ignore-words-list $(IGNORE_WORDS)
.PHONY: spell
spell:
codespell $(SPELL_OPTIONS) ./src
.PHONY: clean
clean: ports-clean
$(MAKE) -s -C src clean
+2 -2
View File
@@ -383,7 +383,7 @@ bool bacapp_decode_application_data_safe(uint8_t *new_apdu,
apdu_len += tag_len;
apdu_len_remaining -= tag_len;
/* The tag is boolean then len_value_type is interpreted as value,
*not length, so dont bother
*not length, so don't bother
** checking with apdu_len_remaining */
if (tag_number == BACNET_APPLICATION_TAG_BOOLEAN ||
len_value_type <= apdu_len_remaining) {
@@ -937,7 +937,7 @@ bool bacapp_copy(BACNET_APPLICATION_DATA_VALUE *dest_value,
*
* @param Pointer to the APDU buffer
* @param apdu_len_max Bytes valid in the buffer
* @param property ID of the propery to get the length for.
* @param property ID of the property to get the length for.
*
* @return Length in bytes or BACNET_STATUS_ERROR.
*/
+1 -1
View File
@@ -840,7 +840,7 @@ int decode_bitstring(
bitstring_set_octet(bit_string, (uint8_t) i,
byte_reverse_bits(apdu[len++]));
}
/* Erase the remaining unsed bits. */
/* Erase the remaining unused bits. */
unused_bits = (uint8_t) (apdu[0] & 0x07);
bitstring_set_bits_used(bit_string, (uint8_t) bytes_used,
unused_bits);
+2 -2
View File
@@ -673,7 +673,7 @@ char *characterstring_value(BACNET_CHARACTER_STRING *char_string)
*
* @param char_string Pointer to the character string.
*
* @return Length of the charcater string, but
* @return Length of the character string, but
* maximum MAX_CHARACTER_STRING_BYTES.
*/
size_t characterstring_length(BACNET_CHARACTER_STRING *char_string)
@@ -1117,7 +1117,7 @@ bool octetstring_append(
* function returns false.
*
* @param octet_string Pointer to the octet string.
* @param length New length the octet string is trucated to.
* @param length New length the octet string is truncated to.
*
* @return tur on success, false otherwise.
*/
+2 -2
View File
@@ -355,7 +355,7 @@ static uint16_t bbmd_bdt_forward_npdu(BACNET_IP_ADDRESS *bip_src,
/* If we are forwarding an original broadcast message and the NAT
* handling is enabled, change the source address to NAT routers
* global IP address so the recipient can reply (local IP address
* is not accesible from internet side.
* is not accessible from internet side.
*
* If we are forwarding a message from peer BBMD or foreign device
* or the NAT handling is disabled, leave the source address as is.
@@ -420,7 +420,7 @@ static uint16_t bbmd_fdt_forward_npdu(BACNET_IP_ADDRESS *bip_src,
/* If we are forwarding an original broadcast message and the NAT
* handling is enabled, change the source address to NAT routers
* global IP address so the recipient can reply (local IP address
* is not accesible from internet side.
* is not accessible from internet side.
*
* If we are forwarding a message from peer BBMD or foreign device
* or the NAT handling is disabled, leave the source address as is.
+6 -6
View File
@@ -96,7 +96,7 @@ static struct Address_Cache_Entry {
#define BAC_ADDR_LONG_TIME BAC_ADDR_SECS_1DAY
#define BAC_ADDR_SHORT_TIME BAC_ADDR_SECS_1HOUR
#define BAC_ADDR_FOREVER 0xFFFFFFFF /* Permenant entry */
#define BAC_ADDR_FOREVER 0xFFFFFFFF /* Permanent entry */
/**
* @brief Set the index of the first (top) address being protected.
@@ -410,7 +410,7 @@ static void address_file_init(const char *pFilename)
/**
* Clear down the cache and make sure the full complement of entries are
* available. Assume no persistance of memory.
* available. Assume no persistence of memory.
*/
void address_init(void)
{
@@ -431,7 +431,7 @@ void address_init(void)
/**
* Clear down the cache of any non bound, expired or reserved entries.
* Leave static and unexpired bound entries alone. For use where the cache
* is held in persistant memory which can survive a reset or power cycle.
* is held in persistent memory which can survive a reset or power cycle.
* This reduces the network traffic on restarts as the cache will have much
* of its entries intact.
*/
@@ -465,7 +465,7 @@ void address_init_partial(void)
/**
* Set the TTL info for the given device entry. If it is a bound entry we
* set it to static or normal and can change the TTL. If it is unbound we
* can only set the TTL. This is done as a seperate function at the moment
* can only set the TTL. This is done as a separate function at the moment
* to avoid breaking the current API.
*
* @param device_id Device-Id
@@ -940,7 +940,7 @@ int address_list_encode(uint8_t *apdu, unsigned apdu_len)
*
* We take the simple approach here to filling the buffer by taking a max *
* size for a single entry and then stopping if there is less than that
* left in the buffer. You could build each entry in a seperate buffer and
* left in the buffer. You could build each entry in a separate buffer and
* determine the exact length before copying but this is time consuming,
* requires more memory and would probably only let you sqeeeze one more
* entry in on occasion. The value is calculated as 5 bytes for the device
@@ -1131,7 +1131,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
* periodically to ensure the cache is managed correctly. If this function
* is never called at all the whole cache is effectivly rendered static and
* entries never expire unless explictely deleted.
* entries never expire unless explicitly deleted.
*
* @param uSeconds Approximate number of seconds since last call to this
* function
+1 -1
View File
@@ -258,7 +258,7 @@ void Send_I_Am_Router_To_Network(const int DNET_list[])
* network. Otherwise, designates a particular router
* destination.
* @param reject_reason [in] One of the BACNET_NETWORK_REJECT_REASONS codes.
* @param dnet [in] Which BACnet network orginated the message.
* @param dnet [in] Which BACnet network originated the message.
*/
void Send_Reject_Message_To_Network(
BACNET_ADDRESS *dst, uint8_t reject_reason, int dnet)
+1 -1
View File
@@ -65,7 +65,7 @@ extern "C" {
BACNET_DATE_TIME Event_Time_Stamps[MAX_BACNET_EVENT_TRANSITION];
/* time to generate event notification */
uint32_t Remaining_Time_Delay;
/* AckNotification informations */
/* AckNotification information */
ACK_NOTIFICATION Ack_notify_data;
#endif
} ANALOG_INPUT_DESCR;
+1 -1
View File
@@ -65,7 +65,7 @@ extern "C" {
BACNET_DATE_TIME Event_Time_Stamps[MAX_BACNET_EVENT_TRANSITION];
/* time to generate event notification */
uint32_t Remaining_Time_Delay;
/* AckNotification informations */
/* AckNotification information */
ACK_NOTIFICATION Ack_notify_data;
#endif
} ANALOG_VALUE_DESCR;
+2 -2
View File
@@ -682,7 +682,7 @@ int Command_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
for (i = 0; i < MAX_COMMAND_ACTIONS; i++) {
BACNET_ACTION_LIST *Curr_CL_Member =
&CurrentCommand->Action[0];
/* another loop, for aditional actions in the list */
/* another loop, for additional actions in the list */
for (; Curr_CL_Member != NULL;
Curr_CL_Member = Curr_CL_Member->next) {
len = cl_encode_apdu(
@@ -703,7 +703,7 @@ int Command_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
if (rpdata->array_index < MAX_COMMAND_ACTIONS) {
BACNET_ACTION_LIST *Curr_CL_Member =
&CurrentCommand->Action[rpdata->array_index];
/* another loop, for aditional actions in the list */
/* another loop, for additional actions in the list */
for (; Curr_CL_Member != NULL;
Curr_CL_Member = Curr_CL_Member->next) {
len = cl_encode_apdu(
+1 -1
View File
@@ -91,7 +91,7 @@ typedef bool(
/** Helper function to step through an array of objects and find either the
* first one or the next one of a given type. Used to step through an array
* of objects which is not necessarily contiguious for each type i.e. the
* of objects which is not necessarily contiguous for each type i.e. the
* index for the 'n'th object of a given type is not necessarily 'n'.
* @ingroup ObjHelpers
* @param [in] The index of the current object or a value of ~0 to indicate
+1 -1
View File
@@ -59,7 +59,7 @@
#if defined(BACFILE)
#include "bacnet/basic/object/bacfile.h" /* object list dependency */
#endif
/* os specfic includes */
/* os specific includes */
#include "bacnet/basic/sys/mstimer.h"
/* local forward and external prototypes */
+4 -4
View File
@@ -867,8 +867,8 @@ bool Load_Control_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
unsigned int object_index = 0;
int len = 0;
BACNET_APPLICATION_DATA_VALUE value;
BACNET_DATE
TempDate; /* build here in case of error in time half of datetime */
/* build here in case of error in time half of datetime */
BACNET_DATE start_date;
PRINTF("Load_Control_Write_Property(wp_data=%p)\n", wp_data);
if (wp_data == NULL) {
@@ -954,7 +954,7 @@ bool Load_Control_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
break;
}
/* Hold the date until we are sure the time is also there */
TempDate = value.type.Date;
start_date = value.type.Date;
len =
bacapp_decode_application_data(wp_data->application_data + len,
wp_data->application_data_len - len, &value);
@@ -963,7 +963,7 @@ bool Load_Control_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
BACNET_APPLICATION_TAG_TIME);
if (status) {
/* Write time and date and set written flag */
Start_Time[object_index].date = TempDate;
Start_Time[object_index].date = start_date;
Start_Time[object_index].time = value.type.Time;
Start_Time_Property_Written[object_index] = true;
}
+1 -1
View File
@@ -74,7 +74,7 @@ void Schedule_Init(void)
SCHEDULE_DESCR *psched = &Schedule_Descr[0];
for (i = 0; i < MAX_SCHEDULES; i++, psched++) {
/* whole year, change as neccessary */
/* whole year, change as necessary */
psched->Start_Date.year = 0xFF;
psched->Start_Date.month = 1;
psched->Start_Date.day = 1;
+10 -11
View File
@@ -231,7 +231,7 @@ void Trend_Log_Init(void)
/*
* Note: we use the instance number here and build the name based
* on the assumption that there is a 1 to 1 correspondance. If there
* on the assumption that there is a 1 to 1 correspondence. If there
* is not we need to convert to index before proceeding.
*/
bool Trend_Log_Object_Name(
@@ -419,8 +419,7 @@ bool Trend_Log_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
int len = 0;
BACNET_APPLICATION_DATA_VALUE value;
TL_LOG_INFO *CurrentLog;
BACNET_DATE
TempDate; /* build here in case of error in time half of datetime */
BACNET_DATE start_date, stop_date;
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE TempSource;
bool bEffectiveEnable;
int log_index;
@@ -574,7 +573,7 @@ bool Trend_Log_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
if (!status) {
break;
}
TempDate = value.type.Date;
start_date = value.type.Date;
/* Then decode the time part */
len =
bacapp_decode_application_data(wp_data->application_data + len,
@@ -588,8 +587,8 @@ bool Trend_Log_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
}
/* First record the current enable state of the log */
bEffectiveEnable = TL_Is_Enabled(log_index);
CurrentLog->StartTime.date =
TempDate; /* Safe to copy the date now */
/* Safe to copy the date now */
CurrentLog->StartTime.date = start_date;
CurrentLog->StartTime.time = value.type.Time;
if (datetime_wildcard_present(&CurrentLog->StartTime)) {
@@ -625,7 +624,7 @@ bool Trend_Log_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
if (!status) {
break;
}
TempDate = value.type.Date;
stop_date = value.type.Date;
/* Then decode the time part */
len =
bacapp_decode_application_data(wp_data->application_data + len,
@@ -639,8 +638,8 @@ bool Trend_Log_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
}
/* First record the current enable state of the log */
bEffectiveEnable = TL_Is_Enabled(log_index);
CurrentLog->StopTime.date =
TempDate; /* Safe to copy the date now */
/* Safe to copy the date now */
CurrentLog->StopTime.date = stop_date;
CurrentLog->StopTime.time = value.type.Time;
if (datetime_wildcard_present(&CurrentLog->StopTime)) {
@@ -988,7 +987,7 @@ void TL_Local_Time_To_BAC(BACNET_DATE_TIME *DestTime, time_t SourceTime)
* *
* We take the simple approach here to filling the buffer by taking a max *
* size for a single entry and then stopping if there is less than that *
* left in the buffer. You could build each entry in a seperate buffer and *
* left in the buffer. You could build each entry in a separate buffer and *
* determine the exact length before copying but this is time consuming, *
* requires more memory and would probably only let you sqeeeze one more *
* entry in on occasion. The value is calculated as 10 bytes for the time *
@@ -1740,7 +1739,7 @@ void trend_log_timer(uint16_t uSeconds)
* and the offset to decide when to log. Also log a reading
* if more than interval time has elapsed since last reading
* to ensure we don't miss a reading if we aren't called at
* the precise second when the match occurrs.
* the precise second when the match occurs.
*/
/* if(((tNow % CurrentLog->ulLogInterval) >=
* (CurrentLog->ulIntervalOffset %
+1 -1
View File
@@ -53,7 +53,7 @@ extern "C" {
/* Storage structure for Trend Log data
*
* Note. I've tried to minimise the storage requirements here
* Note. I've tried to minimize the storage requirements here
* as the memory requirements for logging in embedded
* implementations are frequently a big issue. For PC or
* embedded Linux type setupz this may seem like overkill
+1 -1
View File
@@ -169,7 +169,7 @@ void handler_get_event_information(uint8_t *service_request,
(apdu_len >= MAX_APDU - 2)) {
/* Device must be able to fit minimum
one event information.
Length of one event informations needs
Length of one event information needs
more than 50 octets. */
if ((service_data->max_resp < 128) ||
(MAX_APDU < 128)) {
+1 -1
View File
@@ -157,7 +157,7 @@ void handler_read_property(uint8_t *service_request,
if (apdu_len > service_data->max_resp) {
/* too big for the sender - send an abort!
Setting of error code needed here as read property
processing may have overriden the default set at start */
processing may have overridden the default set at start */
rpdata.error_code =
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
len = BACNET_STATUS_ABORT;
+1 -1
View File
@@ -116,7 +116,7 @@ static int Encode_RR_payload(uint8_t *apdu, BACNET_READ_RANGE_DATA *pRequest)
*
* @param service_request Pointer to the service request.
* @param service_len Bytes valid in the service request.
* @param src Pointer to the BACnet addresss.
* @param src Pointer to the BACnet address.
* @param service_data Pointer to the service data,
* taken from the request.
*/
+3 -3
View File
@@ -1,7 +1,7 @@
/* Derived from "Unix Incompatibility Notes: Byte Order" by Jan Wolter */
/* http://unixpapa.com/incnote/byteorder.html */
/** @file bigend.c Determination of Endianess */
/** @file bigend.c Determination of Endianness */
#include "bacnet/basic/sys/bigend.h"
@@ -9,7 +9,7 @@
/* Big-Endian systems save the most significant byte first. */
/* Sun and Motorola processors, IBM-370s and PDP-10s are big-endian. */
/* "Network Byte Order" is also know as "Big-Endian Byte Order" */
/* for example, a 4 byte integer 67305985 is 0x04030201 in hexidecimal. */
/* for example, a 4 byte integer 67305985 is 0x04030201 in hexadecimal. */
/* x[0] = 0x04 */
/* x[1] = 0x03 */
/* x[2] = 0x02 */
@@ -17,7 +17,7 @@
/* Little-Endian systems save the least significant byte first. */
/* The entire Intel x86 family, Vaxes, Alphas and PDP-11s are little-endian. */
/* for example, a 4 byte integer 67305985 is 0x04030201 in hexidecimal. */
/* for example, a 4 byte integer 67305985 is 0x04030201 in hexadecimal. */
/* x[0] = 0x01 */
/* x[1] = 0x02 */
/* x[2] = 0x03 */
+1 -1
View File
@@ -58,7 +58,7 @@
* FIFO_Init(&queue, data_store, sizeof(data_store));
* }
*
* Then begin to use the FIFO queue by giving it data, retreiving data,
* Then begin to use the FIFO queue by giving it data, retrieving data,
* and checking the FIFO queue to see if it is empty or full:
* {@code
* uint8_t in_data = 0;
+1 -1
View File
@@ -39,7 +39,7 @@ struct Keylist_Node {
typedef struct Keylist {
struct Keylist_Node **array; /* array of nodes */
int count; /* number of nodes in this list - more effecient than loop */
int count; /* number of nodes in this list - more efficient than loop */
int size; /* number of available nodes on this list - can grow or shrink */
} KEYLIST_TYPE;
typedef KEYLIST_TYPE *OS_Keylist;
+2 -2
View File
@@ -297,7 +297,7 @@ bool Ringbuf_Pop_Element(
*
* @param b - pointer to RING_BUFFER structure
* @param data_element - one element that is copied to the ring buffer
* @return true on succesful add, false if not added
* @return true on successful add, false if not added
*/
bool Ringbuf_Put(RING_BUFFER *b, uint8_t *data_element)
{
@@ -331,7 +331,7 @@ bool Ringbuf_Put(RING_BUFFER *b, uint8_t *data_element)
*
* @param b - pointer to RING_BUFFER structure
* @param data_element - one element to copy to the front of the ring
* @return true on succesful add, false if not added
* @return true on successful add, false if not added
*/
bool Ringbuf_Put_Front(RING_BUFFER *b, uint8_t *data_element)
{
+1 -1
View File
@@ -316,7 +316,7 @@ bool tsm_get_transaction_pdu(uint8_t invokeID,
/** Called once a millisecond or slower.
* This function calls the handler for a
* timeout 'Timeout_Function', if neccessary.
* timeout 'Timeout_Function', if necessary.
*
* @param milliseconds - Count of milliseconds passed, since the last call.
*/
+1 -1
View File
@@ -1252,7 +1252,7 @@ bool bvlc_foreign_device_table_entry_copy(
}
/**
* @brief Foreign-Device-Table timer maintainence
* @brief Foreign-Device-Table timer maintenance
* @param fdt_list - first element in list of FDT entries
* @param seconds - number of elapsed seconds since the last call
*/
+1 -1
View File
@@ -50,7 +50,7 @@ size_t cobs_crc32k_encode(uint8_t *buffer, size_t buffer_size, uint32_t crc)
/**
* @brief Accumulate "dataValue" into the CRC in "crc32kValue".
* @param dataValue new data value equivalent to one octet.
* @param crc32kValue accumulated alue equivalent to four octets.
* @param crc32kValue accumulated value equivalent to four octets.
* @return value is updated CRC.
* @note This function is copied directly from the BACnet standard.
*/
+1 -1
View File
@@ -220,7 +220,7 @@ extern "C" {
/***************************************************
**
** Sends an Unconfirmed Event Notifcation to a dest
** Sends an Unconfirmed Event Notification to a dest
**
****************************************************/
BACNET_STACK_EXPORT
+1 -1
View File
@@ -105,7 +105,7 @@ int lso_decode_service_request(
data->operation = (BACNET_LIFE_SAFETY_OPERATION)operation;
len += section_length;
/*
** This is an optional parameter, so dont fail if it doesnt exist
** This is an optional parameter, so don't fail if it doesn't exist
*/
if (decode_is_context_tag(&apdu[len], 3)) {
section_length = decode_context_object_id(&apdu[len], 3,
+1 -1
View File
@@ -91,7 +91,7 @@ int rp_encode_apdu(
/** Decode the service request only
*
* @param apdu Pointer to the buffer for encoding.
* @param apdu_len Count of valid bytes inthe buffer.
* @param apdu_len Count of valid bytes in the buffer.
* @param rpdata Pointer to the property data to be encoded.
*
* @return Bytes decoded or zero on error.
+2 -2
View File
@@ -162,7 +162,7 @@ int rpm_encode_apdu(uint8_t *apdu,
rpm_object = read_access_data;
while (rpm_object) {
/* The encode function will return a length not more than 12. So the
* temp buffer being 16 bytes is fine enought. */
* temp buffer being 16 bytes is fine enough. */
len = encode_context_object_id(&apdu_temp[0], 0,
rpm_object->object_type, rpm_object->object_instance);
len = (int)memcopy(&apdu[0], &apdu_temp[0], (size_t)apdu_len,
@@ -182,7 +182,7 @@ int rpm_encode_apdu(uint8_t *apdu,
rpm_property = rpm_object->listOfProperties;
while (rpm_property) {
/* The encode function will return a length not more than 12. So the
* temp buffer being 16 bytes is fine enought. Stuff as many
* temp buffer being 16 bytes is fine enough. Stuff as many
* properties into it as APDU length will allow. */
len = encode_context_enumerated(
&apdu_temp[0], 0, rpm_property->propertyIdentifier);
+2 -2
View File
@@ -47,7 +47,7 @@
* @param apdu [in] The contents of the APDU buffer.
* @param apdu_len [in] The length of the APDU buffer.
* @param wp_data [out] The BACNET_WRITE_PROPERTY_DATA structure
* which will contain the reponse values or error.
* which will contain the response values or error.
*
* @return Count of decoded bytes.
*/
@@ -152,7 +152,7 @@ int wpm_decode_object_property(
len++;
if (imax != BACNET_STATUS_ERROR) {
/* copy application data, check max lengh */
/* copy application data, check max length */
if (imax > (apdu_len - len)) {
imax = (apdu_len - len);
}