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:
+20
-12
@@ -14,8 +14,8 @@
|
||||
#include "network_layer.h"
|
||||
#include "bacnet/bacint.h"
|
||||
|
||||
uint16_t process_network_message(
|
||||
const BACMSG *msg, MSG_DATA *data, uint8_t **buff)
|
||||
uint16_t
|
||||
process_network_message(const BACMSG *msg, MSG_DATA *data, uint8_t **buff)
|
||||
{
|
||||
BACNET_NPDU_DATA npdu_data;
|
||||
ROUTER_PORT *srcport;
|
||||
@@ -28,8 +28,8 @@ uint16_t process_network_message(
|
||||
|
||||
memmove(data, msg->data, sizeof(MSG_DATA));
|
||||
|
||||
apdu_offset = bacnet_npdu_decode(data->pdu, data->pdu_len, &data->dest,
|
||||
NULL, &npdu_data);
|
||||
apdu_offset = bacnet_npdu_decode(
|
||||
data->pdu, data->pdu_len, &data->dest, NULL, &npdu_data);
|
||||
apdu_len = data->pdu_len - apdu_offset;
|
||||
|
||||
srcport = find_snet(msg->origin);
|
||||
@@ -71,9 +71,11 @@ uint16_t process_network_message(
|
||||
int net_count = apdu_len / 2;
|
||||
int i;
|
||||
for (i = 0; i < net_count; i++) {
|
||||
decode_unsigned16(&data->pdu[apdu_offset + 2 * i],
|
||||
decode_unsigned16(
|
||||
&data->pdu[apdu_offset + 2 * i],
|
||||
&net); /* decode received NET values */
|
||||
add_dnet(&srcport->route_info, net,
|
||||
add_dnet(
|
||||
&srcport->route_info, net,
|
||||
data->src); /* and update routing table */
|
||||
}
|
||||
break;
|
||||
@@ -110,9 +112,11 @@ uint16_t process_network_message(
|
||||
int net_count = data->pdu[apdu_offset];
|
||||
while (net_count--) {
|
||||
int i = 1;
|
||||
decode_unsigned16(&data->pdu[apdu_offset + i],
|
||||
decode_unsigned16(
|
||||
&data->pdu[apdu_offset + i],
|
||||
&net); /* decode received NET values */
|
||||
add_dnet(&srcport->route_info, net,
|
||||
add_dnet(
|
||||
&srcport->route_info, net,
|
||||
data->src); /* and update routing table */
|
||||
if (data->pdu[apdu_offset + i + 3] >
|
||||
0) { /* find next NET value */
|
||||
@@ -135,9 +139,11 @@ uint16_t process_network_message(
|
||||
int net_count = data->pdu[apdu_offset];
|
||||
while (net_count--) {
|
||||
int i = 1;
|
||||
decode_unsigned16(&data->pdu[apdu_offset + i],
|
||||
decode_unsigned16(
|
||||
&data->pdu[apdu_offset + i],
|
||||
&net); /* decode received NET values */
|
||||
add_dnet(&srcport->route_info, net,
|
||||
add_dnet(
|
||||
&srcport->route_info, net,
|
||||
data->src); /* and update routing table */
|
||||
if (data->pdu[apdu_offset + i + 3] >
|
||||
0) { /* find next NET value */
|
||||
@@ -299,7 +305,8 @@ uint16_t create_network_message(
|
||||
return buff_len;
|
||||
}
|
||||
|
||||
void send_network_message(BACNET_NETWORK_MESSAGE_TYPE network_message_type,
|
||||
void send_network_message(
|
||||
BACNET_NETWORK_MESSAGE_TYPE network_message_type,
|
||||
MSG_DATA *data,
|
||||
uint8_t **buff,
|
||||
void *val)
|
||||
@@ -334,7 +341,8 @@ void send_network_message(BACNET_NETWORK_MESSAGE_TYPE network_message_type,
|
||||
}
|
||||
}
|
||||
|
||||
void init_npdu(BACNET_NPDU_DATA *npdu_data,
|
||||
void init_npdu(
|
||||
BACNET_NPDU_DATA *npdu_data,
|
||||
BACNET_NETWORK_MESSAGE_TYPE network_message_type,
|
||||
bool data_expecting_reply)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user