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:
@@ -48,11 +48,14 @@ static const BACNET_OBJECT_TYPE Object_Type = OBJECT_LIFE_SAFETY_ZONE;
|
||||
|
||||
/* These three arrays are used by the ReadPropertyMultiple handler */
|
||||
static const int Life_Safety_Zone_Properties_Required[] = {
|
||||
PROP_OBJECT_IDENTIFIER, PROP_OBJECT_NAME, PROP_OBJECT_TYPE,
|
||||
PROP_PRESENT_VALUE, PROP_TRACKING_VALUE, PROP_STATUS_FLAGS,
|
||||
PROP_EVENT_STATE, PROP_RELIABILITY, PROP_OUT_OF_SERVICE, PROP_MODE,
|
||||
PROP_ACCEPTED_MODES, PROP_SILENCED, PROP_OPERATION_EXPECTED,
|
||||
PROP_ZONE_MEMBERS, PROP_MAINTENANCE_REQUIRED, -1
|
||||
PROP_OBJECT_IDENTIFIER, PROP_OBJECT_NAME,
|
||||
PROP_OBJECT_TYPE, PROP_PRESENT_VALUE,
|
||||
PROP_TRACKING_VALUE, PROP_STATUS_FLAGS,
|
||||
PROP_EVENT_STATE, PROP_RELIABILITY,
|
||||
PROP_OUT_OF_SERVICE, PROP_MODE,
|
||||
PROP_ACCEPTED_MODES, PROP_SILENCED,
|
||||
PROP_OPERATION_EXPECTED, PROP_ZONE_MEMBERS,
|
||||
PROP_MAINTENANCE_REQUIRED, -1
|
||||
};
|
||||
|
||||
static const int Life_Safety_Zone_Properties_Optional[] = { -1 };
|
||||
@@ -147,8 +150,8 @@ unsigned Life_Safety_Zone_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_Zone_Present_Value(
|
||||
uint32_t object_instance)
|
||||
BACNET_LIFE_SAFETY_STATE
|
||||
Life_Safety_Zone_Present_Value(uint32_t object_instance)
|
||||
{
|
||||
BACNET_LIFE_SAFETY_STATE value = LIFE_SAFETY_STATE_QUIET;
|
||||
struct object_data *pObject;
|
||||
@@ -205,7 +208,8 @@ bool Life_Safety_Zone_Object_Name(
|
||||
status =
|
||||
characterstring_init_ansi(object_name, pObject->Object_Name);
|
||||
} else {
|
||||
snprintf(name_text, sizeof(name_text), "LIFE-SAFETY-ZONE-%u",
|
||||
snprintf(
|
||||
name_text, sizeof(name_text), "LIFE-SAFETY-ZONE-%u",
|
||||
object_instance);
|
||||
status = characterstring_init_ansi(object_name, name_text);
|
||||
}
|
||||
@@ -339,8 +343,8 @@ bool Life_Safety_Zone_Mode_Set(
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @return property value
|
||||
*/
|
||||
BACNET_LIFE_SAFETY_OPERATION Life_Safety_Zone_Operation_Expected(
|
||||
uint32_t object_instance)
|
||||
BACNET_LIFE_SAFETY_OPERATION
|
||||
Life_Safety_Zone_Operation_Expected(uint32_t object_instance)
|
||||
{
|
||||
BACNET_LIFE_SAFETY_OPERATION value = LIFE_SAFETY_OP_NONE;
|
||||
struct object_data *pObject;
|
||||
@@ -525,16 +529,14 @@ bool Life_Safety_Zone_Members_Add(
|
||||
status = Keylist_Data_Add(
|
||||
pObject->Zone_Members, Keylist_Count(pObject->Zone_Members), entry);
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Remove all members from the Zone Members list
|
||||
* @param object_instance - object-instance number of the object
|
||||
*/
|
||||
void Life_Safety_Zone_Members_Clear(
|
||||
uint32_t object_instance)
|
||||
*/
|
||||
void Life_Safety_Zone_Members_Clear(uint32_t object_instance)
|
||||
{
|
||||
struct object_data *pObject;
|
||||
|
||||
@@ -549,7 +551,7 @@ void Life_Safety_Zone_Members_Clear(
|
||||
* @param wp_data - BACNET_WRITE_PROPERTY_DATA data, including
|
||||
* requested data and space for the reply, or error response.
|
||||
* @return true if the list was written
|
||||
*/
|
||||
*/
|
||||
static bool Life_Safety_Zone_Members_Write(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
{
|
||||
int len = 0, apdu_len = 0, apdu_size = 0;
|
||||
@@ -599,13 +601,14 @@ bool Life_Safety_Zone_Maintenance_Required(uint32_t object_instance)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief For a given object instance-number, sets the maintenance-required status
|
||||
* flag
|
||||
* @brief For a given object instance-number, sets the maintenance-required
|
||||
* status flag
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @param value - boolean property value
|
||||
* @return true if the property flag was set
|
||||
*/
|
||||
void Life_Safety_Zone_Maintenance_Required_Set(uint32_t object_instance, bool value)
|
||||
void Life_Safety_Zone_Maintenance_Required_Set(
|
||||
uint32_t object_instance, bool value)
|
||||
{
|
||||
struct object_data *pObject;
|
||||
|
||||
@@ -774,7 +777,8 @@ bool Life_Safety_Zone_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_Zone_Mode_Set(wp_data->object_instance,
|
||||
Life_Safety_Zone_Mode_Set(
|
||||
wp_data->object_instance,
|
||||
(BACNET_LIFE_SAFETY_MODE)value.type.Enumerated);
|
||||
} else {
|
||||
status = false;
|
||||
@@ -788,7 +792,8 @@ bool Life_Safety_Zone_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_Zone_Present_Value_Set(wp_data->object_instance,
|
||||
Life_Safety_Zone_Present_Value_Set(
|
||||
wp_data->object_instance,
|
||||
(BACNET_LIFE_SAFETY_STATE)value.type.Enumerated);
|
||||
} else {
|
||||
status = false;
|
||||
@@ -810,7 +815,8 @@ bool Life_Safety_Zone_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_Zone_Silenced_Set(wp_data->object_instance,
|
||||
Life_Safety_Zone_Silenced_Set(
|
||||
wp_data->object_instance,
|
||||
(BACNET_SILENCED_STATE)value.type.Enumerated);
|
||||
} else {
|
||||
status = false;
|
||||
@@ -839,10 +845,10 @@ bool Life_Safety_Zone_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
break;
|
||||
default:
|
||||
if (property_lists_member(
|
||||
Life_Safety_Zone_Properties_Required,
|
||||
Life_Safety_Zone_Properties_Optional,
|
||||
Life_Safety_Zone_Properties_Proprietary,
|
||||
wp_data->object_property)) {
|
||||
Life_Safety_Zone_Properties_Required,
|
||||
Life_Safety_Zone_Properties_Optional,
|
||||
Life_Safety_Zone_Properties_Proprietary,
|
||||
wp_data->object_property)) {
|
||||
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
||||
wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user