crt: Fix profil.c compile warning: cast between incompatible function types

profile/profil.c:140:36: warning: cast between incompatible function types from ‘void (__attribute__((stdcall)) *)(void *)’ to ‘DWORD (__attribute__((stdcall)) *)(void *)’ [-Wcast-function-type]

Callback thread function must return DWORD, not void.

Signed-off-by: LIU Hao <lh_mouse@126.com>
This commit is contained in:
Pali Rohár 2024-08-06 15:29:07 +02:00 committed by LIU Hao
parent 5d453b075b
commit a20b17848e

View File

@ -70,9 +70,9 @@ print_prof (struct profinfo *p)
/* Everytime we wake up use the main thread pc to hash into the cell in the
profile buffer ARG. */
static void CALLBACK profthr_func (LPVOID);
static DWORD CALLBACK profthr_func (LPVOID);
static void CALLBACK
static DWORD CALLBACK
profthr_func (LPVOID arg)
{
struct profinfo *p = (struct profinfo *) arg;
@ -91,7 +91,7 @@ profthr_func (LPVOID arg)
#endif
/* Check quit condition, WAIT_OBJECT_0 or WAIT_TIMEOUT */
if (WaitForSingleObject (p->quitevt, SLEEPTIME) == WAIT_OBJECT_0)
return;
return 0;
}
}
@ -137,8 +137,7 @@ profile_on (struct profinfo *p)
return -1;
}
p->profthr = CreateThread (0, 0, (DWORD (WINAPI *)(LPVOID)) profthr_func,
(void *) p, 0, &thrid);
p->profthr = CreateThread (0, 0, profthr_func, (void *) p, 0, &thrid);
if (!p->profthr)
{