From 72ac4e888aff9b766216f96cc090b051a7f52188 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 6 Jul 2008 02:21:39 +0000 Subject: [PATCH] take const address objects in wxSocketClient::Connect() and wxSocketBase::SetLocal() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54504 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/socket.h | 12 +++++++----- interface/wx/socket.h | 6 +++--- src/common/socket.cpp | 16 ++++++++++------ 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/include/wx/socket.h b/include/wx/socket.h index 5e9e687b3e..40a8ed35c1 100644 --- a/include/wx/socket.h +++ b/include/wx/socket.h @@ -124,7 +124,7 @@ public: // addresses virtual bool GetLocal(wxSockAddress& addr_man) const; virtual bool GetPeer(wxSockAddress& addr_man) const; - virtual bool SetLocal(wxIPV4address& local); + virtual bool SetLocal(const wxIPV4address& local); // base IO virtual bool Close(); @@ -258,8 +258,9 @@ public: wxSocketClient(wxSocketFlags flags = wxSOCKET_NONE); virtual ~wxSocketClient(); - virtual bool Connect(wxSockAddress& addr, bool wait = true); - bool Connect(wxSockAddress& addr, wxSockAddress& local, bool wait = true); + virtual bool Connect(const wxSockAddress& addr, bool wait = true); + bool Connect(const wxSockAddress& addr, const wxSockAddress& local, + bool wait = true); bool WaitOnConnect(long seconds = -1, long milliseconds = 0); @@ -272,8 +273,9 @@ public: } private: - virtual bool - DoConnect(wxSockAddress& addr, wxSockAddress* local, bool wait = true); + virtual bool DoConnect(const wxSockAddress& addr, + const wxSockAddress* local, + bool wait = true); // buffer sizes, -1 if unset and defaults should be used int m_initialRecvBufferSize; diff --git a/interface/wx/socket.h b/interface/wx/socket.h index 8f06f895a6..4248752b6d 100644 --- a/interface/wx/socket.h +++ b/interface/wx/socket.h @@ -272,8 +272,8 @@ public: @see WaitOnConnect(), wxSocketBase::SetNotify, wxSocketBase::Notify */ - bool Connect(wxSockAddress& address, bool wait = true); - bool Connect(wxSockAddress& address, wxSockAddress& local, + bool Connect(const wxSockAddress& address, bool wait = true); + bool Connect(const wxSockAddress& address, const wxSockAddress& local, bool wait = true); //@} @@ -813,7 +813,7 @@ public: a local port is set for a wxSocketClient, @b bind will be called before @b connect. */ - bool SetLocal(wxIPV4address& local); + bool SetLocal(const wxIPV4address& local); /** SetNotify specifies which socket events are to be sent to the event handler. diff --git a/src/common/socket.cpp b/src/common/socket.cpp index a53ae44d63..70a788017c 100644 --- a/src/common/socket.cpp +++ b/src/common/socket.cpp @@ -1234,7 +1234,7 @@ bool wxSocketBase::SetOption(int level, int optname, const void *optval, return true; } -bool wxSocketBase::SetLocal(wxIPV4address& local) +bool wxSocketBase::SetLocal(const wxIPV4address& local) { GAddress* la = local.GetAddress(); @@ -1272,7 +1272,9 @@ wxSocketClient::~wxSocketClient() // Connect // -------------------------------------------------------------------------- -bool wxSocketClient::DoConnect(wxSockAddress& addr_man, wxSockAddress* local, bool wait) +bool wxSocketClient::DoConnect(const wxSockAddress& addr_man, + const wxSockAddress* local, + bool wait) { GSocketError err; @@ -1356,14 +1358,16 @@ bool wxSocketClient::DoConnect(wxSockAddress& addr_man, wxSockAddress* local, bo return true; } -bool wxSocketClient::Connect(wxSockAddress& addr_man, bool wait) +bool wxSocketClient::Connect(const wxSockAddress& addr_man, bool wait) { - return (DoConnect(addr_man, NULL, wait)); + return DoConnect(addr_man, NULL, wait); } -bool wxSocketClient::Connect(wxSockAddress& addr_man, wxSockAddress& local, bool wait) +bool wxSocketClient::Connect(const wxSockAddress& addr_man, + const wxSockAddress& local, + bool wait) { - return (DoConnect(addr_man, &local, wait)); + return DoConnect(addr_man, &local, wait); } bool wxSocketClient::WaitOnConnect(long seconds, long milliseconds) -- 2.45.2