]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/socket.cpp
Various source cleanings.
[wxWidgets.git] / src / common / socket.cpp
index f4f42cc31f4ba7c0d14869dbb401c1d40ed21588..247be68f8ea28480f73f7cfafeba25bcc97ef2d2 100644 (file)
 // Declarations
 // ==========================================================================
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "socket.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
@@ -99,7 +95,7 @@ public:
 public:
   wxSocketState() : wxObject() {}
 
-    DECLARE_NO_COPY_CLASS(wxSocketState)
+  DECLARE_NO_COPY_CLASS(wxSocketState)
 };
 
 // ==========================================================================
@@ -1057,7 +1053,7 @@ wxUint32 wxSocketBase::GetPushback(void *buffer, wxUint32 size, bool peek)
 // Ctor
 // --------------------------------------------------------------------------
 
-wxSocketServer::wxSocketServer(wxSockAddress& addr_man,
+wxSocketServer::wxSocketServer(const wxSockAddress& addr_man,
                                wxSocketFlags flags)
               : wxSocketBase(flags, wxSOCKET_SERVER)
 {
@@ -1154,6 +1150,8 @@ bool wxSocketServer::WaitForAccept(long seconds, long milliseconds)
 
 bool wxSocketBase::GetOption(int level, int optname, void *optval, int *optlen)
 {
+    wxASSERT_MSG( m_socket, _T("Socket not initialised") );
+
     if (m_socket->GetSockOpt(level, optname, optval, optlen)
         != GSOCK_NOERROR)
     {
@@ -1165,6 +1163,8 @@ bool wxSocketBase::GetOption(int level, int optname, void *optval, int *optlen)
 bool wxSocketBase::SetOption(int level, int optname, const void *optval,
                               int optlen)
 {
+    wxASSERT_MSG( m_socket, _T("Socket not initialised") );
+    
     if (m_socket->SetSockOpt(level, optname, optval, optlen)
         != GSOCK_NOERROR)
     {
@@ -1260,7 +1260,7 @@ bool wxSocketClient::WaitOnConnect(long seconds, long milliseconds)
 
 /* NOTE: experimental stuff - might change */
 
-wxDatagramSocket::wxDatagramSocket( wxSockAddress& addr,
+wxDatagramSocket::wxDatagramSocket( const wxSockAddress& addr,
                                     wxSocketFlags flags )
                 : wxSocketBase( flags, wxSOCKET_DATAGRAM )
 {
@@ -1300,10 +1300,12 @@ wxDatagramSocket& wxDatagramSocket::RecvFrom( wxSockAddress& addr,
     return (*this);
 }
 
-wxDatagramSocket& wxDatagramSocket::SendTo( wxSockAddress& addr,
+wxDatagramSocket& wxDatagramSocket::SendTo( const wxSockAddress& addr,
                                             const void* buf,
                                             wxUint32 nBytes )
 {
+    wxASSERT_MSG( m_socket, _T("Socket not initialised") );
+    
     m_socket->SetPeer(addr.GetAddress());
     Write(buf, nBytes);
     return (*this);