Fixed const warnings

This commit is contained in:
Armin Novak 2021-10-07 09:22:27 +02:00 committed by akallabeth
parent cf74a6ea3f
commit 73fbbcf0fb
4 changed files with 34 additions and 10 deletions

View File

@ -1999,6 +1999,11 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings*
if (~((size_t)file->RedirectCameras))
{
union
{
char** c;
const char** cc;
} cnv;
BOOL status;
ADDIN_ARGV* args = rdp_file_to_args(RDPECAM_DVC_CHANNEL_NAME, file->RedirectCameras);
if (!args)
@ -2019,7 +2024,8 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings*
freerdp_addin_argv_add_argument(args, quality);
}
status = freerdp_client_add_dynamic_channel(settings, args->argc, args->argv);
cnv.c = args->argv;
status = freerdp_client_add_dynamic_channel(settings, args->argc, cnv.cc);
freerdp_addin_argv_free(args);
/* Ignore return */ WINPR_UNUSED(status);
}
@ -2027,11 +2033,17 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings*
#ifdef CHANNEL_URBDRC_CLIENT
if (~((size_t)file->UsbDevicesToRedirect))
{
union
{
char** c;
const char** cc;
} cnv;
BOOL status;
ADDIN_ARGV* args = rdp_file_to_args(URBDRC_CHANNEL_NAME, file->UsbDevicesToRedirect);
if (!args)
return FALSE;
status = freerdp_client_add_dynamic_channel(settings, args->argc, args->argv);
cnv.c = args->argv;
status = freerdp_client_add_dynamic_channel(settings, args->argc, cnv.cc);
freerdp_addin_argv_free(args);
/* Ignore return */ WINPR_UNUSED(status);
}

View File

@ -686,9 +686,15 @@ fail:
ADDIN_ARGV* freerdp_addin_argv_clone(const ADDIN_ARGV* args)
{
union
{
char** c;
const char** cc;
} cnv;
if (!args)
return NULL;
return freerdp_addin_argv_new(args->argc, (const char**)args->argv);
cnv.c = args->argv;
return freerdp_addin_argv_new(args->argc, cnv.cc);
}
void freerdp_dynamic_channel_collection_free(rdpSettings* settings)
@ -1050,6 +1056,13 @@ const void* freerdp_settings_get_pointer(const rdpSettings* settings, size_t id)
BOOL freerdp_settings_set_pointer_len(rdpSettings* settings, size_t id, const void* data,
size_t len)
{
union
{
const void* cv;
void* v;
} cnv;
cnv.cv = data;
if (!settings)
return FALSE;
@ -1057,11 +1070,11 @@ BOOL freerdp_settings_set_pointer_len(rdpSettings* settings, size_t id, const vo
{
case FreeRDP_RdpServerCertificate:
certificate_free(settings->RdpServerCertificate);
settings->RdpServerCertificate = (rdpCertificate*)data;
settings->RdpServerCertificate = (rdpCertificate*)cnv.v;
return TRUE;
case FreeRDP_RdpServerRsaKey:
key_free(settings->RdpServerRsaKey);
settings->RdpServerRsaKey = (rdpRsaKey*)data;
settings->RdpServerRsaKey = (rdpRsaKey*)cnv.v;
return TRUE;
case FreeRDP_RedirectionPassword:
return freerdp_settings_set_pointer_len_(

View File

@ -78,7 +78,7 @@ static BOOL settings_reg_query_word_val(HKEY hKey, const TCHAR* sub, UINT16* val
if (!settings_reg_query_dword_val(hKey, sub, &dwValue))
return FALSE;
*value = dwValue;
*value = (UINT16)dwValue;
return TRUE;
}

View File

@ -130,8 +130,7 @@ static BOOL pf_client_load_rdpsnd(pClientContext* pc)
*/
if (!freerdp_static_channel_collection_find(context->settings, RDPSND_CHANNEL_NAME))
{
char* params[2];
params[0] = RDPSND_CHANNEL_NAME;
const char* params[2] = { RDPSND_CHANNEL_NAME };
if (config->AudioOutput &&
WTSVirtualChannelManagerIsChannelJoined(ps->vcm, RDPSND_CHANNEL_NAME))
@ -139,7 +138,7 @@ static BOOL pf_client_load_rdpsnd(pClientContext* pc)
else
params[1] = "sys:fake";
if (!freerdp_client_add_static_channel(context->settings, 2, (char**)params))
if (!freerdp_client_add_static_channel(context->settings, ARRAYSIZE(params), params))
return FALSE;
}
@ -282,7 +281,7 @@ static BOOL pf_client_pre_connect(freerdp* instance)
/* Filter out channels we do not want */
{
CHANNEL_DEF* channels = (CHANNEL_DEF*)freerdp_settings_get_pointer_array(
CHANNEL_DEF* channels = (CHANNEL_DEF*)freerdp_settings_get_pointer_array_writable(
settings, FreeRDP_ChannelDefArray, 0);
size_t x, size = freerdp_settings_get_uint32(settings, FreeRDP_ChannelCount);