[client,common] const correct pointer array arguments

This commit is contained in:
akallabeth 2024-10-24 11:08:58 +02:00
parent 14c4cd8dc3
commit 7ab30a1b18
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
4 changed files with 25 additions and 21 deletions

View File

@ -727,7 +727,8 @@ static int freerdp_client_command_line_pre_filter(void* context, int index, int
return 0;
}
BOOL freerdp_client_add_device_channel(rdpSettings* settings, size_t count, const char** params)
BOOL freerdp_client_add_device_channel(rdpSettings* settings, size_t count,
const char* const* params)
{
WINPR_ASSERT(settings);
WINPR_ASSERT(params);
@ -858,7 +859,8 @@ BOOL freerdp_client_del_static_channel(rdpSettings* settings, const char* name)
return freerdp_static_channel_collection_del(settings, name);
}
BOOL freerdp_client_add_static_channel(rdpSettings* settings, size_t count, const char** params)
BOOL freerdp_client_add_static_channel(rdpSettings* settings, size_t count,
const char* const* params)
{
ADDIN_ARGV* _args = NULL;
@ -887,7 +889,8 @@ BOOL freerdp_client_del_dynamic_channel(rdpSettings* settings, const char* name)
return freerdp_dynamic_channel_collection_del(settings, name);
}
BOOL freerdp_client_add_dynamic_channel(rdpSettings* settings, size_t count, const char** params)
BOOL freerdp_client_add_dynamic_channel(rdpSettings* settings, size_t count,
const char* const* params)
{
ADDIN_ARGV* _args = NULL;
@ -1057,7 +1060,7 @@ static int freerdp_client_command_line_post_filter_int(void* context, COMMAND_LI
{
size_t count = 0;
char** ptr = CommandLineParseCommaSeparatedValues(arg->Value, &count);
if (!freerdp_client_add_static_channel(settings, count, ptr))
if (!freerdp_client_add_static_channel(settings, count, (const char* const*)ptr))
status = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
CommandLineParserFree(ptr);
if (status)
@ -1067,7 +1070,7 @@ static int freerdp_client_command_line_post_filter_int(void* context, COMMAND_LI
{
size_t count = 0;
char** ptr = CommandLineParseCommaSeparatedValues(arg->Value, &count);
if (!freerdp_client_add_dynamic_channel(settings, count, ptr))
if (!freerdp_client_add_dynamic_channel(settings, count, (const char* const*)ptr))
status = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
CommandLineParserFree(ptr);
if (status)
@ -1077,7 +1080,7 @@ static int freerdp_client_command_line_post_filter_int(void* context, COMMAND_LI
{
size_t count = 0;
char** ptr = CommandLineParseCommaSeparatedValuesEx(arg->Name, arg->Value, &count);
if (!freerdp_client_add_device_channel(settings, count, ptr))
if (!freerdp_client_add_device_channel(settings, count, (const char* const*)ptr))
status = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
CommandLineParserFree(ptr);
if (status)
@ -1088,7 +1091,7 @@ static int freerdp_client_command_line_post_filter_int(void* context, COMMAND_LI
{
size_t count = 0;
char** ptr = CommandLineParseCommaSeparatedValuesEx(arg->Name, arg->Value, &count);
if (!freerdp_client_add_device_channel(settings, count, ptr))
if (!freerdp_client_add_device_channel(settings, count, (const char* const*)ptr))
status = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
CommandLineParserFree(ptr);
if (status)
@ -1100,7 +1103,7 @@ static int freerdp_client_command_line_post_filter_int(void* context, COMMAND_LI
{
size_t count = 0;
char** ptr = CommandLineParseCommaSeparatedValuesEx(arg->Name, arg->Value, &count);
if (!freerdp_client_add_device_channel(settings, count, ptr))
if (!freerdp_client_add_device_channel(settings, count, (const char* const*)ptr))
status = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
CommandLineParserFree(ptr);
if (status)
@ -1111,7 +1114,7 @@ static int freerdp_client_command_line_post_filter_int(void* context, COMMAND_LI
{
size_t count = 0;
char** ptr = CommandLineParseCommaSeparatedValuesEx(arg->Name, arg->Value, &count);
if (!freerdp_client_add_device_channel(settings, count, ptr))
if (!freerdp_client_add_device_channel(settings, count, (const char* const*)ptr))
status = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
CommandLineParserFree(ptr);
if (status)
@ -1121,7 +1124,7 @@ static int freerdp_client_command_line_post_filter_int(void* context, COMMAND_LI
{
size_t count = 0;
char** ptr = CommandLineParseCommaSeparatedValuesEx(arg->Name, arg->Value, &count);
if (!freerdp_client_add_device_channel(settings, count, ptr))
if (!freerdp_client_add_device_channel(settings, count, (const char* const*)ptr))
status = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
CommandLineParserFree(ptr);
if (status)
@ -1132,7 +1135,7 @@ static int freerdp_client_command_line_post_filter_int(void* context, COMMAND_LI
size_t count = 0;
char** ptr =
CommandLineParseCommaSeparatedValuesEx(URBDRC_CHANNEL_NAME, arg->Value, &count);
if (!freerdp_client_add_dynamic_channel(settings, count, ptr))
if (!freerdp_client_add_dynamic_channel(settings, count, (const char* const*)ptr))
status = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
CommandLineParserFree(ptr);
if (status)
@ -1181,9 +1184,9 @@ static int freerdp_client_command_line_post_filter_int(void* context, COMMAND_LI
size_t count = 0;
char** ptr =
CommandLineParseCommaSeparatedValuesEx(RDPSND_CHANNEL_NAME, arg->Value, &count);
if (!freerdp_client_add_static_channel(settings, count, ptr))
if (!freerdp_client_add_static_channel(settings, count, (const char* const*)ptr))
status = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
if (!freerdp_client_add_dynamic_channel(settings, count, ptr))
if (!freerdp_client_add_dynamic_channel(settings, count, (const char* const*)ptr))
status = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
CommandLineParserFree(ptr);
@ -1194,7 +1197,7 @@ static int freerdp_client_command_line_post_filter_int(void* context, COMMAND_LI
{
size_t count = 0;
char** ptr = CommandLineParseCommaSeparatedValuesEx(AUDIN_CHANNEL_NAME, arg->Value, &count);
if (!freerdp_client_add_dynamic_channel(settings, count, ptr))
if (!freerdp_client_add_dynamic_channel(settings, count, (const char* const*)ptr))
status = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
CommandLineParserFree(ptr);
if (status)

View File

@ -104,12 +104,12 @@ extern "C"
FREERDP_API BOOL freerdp_set_connection_type(rdpSettings* settings, UINT32 type);
FREERDP_API BOOL freerdp_client_add_device_channel(rdpSettings* settings, size_t count,
const char** params);
const char* const* params);
FREERDP_API BOOL freerdp_client_add_static_channel(rdpSettings* settings, size_t count,
const char** params);
const char* const* params);
FREERDP_API BOOL freerdp_client_del_static_channel(rdpSettings* settings, const char* name);
FREERDP_API BOOL freerdp_client_add_dynamic_channel(rdpSettings* settings, size_t count,
const char** params);
const char* const* params);
FREERDP_API BOOL freerdp_client_del_dynamic_channel(rdpSettings* settings, const char* name);
#ifdef __cplusplus

View File

@ -153,7 +153,7 @@ extern "C"
FREERDP_API void freerdp_addin_argv_free(ADDIN_ARGV* args);
WINPR_ATTR_MALLOC(freerdp_addin_argv_free, 1)
FREERDP_API ADDIN_ARGV* freerdp_addin_argv_new(size_t argc, const char* argv[]);
FREERDP_API ADDIN_ARGV* freerdp_addin_argv_new(size_t argc, const char* const argv[]);
WINPR_ATTR_MALLOC(freerdp_addin_argv_free, 1)
FREERDP_API ADDIN_ARGV* freerdp_addin_argv_clone(const ADDIN_ARGV* args);
@ -193,7 +193,8 @@ extern "C"
FREERDP_API void freerdp_device_free(RDPDR_DEVICE* device);
WINPR_ATTR_MALLOC(freerdp_device_free, 1)
FREERDP_API RDPDR_DEVICE* freerdp_device_new(UINT32 Type, size_t count, const char* args[]);
FREERDP_API RDPDR_DEVICE* freerdp_device_new(UINT32 Type, size_t count,
const char* const args[]);
WINPR_ATTR_MALLOC(freerdp_device_free, 1)
FREERDP_API RDPDR_DEVICE* freerdp_device_clone(const RDPDR_DEVICE* device);

View File

@ -300,7 +300,7 @@ RDPDR_DEVICE* freerdp_device_collection_find_type(rdpSettings* settings, UINT32
return NULL;
}
RDPDR_DEVICE* freerdp_device_new(UINT32 Type, size_t count, const char* args[])
RDPDR_DEVICE* freerdp_device_new(UINT32 Type, size_t count, const char* const args[])
{
size_t size = 0;
union
@ -779,7 +779,7 @@ void freerdp_addin_argv_free(ADDIN_ARGV* args)
free(args);
}
ADDIN_ARGV* freerdp_addin_argv_new(size_t argc, const char* argv[])
ADDIN_ARGV* freerdp_addin_argv_new(size_t argc, const char* const argv[])
{
if (argc > INT32_MAX)
return NULL;