Run clang-format and enable CI check for it (#755)

* pre-commit: Update and enable clang-format check

There is newer version from clang-format so use that. We do not yet want
18 as that is little bit too new.

* Format some thing by hand which clang-format "breaks"

Clang-format will format some things little bit off in some cases.
Format some things by hand so we get cleaner end result.

* Run clang-format with

```
pre-commit run --all-files clang-format
```

We have already in previously checked places where clang-format does not
make good format and ignored those (hopefully most of the things).

---------

Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
This commit is contained in:
Kari Argillander
2024-08-30 19:20:58 +03:00
committed by GitHub
parent 622a9e609e
commit f806c5829b
547 changed files with 18286 additions and 16575 deletions
+92 -115
View File
@@ -28,8 +28,8 @@
* }
*/
typedef struct BACnetHostNPort {
bool host_ip_address:1;
bool host_name:1;
bool host_ip_address : 1;
bool host_name : 1;
union BACnetHostAddress {
/* none = host_ip_address AND host_name are FALSE */
BACNET_OCTET_STRING ip_address;
@@ -70,121 +70,98 @@ typedef struct BACnetFDTEntry {
extern "C" {
#endif /* __cplusplus */
BACNET_STACK_EXPORT
int host_n_port_address_encode(
uint8_t *apdu,
const BACNET_HOST_N_PORT *address);
BACNET_STACK_EXPORT
int host_n_port_encode(
uint8_t * apdu,
const BACNET_HOST_N_PORT *address);
BACNET_STACK_EXPORT
int host_n_port_context_encode(
uint8_t * apdu,
uint8_t tag_number,
const BACNET_HOST_N_PORT *address);
BACNET_STACK_EXPORT
int host_n_port_address_decode(const uint8_t *apdu,
uint32_t apdu_size,
BACNET_ERROR_CODE *error_code,
BACNET_HOST_N_PORT *address);
BACNET_STACK_EXPORT
int host_n_port_decode(const uint8_t *apdu,
uint32_t apdu_len,
BACNET_ERROR_CODE *error_code,
BACNET_HOST_N_PORT *address);
BACNET_STACK_EXPORT
int host_n_port_context_decode(const uint8_t *apdu,
uint32_t apdu_size,
uint8_t tag_number,
BACNET_ERROR_CODE *error_code,
BACNET_HOST_N_PORT *address);
BACNET_STACK_EXPORT
bool host_n_port_copy(
BACNET_HOST_N_PORT * dst,
const BACNET_HOST_N_PORT * src);
BACNET_STACK_EXPORT
bool host_n_port_same(
const BACNET_HOST_N_PORT * dst,
const BACNET_HOST_N_PORT * src);
BACNET_STACK_EXPORT
bool host_n_port_from_ascii(
BACNET_HOST_N_PORT *value,
const char *argv);
BACNET_STACK_EXPORT
int host_n_port_address_encode(
uint8_t *apdu, const BACNET_HOST_N_PORT *address);
BACNET_STACK_EXPORT
int host_n_port_encode(uint8_t *apdu, const BACNET_HOST_N_PORT *address);
BACNET_STACK_EXPORT
int host_n_port_context_encode(
uint8_t *apdu, uint8_t tag_number, const BACNET_HOST_N_PORT *address);
BACNET_STACK_EXPORT
int host_n_port_address_decode(
const uint8_t *apdu,
uint32_t apdu_size,
BACNET_ERROR_CODE *error_code,
BACNET_HOST_N_PORT *address);
BACNET_STACK_EXPORT
int host_n_port_decode(
const uint8_t *apdu,
uint32_t apdu_len,
BACNET_ERROR_CODE *error_code,
BACNET_HOST_N_PORT *address);
BACNET_STACK_EXPORT
int host_n_port_context_decode(
const uint8_t *apdu,
uint32_t apdu_size,
uint8_t tag_number,
BACNET_ERROR_CODE *error_code,
BACNET_HOST_N_PORT *address);
BACNET_STACK_EXPORT
bool host_n_port_copy(BACNET_HOST_N_PORT *dst, const BACNET_HOST_N_PORT *src);
BACNET_STACK_EXPORT
bool host_n_port_same(
const BACNET_HOST_N_PORT *dst, const BACNET_HOST_N_PORT *src);
BACNET_STACK_EXPORT
bool host_n_port_from_ascii(BACNET_HOST_N_PORT *value, const char *argv);
BACNET_STACK_EXPORT
int bacnet_bdt_entry_encode(
uint8_t * apdu,
const BACNET_BDT_ENTRY *entry);
BACNET_STACK_EXPORT
int bacnet_bdt_entry_context_encode(
uint8_t * apdu,
uint8_t tag_number,
const BACNET_BDT_ENTRY *entry);
BACNET_STACK_EXPORT
int bacnet_bdt_entry_decode(const uint8_t *apdu,
uint32_t apdu_len,
BACNET_ERROR_CODE *error_code,
BACNET_BDT_ENTRY *address);
BACNET_STACK_EXPORT
int bacnet_bdt_entry_context_decode(const uint8_t *apdu,
uint32_t apdu_size,
uint8_t tag_number,
BACNET_ERROR_CODE *error_code,
BACNET_BDT_ENTRY *address);
BACNET_STACK_EXPORT
bool bacnet_bdt_entry_copy(
BACNET_BDT_ENTRY * dst,
const BACNET_BDT_ENTRY * src);
BACNET_STACK_EXPORT
bool bacnet_bdt_entry_same(
const BACNET_BDT_ENTRY * dst,
const BACNET_BDT_ENTRY * src);
BACNET_STACK_EXPORT
bool bacnet_bdt_entry_from_ascii(
BACNET_BDT_ENTRY *value,
const char *argv);
BACNET_STACK_EXPORT
int bacnet_bdt_entry_to_ascii(
char *str, size_t str_size,
const BACNET_BDT_ENTRY *value);
BACNET_STACK_EXPORT
int bacnet_bdt_entry_encode(uint8_t *apdu, const BACNET_BDT_ENTRY *entry);
BACNET_STACK_EXPORT
int bacnet_bdt_entry_context_encode(
uint8_t *apdu, uint8_t tag_number, const BACNET_BDT_ENTRY *entry);
BACNET_STACK_EXPORT
int bacnet_bdt_entry_decode(
const uint8_t *apdu,
uint32_t apdu_len,
BACNET_ERROR_CODE *error_code,
BACNET_BDT_ENTRY *address);
BACNET_STACK_EXPORT
int bacnet_bdt_entry_context_decode(
const uint8_t *apdu,
uint32_t apdu_size,
uint8_t tag_number,
BACNET_ERROR_CODE *error_code,
BACNET_BDT_ENTRY *address);
BACNET_STACK_EXPORT
bool bacnet_bdt_entry_copy(BACNET_BDT_ENTRY *dst, const BACNET_BDT_ENTRY *src);
BACNET_STACK_EXPORT
bool bacnet_bdt_entry_same(
const BACNET_BDT_ENTRY *dst, const BACNET_BDT_ENTRY *src);
BACNET_STACK_EXPORT
bool bacnet_bdt_entry_from_ascii(BACNET_BDT_ENTRY *value, const char *argv);
BACNET_STACK_EXPORT
int bacnet_bdt_entry_to_ascii(
char *str, size_t str_size, const BACNET_BDT_ENTRY *value);
BACNET_STACK_EXPORT
int bacnet_fdt_entry_encode(
uint8_t * apdu,
const BACNET_FDT_ENTRY *entry);
BACNET_STACK_EXPORT
int bacnet_fdt_entry_context_encode(
uint8_t * apdu,
uint8_t tag_number,
const BACNET_FDT_ENTRY *entry);
BACNET_STACK_EXPORT
int bacnet_fdt_entry_decode(const uint8_t *apdu,
uint32_t apdu_len,
BACNET_ERROR_CODE *error_code,
BACNET_FDT_ENTRY *address);
BACNET_STACK_EXPORT
int bacnet_fdt_entry_context_decode(const uint8_t *apdu,
uint32_t apdu_size,
uint8_t tag_number,
BACNET_ERROR_CODE *error_code,
BACNET_FDT_ENTRY *address);
BACNET_STACK_EXPORT
bool bacnet_fdt_entry_copy(
BACNET_FDT_ENTRY * dst,
const BACNET_FDT_ENTRY * src);
BACNET_STACK_EXPORT
bool bacnet_fdt_entry_same(
const BACNET_FDT_ENTRY * dst,
const BACNET_FDT_ENTRY * src);
BACNET_STACK_EXPORT
bool bacnet_fdt_entry_from_ascii(
BACNET_FDT_ENTRY *value,
const char *argv);
BACNET_STACK_EXPORT
int bacnet_fdt_entry_to_ascii(
char *str, size_t str_size,
const BACNET_FDT_ENTRY *value);
BACNET_STACK_EXPORT
int bacnet_fdt_entry_encode(uint8_t *apdu, const BACNET_FDT_ENTRY *entry);
BACNET_STACK_EXPORT
int bacnet_fdt_entry_context_encode(
uint8_t *apdu, uint8_t tag_number, const BACNET_FDT_ENTRY *entry);
BACNET_STACK_EXPORT
int bacnet_fdt_entry_decode(
const uint8_t *apdu,
uint32_t apdu_len,
BACNET_ERROR_CODE *error_code,
BACNET_FDT_ENTRY *address);
BACNET_STACK_EXPORT
int bacnet_fdt_entry_context_decode(
const uint8_t *apdu,
uint32_t apdu_size,
uint8_t tag_number,
BACNET_ERROR_CODE *error_code,
BACNET_FDT_ENTRY *address);
BACNET_STACK_EXPORT
bool bacnet_fdt_entry_copy(BACNET_FDT_ENTRY *dst, const BACNET_FDT_ENTRY *src);
BACNET_STACK_EXPORT
bool bacnet_fdt_entry_same(
const BACNET_FDT_ENTRY *dst, const BACNET_FDT_ENTRY *src);
BACNET_STACK_EXPORT
bool bacnet_fdt_entry_from_ascii(BACNET_FDT_ENTRY *value, const char *argv);
BACNET_STACK_EXPORT
int bacnet_fdt_entry_to_ascii(
char *str, size_t str_size, const BACNET_FDT_ENTRY *value);
#ifdef __cplusplus
}