Typecasting fix to compile on old solaris.

This commit is contained in:
crs 2004-03-08 20:45:53 +00:00
parent a27c6ad2c6
commit f068232643
2 changed files with 11 additions and 3 deletions

View File

@ -502,7 +502,8 @@ CArchNetworkBSD::throwErrorOnSocket(CArchSocket s)
// get the error from the socket layer
int err = 0;
socklen_t size = sizeof(err);
if (getsockopt(s->m_fd, SOL_SOCKET, SO_ERROR, &err, &size) == -1) {
if (getsockopt(s->m_fd, SOL_SOCKET, SO_ERROR,
(optval_t*)&err, &size) == -1) {
err = errno;
}
@ -540,13 +541,15 @@ CArchNetworkBSD::setNoDelayOnSocket(CArchSocket s, bool noDelay)
// get old state
int oflag;
socklen_t size = sizeof(oflag);
if (getsockopt(s->m_fd, IPPROTO_TCP, TCP_NODELAY, &oflag, &size) == -1) {
if (getsockopt(s->m_fd, IPPROTO_TCP, TCP_NODELAY,
(optval_t*)&oflag, &size) == -1) {
throwError(errno);
}
int flag = noDelay ? 1 : 0;
size = sizeof(flag);
if (setsockopt(s->m_fd, IPPROTO_TCP, TCP_NODELAY, &flag, size) == -1) {
if (setsockopt(s->m_fd, IPPROTO_TCP, TCP_NODELAY,
(optval_t*)&flag, size) == -1) {
throwError(errno);
}

View File

@ -25,6 +25,11 @@
typedef int socklen_t;
#endif
// old systems may use char* for [gs]etsockopt()'s optval argument.
// this should be void on modern systems but char is forwards
// compatible so we always use it.
typedef char optval_t;
#define ARCH_NETWORK CArchNetworkBSD
class CArchSocketImpl {