osdep/threads-win32: cast function type directly to avoid warnings

This commit is contained in:
Kacper Michajłow 2024-06-10 21:09:20 +02:00
parent ab3d0b73f7
commit c430420840
1 changed files with 3 additions and 2 deletions

View File

@ -188,12 +188,13 @@ static inline int mp_thread_detach(mp_thread thread)
wchar_t *mp_from_utf8(void *talloc_ctx, const char *s); wchar_t *mp_from_utf8(void *talloc_ctx, const char *s);
static inline void mp_thread_set_name(const char *name) static inline void mp_thread_set_name(const char *name)
{ {
HRESULT (WINAPI *pSetThreadDescription)(HANDLE, PCWSTR); typedef HRESULT (WINAPI *SetThreadDescriptionFn)(HANDLE, PCWSTR);
SetThreadDescriptionFn pSetThreadDescription;
#if !HAVE_UWP #if !HAVE_UWP
HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll"); HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll");
if (!kernel32) if (!kernel32)
return; return;
pSetThreadDescription = (void *) GetProcAddress(kernel32, "SetThreadDescription"); pSetThreadDescription = (SetThreadDescriptionFn) GetProcAddress(kernel32, "SetThreadDescription");
if (!pSetThreadDescription) if (!pSetThreadDescription)
return; return;
#else #else