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