Bugfix/clang tidy applied 2022 (#232)

* clang-tidy applied fixes to src folder
* clang-tidy applied fixes to apps folder

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
Steve Karg
2022-02-27 19:14:17 -06:00
committed by GitHub
parent 5e70eeecfc
commit d0fe77c030
33 changed files with 211 additions and 123 deletions
+18 -9
View File
@@ -1693,8 +1693,9 @@ bool bacapp_same_value(BACNET_APPLICATION_DATA_VALUE *value,
if ((value == NULL) || (test_value == NULL)) {
return false;
}
if (test_value->tag == value->tag)
if (test_value->tag == value->tag) {
status = true;
}
if (status) {
/* second test for same-ness */
status = false;
@@ -1707,52 +1708,60 @@ bool bacapp_same_value(BACNET_APPLICATION_DATA_VALUE *value,
#endif
#if defined(BACAPP_BOOLEAN)
case BACNET_APPLICATION_TAG_BOOLEAN:
if (test_value->type.Boolean == value->type.Boolean)
if (test_value->type.Boolean == value->type.Boolean) {
status = true;
}
break;
#endif
#if defined(BACAPP_UNSIGNED)
case BACNET_APPLICATION_TAG_UNSIGNED_INT:
if (test_value->type.Unsigned_Int == value->type.Unsigned_Int)
if (test_value->type.Unsigned_Int == value->type.Unsigned_Int) {
status = true;
}
break;
#endif
#if defined(BACAPP_SIGNED)
case BACNET_APPLICATION_TAG_SIGNED_INT:
if (test_value->type.Signed_Int == value->type.Signed_Int)
if (test_value->type.Signed_Int == value->type.Signed_Int) {
status = true;
}
break;
#endif
#if defined(BACAPP_REAL)
case BACNET_APPLICATION_TAG_REAL:
if (test_value->type.Real == value->type.Real)
if (test_value->type.Real == value->type.Real) {
status = true;
}
break;
#endif
#if defined(BACAPP_DOUBLE)
case BACNET_APPLICATION_TAG_DOUBLE:
if (test_value->type.Double == value->type.Double)
if (test_value->type.Double == value->type.Double) {
status = true;
}
break;
#endif
#if defined(BACAPP_ENUMERATED)
case BACNET_APPLICATION_TAG_ENUMERATED:
if (test_value->type.Enumerated == value->type.Enumerated)
if (test_value->type.Enumerated == value->type.Enumerated) {
status = true;
}
break;
#endif
#if defined(BACAPP_DATE)
case BACNET_APPLICATION_TAG_DATE:
if (datetime_compare_date(
&test_value->type.Date, &value->type.Date) == 0)
&test_value->type.Date, &value->type.Date) == 0) {
status = true;
}
break;
#endif
#if defined(BACAPP_TIME)
case BACNET_APPLICATION_TAG_TIME:
if (datetime_compare_time(
&test_value->type.Time, &value->type.Time) == 0)
&test_value->type.Time, &value->type.Time) == 0) {
status = true;
}
break;
#endif
#if defined(BACAPP_OBJECT_ID)
+5 -3
View File
@@ -22,8 +22,9 @@
*/
bool days_is_leap_year(uint16_t year)
{
if ((year % 4) == 0 && ((year % 100) != 0 || (year % 400) == 0))
if ((year % 4) == 0 && ((year % 100) != 0 || (year % 400) == 0)) {
return true;
}
return (false);
}
@@ -42,10 +43,11 @@ uint8_t days_per_month(uint16_t year, uint8_t month)
uint8_t month_days[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30,
31 };
if ((month == 2) && days_is_leap_year(year))
if ((month == 2) && days_is_leap_year(year)) {
return (29);
else if (month >= 1 && month <= 12)
} else if (month >= 1 && month <= 12) {
return (month_days[month]);
}
return 0;
}