[warnings] fix function pointer casts

This commit is contained in:
akallabeth 2024-09-04 13:21:47 +02:00
parent 9776cc109e
commit 1a9766e190
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
3 changed files with 22 additions and 9 deletions

View File

@ -494,15 +494,20 @@ PVIRTUALCHANNELENTRY freerdp_channels_load_static_addin_entry(LPCSTR pszName, LP
0) || /* we only want to know if strnlen is > 0 */
(strncmp(subsystems->name, pszSubsystem, MAX_PATH) == 0))
{
/* cast with union trick to avoid -Wcast-function-type-strict */
union
{
PVIRTUALCHANNELENTRY pvce;
static_subsystem_entry_fn_t entry;
} cnv;
cnv.entry = subsystems->entry;
if (pszType)
{
if (strncmp(subsystems->type, pszType, MAX_PATH) == 0)
return (PVIRTUALCHANNELENTRY)subsystems->entry;
return cnv.pvce;
}
else
{
return (PVIRTUALCHANNELENTRY)subsystems->entry;
}
return cnv.pvce;
}
}
}

View File

@ -377,8 +377,16 @@ void primitives_init_copy(primitives_t* prims)
/* Start with the default. */
prims->copy_8u = general_copy_8u;
prims->copy_8u_AC4r = general_copy_8u_AC4r;
/* This is just an alias with void* parameters */
prims->copy = (__copy_t)(prims->copy_8u);
/* This is just an alias with void* parameters
* cast with union trick to avoid -Wcast-function-type-strict
*/
union
{
__copy_8u_t ufkt;
__copy_t fkt;
} cnv;
cnv.ufkt = prims->copy_8u;
prims->copy = cnv.fkt;
prims->copy_no_overlap = generic_image_copy_no_overlap;
}

View File

@ -261,8 +261,9 @@ fallback:
return computerName;
}
static int command_line_pre_filter(MAKECERT_CONTEXT* context, int index, int argc, LPCSTR* argv)
static int command_line_pre_filter(void* pvctx, int index, int argc, LPSTR* argv)
{
MAKECERT_CONTEXT* context = pvctx;
if (!context || !argv || (index < 0) || (argc < 0))
return -1;
@ -299,8 +300,7 @@ static int makecert_context_parse_arguments(MAKECERT_CONTEXT* context,
CommandLineClearArgumentsA(args);
flags = COMMAND_LINE_SEPARATOR_SPACE | COMMAND_LINE_SIGIL_DASH;
status =
CommandLineParseArgumentsA(argc, argv, args, flags, context,
(COMMAND_LINE_PRE_FILTER_FN_A)command_line_pre_filter, NULL);
CommandLineParseArgumentsA(argc, argv, args, flags, context, command_line_pre_filter, NULL);
if (status & COMMAND_LINE_STATUS_PRINT_HELP)
{