fix cppcheck errors
This commit is contained in:
+7
-5
@@ -1569,11 +1569,10 @@ static int bacapp_snprintf_date(char *str, size_t str_len, BACNET_DATE *bdate)
|
|||||||
int slen = 0;
|
int slen = 0;
|
||||||
|
|
||||||
/* false positive cppcheck - snprintf allows null pointers */
|
/* false positive cppcheck - snprintf allows null pointers */
|
||||||
/* cppcheck-suppress nullPointer */
|
/* cppcheck-suppress [nullPointer, ctunullpointer] */
|
||||||
/* cppcheck-suppress ctunullpointer */
|
slen = snprintf(str, str_len, "%s, %s",
|
||||||
slen =
|
bactext_day_of_week_name(bdate->wday),
|
||||||
snprintf(str, str_len, "%s, %s", bactext_day_of_week_name(bdate->wday),
|
bactext_month_name(bdate->month));
|
||||||
bactext_month_name(bdate->month));
|
|
||||||
if (str) {
|
if (str) {
|
||||||
str += slen;
|
str += slen;
|
||||||
if (str_len >= slen) {
|
if (str_len >= slen) {
|
||||||
@@ -2310,6 +2309,9 @@ bool bacapp_print_value(
|
|||||||
#else
|
#else
|
||||||
char *str;
|
char *str;
|
||||||
str = calloc(sizeof(char), str_len + 1);
|
str = calloc(sizeof(char), str_len + 1);
|
||||||
|
if (!str) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
bacapp_snprintf_value(str, str_len + 1, object_value);
|
bacapp_snprintf_value(str, str_len + 1, object_value);
|
||||||
if (stream) {
|
if (stream) {
|
||||||
|
|||||||
@@ -216,10 +216,11 @@ void routed_get_my_address(BACNET_ADDRESS *my_address)
|
|||||||
bool Routed_Device_Address_Lookup(int idx, uint8_t dlen, uint8_t *dadr)
|
bool Routed_Device_Address_Lookup(int idx, uint8_t dlen, uint8_t *dadr)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
DEVICE_OBJECT_DATA *pDev = &Devices[idx];
|
DEVICE_OBJECT_DATA *pDev;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ((idx >= 0) && (idx < MAX_NUM_DEVICES)) {
|
if ((idx >= 0) && (idx < MAX_NUM_DEVICES)) {
|
||||||
|
pDev = &Devices[idx];
|
||||||
if (dlen == 0) {
|
if (dlen == 0) {
|
||||||
/* Automatic match */
|
/* Automatic match */
|
||||||
iCurrent_Device_Idx = idx;
|
iCurrent_Device_Idx = idx;
|
||||||
@@ -236,6 +237,7 @@ bool Routed_Device_Address_Lookup(int idx, uint8_t dlen, uint8_t *dadr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user