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:
+13
-11
@@ -36,8 +36,8 @@
|
||||
* @param data Pointer to the service data used for encoding values
|
||||
* @return number of bytes encoded, or zero if unable to encode
|
||||
*/
|
||||
size_t writeproperty_apdu_encode(
|
||||
uint8_t *apdu, const BACNET_WRITE_PROPERTY_DATA *data)
|
||||
size_t
|
||||
writeproperty_apdu_encode(uint8_t *apdu, const BACNET_WRITE_PROPERTY_DATA *data)
|
||||
{
|
||||
size_t apdu_len = 0; /* total length of the apdu, return value */
|
||||
size_t len = 0; /* total length of the apdu, return value */
|
||||
@@ -184,9 +184,7 @@ int wp_encode_apdu(
|
||||
* @return number of bytes decoded, or #BACNET_STATUS_ERROR
|
||||
*/
|
||||
int wp_decode_service_request(
|
||||
const uint8_t *apdu,
|
||||
unsigned apdu_size,
|
||||
BACNET_WRITE_PROPERTY_DATA *wpdata)
|
||||
const uint8_t *apdu, unsigned apdu_size, BACNET_WRITE_PROPERTY_DATA *wpdata)
|
||||
{
|
||||
int len = 0;
|
||||
int apdu_len = 0;
|
||||
@@ -305,7 +303,8 @@ int wp_decode_service_request(
|
||||
* @param expected_tag - the tag that is expected for this property value
|
||||
* @return true if the expected tag matches the value tag
|
||||
*/
|
||||
bool write_property_type_valid(BACNET_WRITE_PROPERTY_DATA *wp_data,
|
||||
bool write_property_type_valid(
|
||||
BACNET_WRITE_PROPERTY_DATA *wp_data,
|
||||
const BACNET_APPLICATION_DATA_VALUE *value,
|
||||
uint8_t expected_tag)
|
||||
{
|
||||
@@ -331,7 +330,8 @@ bool write_property_type_valid(BACNET_WRITE_PROPERTY_DATA *wp_data,
|
||||
* @param len_max - max length accepted for a character string, or 0=unchecked
|
||||
* @return true if the character string value is valid
|
||||
*/
|
||||
bool write_property_string_valid(BACNET_WRITE_PROPERTY_DATA *wp_data,
|
||||
bool write_property_string_valid(
|
||||
BACNET_WRITE_PROPERTY_DATA *wp_data,
|
||||
const BACNET_APPLICATION_DATA_VALUE *value,
|
||||
size_t len_max)
|
||||
{
|
||||
@@ -352,9 +352,10 @@ bool write_property_string_valid(BACNET_WRITE_PROPERTY_DATA *wp_data,
|
||||
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
||||
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
|
||||
}
|
||||
} else if ((len_max > 0) &&
|
||||
} else if (
|
||||
(len_max > 0) &&
|
||||
(characterstring_length(&value->type.Character_String) >
|
||||
len_max)) {
|
||||
len_max)) {
|
||||
if (wp_data) {
|
||||
wp_data->error_class = ERROR_CLASS_RESOURCES;
|
||||
wp_data->error_code = ERROR_CODE_NO_SPACE_TO_WRITE_PROPERTY;
|
||||
@@ -388,7 +389,8 @@ bool write_property_string_valid(BACNET_WRITE_PROPERTY_DATA *wp_data,
|
||||
* @param len_max - max length accepted for a character string, or 0=unchecked
|
||||
* @return true if the character string value is valid
|
||||
*/
|
||||
bool write_property_empty_string_valid(BACNET_WRITE_PROPERTY_DATA *wp_data,
|
||||
bool write_property_empty_string_valid(
|
||||
BACNET_WRITE_PROPERTY_DATA *wp_data,
|
||||
const BACNET_APPLICATION_DATA_VALUE *value,
|
||||
size_t len_max)
|
||||
{
|
||||
@@ -399,7 +401,7 @@ bool write_property_empty_string_valid(BACNET_WRITE_PROPERTY_DATA *wp_data,
|
||||
CHARACTER_ANSI_X34) {
|
||||
if ((len_max > 0) &&
|
||||
(characterstring_length(&value->type.Character_String) >
|
||||
len_max)) {
|
||||
len_max)) {
|
||||
if (wp_data) {
|
||||
wp_data->error_class = ERROR_CLASS_RESOURCES;
|
||||
wp_data->error_code = ERROR_CODE_NO_SPACE_TO_WRITE_PROPERTY;
|
||||
|
||||
Reference in New Issue
Block a user