X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/519cb848a8f4c91c73421bb75314754284e593a4..0834112f89c4c5da7864e17e6f483ce296798ce6:/src/common/socket.cpp?ds=sidebyside diff --git a/src/common/socket.cpp b/src/common/socket.cpp index 0f7a633165..a00beb5e2f 100644 --- a/src/common/socket.cpp +++ b/src/common/socket.cpp @@ -33,6 +33,7 @@ #include "wx/utils.h" #include "wx/module.h" #include "wx/log.h" +#include "wx/intl.h" #include #include @@ -56,12 +57,10 @@ // -------------------------------------------------------------- // ClassInfos // -------------------------------------------------------------- -#if !USE_SHARED_LIBRARY IMPLEMENT_CLASS(wxSocketBase, wxObject) IMPLEMENT_CLASS(wxSocketServer, wxSocketBase) IMPLEMENT_CLASS(wxSocketClient, wxSocketBase) IMPLEMENT_DYNAMIC_CLASS(wxSocketEvent, wxEvent) -#endif class wxSocketState : public wxObject { @@ -155,7 +154,7 @@ public: void Notify() { - *m_state = m_new_val; // Change the value + *m_state = (int)m_new_val; // Change the value } }; @@ -178,7 +177,7 @@ wxUint32 wxSocketBase::DeferRead(char *buffer, wxUint32 nbytes) timer.m_state = (int *)&m_defer_buffer; timer.m_new_val = 0; - timer.Start(m_timeout * 1000, FALSE); + timer.Start((int)(m_timeout * 1000), FALSE); // If the socket is readable, call DoDefer for the first time if (GSocket_Select(m_socket, GSOCK_INPUT_FLAG)) @@ -315,7 +314,7 @@ wxSocketBase& wxSocketBase::ReadMsg(char* buffer, wxUint32 nbytes) if (sig != 0xfeeddead) { - wxLogMessage(wxT("Warning: invalid signature returned to ReadMsg")); + wxLogWarning( _("TCP: invalid signature returned to ReadMsg.")); goto exit; } @@ -353,8 +352,8 @@ wxSocketBase& wxSocketBase::ReadMsg(char* buffer, wxUint32 nbytes) do { discard_len = ((len2 > MAX_DISCARD_SIZE)? MAX_DISCARD_SIZE : len2); - discard_len = _Read(discard_buffer, discard_len); - len2 -= discard_len; + discard_len = _Read(discard_buffer, (wxUint32)discard_len); + len2 -= (wxUint32)discard_len; } while ((discard_len > 0) && len2); @@ -432,7 +431,7 @@ wxUint32 wxSocketBase::DeferWrite(const char *buffer, wxUint32 nbytes) timer.m_state = (int *)&m_defer_buffer; timer.m_new_val = 0; - timer.Start(m_timeout * 1000, FALSE); + timer.Start((int)(m_timeout * 1000), FALSE); // If the socket is writable, call DoDefer for the first time if (GSocket_Select(m_socket, GSOCK_OUTPUT_FLAG)) @@ -451,8 +450,8 @@ wxUint32 wxSocketBase::DeferWrite(const char *buffer, wxUint32 nbytes) m_defer_timer = NULL; m_defering = NO_DEFER; - wxString s; - s.Printf(wxT("Saliendo de DeferWrite: total %d bytes"), nbytes-m_defer_nbytes); + //wxString s; + //s.Printf(wxT("Saliendo de DeferWrite: total %d bytes"), nbytes-m_defer_nbytes); //wxLogMessage(s); return nbytes-m_defer_nbytes; @@ -649,7 +648,7 @@ void wxSocketBase::DoDefer() else { m_defer_buffer += ret; - m_defer_timer->Start(m_timeout * 1000, FALSE); + m_defer_timer->Start((int)(m_timeout * 1000), FALSE); } //wxLogMessage("DoDefer ha transferido %d bytes", ret); @@ -799,7 +798,7 @@ bool wxSocketBase::_Wait(long seconds, long milliseconds, wxSocketEventFlags fla { timer.m_state = &state; timer.m_new_val = 0; - timer.Start(timeout, TRUE); + timer.Start((int)timeout, TRUE); } // Active polling (without using events) @@ -889,7 +888,7 @@ void wxSocketBase::SetTimeout(long seconds) m_timeout = seconds; if (m_socket) - GSocket_SetTimeout(m_socket, m_timeout); + GSocket_SetTimeout(m_socket, m_timeout * 1000); } // -------------------------------------------------------------- @@ -1105,7 +1104,7 @@ wxSocketServer::wxSocketServer(wxSockAddress& addr_man, return; } - GSocket_SetTimeout(m_socket, m_timeout); + GSocket_SetTimeout(m_socket, m_timeout * 1000); GSocket_SetCallback(m_socket, GSOCK_INPUT_FLAG | GSOCK_OUTPUT_FLAG | GSOCK_LOST_FLAG | GSOCK_CONNECTION_FLAG, wx_socket_callback, (char *)this); @@ -1143,7 +1142,7 @@ bool wxSocketServer::AcceptWith(wxSocketBase& sock, bool wait) sock.m_socket = child_socket; sock.m_connected = TRUE; - GSocket_SetTimeout(sock.m_socket, sock.m_timeout); + GSocket_SetTimeout(sock.m_socket, sock.m_timeout * 1000); GSocket_SetCallback(sock.m_socket, GSOCK_INPUT_FLAG | GSOCK_OUTPUT_FLAG | GSOCK_LOST_FLAG | GSOCK_CONNECTION_FLAG, wx_socket_callback, (char *)&sock); @@ -1207,7 +1206,7 @@ bool wxSocketClient::Connect(wxSockAddress& addr_man, bool wait) if (!m_socket) return FALSE; - GSocket_SetTimeout(m_socket, m_timeout); + GSocket_SetTimeout(m_socket, m_timeout * 1000); GSocket_SetCallback(m_socket, GSOCK_INPUT_FLAG | GSOCK_OUTPUT_FLAG | GSOCK_LOST_FLAG | GSOCK_CONNECTION_FLAG, wx_socket_callback, (char *)this);