tests/server/sockfilt.c: Fixed integer comparison warning

This commit is contained in:
Marc Hoersken 2013-01-07 07:47:54 +01:00
parent 6a4f5e5268
commit 561b551deb

View File

@ -430,7 +430,7 @@ static int select_ws(int nfds, fd_set *readfds, fd_set *writefds,
WSANETWORKEVENTS wsanetevents; WSANETWORKEVENTS wsanetevents;
INPUT_RECORD *inputrecords; INPUT_RECORD *inputrecords;
HANDLE handle, *handles; HANDLE handle, *handles;
curl_socket_t *fdarr, *wsasocks; curl_socket_t sock, *fdarr, *wsasocks;
int error, fds; int error, fds;
DWORD nfd = 0, wsa = 0; DWORD nfd = 0, wsa = 0;
int ret = 0; int ret = 0;
@ -536,6 +536,7 @@ static int select_ws(int nfds, fd_set *readfds, fd_set *writefds,
for(idx = 0; idx < nfd; idx++) { for(idx = 0; idx < nfd; idx++) {
fds = fdarr[idx]; fds = fdarr[idx];
handle = handles[idx]; handle = handles[idx];
sock = (curl_socket_t)fds;
/* check if the current internal handle was triggered */ /* check if the current internal handle was triggered */
if(wait != WAIT_FAILED && (wait - WAIT_OBJECT_0) >= idx && if(wait != WAIT_FAILED && (wait - WAIT_OBJECT_0) >= idx &&
@ -550,7 +551,7 @@ static int select_ws(int nfds, fd_set *readfds, fd_set *writefds,
if(!PeekNamedPipe(handle, NULL, 0, NULL, &avail, NULL)) if(!PeekNamedPipe(handle, NULL, 0, NULL, &avail, NULL))
avail = 0; avail = 0;
if(!avail) if(!avail)
FD_CLR(fds, readfds); FD_CLR(sock, readfds);
} /* check if there is no data from keyboard input */ } /* check if there is no data from keyboard input */
else if (!_kbhit()) { else if (!_kbhit()) {
/* check if there are INPUT_RECORDs in the input buffer */ /* check if there are INPUT_RECORDs in the input buffer */
@ -573,18 +574,18 @@ static int select_ws(int nfds, fd_set *readfds, fd_set *writefds,
} }
/* remove from descriptor set since there is no real data */ /* remove from descriptor set since there is no real data */
FD_CLR(fds, readfds); FD_CLR(sock, readfds);
} }
} }
/* stdin is never ready for write or exceptional */ /* stdin is never ready for write or exceptional */
FD_CLR(fds, writefds); FD_CLR(sock, writefds);
FD_CLR(fds, exceptfds); FD_CLR(sock, exceptfds);
} }
else if(fds == fileno(stdout) || fds == fileno(stderr)) { else if(fds == fileno(stdout) || fds == fileno(stderr)) {
/* stdout and stderr are never ready for read or exceptional */ /* stdout and stderr are never ready for read or exceptional */
FD_CLR(fds, readfds); FD_CLR(sock, readfds);
FD_CLR(fds, exceptfds); FD_CLR(sock, exceptfds);
} }
else { else {
/* try to handle the event with the WINSOCK2 functions */ /* try to handle the event with the WINSOCK2 functions */
@ -592,29 +593,29 @@ static int select_ws(int nfds, fd_set *readfds, fd_set *writefds,
if(error != SOCKET_ERROR) { if(error != SOCKET_ERROR) {
/* remove from descriptor set if not ready for read/accept/close */ /* remove from descriptor set if not ready for read/accept/close */
if(!(wsanetevents.lNetworkEvents & (FD_READ|FD_ACCEPT|FD_CLOSE))) if(!(wsanetevents.lNetworkEvents & (FD_READ|FD_ACCEPT|FD_CLOSE)))
FD_CLR(fds, readfds); FD_CLR(sock, readfds);
/* remove from descriptor set if not ready for write/connect */ /* remove from descriptor set if not ready for write/connect */
if(!(wsanetevents.lNetworkEvents & (FD_WRITE|FD_CONNECT))) if(!(wsanetevents.lNetworkEvents & (FD_WRITE|FD_CONNECT)))
FD_CLR(fds, writefds); FD_CLR(sock, writefds);
/* remove from descriptor set if not exceptional */ /* remove from descriptor set if not exceptional */
if(!(wsanetevents.lNetworkEvents & FD_OOB)) if(!(wsanetevents.lNetworkEvents & FD_OOB))
FD_CLR(fds, exceptfds); FD_CLR(sock, exceptfds);
} }
} }
/* check if the event has not been filtered using specific tests */ /* check if the event has not been filtered using specific tests */
if(FD_ISSET(fds, readfds) || FD_ISSET(fds, writefds) || if(FD_ISSET(sock, readfds) || FD_ISSET(sock, writefds) ||
FD_ISSET(fds, exceptfds)) { FD_ISSET(sock, exceptfds)) {
ret++; ret++;
} }
} }
else { else {
/* remove from all descriptor sets since this handle did not trigger */ /* remove from all descriptor sets since this handle did not trigger */
FD_CLR(fds, readfds); FD_CLR(sock, readfds);
FD_CLR(fds, writefds); FD_CLR(sock, writefds);
FD_CLR(fds, exceptfds); FD_CLR(sock, exceptfds);
} }
} }