make pretty using clang-format 10

This commit is contained in:
Steve Karg
2020-06-19 14:44:32 -05:00
parent be57c73508
commit 15dce68947
71 changed files with 660 additions and 597 deletions
+32 -21
View File
@@ -725,14 +725,14 @@ int encode_context_bitstring(
/* from clause 20.2.14 Encoding of an Object Identifier Value */
/* returns the number of apdu bytes consumed */
int decode_object_id(
uint8_t *apdu, BACNET_OBJECT_TYPE *object_type,uint32_t *instance)
uint8_t *apdu, BACNET_OBJECT_TYPE *object_type, uint32_t *instance)
{
uint32_t value = 0;
int len = 0;
len = decode_unsigned32(apdu, &value);
*object_type = (BACNET_OBJECT_TYPE)
(((value >> BACNET_INSTANCE_BITS) & BACNET_MAX_OBJECT));
*object_type = (BACNET_OBJECT_TYPE)(
((value >> BACNET_INSTANCE_BITS) & BACNET_MAX_OBJECT));
*instance = (value & BACNET_MAX_INSTANCE);
return len;
@@ -866,14 +866,15 @@ int decode_context_object_id(uint8_t *apdu,
/* from clause 20.2.14 Encoding of an Object Identifier Value */
/* returns the number of apdu bytes consumed */
int encode_bacnet_object_id
(uint8_t *apdu, BACNET_OBJECT_TYPE object_type, uint32_t instance)
int encode_bacnet_object_id(
uint8_t *apdu, BACNET_OBJECT_TYPE object_type, uint32_t instance)
{
uint32_t value = 0;
int len = 0;
value = (((uint32_t)object_type & BACNET_MAX_OBJECT)
<< BACNET_INSTANCE_BITS) | (instance & BACNET_MAX_INSTANCE);
value =
(((uint32_t)object_type & BACNET_MAX_OBJECT) << BACNET_INSTANCE_BITS) |
(instance & BACNET_MAX_INSTANCE);
len = encode_unsigned32(apdu, value);
return len;
@@ -1313,8 +1314,10 @@ int decode_context_character_string(
*
* @return number of bytes decoded, or zero if errors occur
*/
int bacnet_unsigned_decode(
uint8_t *apdu, uint16_t apdu_len_max, uint32_t len_value, BACNET_UNSIGNED_INTEGER *value)
int bacnet_unsigned_decode(uint8_t *apdu,
uint16_t apdu_len_max,
uint32_t len_value,
BACNET_UNSIGNED_INTEGER *value)
{
int len = 0;
uint16_t unsigned16_value = 0;
@@ -1388,8 +1391,10 @@ int bacnet_unsigned_decode(
* @return number of bytes decoded, zero if wrong tag number,
* or error (-1) if malformed
*/
int bacnet_unsigned_context_decode(
uint8_t *apdu, uint16_t apdu_len_max, uint8_t tag_value, BACNET_UNSIGNED_INTEGER *value)
int bacnet_unsigned_context_decode(uint8_t *apdu,
uint16_t apdu_len_max,
uint8_t tag_value,
BACNET_UNSIGNED_INTEGER *value)
{
int apdu_len = 0;
unsigned len = 0;
@@ -1473,7 +1478,8 @@ int bacnet_unsigned_application_decode(
*
* @return number of bytes decoded, or zero if errors occur
*/
int decode_unsigned(uint8_t *apdu, uint32_t len_value, BACNET_UNSIGNED_INTEGER *value)
int decode_unsigned(
uint8_t *apdu, uint32_t len_value, BACNET_UNSIGNED_INTEGER *value)
{
#ifdef UINT64_MAX
const uint16_t apdu_len_max = 8;
@@ -1496,13 +1502,13 @@ int decode_unsigned(uint8_t *apdu, uint32_t len_value, BACNET_UNSIGNED_INTEGER *
* @return number of bytes decoded, #BACNET_STATUS_ERROR (-1) if
* wrong tag number, or error (-1) if malformed
*/
int decode_context_unsigned(uint8_t *apdu, uint8_t tag_value,
BACNET_UNSIGNED_INTEGER *value)
int decode_context_unsigned(
uint8_t *apdu, uint8_t tag_value, BACNET_UNSIGNED_INTEGER *value)
{
#ifdef UINT64_MAX
const uint16_t apdu_len_max = 3+8;
const uint16_t apdu_len_max = 3 + 8;
#else
const uint16_t apdu_len_max = 2+4;
const uint16_t apdu_len_max = 2 + 4;
#endif
int len = 0;
@@ -1552,7 +1558,8 @@ int encode_bacnet_unsigned(uint8_t *apdu, BACNET_UNSIGNED_INTEGER value)
/* from clause 20.2.4 Encoding of an Unsigned Integer Value */
/* and 20.2.1 General Rules for Encoding BACnet Tags */
/* returns the number of apdu bytes consumed */
int encode_context_unsigned(uint8_t *apdu, uint8_t tag_number, BACNET_UNSIGNED_INTEGER value)
int encode_context_unsigned(
uint8_t *apdu, uint8_t tag_number, BACNET_UNSIGNED_INTEGER value)
{
int len = 0;
@@ -1597,7 +1604,8 @@ int bacnet_enumerated_decode(
BACNET_UNSIGNED_INTEGER unsigned_value = 0;
int len;
len = bacnet_unsigned_decode(apdu, apdu_len_max, len_value, &unsigned_value);
len =
bacnet_unsigned_decode(apdu, apdu_len_max, len_value, &unsigned_value);
if (len > 0) {
*value = unsigned_value;
}
@@ -2434,7 +2442,8 @@ int encode_bacnet_address(uint8_t *apdu, BACNET_ADDRESS *destination)
if (destination) {
/* network number */
apdu_len += encode_application_unsigned(&apdu[apdu_len], destination->net);
apdu_len +=
encode_application_unsigned(&apdu[apdu_len], destination->net);
/* encode mac address as an octet-string */
if (destination->len != 0) {
octetstring_init(&mac_addr, destination->adr, destination->len);
@@ -2450,7 +2459,8 @@ int encode_bacnet_address(uint8_t *apdu, BACNET_ADDRESS *destination)
* Dencode a BACnetAddress and returns the number of apdu bytes consumed.
*
* @param apdu Receive buffer
* @param destination Pointer to the destination address structure to be filled in.
* @param destination Pointer to the destination address structure to be filled
* in.
*
* @return number of apdu bytes consumed
*/
@@ -2765,7 +2775,8 @@ static void testBACDCodeDouble(Test *pTest)
return;
}
static void testBACDCodeUnsignedValue(Test *pTest, BACNET_UNSIGNED_INTEGER value)
static void testBACDCodeUnsignedValue(
Test *pTest, BACNET_UNSIGNED_INTEGER value)
{
uint8_t array[5] = { 0 };
uint8_t encoded_array[5] = { 0 };