[casts] remove fnObject* function pointer casts

use proper types that match the function pointer definition to avoid
surprises if the code should be refactored
This commit is contained in:
akallabeth 2023-09-20 15:57:39 +02:00 committed by akallabeth
parent 144df287a2
commit 5a7a1c159d
4 changed files with 21 additions and 6 deletions

View File

@ -154,8 +154,9 @@ static void xf_cliprdr_clear_cached_data(xfClipboard* clipboard);
static UINT xf_cliprdr_send_client_format_list(xfClipboard* clipboard, BOOL force);
static void xf_cliprdr_set_selection_owner(xfContext* xfc, xfClipboard* clipboard, Time timestamp);
static void xf_cached_data_free(xfCachedData* cached_data)
static void xf_cached_data_free(void* ptr)
{
xfCachedData* cached_data = ptr;
if (!cached_data)
return;

View File

@ -1535,6 +1535,8 @@ fail:
return cliprdr_file_context_send_file_contents_failure(file, fileContentsRequest);
}
static void cliprdr_local_stream_free(void* obj);
static UINT change_lock(CliprdrFileContext* file, UINT32 lockId, BOOL lock)
{
UINT rc = CHANNEL_RC_OK;

View File

@ -188,6 +188,18 @@ static BOOL wchar_compare(const void* a, const void* b)
return _wcscmp(wa, wb) == 0;
}
static void* str_copy(const void* ptr)
{
const char* src = ptr;
return _strdup(src);
}
static void* wstr_copy(const void* ptr)
{
const WCHAR* src = ptr;
return _wcsdup(src);
}
static SCardContext* scard_context_new(void)
{
SCardContext* ctx = calloc(1, sizeof(SCardContext));
@ -215,7 +227,7 @@ static SCardContext* scard_context_new(void)
WINPR_ASSERT(val);
key->fnObjectEquals = char_compare;
key->fnObjectNew = (OBJECT_NEW_FN)_strdup;
key->fnObjectNew = str_copy;
key->fnObjectFree = free;
val->fnObjectFree = free;
@ -232,7 +244,7 @@ static SCardContext* scard_context_new(void)
WINPR_ASSERT(val);
key->fnObjectEquals = wchar_compare;
key->fnObjectNew = (OBJECT_NEW_FN)_wcsdup;
key->fnObjectNew = wstr_copy;
key->fnObjectFree = free;
val->fnObjectFree = free;

View File

@ -126,10 +126,10 @@ static BOOL client_to_proxy_context_new(freerdp_peer* client, rdpContext* ctx)
goto error;
obj = HashTable_KeyObject(context->channelsByFrontId);
obj->fnObjectEquals = (OBJECT_EQUALS_FN)ChannelId_Compare;
obj->fnObjectEquals = ChannelId_Compare;
obj = HashTable_ValueObject(context->channelsByFrontId);
obj->fnObjectFree = (OBJECT_FREE_FN)StaticChannelContext_free;
obj->fnObjectFree = StaticChannelContext_free;
context->channelsByBackId = HashTable_New(FALSE);
if (!context->channelsByBackId)
@ -138,7 +138,7 @@ static BOOL client_to_proxy_context_new(freerdp_peer* client, rdpContext* ctx)
goto error;
obj = HashTable_KeyObject(context->channelsByBackId);
obj->fnObjectEquals = (OBJECT_EQUALS_FN)ChannelId_Compare;
obj->fnObjectEquals = ChannelId_Compare;
return TRUE;