Skip to content

telnet.c warning #2696

@gvanem

Description

@gvanem

At line 1401 in lib/telnet.c:

  event_handle = (WSAEVENT)create_event_func();

I get this warning when compiling with clang-cl ver 6:

telnet.c(1401,28):  warning: cast from function call of type 'int' to non-matching 
type 'HANDLE' (aka 'void *') [-Wbad-function-cast]
  event_handle = (WSAEVENT)create_event_func();
                           ^~~~~~~~~~~~~~~~~~~

clang-cl is quite correct; a WSAEVENT is always 32-bit and HANDLE is a void* which could be 64-bit wide.

A fix is maybe to use another typedef for the WSACreateEvent() function. Like:

  typedef WSAEVENT (WINAPI *WSOCK2_EVENT)(void);
  ...
  WSOCK2_EVENT create_event_func;
  ...
  create_event_func = (WSOCK2_EVENT) GetProcAddress(wsock2, "WSACreateEvent");

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions