提交 2d5437ea 编写于 作者: J jzavgren

8005120: Compiler warnings in socket transport native code

Reviewed-by: chegar, dsamersoff
上级 0ce1caa0
......@@ -304,7 +304,7 @@ socketTransport_startListening(jdwpTransportEnv* env, const char* address,
{
char buf[20];
int len = sizeof(sa);
socklen_t len = sizeof(sa);
jint portNum;
err = dbgsysGetSocketName(serverSocketFD,
(struct sockaddr *)&sa, &len);
......@@ -324,7 +324,8 @@ socketTransport_startListening(jdwpTransportEnv* env, const char* address,
static jdwpTransportError JNICALL
socketTransport_accept(jdwpTransportEnv* env, jlong acceptTimeout, jlong handshakeTimeout)
{
int socketLen, err;
socklen_t socketLen;
int err;
struct sockaddr_in socket;
jlong startTime = (jlong)0;
......@@ -508,7 +509,7 @@ socketTransport_close(jdwpTransportEnv* env)
if (dbgsysSocketClose(fd) < 0) {
/*
* close failed - it's pointless to restore socketFD here because
* any subsequent close will likely fail aswell.
* any subsequent close will likely fail as well.
*/
RETURN_IO_ERROR("close failed");
}
......
......@@ -34,28 +34,29 @@
#define DBG_EINPROGRESS -150
#define DBG_ETIMEOUT -200
#ifdef WIN32
typedef int socklen_t;
#endif
int dbgsysSocketClose(int fd);
int dbgsysConnect(int fd, struct sockaddr *him, int len);
int dbgsysFinishConnect(int fd, long timeout);
int dbgsysAccept(int fd, struct sockaddr *him, int *len);
int dbgsysSendTo(int fd, char *buf, int len, int flags, struct sockaddr *to,
int tolen);
int dbgsysRecvFrom(int fd, char *buf, int nbytes, int flags,
struct sockaddr *from, int *fromlen);
int dbgsysConnect(int fd, struct sockaddr *him, socklen_t len);
int dbgsysFinishConnect(int fd, int timeout);
int dbgsysAccept(int fd, struct sockaddr *him, socklen_t *len);
int dbgsysSendTo(int fd, char *buf, size_t len, int flags, struct sockaddr *to, socklen_t tolen);
int dbgsysRecvFrom(int fd, char *buf, size_t nBytes, int flags, struct sockaddr *from, socklen_t *fromlen);
int dbgsysListen(int fd, int backlog);
int dbgsysRecv(int fd, char *buf, int nBytes, int flags);
int dbgsysSend(int fd, char *buf, int nBytes, int flags);
int dbgsysRecv(int fd, char *buf, size_t nBytes, int flags);
int dbgsysSend(int fd, char *buf, size_t nBytes, int flags);
struct hostent *dbgsysGetHostByName(char *hostname);
int dbgsysSocket(int domain, int type, int protocol);
int dbgsysBind(int fd, struct sockaddr *name, int namelen);
int dbgsysBind(int fd, struct sockaddr *name, socklen_t namelen);
int dbgsysSetSocketOption(int fd, jint cmd, jboolean on, jvalue value);
uint32_t dbgsysInetAddr(const char* cp);
uint32_t dbgsysHostToNetworkLong(uint32_t hostlong);
unsigned short dbgsysHostToNetworkShort(unsigned short hostshort);
uint32_t dbgsysNetworkToHostLong(uint32_t netlong);
unsigned short dbgsysNetworkToHostShort(unsigned short netshort);
int dbgsysGetSocketName(int fd, struct sockaddr *him, int *len);
int dbgsysGetSocketName(int fd, struct sockaddr *him, socklen_t *len);
int dbgsysConfigureBlocking(int fd, jboolean blocking);
int dbgsysPoll(int fd, jboolean rd, jboolean wr, long timeout);
int dbgsysGetLastIOError(char *buf, jint size);
......
......@@ -49,7 +49,7 @@ dbgsysListen(int fd, int backlog) {
}
int
dbgsysConnect(int fd, struct sockaddr *name, int namelen) {
dbgsysConnect(int fd, struct sockaddr *name, socklen_t namelen) {
int rv = connect(fd, name, namelen);
if (rv < 0 && (errno == EINPROGRESS || errno == EINTR)) {
return DBG_EINPROGRESS;
......@@ -59,7 +59,7 @@ dbgsysConnect(int fd, struct sockaddr *name, int namelen) {
}
int
dbgsysFinishConnect(int fd, long timeout) {
dbgsysFinishConnect(int fd, int timeout) {
int rv = dbgsysPoll(fd, 0, 1, timeout);
if (rv == 0) {
return DBG_ETIMEOUT;
......@@ -71,7 +71,7 @@ dbgsysFinishConnect(int fd, long timeout) {
}
int
dbgsysAccept(int fd, struct sockaddr *name, int *namelen) {
dbgsysAccept(int fd, struct sockaddr *name, socklen_t *namelen) {
int rv;
for (;;) {
rv = accept(fd, name, namelen);
......@@ -85,8 +85,8 @@ dbgsysAccept(int fd, struct sockaddr *name, int *namelen) {
}
int
dbgsysRecvFrom(int fd, char *buf, int nBytes,
int flags, struct sockaddr *from, int *fromlen) {
dbgsysRecvFrom(int fd, char *buf, size_t nBytes,
int flags, struct sockaddr *from, socklen_t *fromlen) {
int rv;
do {
rv = recvfrom(fd, buf, nBytes, flags, from, fromlen);
......@@ -96,8 +96,8 @@ dbgsysRecvFrom(int fd, char *buf, int nBytes,
}
int
dbgsysSendTo(int fd, char *buf, int len,
int flags, struct sockaddr *to, int tolen) {
dbgsysSendTo(int fd, char *buf, size_t len,
int flags, struct sockaddr *to, socklen_t tolen) {
int rv;
do {
rv = sendto(fd, buf, len, flags, to, tolen);
......@@ -107,7 +107,7 @@ dbgsysSendTo(int fd, char *buf, int len,
}
int
dbgsysRecv(int fd, char *buf, int nBytes, int flags) {
dbgsysRecv(int fd, char *buf, size_t nBytes, int flags) {
int rv;
do {
rv = recv(fd, buf, nBytes, flags);
......@@ -117,7 +117,7 @@ dbgsysRecv(int fd, char *buf, int nBytes, int flags) {
}
int
dbgsysSend(int fd, char *buf, int nBytes, int flags) {
dbgsysSend(int fd, char *buf, size_t nBytes, int flags) {
int rv;
do {
rv = send(fd, buf, nBytes, flags);
......@@ -151,7 +151,7 @@ int dbgsysSocketClose(int fd) {
}
int
dbgsysBind(int fd, struct sockaddr *name, int namelen) {
dbgsysBind(int fd, struct sockaddr *name, socklen_t namelen) {
return bind(fd, name, namelen);
}
......@@ -171,7 +171,7 @@ dbgsysNetworkToHostShort(unsigned short netshort) {
}
int
dbgsysGetSocketName(int fd, struct sockaddr *name, int *namelen) {
dbgsysGetSocketName(int fd, struct sockaddr *name, socklen_t *namelen) {
return getsockname(fd, name, namelen);
}
......
......@@ -125,7 +125,7 @@ dbgsysListen(int fd, int backlog) {
}
int
dbgsysConnect(int fd, struct sockaddr *name, int namelen) {
dbgsysConnect(int fd, struct sockaddr *name, socklen_t namelen) {
int rv = connect(fd, name, namelen);
if (rv == SOCKET_ERROR) {
if (WSAGetLastError() == WSAEINPROGRESS || WSAGetLastError() == WSAEWOULDBLOCK) {
......@@ -135,7 +135,7 @@ dbgsysConnect(int fd, struct sockaddr *name, int namelen) {
return rv;
}
int dbgsysFinishConnect(int fd, long timeout) {
int dbgsysFinishConnect(int fd, int timeout) {
int rv;
struct timeval t;
fd_set wr, ex;
......@@ -171,30 +171,30 @@ int dbgsysFinishConnect(int fd, long timeout) {
int
dbgsysAccept(int fd, struct sockaddr *name, int *namelen) {
dbgsysAccept(int fd, struct sockaddr *name, socklen_t *namelen) {
return (int)accept(fd, name, namelen);
}
int
dbgsysRecvFrom(int fd, char *buf, int nBytes,
int flags, struct sockaddr *from, int *fromlen) {
return recvfrom(fd, buf, nBytes, flags, from, fromlen);
dbgsysRecvFrom(int fd, char *buf, size_t nBytes,
int flags, struct sockaddr *from, socklen_t *fromlen) {
return recvfrom(fd, buf, (int)nBytes, flags, from, fromlen);
}
int
dbgsysSendTo(int fd, char *buf, int len,
int flags, struct sockaddr *to, int tolen) {
return sendto(fd, buf, len, flags, to, tolen);
dbgsysSendTo(int fd, char *buf, size_t len,
int flags, struct sockaddr *to, socklen_t tolen) {
return sendto(fd, buf, (int)len, flags, to, tolen);
}
int
dbgsysRecv(int fd, char *buf, int nBytes, int flags) {
return recv(fd, buf, nBytes, flags);
dbgsysRecv(int fd, char *buf, size_t nBytes, int flags) {
return recv(fd, buf, (int) nBytes, flags);
}
int
dbgsysSend(int fd, char *buf, int nBytes, int flags) {
return send(fd, buf, nBytes, flags);
dbgsysSend(int fd, char *buf, size_t nBytes, int flags) {
return send(fd, buf, (int)nBytes, flags);
}
struct hostent *
......@@ -232,7 +232,7 @@ dbgsysSocketClose(int fd) {
/* Additions to original follow */
int
dbgsysBind(int fd, struct sockaddr *name, int namelen) {
dbgsysBind(int fd, struct sockaddr *name, socklen_t namelen) {
return bind(fd, name, namelen);
}
......@@ -253,7 +253,7 @@ dbgsysNetworkToHostShort(unsigned short netshort) {
}
int
dbgsysGetSocketName(int fd, struct sockaddr *name, int *namelen) {
dbgsysGetSocketName(int fd, struct sockaddr *name, socklen_t *namelen) {
return getsockname(fd, name, namelen);
}
......@@ -426,7 +426,7 @@ dbgsysTlsGet(int index) {
}
#define FT2INT64(ft) \
((long)(ft).dwHighDateTime << 32 | (long)(ft).dwLowDateTime)
((INT64)(ft).dwHighDateTime << 32 | (INT64)(ft).dwLowDateTime)
long
dbgsysCurrentTimeMillis() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册