Remove unnecessary checks for INVALID_SOCKET in MSW code

wxSocketManager::Install_Callback() and Uninstall_Callback() are only
called for successfully created sockets, so there should be no need for
these checks and there are none in the Unix version.
This commit is contained in:
Vadim Zeitlin
2017-08-15 14:15:33 +02:00
parent 8a29f958a1
commit 2e3e265a8b

View File

@@ -267,8 +267,6 @@ void wxSocketMSWManager::Install_Callback(wxSocketImpl *socket_,
{ {
wxSocketImplMSW * const socket = static_cast<wxSocketImplMSW *>(socket_); wxSocketImplMSW * const socket = static_cast<wxSocketImplMSW *>(socket_);
if (socket->m_fd != INVALID_SOCKET)
{
/* We could probably just subscribe to all events regardless /* We could probably just subscribe to all events regardless
* of the socket type, but MS recommends to do it this way. * of the socket type, but MS recommends to do it this way.
*/ */
@@ -276,7 +274,6 @@ void wxSocketMSWManager::Install_Callback(wxSocketImpl *socket_,
FD_ACCEPT : (FD_READ | FD_WRITE | FD_CONNECT | FD_CLOSE); FD_ACCEPT : (FD_READ | FD_WRITE | FD_CONNECT | FD_CLOSE);
gs_WSAAsyncSelect(socket->m_fd, hWin, socket->m_msgnumber, lEvent); gs_WSAAsyncSelect(socket->m_fd, hWin, socket->m_msgnumber, lEvent);
} }
}
/* /*
* Disable event notifications (used when shutting down the socket) * Disable event notifications (used when shutting down the socket)
@@ -286,11 +283,8 @@ void wxSocketMSWManager::Uninstall_Callback(wxSocketImpl *socket_,
{ {
wxSocketImplMSW * const socket = static_cast<wxSocketImplMSW *>(socket_); wxSocketImplMSW * const socket = static_cast<wxSocketImplMSW *>(socket_);
if (socket->m_fd != INVALID_SOCKET)
{
gs_WSAAsyncSelect(socket->m_fd, hWin, socket->m_msgnumber, 0); gs_WSAAsyncSelect(socket->m_fd, hWin, socket->m_msgnumber, 0);
} }
}
// set the wxBase variable to point to our wxSocketManager implementation // set the wxBase variable to point to our wxSocketManager implementation
// //