no changes at all, just reformatted to use consistent indentation before the upcoming real changes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56259 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-10-12 23:04:33 +00:00
parent 7b9b06e323
commit c2116a3579

View File

@@ -204,8 +204,8 @@ void wxSocketBase::Init()
if ( !IsInitialized() )
{
// this Initialize() will be undone by wxSocketModule::OnExit(), all the
// other calls to it should be matched by a call to Shutdown()
// this Initialize() will be undone by wxSocketModule::OnExit(), all
// the other calls to it should be matched by a call to Shutdown()
Initialize();
}
}
@@ -225,8 +225,8 @@ wxSocketBase::wxSocketBase(wxSocketFlags flags, wxSocketType type)
wxSocketBase::~wxSocketBase()
{
// Just in case the app called Destroy() *and* then deleted
// the socket immediately: don't leave dangling pointers.
// Just in case the app called Destroy() *and* then deleted the socket
// immediately: don't leave dangling pointers.
wxAppTraits *traits = wxTheApp ? wxTheApp->GetTraits() : NULL;
if ( traits )
traits->RemoveFromPendingDelete(this);
@@ -246,9 +246,9 @@ wxSocketBase::~wxSocketBase()
bool wxSocketBase::Destroy()
{
// Delayed destruction: the socket will be deleted during the next
// idle loop iteration. This ensures that all pending events have
// been processed.
// Delayed destruction: the socket will be deleted during the next idle
// loop iteration. This ensures that all pending events have been
// processed.
m_beingDeleted = true;
// Shutdown and close the socket
@@ -290,8 +290,12 @@ bool wxSocketBase::Close()
if (m_socket)
{
// Disable callbacks
m_socket->UnsetCallback(GSOCK_INPUT_FLAG | GSOCK_OUTPUT_FLAG |
GSOCK_LOST_FLAG | GSOCK_CONNECTION_FLAG);
m_socket->UnsetCallback(
GSOCK_INPUT_FLAG |
GSOCK_OUTPUT_FLAG |
GSOCK_LOST_FLAG |
GSOCK_CONNECTION_FLAG
);
// Shutdown the connection
m_socket->Shutdown();
@@ -368,10 +372,10 @@ wxUint32 wxSocketBase::_Read(void* buffer_, wxUint32 nbytes)
ret = m_socket->Read(buffer, nbytes);
if ( ret == 0 )
{
// for connection-oriented (e.g. TCP) sockets we can only read 0
// bytes if the other end has been closed, and for connectionless
// ones (UDP) this flag doesn't make sense anyhow so we can set it to
// true too without doing any harm
// for connection-oriented (e.g. TCP) sockets we can only read
// 0 bytes if the other end has been closed, and for
// connectionless ones (UDP) this flag doesn't make sense
// anyhow so we can set it to true too without doing any harm
m_closed = true;
break;
}
@@ -448,7 +452,7 @@ wxSocketBase& wxSocketBase::ReadMsg(void* buffer, wxUint32 nbytes)
else
len2 = 0;
// Don't attemp to read if the msg was zero bytes long.
// Don't attempt to read if the msg was zero bytes long.
if (len)
{
total = _Read(buffer, len);
@@ -456,6 +460,7 @@ wxSocketBase& wxSocketBase::ReadMsg(void* buffer, wxUint32 nbytes)
if (total != len)
goto exit;
}
if (len2)
{
char *discard_buffer = new char[MAX_DISCARD_SIZE];
@@ -641,7 +646,10 @@ wxSocketBase& wxSocketBase::WriteMsg(const void *buffer, wxUint32 nbytes)
msg.sig[1] = (unsigned char) 0xfe;
msg.sig[2] = (unsigned char) 0xad;
msg.sig[3] = (unsigned char) 0xde;
msg.len[0] = msg.len[1] = msg.len[2] = msg.len[3] = (char) 0;
msg.len[0] =
msg.len[1] =
msg.len[2] =
msg.len[3] = (char) 0;
if ((_Write(&msg, sizeof(msg))) < sizeof(msg))
goto exit;
@@ -795,13 +803,14 @@ bool wxSocketBase::_Wait(long seconds,
{
if (eventLoop)
{
// from the main thread itself we have to run the event loop to let the
// events (including the GUI events and the low-level (not wxWidgets)
// events from GSocket) be processed but from another thread it is
// enough to just call wxThread::Yield() which will give away the rest
// of our time slice: the explanation is that the events will be
// processed by the main thread anyhow, but we don't want to eat the
// CPU time uselessly while sitting in the loop waiting for the data
// from the main thread itself we have to run the event loop to
// let the events (including the GUI events and the low-level
// (not wxWidgets) events from GSocket) be processed but from
// another thread it is enough to just call wxThread::Yield()
// which will give away the rest of our time slice: the
// explanation is that the events will be processed by the main
// thread anyhow, but we don't want to eat the CPU time
// uselessly while sitting in the loop waiting for the data
if ( wxIsMainThread() )
{
if ( eventLoop->Pending() )
@@ -847,8 +856,7 @@ bool wxSocketBase::WaitForRead(long seconds, long milliseconds)
// value of true means that a GSocket_Read call will return
// immediately, not that there is actually data to read.
return _Wait(seconds, milliseconds, GSOCK_INPUT_FLAG |
GSOCK_LOST_FLAG);
return _Wait(seconds, milliseconds, GSOCK_INPUT_FLAG | GSOCK_LOST_FLAG);
}
@@ -1024,9 +1032,6 @@ void wxSocketBase::OnRequest(wxSocketNotify notification)
m_connected = false;
m_establishing = false;
break;
default:
break;
}
// Schedule the event
@@ -1323,13 +1328,17 @@ bool wxSocketClient::DoConnect(const wxSockAddress& addr_man,
return false;
m_socket->SetTimeout(m_timeout * 1000);
m_socket->SetCallback(GSOCK_INPUT_FLAG | GSOCK_OUTPUT_FLAG |
GSOCK_LOST_FLAG | GSOCK_CONNECTION_FLAG,
wx_socket_callback, (char *)this);
m_socket->SetCallback(
GSOCK_INPUT_FLAG |
GSOCK_OUTPUT_FLAG |
GSOCK_LOST_FLAG |
GSOCK_CONNECTION_FLAG,
wx_socket_callback,
(char *)this
);
// If wait == false, then the call should be nonblocking.
// When we are finished, we put the socket to blocking mode
// again.
// If wait == false, then the call should be nonblocking. When we are
// finished, we put the socket to blocking mode again.
if (!wait)
m_socket->SetNonBlocking(1);
@@ -1506,5 +1515,4 @@ private:
IMPLEMENT_DYNAMIC_CLASS(wxSocketModule, wxModule)
#endif
// wxUSE_SOCKETS
#endif // wxUSE_SOCKETS