[channels] fix function pointer casts
* Cast freerdp_load_channel_addin_entry return with a union (removes the incompatible function pointer cast warnings) * Typedef function pointers in tables.h
This commit is contained in:
parent
f3d84d4557
commit
b77d6e8550
@ -810,11 +810,15 @@ static UINT audin_load_device_plugin(AUDIN_PLUGIN* audin, const char* name, cons
|
||||
|
||||
FREERDP_AUDIN_DEVICE_ENTRY_POINTS entryPoints = { 0 };
|
||||
UINT error = ERROR_INTERNAL_ERROR;
|
||||
const PFREERDP_AUDIN_DEVICE_ENTRY entry =
|
||||
(const PFREERDP_AUDIN_DEVICE_ENTRY)freerdp_load_channel_addin_entry(AUDIN_CHANNEL_NAME,
|
||||
name, NULL, 0);
|
||||
|
||||
if (entry == NULL)
|
||||
union
|
||||
{
|
||||
PVIRTUALCHANNELENTRY pvce;
|
||||
PFREERDP_AUDIN_DEVICE_ENTRY entry;
|
||||
} cnv;
|
||||
cnv.pvce = freerdp_load_channel_addin_entry(AUDIN_CHANNEL_NAME, name, NULL, 0);
|
||||
|
||||
if (cnv.entry == NULL)
|
||||
{
|
||||
WLog_Print(audin->log, WLOG_ERROR,
|
||||
"freerdp_load_channel_addin_entry did not return any function pointers for %s ",
|
||||
@ -827,7 +831,8 @@ static UINT audin_load_device_plugin(AUDIN_PLUGIN* audin, const char* name, cons
|
||||
entryPoints.args = args;
|
||||
entryPoints.rdpcontext = audin->rdpcontext;
|
||||
|
||||
if ((error = entry(&entryPoints)))
|
||||
error = cnv.entry(&entryPoints);
|
||||
if (error)
|
||||
{
|
||||
WLog_Print(audin->log, WLOG_ERROR, "%s entry returned error %" PRIu32 ".", name, error);
|
||||
return error;
|
||||
|
@ -57,7 +57,7 @@ static void* freerdp_channels_find_static_entry_in_table(const STATIC_ENTRY_TABL
|
||||
union
|
||||
{
|
||||
void* pv;
|
||||
UINT (*entry)();
|
||||
static_entry_fn_t entry;
|
||||
} cnv;
|
||||
cnv.entry = pEntry->entry;
|
||||
return cnv.pv;
|
||||
|
@ -24,10 +24,11 @@
|
||||
WINPR_PRAGMA_DIAG_PUSH
|
||||
WINPR_PRAGMA_DIAG_IGNORED_STRICT_PROTOTYPES
|
||||
|
||||
typedef UINT (*static_entry_fn_t)();
|
||||
typedef struct
|
||||
{
|
||||
const char* name;
|
||||
UINT (*entry)();
|
||||
static_entry_fn_t entry;
|
||||
} STATIC_ENTRY;
|
||||
|
||||
typedef struct
|
||||
@ -36,18 +37,20 @@ typedef struct
|
||||
const STATIC_ENTRY* table;
|
||||
} STATIC_ENTRY_TABLE;
|
||||
|
||||
typedef UINT (*static_subsystem_entry_fn_t)();
|
||||
typedef struct
|
||||
{
|
||||
const char* name;
|
||||
const char* type;
|
||||
UINT (*entry)();
|
||||
static_subsystem_entry_fn_t entry;
|
||||
} STATIC_SUBSYSTEM_ENTRY;
|
||||
|
||||
typedef UINT (*static_addin_entry_fn_t)();
|
||||
typedef struct
|
||||
{
|
||||
const char* name;
|
||||
const char* type;
|
||||
UINT (*entry)();
|
||||
static_addin_entry_fn_t entry;
|
||||
const STATIC_SUBSYSTEM_ENTRY* table;
|
||||
} STATIC_ADDIN_TABLE;
|
||||
|
||||
|
@ -352,18 +352,22 @@ fail:
|
||||
static UINT dvcman_load_addin(drdynvcPlugin* drdynvc, IWTSVirtualChannelManager* pChannelMgr,
|
||||
const ADDIN_ARGV* args, rdpContext* context)
|
||||
{
|
||||
PDVC_PLUGIN_ENTRY pDVCPluginEntry = NULL;
|
||||
|
||||
WINPR_ASSERT(drdynvc);
|
||||
WINPR_ASSERT(pChannelMgr);
|
||||
WINPR_ASSERT(args);
|
||||
WINPR_ASSERT(context);
|
||||
|
||||
WLog_Print(drdynvc->log, WLOG_INFO, "Loading Dynamic Virtual Channel %s", args->argv[0]);
|
||||
pDVCPluginEntry = (PDVC_PLUGIN_ENTRY)freerdp_load_channel_addin_entry(
|
||||
args->argv[0], NULL, NULL, FREERDP_ADDIN_CHANNEL_DYNAMIC);
|
||||
|
||||
if (pDVCPluginEntry)
|
||||
union
|
||||
{
|
||||
PVIRTUALCHANNELENTRY pvce;
|
||||
PDVC_PLUGIN_ENTRY pDVCPluginEntry;
|
||||
} cnv;
|
||||
cnv.pvce =
|
||||
freerdp_load_channel_addin_entry(args->argv[0], NULL, NULL, FREERDP_ADDIN_CHANNEL_DYNAMIC);
|
||||
|
||||
if (cnv.pDVCPluginEntry)
|
||||
{
|
||||
DVCMAN_ENTRY_POINTS entryPoints = { 0 };
|
||||
|
||||
@ -375,7 +379,7 @@ static UINT dvcman_load_addin(drdynvcPlugin* drdynvc, IWTSVirtualChannelManager*
|
||||
entryPoints.dvcman = (DVCMAN*)pChannelMgr;
|
||||
entryPoints.args = args;
|
||||
entryPoints.context = context;
|
||||
return pDVCPluginEntry(&entryPoints.iface);
|
||||
return cnv.pDVCPluginEntry(&entryPoints.iface);
|
||||
}
|
||||
|
||||
return ERROR_INVALID_FUNCTION;
|
||||
|
@ -185,8 +185,12 @@ static const char PARALLEL_SERVICE_NAME[] = "parallel";
|
||||
UINT devman_load_device_service(DEVMAN* devman, const RDPDR_DEVICE* device, rdpContext* rdpcontext)
|
||||
{
|
||||
const char* ServiceName = NULL;
|
||||
DEVICE_SERVICE_ENTRY_POINTS ep;
|
||||
PDEVICE_SERVICE_ENTRY entry = NULL;
|
||||
DEVICE_SERVICE_ENTRY_POINTS ep = { 0 };
|
||||
union
|
||||
{
|
||||
PVIRTUALCHANNELENTRY pvce;
|
||||
PDEVICE_SERVICE_ENTRY entry;
|
||||
} cnv;
|
||||
union
|
||||
{
|
||||
const RDPDR_DEVICE* cdp;
|
||||
@ -219,10 +223,9 @@ UINT devman_load_device_service(DEVMAN* devman, const RDPDR_DEVICE* device, rdpC
|
||||
else
|
||||
WLog_INFO(TAG, "Loading device service %s (static)", ServiceName);
|
||||
|
||||
entry = (PDEVICE_SERVICE_ENTRY)freerdp_load_channel_addin_entry(ServiceName, NULL,
|
||||
"DeviceServiceEntry", 0);
|
||||
cnv.pvce = freerdp_load_channel_addin_entry(ServiceName, NULL, "DeviceServiceEntry", 0);
|
||||
|
||||
if (!entry)
|
||||
if (!cnv.entry)
|
||||
{
|
||||
WLog_INFO(TAG, "freerdp_load_channel_addin_entry failed!");
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
@ -232,5 +235,5 @@ UINT devman_load_device_service(DEVMAN* devman, const RDPDR_DEVICE* device, rdpC
|
||||
ep.RegisterDevice = devman_register_device;
|
||||
ep.device = devconv.dp;
|
||||
ep.rdpcontext = rdpcontext;
|
||||
return entry(&ep);
|
||||
return cnv.entry(&ep);
|
||||
}
|
||||
|
@ -468,11 +468,14 @@ static UINT ecam_load_hal_plugin(CameraPlugin* ecam, const char* name, const ADD
|
||||
|
||||
FREERDP_CAMERA_HAL_ENTRY_POINTS entryPoints = { 0 };
|
||||
UINT error = ERROR_INTERNAL_ERROR;
|
||||
const PFREERDP_CAMERA_HAL_ENTRY entry =
|
||||
(const PFREERDP_CAMERA_HAL_ENTRY)freerdp_load_channel_addin_entry(RDPECAM_CHANNEL_NAME,
|
||||
name, NULL, 0);
|
||||
union
|
||||
{
|
||||
PVIRTUALCHANNELENTRY pvce;
|
||||
const PFREERDP_CAMERA_HAL_ENTRY entry;
|
||||
} cnv;
|
||||
cnv.pvce = freerdp_load_channel_addin_entry(RDPECAM_CHANNEL_NAME, name, NULL, 0);
|
||||
|
||||
if (entry == NULL)
|
||||
if (cnv.entry == NULL)
|
||||
{
|
||||
WLog_ERR(TAG,
|
||||
"freerdp_load_channel_addin_entry did not return any function pointers for %s ",
|
||||
@ -485,7 +488,8 @@ static UINT ecam_load_hal_plugin(CameraPlugin* ecam, const char* name, const ADD
|
||||
entryPoints.args = args;
|
||||
entryPoints.ecam = ecam;
|
||||
|
||||
if ((error = entry(&entryPoints)))
|
||||
error = cnv.entry(&entryPoints);
|
||||
if (error)
|
||||
{
|
||||
WLog_ERR(TAG, "%s entry returned error %" PRIu32 ".", name, error);
|
||||
return error;
|
||||
|
@ -848,23 +848,28 @@ static void rdpsnd_register_device_plugin(rdpsndPlugin* rdpsnd, rdpsndDevicePlug
|
||||
static UINT rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name,
|
||||
const ADDIN_ARGV* args)
|
||||
{
|
||||
PFREERDP_RDPSND_DEVICE_ENTRY entry = NULL;
|
||||
FREERDP_RDPSND_DEVICE_ENTRY_POINTS entryPoints;
|
||||
union
|
||||
{
|
||||
PVIRTUALCHANNELENTRY pvce;
|
||||
PFREERDP_RDPSND_DEVICE_ENTRY entry;
|
||||
} cnv;
|
||||
|
||||
FREERDP_RDPSND_DEVICE_ENTRY_POINTS entryPoints = { 0 };
|
||||
UINT error = 0;
|
||||
DWORD flags = FREERDP_ADDIN_CHANNEL_STATIC | FREERDP_ADDIN_CHANNEL_ENTRYEX;
|
||||
if (rdpsnd->dynamic)
|
||||
flags = FREERDP_ADDIN_CHANNEL_DYNAMIC;
|
||||
entry = (PFREERDP_RDPSND_DEVICE_ENTRY)freerdp_load_channel_addin_entry(RDPSND_CHANNEL_NAME,
|
||||
name, NULL, flags);
|
||||
cnv.pvce = freerdp_load_channel_addin_entry(RDPSND_CHANNEL_NAME, name, NULL, flags);
|
||||
|
||||
if (!entry)
|
||||
if (!cnv.entry)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
entryPoints.rdpsnd = rdpsnd;
|
||||
entryPoints.pRegisterRdpsndDevice = rdpsnd_register_device_plugin;
|
||||
entryPoints.args = args;
|
||||
|
||||
if ((error = entry(&entryPoints)))
|
||||
error = cnv.entry(&entryPoints);
|
||||
if (error)
|
||||
WLog_ERR(TAG, "%s %s entry returns error %" PRIu32 "", rdpsnd_is_dyn_str(rdpsnd->dynamic),
|
||||
name, error);
|
||||
|
||||
|
@ -769,22 +769,26 @@ static BOOL urbdrc_register_udevman_addin(IWTSPlugin* pPlugin, IUDEVMAN* udevman
|
||||
static UINT urbdrc_load_udevman_addin(IWTSPlugin* pPlugin, LPCSTR name, const ADDIN_ARGV* args)
|
||||
{
|
||||
URBDRC_PLUGIN* urbdrc = (URBDRC_PLUGIN*)pPlugin;
|
||||
PFREERDP_URBDRC_DEVICE_ENTRY entry = NULL;
|
||||
FREERDP_URBDRC_SERVICE_ENTRY_POINTS entryPoints;
|
||||
entry = (PFREERDP_URBDRC_DEVICE_ENTRY)freerdp_load_channel_addin_entry(URBDRC_CHANNEL_NAME,
|
||||
name, NULL, 0);
|
||||
FREERDP_URBDRC_SERVICE_ENTRY_POINTS entryPoints = { 0 };
|
||||
union
|
||||
{
|
||||
PVIRTUALCHANNELENTRY pvce;
|
||||
PFREERDP_URBDRC_DEVICE_ENTRY entry;
|
||||
} cnv;
|
||||
cnv.pvce = freerdp_load_channel_addin_entry(URBDRC_CHANNEL_NAME, name, NULL, 0);
|
||||
|
||||
if (!entry)
|
||||
if (!cnv.entry)
|
||||
return ERROR_INVALID_OPERATION;
|
||||
|
||||
entryPoints.plugin = pPlugin;
|
||||
entryPoints.pRegisterUDEVMAN = urbdrc_register_udevman_addin;
|
||||
entryPoints.args = args;
|
||||
|
||||
if (entry(&entryPoints) != 0)
|
||||
const UINT error = cnv.entry(&entryPoints);
|
||||
if (error)
|
||||
{
|
||||
WLog_Print(urbdrc->log, WLOG_ERROR, "%s entry returns error.", name);
|
||||
return ERROR_INVALID_OPERATION;
|
||||
return error;
|
||||
}
|
||||
|
||||
return CHANNEL_RC_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user