New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
telnet.c warning #2696
Comments
FYI, there is also this similar warning: curl_threads.c(111,22): warning: cast from function call of type
'uintptr_t' (aka 'unsigned int') to non-matching type 'HANDLE' (aka 'void *') [-Wbad-function-cast]
t = (curl_thread_t)_beginthreadex(NULL, 0, func, arg, 0, NULL);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
Can you suggest full patches too, since you have the compiler there to verify that the warnings actually go away... ? |
Here is my suggestion: --- a/telnet.c 2018-06-14 09:28:16
+++ b/telnet.c 2018-06-29 15:04:08
@@ -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 @@
#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 @@
}
/* 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); |
bagder
pushed a commit
that referenced
this issue
Jun 29, 2018
telnet.c(1401,28): warning: cast from function call of type 'int' to non-matching type 'HANDLE' (aka 'void *') [-Wbad-function-cast] Fixes #2696
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
At line 1401 in
lib/telnet.c
:I get this warning when compiling with
clang-cl
ver 6:clang-cl is quite correct; a
WSAEVENT
is always 32-bit andHANDLE
is avoid*
which could be 64-bit wide.A fix is maybe to use another
typedef
for theWSACreateEvent()
function. Like:The text was updated successfully, but these errors were encountered: