Typecasting fix to compile on old solaris.
This commit is contained in:
parent
a27c6ad2c6
commit
f068232643
|
@ -502,7 +502,8 @@ CArchNetworkBSD::throwErrorOnSocket(CArchSocket s)
|
||||||
// get the error from the socket layer
|
// get the error from the socket layer
|
||||||
int err = 0;
|
int err = 0;
|
||||||
socklen_t size = sizeof(err);
|
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;
|
err = errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -540,13 +541,15 @@ CArchNetworkBSD::setNoDelayOnSocket(CArchSocket s, bool noDelay)
|
||||||
// get old state
|
// get old state
|
||||||
int oflag;
|
int oflag;
|
||||||
socklen_t size = sizeof(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);
|
throwError(errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
int flag = noDelay ? 1 : 0;
|
int flag = noDelay ? 1 : 0;
|
||||||
size = sizeof(flag);
|
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);
|
throwError(errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,11 @@
|
||||||
typedef int socklen_t;
|
typedef int socklen_t;
|
||||||
#endif
|
#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
|
#define ARCH_NETWORK CArchNetworkBSD
|
||||||
|
|
||||||
class CArchSocketImpl {
|
class CArchSocketImpl {
|
||||||
|
|
Loading…
Reference in New Issue