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
+37 -42
View File
@@ -16,8 +16,8 @@
#include "bacnet/bacdcode.h"
#include "bacnet/bacapp.h"
/** @note: write property can have application tagged data, or context tagged data,
or even complex data types (i.e. opening and closing tag around data).
/** @note: write property can have application tagged data, or context tagged
data, or even complex data types (i.e. opening and closing tag around data).
It could also have more than one value or element. */
typedef struct BACnet_Write_Property_Data {
@@ -29,7 +29,7 @@ typedef struct BACnet_Write_Property_Data {
BACNET_ARRAY_INDEX array_index;
uint8_t application_data[MAX_APDU];
int application_data_len;
uint8_t priority; /* use BACNET_NO_PRIORITY if no priority */
uint8_t priority; /* use BACNET_NO_PRIORITY if no priority */
BACNET_ERROR_CLASS error_class;
BACNET_ERROR_CODE error_code;
} BACNET_WRITE_PROPERTY_DATA;
@@ -44,52 +44,47 @@ typedef struct BACnet_Write_Property_Data {
* @return The length of the apdu encoded or -1 for error or
* -2 for abort message.
*/
typedef bool(
*write_property_function) (
BACNET_WRITE_PROPERTY_DATA * wp_data);
typedef bool (*write_property_function)(BACNET_WRITE_PROPERTY_DATA *wp_data);
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* encode service */
BACNET_STACK_EXPORT
size_t writeproperty_apdu_encode(
uint8_t *apdu,
const BACNET_WRITE_PROPERTY_DATA *data);
BACNET_STACK_EXPORT
size_t writeproperty_service_request_encode(
uint8_t *apdu,
size_t apdu_size,
const BACNET_WRITE_PROPERTY_DATA *data);
BACNET_STACK_EXPORT
int wp_encode_apdu(
uint8_t * apdu,
uint8_t invoke_id,
const BACNET_WRITE_PROPERTY_DATA * wp_data);
/* encode service */
BACNET_STACK_EXPORT
size_t writeproperty_apdu_encode(
uint8_t *apdu, const BACNET_WRITE_PROPERTY_DATA *data);
BACNET_STACK_EXPORT
size_t writeproperty_service_request_encode(
uint8_t *apdu, size_t apdu_size, const BACNET_WRITE_PROPERTY_DATA *data);
BACNET_STACK_EXPORT
int wp_encode_apdu(
uint8_t *apdu,
uint8_t invoke_id,
const BACNET_WRITE_PROPERTY_DATA *wp_data);
/* decode the service request only */
BACNET_STACK_EXPORT
int wp_decode_service_request(
const uint8_t * apdu,
unsigned apdu_len,
BACNET_WRITE_PROPERTY_DATA * wp_data);
/* decode the service request only */
BACNET_STACK_EXPORT
int wp_decode_service_request(
const uint8_t *apdu,
unsigned apdu_len,
BACNET_WRITE_PROPERTY_DATA *wp_data);
BACNET_STACK_EXPORT
bool write_property_type_valid(
BACNET_WRITE_PROPERTY_DATA * wp_data,
const BACNET_APPLICATION_DATA_VALUE * value,
uint8_t expected_tag);
BACNET_STACK_EXPORT
bool write_property_string_valid(
BACNET_WRITE_PROPERTY_DATA * wp_data,
const BACNET_APPLICATION_DATA_VALUE * value,
size_t len_max);
BACNET_STACK_EXPORT
bool write_property_empty_string_valid(
BACNET_WRITE_PROPERTY_DATA * wp_data,
const BACNET_APPLICATION_DATA_VALUE * value,
size_t len_max);
BACNET_STACK_EXPORT
bool write_property_type_valid(
BACNET_WRITE_PROPERTY_DATA *wp_data,
const BACNET_APPLICATION_DATA_VALUE *value,
uint8_t expected_tag);
BACNET_STACK_EXPORT
bool write_property_string_valid(
BACNET_WRITE_PROPERTY_DATA *wp_data,
const BACNET_APPLICATION_DATA_VALUE *value,
size_t len_max);
BACNET_STACK_EXPORT
bool write_property_empty_string_valid(
BACNET_WRITE_PROPERTY_DATA *wp_data,
const BACNET_APPLICATION_DATA_VALUE *value,
size_t len_max);
#ifdef __cplusplus
}