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
+19 -12
View File
@@ -38,10 +38,13 @@ static const BACNET_OBJECT_TYPE Object_Type = OBJECT_LIFE_SAFETY_POINT;
/* These three arrays are used by the ReadPropertyMultiple handler */
static const int Life_Safety_Point_Properties_Required[] = {
PROP_OBJECT_IDENTIFIER, PROP_OBJECT_NAME, PROP_OBJECT_TYPE,
PROP_PRESENT_VALUE, PROP_TRACKING_VALUE, PROP_STATUS_FLAGS,
PROP_EVENT_STATE, PROP_OUT_OF_SERVICE, PROP_RELIABILITY, PROP_MODE,
PROP_ACCEPTED_MODES, PROP_SILENCED, PROP_OPERATION_EXPECTED, -1
PROP_OBJECT_IDENTIFIER, PROP_OBJECT_NAME,
PROP_OBJECT_TYPE, PROP_PRESENT_VALUE,
PROP_TRACKING_VALUE, PROP_STATUS_FLAGS,
PROP_EVENT_STATE, PROP_OUT_OF_SERVICE,
PROP_RELIABILITY, PROP_MODE,
PROP_ACCEPTED_MODES, PROP_SILENCED,
PROP_OPERATION_EXPECTED, -1
};
static const int Life_Safety_Point_Properties_Optional[] = { -1 };
@@ -136,8 +139,8 @@ unsigned Life_Safety_Point_Instance_To_Index(uint32_t object_instance)
* @param object_instance - object-instance number of the object
* @return present-value of the object
*/
BACNET_LIFE_SAFETY_STATE Life_Safety_Point_Present_Value(
uint32_t object_instance)
BACNET_LIFE_SAFETY_STATE
Life_Safety_Point_Present_Value(uint32_t object_instance)
{
BACNET_LIFE_SAFETY_STATE value = LIFE_SAFETY_STATE_QUIET;
struct object_data *pObject;
@@ -194,7 +197,8 @@ bool Life_Safety_Point_Object_Name(
status =
characterstring_init_ansi(object_name, pObject->Object_Name);
} else {
snprintf(name_text, sizeof(name_text), "LIFE-SAFETY-POINT-%u",
snprintf(
name_text, sizeof(name_text), "LIFE-SAFETY-POINT-%u",
object_instance);
status = characterstring_init_ansi(object_name, name_text);
}
@@ -328,8 +332,8 @@ bool Life_Safety_Point_Mode_Set(
* @param object_instance - object-instance number of the object
* @return property value
*/
BACNET_LIFE_SAFETY_OPERATION Life_Safety_Point_Operation_Expected(
uint32_t object_instance)
BACNET_LIFE_SAFETY_OPERATION
Life_Safety_Point_Operation_Expected(uint32_t object_instance)
{
BACNET_LIFE_SAFETY_OPERATION value = LIFE_SAFETY_OP_NONE;
struct object_data *pObject;
@@ -545,7 +549,8 @@ int Life_Safety_Point_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
apdu_len = encode_application_enumerated(&apdu[0], silenced_state);
break;
case PROP_OPERATION_EXPECTED:
operation = Life_Safety_Point_Operation_Expected(rpdata->object_instance);
operation =
Life_Safety_Point_Operation_Expected(rpdata->object_instance);
apdu_len = encode_application_enumerated(&apdu[0], operation);
break;
default:
@@ -593,7 +598,8 @@ bool Life_Safety_Point_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
if (status) {
if (value.type.Enumerated <= MAX_LIFE_SAFETY_MODE) {
Life_Safety_Point_Mode_Set(wp_data->object_instance,
Life_Safety_Point_Mode_Set(
wp_data->object_instance,
(BACNET_LIFE_SAFETY_MODE)value.type.Enumerated);
} else {
status = false;
@@ -630,7 +636,8 @@ bool Life_Safety_Point_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
if (status) {
if (value.type.Enumerated <= UINT16_MAX) {
Life_Safety_Point_Silenced_Set(wp_data->object_instance,
Life_Safety_Point_Silenced_Set(
wp_data->object_instance,
(BACNET_SILENCED_STATE)value.type.Enumerated);
} else {
status = false;