Bugfix/c89 compile fixes (#327)

* Fix code to be able to compile with older C89 ANSI compilers

* Convert C++ comments to C89 comments.

* default to std=gnu89

* Fix to enable CMake 3.1 to build on Centos7

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
Steve Karg
2022-08-23 13:37:32 -05:00
committed by GitHub
parent 065d0334ee
commit 95b487ea6f
16 changed files with 85 additions and 56 deletions
+5 -5
View File
@@ -1415,9 +1415,9 @@ static int bacapp_snprintf_date(char *str, size_t str_len, BACNET_DATE *bdate)
int ret_val = 0;
int slen = 0;
// false positive cppcheck - snprintf allows null pointers
// cppcheck-suppress nullPointer
// cppcheck-suppress ctunullpointer
/* false positive cppcheck - snprintf allows null pointers */
/* cppcheck-suppress nullPointer */
/* cppcheck-suppress ctunullpointer */
slen = snprintf(str, str_len, "%s, %s",
bactext_day_of_week_name(bdate->wday),
bactext_month_name(bdate->month));
@@ -1471,8 +1471,8 @@ static int bacapp_snprintf_time(char *str, size_t str_len, BACNET_TIME *btime)
if (btime->hour == 255) {
slen = snprintf(str, str_len, "**:");
} else {
// false positive cppcheck - snprintf allows null pointers
// cppcheck-suppress nullPointer
/* false positive cppcheck - snprintf allows null pointers */
/* cppcheck-suppress nullPointer */
slen = snprintf(str, str_len, "%02u:",
(unsigned)btime->hour);
}