Actually make the correct cast

The cast works best if you don't imply another conversion to a
temporary. Just return the value directly from the syscall/pthreads
call, while casting to a DWORD.
This commit is contained in:
Phil Vachon
2025-08-10 15:09:29 -04:00
parent 9e217fc3ac
commit e620bf6c53

View File

@@ -918,11 +918,9 @@ HANDLE _GetCurrentThread(VOID)
DWORD GetCurrentThreadId(VOID)
{
#if defined(__FreeBSD__)
int tid = WINPR_CXX_COMPAT_CAST(DWORD, pthread_getthreadid_np());
return tid;
return WINPR_CXX_COMPAT_CAST(DWORD, pthread_getthreadid_np());
#elif defined(__linux__)
pid_t tid = WINPR_CXX_COMPAT_CAST(DWORD, syscall(SYS_gettid));
return tid;
return WINPR_CXX_COMPAT_CAST(DWORD, syscall(SYS_gettid));
#else
pthread_t tid = pthread_self();
/* Since pthread_t can be 64-bits on some systems, take just the */