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:
@@ -34,12 +34,14 @@ static char Object_Description[MAX_CHARACTERSTRING_VALUES][64];
|
||||
static bool Changed[MAX_CHARACTERSTRING_VALUES];
|
||||
|
||||
/* These three arrays are used by the ReadPropertyMultiple handler */
|
||||
static const int Properties_Required[] = { PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME, PROP_OBJECT_TYPE, PROP_PRESENT_VALUE, PROP_STATUS_FLAGS,
|
||||
-1 };
|
||||
static const int Properties_Required[] = {
|
||||
PROP_OBJECT_IDENTIFIER, PROP_OBJECT_NAME, PROP_OBJECT_TYPE,
|
||||
PROP_PRESENT_VALUE, PROP_STATUS_FLAGS, -1
|
||||
};
|
||||
|
||||
static const int Properties_Optional[] = { PROP_EVENT_STATE,
|
||||
PROP_OUT_OF_SERVICE, PROP_DESCRIPTION, -1 };
|
||||
PROP_OUT_OF_SERVICE,
|
||||
PROP_DESCRIPTION, -1 };
|
||||
|
||||
static const int Properties_Proprietary[] = { -1 };
|
||||
|
||||
@@ -76,9 +78,11 @@ void CharacterString_Value_Init(void)
|
||||
|
||||
/* initialize all Present Values */
|
||||
for (i = 0; i < MAX_CHARACTERSTRING_VALUES; i++) {
|
||||
snprintf(&Object_Name[i][0], sizeof(Object_Name[i]),
|
||||
snprintf(
|
||||
&Object_Name[i][0], sizeof(Object_Name[i]),
|
||||
"CHARACTER STRING VALUE %u", i + 1);
|
||||
snprintf(&Object_Description[i][0], sizeof(Object_Description[i]),
|
||||
snprintf(
|
||||
&Object_Description[i][0], sizeof(Object_Description[i]),
|
||||
"A Character String Value Example");
|
||||
characterstring_init_ansi(&Present_Value[i], "");
|
||||
Changed[i] = false;
|
||||
@@ -228,8 +232,8 @@ bool CharacterString_Value_Out_Of_Service(uint32_t object_instance)
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @param true/false
|
||||
*/
|
||||
static void CharacterString_Value_Out_Of_Service_Set(
|
||||
uint32_t object_instance, bool value)
|
||||
static void
|
||||
CharacterString_Value_Out_Of_Service_Set(uint32_t object_instance, bool value)
|
||||
{
|
||||
unsigned index = 0;
|
||||
|
||||
@@ -294,8 +298,8 @@ bool CharacterString_Value_Encode_Value_List(
|
||||
|
||||
index = CharacterString_Value_Instance_To_Index(object_instance);
|
||||
if (index < MAX_CHARACTERSTRING_VALUES) {
|
||||
status = cov_value_list_encode_character_string(value_list,
|
||||
&Present_Value[index], in_alarm, fault, overridden,
|
||||
status = cov_value_list_encode_character_string(
|
||||
value_list, &Present_Value[index], in_alarm, fault, overridden,
|
||||
Out_Of_Service[index]);
|
||||
}
|
||||
|
||||
@@ -349,7 +353,8 @@ bool CharacterString_Value_Description_Set(
|
||||
}
|
||||
}
|
||||
} else {
|
||||
memset(&Object_Description[index][0], 0,
|
||||
memset(
|
||||
&Object_Description[index][0], 0,
|
||||
sizeof(Object_Description[index]));
|
||||
}
|
||||
}
|
||||
@@ -454,8 +459,9 @@ int CharacterString_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
|
||||
switch (rpdata->object_property) {
|
||||
case PROP_OBJECT_IDENTIFIER:
|
||||
apdu_len = encode_application_object_id(&apdu[0],
|
||||
OBJECT_CHARACTERSTRING_VALUE, rpdata->object_instance);
|
||||
apdu_len = encode_application_object_id(
|
||||
&apdu[0], OBJECT_CHARACTERSTRING_VALUE,
|
||||
rpdata->object_instance);
|
||||
break;
|
||||
/* note: Name and Description don't have to be the same.
|
||||
You could make Description writable and different */
|
||||
@@ -467,7 +473,8 @@ int CharacterString_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
}
|
||||
break;
|
||||
case PROP_DESCRIPTION:
|
||||
if (characterstring_init_ansi(&char_string,
|
||||
if (characterstring_init_ansi(
|
||||
&char_string,
|
||||
CharacterString_Value_Description(
|
||||
rpdata->object_instance))) {
|
||||
apdu_len =
|
||||
|
||||
Reference in New Issue
Block a user