wxOS2 with Open Watcom: correct PCH usage, missing headers, warning fixes, source cleaning and other Watcom adjustements.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34903 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -16,6 +16,12 @@
|
||||
* 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
|
||||
@@ -118,7 +124,7 @@ int _System soclose(int);
|
||||
# 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
|
||||
@@ -150,15 +156,24 @@ int _System soclose(int);
|
||||
#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.
|
||||
@@ -906,7 +921,7 @@ int GSocket::Write(const char *buffer, int size)
|
||||
|
||||
if (ret == -1)
|
||||
{
|
||||
if ((errno == EWOULDBLOCK) || (errno == EAGAIN))
|
||||
if ((errno == EWOULDBLOCK) || (errno == EAGAIN))
|
||||
{
|
||||
m_error = GSOCK_WOULDBLOCK;
|
||||
GSocket_Debug(( "GSocket_Write error WOULDBLOCK\n" ));
|
||||
@@ -1303,7 +1318,7 @@ GSocketError GSocket::Output_Timeout()
|
||||
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 */
|
||||
@@ -1319,7 +1334,7 @@ int GSocket::Recv_Dgram(char *buffer, int size)
|
||||
|
||||
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 */
|
||||
@@ -1353,16 +1368,14 @@ int GSocket::Send_Stream(const char *buffer, int size)
|
||||
{
|
||||
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;
|
||||
}
|
||||
@@ -1386,16 +1399,14 @@ int GSocket::Send_Dgram(const char *buffer, int size)
|
||||
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);
|
||||
@@ -1440,15 +1451,15 @@ void GSocket::Detected_Read()
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1916,4 +1927,3 @@ GSocketError GAddress_UNIX_GetPath(GAddress *address, char *path, size_t sbuf)
|
||||
}
|
||||
#endif /* !defined(__VISAGECPP__) */
|
||||
#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
|
||||
|
||||
|
Reference in New Issue
Block a user