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
+50 -56
View File
@@ -36,7 +36,7 @@ typedef struct bacnet_npdu_data_t {
bool network_layer_message; /* false if APDU */
BACNET_MESSAGE_PRIORITY priority;
/* optional network message info */
BACNET_NETWORK_MESSAGE_TYPE network_message_type; /* optional */
BACNET_NETWORK_MESSAGE_TYPE network_message_type; /* optional */
uint16_t vendor_id; /* optional, if net message type is > 0x80 */
uint8_t hop_count;
} BACNET_NPDU_DATA, BACNET_NPCI_DATA;
@@ -47,11 +47,11 @@ struct router_port_t;
#define ROUTER_PORT_INFO_LEN 2
/** Port Info structure used by Routers for their routing table. */
typedef struct router_port_t {
uint16_t dnet; /**< The DNET number that identifies this port. */
uint8_t id; /**< Either 0 or some ill-defined, meaningless value. */
uint8_t info[ROUTER_PORT_INFO_LEN]; /**< Info like 'modem dialing string' */
uint8_t info_len; /**< Length of info[]. */
struct router_port_t *next; /**< Point to next in linked list */
uint16_t dnet; /**< The DNET number that identifies this port. */
uint8_t id; /**< Either 0 or some ill-defined, meaningless value. */
uint8_t info[ROUTER_PORT_INFO_LEN]; /**< Info like 'modem dialing string' */
uint8_t info_len; /**< Length of info[]. */
struct router_port_t *next; /**< Point to next in linked list */
} BACNET_ROUTER_PORT;
#define NETWORK_NUMBER_LEARNED 0
@@ -61,64 +61,58 @@ typedef struct router_port_t {
extern "C" {
#endif /* __cplusplus */
BACNET_STACK_EXPORT
uint8_t npdu_encode_max_seg_max_apdu(
int max_segs,
int max_apdu);
BACNET_STACK_EXPORT
uint8_t npdu_encode_max_seg_max_apdu(int max_segs, int max_apdu);
BACNET_STACK_EXPORT
int npdu_encode_pdu(
uint8_t * npdu,
BACNET_ADDRESS * dest,
BACNET_ADDRESS * src,
const BACNET_NPDU_DATA * npdu_data);
BACNET_STACK_EXPORT
int npdu_encode_pdu(
uint8_t *npdu,
BACNET_ADDRESS *dest,
BACNET_ADDRESS *src,
const BACNET_NPDU_DATA *npdu_data);
BACNET_STACK_EXPORT
int bacnet_npdu_encode_pdu(
uint8_t * pdu,
uint16_t pdu_size,
BACNET_ADDRESS * dest,
BACNET_ADDRESS * src,
const BACNET_NPDU_DATA * npdu_data);
BACNET_STACK_EXPORT
int bacnet_npdu_encode_pdu(
uint8_t *pdu,
uint16_t pdu_size,
BACNET_ADDRESS *dest,
BACNET_ADDRESS *src,
const BACNET_NPDU_DATA *npdu_data);
BACNET_STACK_EXPORT
void npdu_encode_npdu_data(
BACNET_NPDU_DATA * npdu,
bool data_expecting_reply,
BACNET_MESSAGE_PRIORITY priority);
BACNET_STACK_EXPORT
void npdu_encode_npdu_data(
BACNET_NPDU_DATA *npdu,
bool data_expecting_reply,
BACNET_MESSAGE_PRIORITY priority);
BACNET_STACK_EXPORT
void npdu_encode_npdu_network(
BACNET_NPDU_DATA *npdu_data,
BACNET_NETWORK_MESSAGE_TYPE network_message_type,
bool data_expecting_reply,
BACNET_MESSAGE_PRIORITY priority);
BACNET_STACK_EXPORT
void npdu_encode_npdu_network(
BACNET_NPDU_DATA *npdu_data,
BACNET_NETWORK_MESSAGE_TYPE network_message_type,
bool data_expecting_reply,
BACNET_MESSAGE_PRIORITY priority);
BACNET_STACK_EXPORT
void npdu_copy_data(
BACNET_NPDU_DATA * dest,
const BACNET_NPDU_DATA * src);
BACNET_STACK_EXPORT
void npdu_copy_data(BACNET_NPDU_DATA *dest, const BACNET_NPDU_DATA *src);
BACNET_STACK_DEPRECATED("Use bacnet_npdu_decode() instead")
BACNET_STACK_EXPORT
int npdu_decode(
const uint8_t * npdu,
BACNET_ADDRESS * dest,
BACNET_ADDRESS * src,
BACNET_NPDU_DATA * npdu_data);
BACNET_STACK_DEPRECATED("Use bacnet_npdu_decode() instead")
BACNET_STACK_EXPORT
int npdu_decode(
const uint8_t *npdu,
BACNET_ADDRESS *dest,
BACNET_ADDRESS *src,
BACNET_NPDU_DATA *npdu_data);
BACNET_STACK_EXPORT
int bacnet_npdu_decode(
const uint8_t * npdu,
uint16_t pdu_len,
BACNET_ADDRESS * dest,
BACNET_ADDRESS * src,
BACNET_NPDU_DATA * npdu_data);
BACNET_STACK_EXPORT
int bacnet_npdu_decode(
const uint8_t *npdu,
uint16_t pdu_len,
BACNET_ADDRESS *dest,
BACNET_ADDRESS *src,
BACNET_NPDU_DATA *npdu_data);
BACNET_STACK_EXPORT
bool npdu_confirmed_service(
const uint8_t *pdu,
uint16_t pdu_len);
BACNET_STACK_EXPORT
bool npdu_confirmed_service(const uint8_t *pdu, uint16_t pdu_len);
#ifdef __cplusplus
}