* PLEASE don't put C++ comments here - this is a C source file.
*/
+#if defined(__WATCOMC__)
+#include "wx/wxprec.h"
+#include <errno.h>
+#include <nerrno.h>
+#endif
+
#ifndef __GSOCKET_STANDALONE__
#include "wx/setup.h"
#endif
# define SOCKLEN_T socklen_t
# endif
# elif defined(__WXMAC__)
-# define SOCKLEN_T socklen_t
+# define SOCKLEN_T socklen_t
# else
# define SOCKLEN_T int
# endif
#define INADDR_NONE INADDR_BROADCAST
#endif
-#define MASK_SIGNAL() \
-{ \
- void (*old_handler)(int); \
- \
- old_handler = signal(SIGPIPE, SIG_IGN);
+#if defined(__VISAGECPP__) || defined(__WATCOMC__)
-#define UNMASK_SIGNAL() \
- signal(SIGPIPE, old_handler); \
-}
+ #define MASK_SIGNAL() {
+ #define UNMASK_SIGNAL() }
+
+#else
+
+ #define MASK_SIGNAL() \
+ { \
+ void (*old_handler)(int); \
+ \
+ old_handler = signal(SIGPIPE, SIG_IGN);
+
+ #define UNMASK_SIGNAL() \
+ signal(SIGPIPE, old_handler); \
+ }
+
+#endif
/* If a SIGPIPE is issued by a socket call on a remotely closed socket,
the program will "crash" unless it explicitly handles the SIGPIPE.
#else
# include "gsockunx.h"
# include "gsocket.h"
+# ifndef WXUNUSED
+# define WXUNUSED(x)
+# endif
#endif /* __GSOCKET_STANDALONE__ */
/* debugging helpers */
{}
bool GSocketGUIFunctionsTableNull::CanUseEventLoop()
{ return false; }
-bool GSocketGUIFunctionsTableNull::Init_Socket(GSocket *socket)
+bool GSocketGUIFunctionsTableNull::Init_Socket(GSocket *WXUNUSED(socket))
{ return true; }
-void GSocketGUIFunctionsTableNull::Destroy_Socket(GSocket *socket)
+void GSocketGUIFunctionsTableNull::Destroy_Socket(GSocket *WXUNUSED(socket))
{}
-void GSocketGUIFunctionsTableNull::Install_Callback(GSocket *socket, GSocketEvent event)
+void GSocketGUIFunctionsTableNull::Install_Callback(GSocket *WXUNUSED(socket), GSocketEvent WXUNUSED(event))
{}
-void GSocketGUIFunctionsTableNull::Uninstall_Callback(GSocket *socket, GSocketEvent event)
+void GSocketGUIFunctionsTableNull::Uninstall_Callback(GSocket *WXUNUSED(socket), GSocketEvent WXUNUSED(event))
{}
-void GSocketGUIFunctionsTableNull::Enable_Events(GSocket *socket)
+void GSocketGUIFunctionsTableNull::Enable_Events(GSocket *WXUNUSED(socket))
{}
-void GSocketGUIFunctionsTableNull::Disable_Events(GSocket *socket)
+void GSocketGUIFunctionsTableNull::Disable_Events(GSocket *WXUNUSED(socket))
{}
/* Global initialisers */
if (ret == -1)
{
- if ((errno == EWOULDBLOCK) || (errno == EAGAIN))
+ if ((errno == EWOULDBLOCK) || (errno == EAGAIN))
{
m_error = GSOCK_WOULDBLOCK;
GSocket_Debug(( "GSocket_Write error WOULDBLOCK\n" ));
int GSocket::Recv_Stream(char *buffer, int size)
{
int ret;
- do
+ do
{
ret = recv(m_fd, buffer, size, GSOCKET_MSG_NOSIGNAL);
} while (ret == -1 && errno == EINTR); /* Loop until not interrupted */
fromlen = sizeof(from);
- do
+ do
{
ret = recvfrom(m_fd, buffer, size, 0, &from, (SOCKLEN_T *) &fromlen);
} while (ret == -1 && errno == EINTR); /* Loop until not interrupted */
{
int ret;
-#ifndef __VISAGECPP__
- MASK_SIGNAL();
-#endif
- do
+ MASK_SIGNAL();
+
+ do
{
ret = send(m_fd, (char *)buffer, size, GSOCKET_MSG_NOSIGNAL);
} while (ret == -1 && errno == EINTR); /* Loop until not interrupted */
-#ifndef __VISAGECPP__
+
UNMASK_SIGNAL();
-#endif
return ret;
}
return -1;
}
-#ifndef __VISAGECPP__
MASK_SIGNAL();
-#endif
- do
+
+ do
{
ret = sendto(m_fd, (char *)buffer, size, 0, addr, len);
} while (ret == -1 && errno == EINTR); /* Loop until not interrupted */
-#ifndef __VISAGECPP__
+
UNMASK_SIGNAL();
-#endif
/* Frees memory allocated from _GAddress_translate_to */
free(addr);
else
{
/* Do not throw a lost event in cases where the socket isn't really lost */
- if ((errno == EWOULDBLOCK) || (errno == EAGAIN) || (errno == EINTR))
+ if ((errno == EWOULDBLOCK) || (errno == EAGAIN) || (errno == EINTR))
{
CALL_CALLBACK(this, GSOCK_INPUT);
}
- else
+ else
{
CALL_CALLBACK(this, GSOCK_LOST);
Shutdown();
- }
+ }
}
}
}
}
#endif /* !defined(__VISAGECPP__) */
#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
-