Code changes for cppcheck 2.1 warnings

This commit is contained in:
matt335672 2020-06-19 11:07:23 +01:00
parent a57c68f55e
commit 27653f97f2
3 changed files with 13 additions and 0 deletions

View File

@ -569,6 +569,7 @@ log_message(const enum logLevels lvl, const char *msg, ...)
if (len > LOG_BUFFER_SIZE) if (len > LOG_BUFFER_SIZE)
{ {
log_message(LOG_LEVEL_WARNING, "next message will be truncated"); log_message(LOG_LEVEL_WARNING, "next message will be truncated");
len = LOG_BUFFER_SIZE;
} }
/* forcing the end of message string */ /* forcing the end of message string */

View File

@ -2896,6 +2896,12 @@ g_strtrim(char *str, int trim_flags)
text = (wchar_t *)malloc(len * sizeof(wchar_t) + 8); text = (wchar_t *)malloc(len * sizeof(wchar_t) + 8);
text1 = (wchar_t *)malloc(len * sizeof(wchar_t) + 8); text1 = (wchar_t *)malloc(len * sizeof(wchar_t) + 8);
if (text == NULL || text1 == NULL)
{
free(text);
free(text1);
return 1;
}
text1_index = 0; text1_index = 0;
mbstowcs(text, str, len + 1); mbstowcs(text, str, len + 1);

View File

@ -83,6 +83,12 @@
#define GOOD_RECT(rect) ((rect)->x1 < (rect)->x2 && (rect)->y1 < (rect)->y2) #define GOOD_RECT(rect) ((rect)->x1 < (rect)->x2 && (rect)->y1 < (rect)->y2)
#define BAD_RECT(rect) ((rect)->x1 > (rect)->x2 || (rect)->y1 > (rect)->y2) #define BAD_RECT(rect) ((rect)->x1 > (rect)->x2 || (rect)->y1 > (rect)->y2)
/* This file is included by pixman-region16.c which defines PREFIX(x).
* This check allows cppcheck 2.x to scan this file separately */
#ifndef PREFIX
#define PREFIX(x) pixman_region##x
#endif
#ifdef XRDP_DEBUG #ifdef XRDP_DEBUG
#define GOOD(reg) \ #define GOOD(reg) \