From e620bf6c53784ec0e9450e00d94b76c8af73e15a Mon Sep 17 00:00:00 2001 From: Phil Vachon Date: Sun, 10 Aug 2025 15:09:29 -0400 Subject: [PATCH] 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. --- winpr/libwinpr/thread/thread.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/winpr/libwinpr/thread/thread.c b/winpr/libwinpr/thread/thread.c index c0698e41c..5323078f3 100644 --- a/winpr/libwinpr/thread/thread.c +++ b/winpr/libwinpr/thread/thread.c @@ -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 */