fix cppcheck errors

This commit is contained in:
Steve Karg
2022-09-10 20:41:38 -05:00
parent 9136089e37
commit 457ceb4a25
2 changed files with 10 additions and 6 deletions
+7 -5
View File
@@ -1569,11 +1569,10 @@ static int bacapp_snprintf_date(char *str, size_t str_len, BACNET_DATE *bdate)
int slen = 0;
/* 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));
/* cppcheck-suppress [nullPointer, ctunullpointer] */
slen = snprintf(str, str_len, "%s, %s",
bactext_day_of_week_name(bdate->wday),
bactext_month_name(bdate->month));
if (str) {
str += slen;
if (str_len >= slen) {
@@ -2310,6 +2309,9 @@ bool bacapp_print_value(
#else
char *str;
str = calloc(sizeof(char), str_len + 1);
if (!str) {
return false;
}
#endif
bacapp_snprintf_value(str, str_len + 1, object_value);
if (stream) {