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:
+29
-24
@@ -162,7 +162,8 @@ static int bbmd_register_as_foreign_device(void)
|
||||
}
|
||||
if (BBMD_Address_Valid) {
|
||||
if (BIP_DL_Debug) {
|
||||
fprintf(stderr,
|
||||
fprintf(
|
||||
stderr,
|
||||
"Registering with BBMD at %u.%u.%u.%u:%u for %u seconds\n",
|
||||
(unsigned)BBMD_Address.address[0],
|
||||
(unsigned)BBMD_Address.address[1],
|
||||
@@ -172,7 +173,8 @@ static int bbmd_register_as_foreign_device(void)
|
||||
}
|
||||
retval = bvlc_register_with_bbmd(&BBMD_Address, BBMD_TTL_Seconds);
|
||||
if (retval < 0) {
|
||||
fprintf(stderr, "FAILED to Register with BBMD at %u.%u.%u.%u:%u\n",
|
||||
fprintf(
|
||||
stderr, "FAILED to Register with BBMD at %u.%u.%u.%u:%u\n",
|
||||
(unsigned)BBMD_Address.address[0],
|
||||
(unsigned)BBMD_Address.address[1],
|
||||
(unsigned)BBMD_Address.address[2],
|
||||
@@ -190,7 +192,8 @@ static int bbmd_register_as_foreign_device(void)
|
||||
bip_get_addr_by_name(pEnv, &BBMD_Table_Entry.dest_address);
|
||||
if (entry_number == 1) {
|
||||
if (BIP_DL_Debug) {
|
||||
fprintf(stderr, "BBMD 1 address overridden %s=%s!\n",
|
||||
fprintf(
|
||||
stderr, "BBMD 1 address overridden %s=%s!\n",
|
||||
bbmd_env, pEnv);
|
||||
}
|
||||
}
|
||||
@@ -208,7 +211,8 @@ static int bbmd_register_as_foreign_device(void)
|
||||
bdt_entry_port = strtol(pEnv, NULL, 0);
|
||||
if (entry_number == 1) {
|
||||
if (BIP_DL_Debug) {
|
||||
fprintf(stderr, "BBMD 1 port overridden %s=%s!\n",
|
||||
fprintf(
|
||||
stderr, "BBMD 1 port overridden %s=%s!\n",
|
||||
bbmd_env, pEnv);
|
||||
}
|
||||
}
|
||||
@@ -236,7 +240,8 @@ static int bbmd_register_as_foreign_device(void)
|
||||
bvlc_broadcast_distribution_table_entry_append(
|
||||
bvlc_bdt_list(), &BBMD_Table_Entry);
|
||||
if (BIP_DL_Debug) {
|
||||
fprintf(stderr, "BBMD %4u: %u.%u.%u.%u:%u %u.%u.%u.%u\n",
|
||||
fprintf(
|
||||
stderr, "BBMD %4u: %u.%u.%u.%u:%u %u.%u.%u.%u\n",
|
||||
entry_number,
|
||||
(unsigned)BBMD_Table_Entry.dest_address.address[0],
|
||||
(unsigned)BBMD_Table_Entry.dest_address.address[1],
|
||||
@@ -303,14 +308,15 @@ static int bbmd6_register_as_foreign_device(void)
|
||||
pEnv = getenv("BACNET_BBMD6_ADDRESS");
|
||||
if (bvlc6_address_from_ascii(pEnv, &bip6_addr)) {
|
||||
if (BIP_DL_Debug) {
|
||||
fprintf(stderr,
|
||||
"Registering with BBMD6 at %s for %u seconds\n",
|
||||
pEnv, (unsigned)bip6_port, (unsigned)BBMD_TTL_Seconds);
|
||||
fprintf(
|
||||
stderr, "Registering with BBMD6 at %s for %u seconds\n", pEnv,
|
||||
(unsigned)bip6_port, (unsigned)BBMD_TTL_Seconds);
|
||||
}
|
||||
retval = bvlc6_register_with_bbmd(&bip6_addr, BBMD_TTL_Seconds);
|
||||
if (retval < 0) {
|
||||
fprintf(stderr, "FAILED to Register with BBMD6 at %s:%u\n",
|
||||
pEnv, (unsigned)BBMD_Address.port);
|
||||
fprintf(
|
||||
stderr, "FAILED to Register with BBMD6 at %s:%u\n", pEnv,
|
||||
(unsigned)BBMD_Address.port);
|
||||
}
|
||||
BBMD_Timer_Seconds = BBMD_TTL_Seconds;
|
||||
}
|
||||
@@ -361,19 +367,16 @@ void dlenv_network_port_init(void)
|
||||
bip_get_addr(&addr);
|
||||
prefix = bip_get_subnet_prefix();
|
||||
if (BIP_DL_Debug) {
|
||||
fprintf(stderr,
|
||||
"BIP: Setting Network Port %lu address %u.%u.%u.%u:%u/%u\n",
|
||||
(unsigned long)instance,
|
||||
(unsigned)addr.address[0],
|
||||
(unsigned)addr.address[1],
|
||||
(unsigned)addr.address[2],
|
||||
(unsigned)addr.address[3],
|
||||
(unsigned)addr.port,
|
||||
(unsigned)prefix);
|
||||
fprintf(
|
||||
stderr, "BIP: Setting Network Port %lu address %u.%u.%u.%u:%u/%u\n",
|
||||
(unsigned long)instance, (unsigned)addr.address[0],
|
||||
(unsigned)addr.address[1], (unsigned)addr.address[2],
|
||||
(unsigned)addr.address[3], (unsigned)addr.port, (unsigned)prefix);
|
||||
}
|
||||
Network_Port_BIP_Port_Set(instance, addr.port);
|
||||
Network_Port_IP_Address_Set(instance, addr.address[0], addr.address[1],
|
||||
addr.address[2], addr.address[3]);
|
||||
Network_Port_IP_Address_Set(
|
||||
instance, addr.address[0], addr.address[1], addr.address[2],
|
||||
addr.address[3]);
|
||||
Network_Port_IP_Subnet_Prefix_Set(instance, prefix);
|
||||
Network_Port_Link_Speed_Set(instance, 0.0);
|
||||
#if BBMD_ENABLED
|
||||
@@ -567,11 +570,13 @@ void dlenv_init(void)
|
||||
}
|
||||
pEnv = getenv("BACNET_BIP6_BROADCAST");
|
||||
if (pEnv) {
|
||||
bvlc6_address_set(&addr, (uint16_t)strtol(pEnv, NULL, 0), 0, 0, 0, 0, 0,
|
||||
0, BIP6_MULTICAST_GROUP_ID);
|
||||
bvlc6_address_set(
|
||||
&addr, (uint16_t)strtol(pEnv, NULL, 0), 0, 0, 0, 0, 0, 0,
|
||||
BIP6_MULTICAST_GROUP_ID);
|
||||
bip6_set_broadcast_addr(&addr);
|
||||
} else {
|
||||
bvlc6_address_set(&addr, BIP6_MULTICAST_SITE_LOCAL, 0, 0, 0, 0, 0, 0,
|
||||
bvlc6_address_set(
|
||||
&addr, BIP6_MULTICAST_SITE_LOCAL, 0, 0, 0, 0, 0, 0,
|
||||
BIP6_MULTICAST_GROUP_ID);
|
||||
bip6_set_broadcast_addr(&addr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user