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
+21 -11
View File
@@ -24,11 +24,19 @@ static ACCESS_CREDENTIAL_DESCR ac_descr[MAX_ACCESS_CREDENTIALS];
/* These three arrays are used by the ReadPropertyMultiple handler */
static const int Properties_Required[] = { PROP_OBJECT_IDENTIFIER,
PROP_OBJECT_NAME, PROP_OBJECT_TYPE, PROP_GLOBAL_IDENTIFIER,
PROP_STATUS_FLAGS, PROP_RELIABILITY, PROP_CREDENTIAL_STATUS,
PROP_REASON_FOR_DISABLE, PROP_AUTHENTICATION_FACTORS, PROP_ACTIVATION_TIME,
PROP_EXPIRATION_TIME, PROP_CREDENTIAL_DISABLE, PROP_ASSIGNED_ACCESS_RIGHTS,
-1 };
PROP_OBJECT_NAME,
PROP_OBJECT_TYPE,
PROP_GLOBAL_IDENTIFIER,
PROP_STATUS_FLAGS,
PROP_RELIABILITY,
PROP_CREDENTIAL_STATUS,
PROP_REASON_FOR_DISABLE,
PROP_AUTHENTICATION_FACTORS,
PROP_ACTIVATION_TIME,
PROP_EXPIRATION_TIME,
PROP_CREDENTIAL_DISABLE,
PROP_ASSIGNED_ACCESS_RIGHTS,
-1 };
static const int Properties_Optional[] = { -1 };
@@ -123,7 +131,8 @@ bool Access_Credential_Object_Name(
bool status = false;
if (object_instance < MAX_ACCESS_CREDENTIALS) {
snprintf(text, sizeof(text), "ACCESS CREDENTIAL %lu",
snprintf(
text, sizeof(text), "ACCESS CREDENTIAL %lu",
(unsigned long)object_instance);
status = characterstring_init_ansi(object_name, text);
}
@@ -250,8 +259,8 @@ int Access_Credential_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
}
break;
case PROP_AUTHENTICATION_FACTORS:
apdu_len = bacnet_array_encode(rpdata->object_instance,
rpdata->array_index,
apdu_len = bacnet_array_encode(
rpdata->object_instance, rpdata->array_index,
Access_Credential_Authentication_Factor_Array_Encode,
ac_descr[object_index].auth_factors_count, apdu, apdu_size);
if (apdu_len == BACNET_STATUS_ABORT) {
@@ -275,10 +284,11 @@ int Access_Credential_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
&apdu[0], ac_descr[object_index].credential_disable);
break;
case PROP_ASSIGNED_ACCESS_RIGHTS:
apdu_len = bacnet_array_encode(rpdata->object_instance,
rpdata->array_index,
apdu_len = bacnet_array_encode(
rpdata->object_instance, rpdata->array_index,
Access_Credential_Assigned_Access_Rights_Array_Encode,
ac_descr[object_index].assigned_access_rights_count, apdu, apdu_size);
ac_descr[object_index].assigned_access_rights_count, apdu,
apdu_size);
if (apdu_len == BACNET_STATUS_ABORT) {
rpdata->error_code =
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;