mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 16:34:18 +09:00
[compiler,gcc] fix function pointer casts
use dedicated macro WINPR_FUNC_PTR_CAST to cast function pointers without warnings.
This commit is contained in:
@@ -456,9 +456,9 @@ static void check_open_close_receive(DVCMAN_CHANNEL* channel)
|
|||||||
WINPR_ASSERT(cb);
|
WINPR_ASSERT(cb);
|
||||||
if (!cb->OnOpen || !cb->OnClose || !cb->OnDataReceived)
|
if (!cb->OnOpen || !cb->OnClose || !cb->OnDataReceived)
|
||||||
WLog_VRB(TAG, "{%s:%" PRIu32 "} OnOpen=%p, OnClose=%p, OnDataReceived=%p", name, id,
|
WLog_VRB(TAG, "{%s:%" PRIu32 "} OnOpen=%p, OnClose=%p, OnDataReceived=%p", name, id,
|
||||||
WINPR_CXX_COMPAT_CAST(const void*, cb->OnOpen),
|
WINPR_FUNC_PTR_CAST(cb->OnOpen, const void*),
|
||||||
WINPR_CXX_COMPAT_CAST(const void*, cb->OnClose),
|
WINPR_FUNC_PTR_CAST(cb->OnClose, const void*),
|
||||||
WINPR_CXX_COMPAT_CAST(const void*, cb->OnDataReceived));
|
WINPR_FUNC_PTR_CAST(cb->OnDataReceived, const void*));
|
||||||
}
|
}
|
||||||
|
|
||||||
static UINT dvcman_call_on_receive(DVCMAN_CHANNEL* channel, wStream* data)
|
static UINT dvcman_call_on_receive(DVCMAN_CHANNEL* channel, wStream* data)
|
||||||
|
|||||||
@@ -851,8 +851,8 @@ BOOL freerdp_client_channel_register(rdpChannels* channels, HANDLE handle,
|
|||||||
if (!channels || (handle == INVALID_HANDLE_VALUE) || !fkt)
|
if (!channels || (handle == INVALID_HANDLE_VALUE) || !fkt)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "Invalid function arguments (channels=%p, handle=%p, fkt=%p, userdata=%p",
|
WLog_ERR(TAG, "Invalid function arguments (channels=%p, handle=%p, fkt=%p, userdata=%p",
|
||||||
WINPR_CXX_COMPAT_CAST(const void*, channels), handle,
|
WINPR_FUNC_PTR_CAST(channels, const void*), handle,
|
||||||
WINPR_CXX_COMPAT_CAST(const void*, fkt), userdata);
|
WINPR_FUNC_PTR_CAST(fkt, const void*), userdata);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,43 +44,40 @@ static const SCardApiFunctionTable* g_SCardApi = nullptr;
|
|||||||
#define xstr(s) str(s)
|
#define xstr(s) str(s)
|
||||||
#define str(s) #s
|
#define str(s) #s
|
||||||
|
|
||||||
#define SCARDAPI_STUB_CALL_LONG(_name, ...) \
|
#define SCARDAPI_STUB_CALL_LONG(_name, ...) \
|
||||||
if (!InitOnceExecuteOnce(&g_Initialized, InitializeSCardApiStubs, nullptr, nullptr)) \
|
if (!InitOnceExecuteOnce(&g_Initialized, InitializeSCardApiStubs, nullptr, nullptr)) \
|
||||||
return SCARD_E_NO_SERVICE; \
|
return SCARD_E_NO_SERVICE; \
|
||||||
if (!g_SCardApi || !g_SCardApi->pfn##_name) \
|
if (!g_SCardApi || !g_SCardApi->pfn##_name) \
|
||||||
{ \
|
{ \
|
||||||
WLog_DBG( \
|
WLog_DBG(TAG, "Missing function pointer g_SCardApi=%p->" xstr(pfn##_name) "=%p", \
|
||||||
TAG, "Missing function pointer g_SCardApi=%p->" xstr(pfn##_name) "=%p", \
|
WINPR_FUNC_PTR_CAST(g_SCardApi, const void*), \
|
||||||
WINPR_CXX_COMPAT_CAST(const void*, g_SCardApi), \
|
WINPR_FUNC_PTR_CAST(g_SCardApi ? g_SCardApi->pfn##_name : nullptr, const void*)); \
|
||||||
WINPR_CXX_COMPAT_CAST(const void*, g_SCardApi ? g_SCardApi->pfn##_name : nullptr)); \
|
return SCARD_E_NO_SERVICE; \
|
||||||
return SCARD_E_NO_SERVICE; \
|
} \
|
||||||
} \
|
|
||||||
return g_SCardApi->pfn##_name(__VA_ARGS__)
|
return g_SCardApi->pfn##_name(__VA_ARGS__)
|
||||||
|
|
||||||
#define SCARDAPI_STUB_CALL_HANDLE(_name) \
|
#define SCARDAPI_STUB_CALL_HANDLE(_name) \
|
||||||
if (!InitOnceExecuteOnce(&g_Initialized, InitializeSCardApiStubs, nullptr, nullptr)) \
|
if (!InitOnceExecuteOnce(&g_Initialized, InitializeSCardApiStubs, nullptr, nullptr)) \
|
||||||
return nullptr; \
|
return nullptr; \
|
||||||
if (!g_SCardApi || !g_SCardApi->pfn##_name) \
|
if (!g_SCardApi || !g_SCardApi->pfn##_name) \
|
||||||
{ \
|
{ \
|
||||||
WLog_DBG( \
|
WLog_DBG(TAG, "Missing function pointer g_SCardApi=%p->" xstr(pfn##_name) "=%p", \
|
||||||
TAG, "Missing function pointer g_SCardApi=%p->" xstr(pfn##_name) "=%p", \
|
WINPR_FUNC_PTR_CAST(g_SCardApi, const void*), \
|
||||||
WINPR_CXX_COMPAT_CAST(const void*, g_SCardApi), \
|
WINPR_FUNC_PTR_CAST(g_SCardApi ? g_SCardApi->pfn##_name : nullptr, const void*)); \
|
||||||
WINPR_CXX_COMPAT_CAST(const void*, g_SCardApi ? g_SCardApi->pfn##_name : nullptr)); \
|
return nullptr; \
|
||||||
return nullptr; \
|
} \
|
||||||
} \
|
|
||||||
return g_SCardApi->pfn##_name()
|
return g_SCardApi->pfn##_name()
|
||||||
|
|
||||||
#define SCARDAPI_STUB_CALL_VOID(_name) \
|
#define SCARDAPI_STUB_CALL_VOID(_name) \
|
||||||
if (!InitOnceExecuteOnce(&g_Initialized, InitializeSCardApiStubs, nullptr, nullptr)) \
|
if (!InitOnceExecuteOnce(&g_Initialized, InitializeSCardApiStubs, nullptr, nullptr)) \
|
||||||
return; \
|
return; \
|
||||||
if (!g_SCardApi || !g_SCardApi->pfn##_name) \
|
if (!g_SCardApi || !g_SCardApi->pfn##_name) \
|
||||||
{ \
|
{ \
|
||||||
WLog_DBG( \
|
WLog_DBG(TAG, "Missing function pointer g_SCardApi=%p->" xstr(pfn##_name) "=%p", \
|
||||||
TAG, "Missing function pointer g_SCardApi=%p->" xstr(pfn##_name) "=%p", \
|
WINPR_FUNC_PTR_CAST(g_SCardApi, const void*), \
|
||||||
WINPR_CXX_COMPAT_CAST(const void*, g_SCardApi), \
|
WINPR_FUNC_PTR_CAST(g_SCardApi ? g_SCardApi->pfn##_name : nullptr, const void*)); \
|
||||||
WINPR_CXX_COMPAT_CAST(const void*, g_SCardApi ? g_SCardApi->pfn##_name : nullptr)); \
|
return; \
|
||||||
return; \
|
} \
|
||||||
} \
|
|
||||||
g_SCardApi->pfn##_name()
|
g_SCardApi->pfn##_name()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user