Merge pull request #5857 from akallabeth/scanbuild_fixes
Scanbuild fixes
This commit is contained in:
commit
e304428a5f
@ -439,7 +439,7 @@ static UINT dvcman_close_channel_iface(IWTSVirtualChannel* pChannel)
|
||||
static UINT dvcman_create_channel(drdynvcPlugin* drdynvc, IWTSVirtualChannelManager* pChannelMgr,
|
||||
UINT32 ChannelId, const char* ChannelName)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
BOOL bAccept;
|
||||
DVCMAN_LISTENER* listener;
|
||||
DVCMAN_CHANNEL* channel;
|
||||
|
@ -112,13 +112,28 @@ typedef struct _RDPEI_PLUGIN RDPEI_PLUGIN;
|
||||
*/
|
||||
static UINT rdpei_send_frame(RdpeiClientContext* context);
|
||||
|
||||
static const char* RDPEI_EVENTID_STRINGS[] = { "",
|
||||
"EVENTID_SC_READY",
|
||||
"EVENTID_CS_READY",
|
||||
"EVENTID_TOUCH",
|
||||
"EVENTID_SUSPEND_TOUCH",
|
||||
"EVENTID_RESUME_TOUCH",
|
||||
"EVENTID_DISMISS_HOVERING_CONTACT" };
|
||||
#ifdef WITH_DEBUG_RDPEI
|
||||
static const char* rdpei_eventid_string(UINT16 event)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case EVENTID_SC_READY:
|
||||
return "EVENTID_SC_READY";
|
||||
case EVENTID_CS_READY:
|
||||
return "EVENTID_CS_READY";
|
||||
case EVENTID_TOUCH:
|
||||
return "EVENTID_TOUCH";
|
||||
case EVENTID_SUSPEND_TOUCH:
|
||||
return "EVENTID_SUSPEND_TOUCH";
|
||||
case EVENTID_RESUME_TOUCH:
|
||||
return "EVENTID_RESUME_TOUCH";
|
||||
case EVENTID_DISMISS_HOVERING_CONTACT:
|
||||
return "EVENTID_DISMISS_HOVERING_CONTACT";
|
||||
default:
|
||||
return "EVENTID_UNKNOWN";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Function description
|
||||
@ -179,7 +194,7 @@ static UINT rdpei_send_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s, UINT16
|
||||
#ifdef WITH_DEBUG_RDPEI
|
||||
WLog_DBG(TAG,
|
||||
"rdpei_send_pdu: eventId: %" PRIu16 " (%s) length: %" PRIu32 " status: %" PRIu32 "",
|
||||
eventId, RDPEI_EVENTID_STRINGS[eventId], pduLength, status);
|
||||
eventId, rdpei_eventid_string(eventId), pduLength, status);
|
||||
#endif
|
||||
return status;
|
||||
}
|
||||
@ -434,7 +449,7 @@ static UINT rdpei_recv_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s)
|
||||
Stream_Read_UINT32(s, pduLength); /* pduLength (4 bytes) */
|
||||
#ifdef WITH_DEBUG_RDPEI
|
||||
WLog_DBG(TAG, "rdpei_recv_pdu: eventId: %" PRIu16 " (%s) length: %" PRIu32 "", eventId,
|
||||
RDPEI_EVENTID_STRINGS[eventId], pduLength);
|
||||
rdpei_eventid_string(eventId), pduLength);
|
||||
#endif
|
||||
|
||||
switch (eventId)
|
||||
|
@ -293,8 +293,6 @@ static BOOL udevman_unregister_udevice(IUDEVMAN* idevman, BYTE bus_number, BYTE
|
||||
|
||||
static BOOL udevman_cancel_all_device_requests(IUDEVMAN* idevman)
|
||||
{
|
||||
UDEVMAN* udevman = (UDEVMAN*)idevman;
|
||||
|
||||
if (!idevman)
|
||||
return FALSE;
|
||||
|
||||
|
@ -1544,7 +1544,8 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
|
||||
CommandLineSwitchStart(arg) CommandLineSwitchCase(arg, "v")
|
||||
{
|
||||
assert(arg->Value);
|
||||
if (!arg->Value)
|
||||
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
free(settings->ServerHostname);
|
||||
settings->ServerHostname = NULL;
|
||||
p = strchr(arg->Value, '[');
|
||||
@ -1614,7 +1615,8 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
{
|
||||
size_t count = 0;
|
||||
char* cur = arg->Value;
|
||||
assert(arg->Value);
|
||||
if (!arg->Value)
|
||||
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
settings->RedirectionPreferType = 0;
|
||||
|
||||
do
|
||||
@ -1684,7 +1686,8 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
}
|
||||
CommandLineSwitchCase(arg, "size")
|
||||
{
|
||||
assert(arg->Value);
|
||||
if (!arg->Value)
|
||||
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
p = strchr(arg->Value, 'x');
|
||||
|
||||
if (p)
|
||||
@ -1962,7 +1965,8 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
|
||||
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
||||
{
|
||||
assert(arg->Value);
|
||||
if (!arg->Value)
|
||||
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
p = strchr(arg->Value, ':');
|
||||
|
||||
if (p)
|
||||
@ -2006,7 +2010,8 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
||||
{
|
||||
char* atPtr;
|
||||
assert(arg->Value);
|
||||
if (!arg->Value)
|
||||
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
/* value is [scheme://][user:password@]hostname:port */
|
||||
p = strstr(arg->Value, "://");
|
||||
|
||||
@ -2369,9 +2374,11 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
p = CommandLineParseCommaSeparatedValues(arg->Value, &count);
|
||||
if (!p || (count == 0))
|
||||
rc = COMMAND_LINE_ERROR;
|
||||
for (x = 0; x < count; x++)
|
||||
else
|
||||
{
|
||||
const char* val = p[x];
|
||||
for (x = 0; x < count; x++)
|
||||
{
|
||||
const char* val = p[x];
|
||||
#ifdef WITH_GFX_H264
|
||||
if (_strnicmp("AVC444", val, 7) == 0)
|
||||
{
|
||||
@ -2402,6 +2409,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
}
|
||||
else
|
||||
rc = COMMAND_LINE_ERROR;
|
||||
}
|
||||
}
|
||||
free(p);
|
||||
if (rc != CHANNEL_RC_OK)
|
||||
@ -2447,24 +2455,27 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
p = CommandLineParseCommaSeparatedValues(arg->Value, &count);
|
||||
if (!p || (count == 0))
|
||||
rc = COMMAND_LINE_ERROR;
|
||||
for (x = 0; x < count; x++)
|
||||
else
|
||||
{
|
||||
const char* val = p[x];
|
||||
for (x = 0; x < count; x++)
|
||||
{
|
||||
const char* val = p[x];
|
||||
|
||||
if (_strnicmp("AVC444", val, 7) == 0)
|
||||
{
|
||||
settings->GfxAVC444 = TRUE;
|
||||
}
|
||||
else if (_strnicmp("AVC420", val, 7) != 0)
|
||||
rc = COMMAND_LINE_ERROR;
|
||||
else if (_strnicmp("mask:", val, 5) == 0)
|
||||
{
|
||||
ULONGLONG v;
|
||||
const char* uv = &val[5];
|
||||
if (!value_to_uint(uv, &v, 0, UINT32_MAX))
|
||||
if (_strnicmp("AVC444", val, 7) == 0)
|
||||
{
|
||||
settings->GfxAVC444 = TRUE;
|
||||
}
|
||||
else if (_strnicmp("AVC420", val, 7) != 0)
|
||||
rc = COMMAND_LINE_ERROR;
|
||||
else
|
||||
settings->GfxCapsFilter = (UINT32)v;
|
||||
else if (_strnicmp("mask:", val, 5) == 0)
|
||||
{
|
||||
ULONGLONG v;
|
||||
const char* uv = &val[5];
|
||||
if (!value_to_uint(uv, &v, 0, UINT32_MAX))
|
||||
rc = COMMAND_LINE_ERROR;
|
||||
else
|
||||
settings->GfxCapsFilter = (UINT32)v;
|
||||
}
|
||||
}
|
||||
}
|
||||
free(p);
|
||||
@ -2479,7 +2490,8 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
}
|
||||
CommandLineSwitchCase(arg, "rfx-mode")
|
||||
{
|
||||
assert(arg->Value);
|
||||
if (!arg->Value)
|
||||
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
|
||||
if (strcmp(arg->Value, "video") == 0)
|
||||
settings->RemoteFxCodecMode = 0x00;
|
||||
@ -2538,7 +2550,8 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
}
|
||||
CommandLineSwitchCase(arg, "sec")
|
||||
{
|
||||
assert(arg->Value);
|
||||
if (!arg->Value)
|
||||
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
|
||||
if (strcmp("rdp", arg->Value) == 0) /* Standard RDP */
|
||||
{
|
||||
@ -2606,7 +2619,8 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
|
||||
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
||||
{
|
||||
assert(arg->Value);
|
||||
if (!arg->Value)
|
||||
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
promptForPassword = (strncmp(arg->Value, "force", 6) == 0);
|
||||
|
||||
if (!promptForPassword)
|
||||
@ -2643,7 +2657,8 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
}
|
||||
CommandLineSwitchCase(arg, "tls-ciphers")
|
||||
{
|
||||
assert(arg->Value);
|
||||
if (!arg->Value)
|
||||
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
free(settings->AllowedTlsCiphers);
|
||||
|
||||
if (strcmp(arg->Value, "netmon") == 0)
|
||||
@ -2810,8 +2825,9 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
}
|
||||
CommandLineSwitchCase(arg, "codec-cache")
|
||||
{
|
||||
if (!arg->Value)
|
||||
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
settings->BitmapCacheV3Enabled = TRUE;
|
||||
assert(arg->Value);
|
||||
|
||||
if (strcmp(arg->Value, "rfx") == 0)
|
||||
{
|
||||
@ -2911,7 +2927,9 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
{
|
||||
BYTE* base64 = NULL;
|
||||
int length;
|
||||
assert(arg->Value);
|
||||
if (!arg->Value)
|
||||
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
|
||||
crypto_base64_decode((const char*)(arg->Value), (int)strlen(arg->Value), &base64,
|
||||
&length);
|
||||
|
||||
|
@ -877,7 +877,7 @@ BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file, const rdpSett
|
||||
file->LoadBalanceInfo = calloc(settings->LoadBalanceInfoLength + 1, 1);
|
||||
if (!file->LoadBalanceInfo)
|
||||
return FALSE;
|
||||
strncpy(file->LoadBalanceInfo, settings->LoadBalanceInfo, settings->LoadBalanceInfoLength);
|
||||
memcpy(file->LoadBalanceInfo, settings->LoadBalanceInfo, settings->LoadBalanceInfoLength);
|
||||
}
|
||||
|
||||
if (settings->AudioPlayback)
|
||||
|
@ -946,7 +946,12 @@ static BOOL rfx_process_message_tileset(RFX_CONTEXT* context, RFX_MESSAGE* messa
|
||||
|
||||
if (context->priv->UseThreads)
|
||||
{
|
||||
assert(params);
|
||||
if (!params)
|
||||
{
|
||||
rc = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
params[i].context = context;
|
||||
params[i].tile = message->tiles[i];
|
||||
|
||||
|
@ -74,7 +74,7 @@ static const char* pf_modules_get_hook_type_string(PF_HOOK_TYPE result)
|
||||
BOOL pf_modules_run_hook(PF_HOOK_TYPE type, proxyData* pdata)
|
||||
{
|
||||
BOOL ok = TRUE;
|
||||
size_t index;
|
||||
int index;
|
||||
proxyPlugin* plugin;
|
||||
|
||||
ArrayList_ForEach(plugins_list, proxyPlugin*, index, plugin)
|
||||
@ -127,7 +127,7 @@ BOOL pf_modules_run_hook(PF_HOOK_TYPE type, proxyData* pdata)
|
||||
BOOL pf_modules_run_filter(PF_FILTER_TYPE type, proxyData* pdata, void* param)
|
||||
{
|
||||
BOOL result = TRUE;
|
||||
size_t index;
|
||||
int index;
|
||||
proxyPlugin* plugin;
|
||||
|
||||
ArrayList_ForEach(plugins_list, proxyPlugin*, index, plugin)
|
||||
@ -174,7 +174,7 @@ static BOOL pf_modules_set_plugin_data(const char* plugin_name, proxyData* pdata
|
||||
if (data == NULL) /* no need to store anything */
|
||||
return FALSE;
|
||||
|
||||
if (HashTable_Add(pdata->modules_info, (void*)plugin_name, data) < 0)
|
||||
if (HashTable_Add(pdata->modules_info, plugin_name, data) < 0)
|
||||
{
|
||||
WLog_ERR(TAG, "[%s]: HashTable_Add failed!");
|
||||
return FALSE;
|
||||
@ -195,7 +195,7 @@ static void* pf_modules_get_plugin_data(const char* plugin_name, proxyData* pdat
|
||||
assert(plugin_name);
|
||||
assert(pdata);
|
||||
|
||||
return HashTable_GetItemValue(pdata->modules_info, (void*)plugin_name);
|
||||
return HashTable_GetItemValue(pdata->modules_info, plugin_name);
|
||||
}
|
||||
|
||||
static void pf_modules_abort_connect(proxyData* pdata)
|
||||
@ -207,10 +207,11 @@ static void pf_modules_abort_connect(proxyData* pdata)
|
||||
|
||||
static BOOL pf_modules_register_plugin(proxyPlugin* plugin_to_register)
|
||||
{
|
||||
size_t index;
|
||||
int index;
|
||||
proxyPlugin* plugin;
|
||||
|
||||
assert(plugins_list != NULL);
|
||||
if (!plugin_to_register)
|
||||
return FALSE;
|
||||
|
||||
/* make sure there's no other loaded plugin with the same name of `plugin_to_register`. */
|
||||
ArrayList_ForEach(plugins_list, proxyPlugin*, index, plugin)
|
||||
@ -224,7 +225,8 @@ static BOOL pf_modules_register_plugin(proxyPlugin* plugin_to_register)
|
||||
|
||||
if (ArrayList_Add(plugins_list, plugin_to_register) < 0)
|
||||
{
|
||||
WLog_ERR(TAG, "[%s]: failed adding plugin to list: %s", __FUNCTION__, plugin->name);
|
||||
WLog_ERR(TAG, "[%s]: failed adding plugin to list: %s", __FUNCTION__,
|
||||
plugin_to_register->name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -233,7 +235,7 @@ static BOOL pf_modules_register_plugin(proxyPlugin* plugin_to_register)
|
||||
|
||||
BOOL pf_modules_is_plugin_loaded(const char* plugin_name)
|
||||
{
|
||||
size_t i;
|
||||
int i;
|
||||
proxyPlugin* plugin;
|
||||
|
||||
if (plugins_list == NULL)
|
||||
@ -251,7 +253,7 @@ BOOL pf_modules_is_plugin_loaded(const char* plugin_name)
|
||||
void pf_modules_list_loaded_plugins(void)
|
||||
{
|
||||
size_t count;
|
||||
size_t i;
|
||||
int i;
|
||||
proxyPlugin* plugin;
|
||||
|
||||
if (plugins_list == NULL)
|
||||
@ -365,7 +367,7 @@ error:
|
||||
|
||||
void pf_modules_free(void)
|
||||
{
|
||||
size_t index;
|
||||
int index;
|
||||
|
||||
if (plugins_list)
|
||||
{
|
||||
|
@ -178,6 +178,8 @@ PTP_POOL winpr_CreateThreadpool(PVOID reserved)
|
||||
InitOnceExecuteOnce(&init_once_module, init_module, NULL, NULL);
|
||||
if (pCreateThreadpool)
|
||||
return pCreateThreadpool(reserved);
|
||||
#else
|
||||
WINPR_UNUSED(reserved);
|
||||
#endif
|
||||
if (!(pool = (PTP_POOL)calloc(1, sizeof(TP_POOL))))
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user