]> granicus.if.org Git - curl/commitdiff
curl_threads: silence bad-function-cast warning
authorMarcel Raad <Marcel.Raad@teamviewer.com>
Thu, 23 Aug 2018 07:55:40 +0000 (09:55 +0200)
committerMarcel Raad <Marcel.Raad@teamviewer.com>
Fri, 24 Aug 2018 17:20:16 +0000 (19:20 +0200)
As uintptr_t and HANDLE are always the same size, this warning is
harmless. Just silence it using an intermediate uintptr_t variable.

Closes https://github.com/curl/curl/pull/2908

lib/curl_threads.c

index c1624a913668e21a24e473755fea365be3e7e175..b8f0cd35d527c2e554e8b886692c80eed7ec3797 100644 (file)
@@ -108,7 +108,8 @@ curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void *),
 #ifdef _WIN32_WCE
   t = CreateThread(NULL, 0, func, arg, 0, NULL);
 #else
-  t = (curl_thread_t)_beginthreadex(NULL, 0, func, arg, 0, NULL);
+  uintptr_t thread_handle = _beginthreadex(NULL, 0, func, arg, 0, NULL);
+  t = (curl_thread_t)thread_handle;
 #endif
   if((t == 0) || (t == LongToHandle(-1L))) {
 #ifdef _WIN32_WCE