Applied a number of patches.

* HP-UX fixes (Bernd Noll)
  * Now handling accept() taking an int 3rd arg
  * Now casting sizeof() to socklen_t where necessary
* BSD ports fix (Kristen Glynn)
  * Now defining NULL via stddef.h
* Crash on X11 using clipboard (Daniel Gollub)
  * CXWindowsClipboard::pushReplies() increments iterator better
* Solaris/HP-UX compile errors
  * Now #ifdef out sets of key syms if first key sym undefined
* Fix assertion on bad mouse position (ubiquitous_q)
  * Validate mouse position from client and fix if necessary
This commit is contained in:
crs23
2007-09-06 05:02:13 +00:00
parent 899beb6919
commit 460b751aba
8 changed files with 66 additions and 18 deletions

View File

@@ -212,7 +212,9 @@ CArchNetworkBSD::acceptSocket(CArchSocket s, CArchNetAddress* addr)
*addr = new CArchNetAddressImpl;
// accept on socket
int fd = accept(s->m_fd, &(*addr)->m_addr, &(*addr)->m_len);
ACCEPT_TYPE_ARG3 len = (ACCEPT_TYPE_ARG3)((*addr)->m_len);
int fd = accept(s->m_fd, &(*addr)->m_addr, &len);
(*addr)->m_len = (socklen_t)len;
if (fd == -1) {
int err = errno;
delete newSocket;
@@ -528,7 +530,7 @@ CArchNetworkBSD::throwErrorOnSocket(CArchSocket s)
// get the error from the socket layer
int err = 0;
socklen_t size = sizeof(err);
socklen_t size = (socklen_t)sizeof(err);
if (getsockopt(s->m_fd, SOL_SOCKET, SO_ERROR,
(optval_t*)&err, &size) == -1) {
err = errno;
@@ -567,14 +569,14 @@ CArchNetworkBSD::setNoDelayOnSocket(CArchSocket s, bool noDelay)
// get old state
int oflag;
socklen_t size = sizeof(oflag);
socklen_t size = (socklen_t)sizeof(oflag);
if (getsockopt(s->m_fd, IPPROTO_TCP, TCP_NODELAY,
(optval_t*)&oflag, &size) == -1) {
throwError(errno);
}
int flag = noDelay ? 1 : 0;
size = sizeof(flag);
size = (socklen_t)sizeof(flag);
if (setsockopt(s->m_fd, IPPROTO_TCP, TCP_NODELAY,
(optval_t*)&flag, size) == -1) {
throwError(errno);
@@ -590,14 +592,14 @@ CArchNetworkBSD::setReuseAddrOnSocket(CArchSocket s, bool reuse)
// get old state
int oflag;
socklen_t size = sizeof(oflag);
socklen_t size = (socklen_t)sizeof(oflag);
if (getsockopt(s->m_fd, SOL_SOCKET, SO_REUSEADDR,
(optval_t*)&oflag, &size) == -1) {
throwError(errno);
}
int flag = reuse ? 1 : 0;
size = sizeof(flag);
size = (socklen_t)sizeof(flag);
if (setsockopt(s->m_fd, SOL_SOCKET, SO_REUSEADDR,
(optval_t*)&flag, size) == -1) {
throwError(errno);
@@ -633,7 +635,7 @@ CArchNetworkBSD::newAnyAddr(EAddressFamily family)
ipAddr->sin_family = AF_INET;
ipAddr->sin_port = 0;
ipAddr->sin_addr.s_addr = INADDR_ANY;
addr->m_len = sizeof(struct sockaddr_in);
addr->m_len = (socklen_t)sizeof(struct sockaddr_in);
break;
}
@@ -665,7 +667,7 @@ CArchNetworkBSD::nameToAddr(const std::string& name)
memset(&inaddr, 0, sizeof(inaddr));
if (inet_aton(name.c_str(), &inaddr.sin_addr) != 0) {
// it's a dot notation address
addr->m_len = sizeof(struct sockaddr_in);
addr->m_len = (socklen_t)sizeof(struct sockaddr_in);
inaddr.sin_family = AF_INET;
inaddr.sin_port = 0;
memcpy(&addr->m_addr, &inaddr, addr->m_len);
@@ -683,7 +685,7 @@ CArchNetworkBSD::nameToAddr(const std::string& name)
// copy over address (only IPv4 currently supported)
if (info->h_addrtype == AF_INET) {
addr->m_len = sizeof(struct sockaddr_in);
addr->m_len = (socklen_t)sizeof(struct sockaddr_in);
inaddr.sin_family = info->h_addrtype;
inaddr.sin_port = 0;
memcpy(&inaddr.sin_addr, info->h_addr_list[0],
@@ -819,7 +821,7 @@ CArchNetworkBSD::isAnyAddr(CArchNetAddress addr)
struct sockaddr_in* ipAddr =
reinterpret_cast<struct sockaddr_in*>(&addr->m_addr);
return (ipAddr->sin_addr.s_addr == INADDR_ANY &&
addr->m_len == sizeof(struct sockaddr_in));
addr->m_len == (socklen_t)sizeof(struct sockaddr_in));
}
default: