]> granicus.if.org Git - curl/commitdiff
telnet: fix clang warnings
authorGisle Vanem <gisle.vanem@gmail.com>
Fri, 29 Jun 2018 21:22:19 +0000 (23:22 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 1 Jul 2018 10:45:27 +0000 (12:45 +0200)
telnet.c(1401,28): warning: cast from function call of type 'int' to
non-matching type 'HANDLE' (aka 'void *') [-Wbad-function-cast]

Fixes #2696
Closes #2700

lib/telnet.c

index b04d30bb9635120ed9cd9b9750b84cff9f8f1dc5..fff3f3378d15b3f344fef5a345537008c05a2aa9 100644 (file)
@@ -92,6 +92,7 @@
 #endif
 
 #ifdef USE_WINSOCK
+typedef WSAEVENT (WINAPI *WSOCK2_EVENT)(void);
 typedef FARPROC WSOCK2_FUNC;
 static CURLcode check_wsock2(struct Curl_easy *data);
 #endif
@@ -1306,7 +1307,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
 #ifdef USE_WINSOCK
   HMODULE wsock2;
   WSOCK2_FUNC close_event_func;
-  WSOCK2_FUNC create_event_func;
+  WSOCK2_EVENT create_event_func;
   WSOCK2_FUNC event_select_func;
   WSOCK2_FUNC enum_netevents_func;
   WSAEVENT event_handle;
@@ -1360,7 +1361,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
   }
 
   /* Grab a pointer to WSACreateEvent */
-  create_event_func = GetProcAddress(wsock2, "WSACreateEvent");
+  create_event_func = (WSOCK2_EVENT) GetProcAddress(wsock2, "WSACreateEvent");
   if(create_event_func == NULL) {
     failf(data, "failed to find WSACreateEvent function (%u)", GetLastError());
     FreeLibrary(wsock2);