提交 4bc36777 编写于 作者: O ohair

6725543: Compiler warnings in serviceability native code

Reviewed-by: alanb
上级 51b76b36
......@@ -540,7 +540,6 @@ ownedMonitorsWithStackDepth(PacketInputStream *in, PacketOutputStream *out)
jvmtiError error = JVMTI_ERROR_NONE;
jint count = 0;
jint depth;
jvmtiMonitorStackDepthInfo *monitors=NULL;
error = JVMTI_FUNC_PTR(gdata->jvmti,GetOwnedMonitorStackDepthInfo)
......
......@@ -473,7 +473,7 @@ transport_startTransport(jboolean isServer, char *name, char *address,
/*
* Record listener address in a system property
*/
len = strlen(name) + strlen(retAddress) + 2; /* ':' and '\0' */
len = (int)strlen(name) + (int)strlen(retAddress) + 2; /* ':' and '\0' */
prop_value = (char*)jvmtiAllocate(len);
strcpy(prop_value, name);
strcat(prop_value, ":");
......
......@@ -1900,7 +1900,6 @@ static void
dump_heap_segment_and_reset(jlong segment_size)
{
int fd;
char *last_chunk;
jlong last_chunk_len;
HPROF_ASSERT(gdata->heap_fd >= 0);
......
......@@ -1174,7 +1174,7 @@ add_class_fields(JNIEnv *env, ClassIndex top_cnum, ClassIndex cnum,
finfo = empty_finfo;
finfo.cnum = cnum;
finfo.modifiers = getFieldModifiers(klass, idlist[i]);
finfo.modifiers = (unsigned short)getFieldModifiers(klass, idlist[i]);
if ( ( finfo.modifiers & JVM_ACC_STATIC ) == 0 ||
!skip_static_field_names ) {
char *field_name;
......
......@@ -96,7 +96,8 @@ setLastError(int err, char *newmsg) {
*/
if (err == JDWPTRANSPORT_ERROR_IO_ERROR) {
char *join_str = ": ";
int msg_len = strlen(newmsg) + strlen(join_str) + strlen(buf) + 3;
int msg_len = (int)strlen(newmsg) + (int)strlen(join_str) +
(int)strlen(buf) + 3;
msg = (*callbacks->alloc)(msg_len);
if (msg != NULL) {
strcpy(msg, newmsg);
......@@ -104,7 +105,7 @@ setLastError(int err, char *newmsg) {
strcat(msg, buf);
}
} else {
msg = (*callbacks->alloc)(strlen(newmsg)+1);
msg = (*callbacks->alloc)((int)strlen(newmsg)+1);
if (msg != NULL) {
strcpy(msg, newmsg);
}
......@@ -183,7 +184,7 @@ shmemStartListening(jdwpTransportEnv* env, const char *address, char **actualAdd
char *name2;
rc = shmemBase_name(transport, &name);
if (rc == SYS_OK) {
name2 = (callbacks->alloc)(strlen(name) + 1);
name2 = (callbacks->alloc)((int)strlen(name) + 1);
if (name2 == NULL) {
RETURN_ERROR(JDWPTRANSPORT_ERROR_OUT_OF_MEMORY, "out of memory");
} else {
......@@ -329,7 +330,7 @@ shmemGetLastError(jdwpTransportEnv* env, char **msgP)
if (msg == NULL) {
return JDWPTRANSPORT_ERROR_MSG_NOT_AVAILABLE;
}
*msgP = (*callbacks->alloc)(strlen(msg)+1);
*msgP = (*callbacks->alloc)((int)strlen(msg)+1);
if (*msgP == NULL) {
return JDWPTRANSPORT_ERROR_OUT_OF_MEMORY;
}
......
......@@ -167,7 +167,7 @@ setLastErrorMsg(char *newmsg) {
msg = (char *)sysTlsGet(tlsIndex);
if (msg == NULL) {
msg = (*callback->alloc)(strlen(newmsg)+1);
msg = (*callback->alloc)((int)strlen(newmsg)+1);
if (msg != NULL) {
strcpy(msg, newmsg);
}
......
......@@ -85,7 +85,8 @@ setLastError(jdwpTransportError err, char *newmsg) {
if (err == JDWPTRANSPORT_ERROR_IO_ERROR) {
char *join_str = ": ";
int msg_len = strlen(newmsg) + strlen(join_str) + strlen(buf) + 3;
int msg_len = (int)strlen(newmsg) + (int)strlen(join_str) +
(int)strlen(buf) + 3;
msg = (*callback->alloc)(msg_len);
if (msg != NULL) {
strcpy(msg, newmsg);
......@@ -93,7 +94,7 @@ setLastError(jdwpTransportError err, char *newmsg) {
strcat(msg, buf);
}
} else {
msg = (*callback->alloc)(strlen(newmsg)+1);
msg = (*callback->alloc)((int)strlen(newmsg)+1);
if (msg != NULL) {
strcpy(msg, newmsg);
}
......@@ -153,7 +154,7 @@ handshake(int fd, jlong timeout) {
}
buf = b;
buf += received;
n = dbgsysRecv(fd, buf, strlen(hello)-received, 0);
n = dbgsysRecv(fd, buf, (int)strlen(hello)-received, 0);
if (n == 0) {
setLastError(0, "handshake failed - connection prematurally closed");
return JDWPTRANSPORT_ERROR_IO_ERROR;
......@@ -179,14 +180,14 @@ handshake(int fd, jlong timeout) {
}
}
if (dbgsysSend(fd, hello, strlen(hello), 0) != (int)strlen(hello)) {
if (dbgsysSend(fd, hello, (int)strlen(hello), 0) != (int)strlen(hello)) {
RETURN_IO_ERROR("send failed during handshake");
}
return JDWPTRANSPORT_ERROR_NONE;
}
static jdwpTransportError
parseAddress(const char *address, struct sockaddr_in *sa, UINT32 defaultHost) {
parseAddress(const char *address, struct sockaddr_in *sa, uint32_t defaultHost) {
char *colon;
memset((void *)sa,0,sizeof(struct sockaddr_in));
......@@ -202,9 +203,9 @@ parseAddress(const char *address, struct sockaddr_in *sa, UINT32 defaultHost) {
char *buf;
char *hostname;
u_short port;
UINT32 addr;
uint32_t addr;
buf = (*callback->alloc)(strlen(address)+1);
buf = (*callback->alloc)((int)strlen(address)+1);
if (buf == NULL) {
RETURN_ERROR(JDWPTRANSPORT_ERROR_OUT_OF_MEMORY, "out of memory");
}
......@@ -306,7 +307,7 @@ socketTransport_startListening(jdwpTransportEnv* env, const char* address,
(struct sockaddr *)&sa, &len);
portNum = dbgsysNetworkToHostShort(sa.sin_port);
sprintf(buf, "%d", portNum);
*actualAddress = (*callback->alloc)(strlen(buf) + 1);
*actualAddress = (*callback->alloc)((int)strlen(buf) + 1);
if (*actualAddress == NULL) {
RETURN_ERROR(JDWPTRANSPORT_ERROR_OUT_OF_MEMORY, "out of memory");
} else {
......@@ -679,7 +680,7 @@ socketTransport_getLastError(jdwpTransportEnv* env, char** msgP) {
if (msg == NULL) {
return JDWPTRANSPORT_ERROR_MSG_NOT_AVAILABLE;
}
*msgP = (*callback->alloc)(strlen(msg)+1);
*msgP = (*callback->alloc)((int)strlen(msg)+1);
if (*msgP == NULL) {
return JDWPTRANSPORT_ERROR_OUT_OF_MEMORY;
}
......
......@@ -29,14 +29,6 @@
#include "sys.h"
#include "socket_md.h"
#ifdef _LP64
typedef unsigned int UINT32;
typedef int INT32;
#else /* _LP64 */
typedef unsigned long UINT32;
typedef long INT32;
#endif /* _LP64 */
#define DBG_POLLIN 1
#define DBG_POLLOUT 2
......@@ -44,7 +36,6 @@ typedef long INT32;
#define DBG_ETIMEOUT -200
int dbgsysSocketClose(int fd);
INT32 dbgsysSocketAvailable(int fd, INT32 *pbytes);
int dbgsysConnect(int fd, struct sockaddr *him, int len);
int dbgsysFinishConnect(int fd, long timeout);
int dbgsysAccept(int fd, struct sockaddr *him, int *len);
......@@ -52,18 +43,17 @@ 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 dbgsysListen(int fd, INT32 count);
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 dbgsysTimeout(int fd, INT32 timeout);
struct hostent *dbgsysGetHostByName(char *hostname);
int dbgsysSocket(int domain, int type, int protocol);
int dbgsysBind(int fd, struct sockaddr *name, int namelen);
int dbgsysSetSocketOption(int fd, jint cmd, jboolean on, jvalue value);
UINT32 dbgsysInetAddr(const char* cp);
UINT32 dbgsysHostToNetworkLong(UINT32 hostlong);
uint32_t dbgsysInetAddr(const char* cp);
uint32_t dbgsysHostToNetworkLong(uint32_t hostlong);
unsigned short dbgsysHostToNetworkShort(unsigned short hostshort);
UINT32 dbgsysNetworkToHostLong(UINT32 netlong);
uint32_t dbgsysNetworkToHostLong(uint32_t netlong);
unsigned short dbgsysNetworkToHostShort(unsigned short netshort);
int dbgsysGetSocketName(int fd, struct sockaddr *him, int *len);
int dbgsysConfigureBlocking(int fd, jboolean blocking);
......
......@@ -45,8 +45,8 @@
#include "sysSocket.h"
int
dbgsysListen(int fd, INT32 count) {
return listen(fd, count);
dbgsysListen(int fd, int backlog) {
return listen(fd, backlog);
}
int
......@@ -131,13 +131,13 @@ dbgsysBind(int fd, struct sockaddr *name, int namelen) {
return bind(fd, name, namelen);
}
UINT32
uint32_t
dbgsysInetAddr(const char* cp) {
return (UINT32)inet_addr(cp);
return (uint32_t)inet_addr(cp);
}
UINT32
dbgsysHostToNetworkLong(UINT32 hostlong) {
uint32_t
dbgsysHostToNetworkLong(uint32_t hostlong) {
return htonl(hostlong);
}
......@@ -151,8 +151,8 @@ dbgsysGetSocketName(int fd, struct sockaddr *name, int *namelen) {
return getsockname(fd, name, namelen);
}
UINT32
dbgsysNetworkToHostLong(UINT32 netlong) {
uint32_t
dbgsysNetworkToHostLong(uint32_t netlong) {
return ntohl(netlong);
}
......@@ -163,10 +163,10 @@ dbgsysSetSocketOption(int fd, jint cmd, jboolean on, jvalue value)
if (cmd == TCP_NODELAY) {
struct protoent *proto = getprotobyname("TCP");
int tcp_level = (proto == 0 ? IPPROTO_TCP: proto->p_proto);
INT32 onl = (INT32)on;
uint32_t onl = (uint32_t)on;
if (setsockopt(fd, tcp_level, TCP_NODELAY,
(char *)&onl, sizeof(INT32)) < 0) {
(char *)&onl, sizeof(uint32_t)) < 0) {
return SYS_ERR;
}
} else if (cmd == SO_LINGER) {
......
......@@ -120,8 +120,8 @@ DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved)
* function pointer table, but our pointer should still be good.
*/
int
dbgsysListen(int fd, INT32 count) {
return listen(fd, (int)count);
dbgsysListen(int fd, int backlog) {
return listen(fd, backlog);
}
int
......@@ -172,7 +172,7 @@ int dbgsysFinishConnect(int fd, long timeout) {
int
dbgsysAccept(int fd, struct sockaddr *name, int *namelen) {
return accept(fd, name, namelen);
return (int)accept(fd, name, namelen);
}
int
......@@ -209,7 +209,7 @@ dbgsysHostToNetworkShort(unsigned short hostshort) {
int
dbgsysSocket(int domain, int type, int protocol) {
int fd = socket(domain, type, protocol);
int fd = (int)socket(domain, type, protocol);
if (fd != SOCKET_ERROR) {
SetHandleInformation((HANDLE)(UINT_PTR)fd, HANDLE_FLAG_INHERIT, FALSE);
}
......@@ -229,12 +229,6 @@ dbgsysSocketClose(int fd) {
return closesocket(fd);
}
INT32
dbgsysSocketAvailable(int fd, INT32 *pbytes) {
u_long arg = (u_long)*pbytes;
return (INT32)ioctlsocket(fd, FIONREAD, &arg);
}
/* Additions to original follow */
int
......@@ -243,14 +237,14 @@ dbgsysBind(int fd, struct sockaddr *name, int namelen) {
}
UINT32
uint32_t
dbgsysInetAddr(const char* cp) {
return (UINT32)inet_addr(cp);
return (uint32_t)inet_addr(cp);
}
UINT32
dbgsysHostToNetworkLong(UINT32 hostlong) {
return (UINT32)htonl((u_long)hostlong);
uint32_t
dbgsysHostToNetworkLong(uint32_t hostlong) {
return (uint32_t)htonl((u_long)hostlong);
}
unsigned short
......@@ -263,9 +257,9 @@ dbgsysGetSocketName(int fd, struct sockaddr *name, int *namelen) {
return getsockname(fd, name, namelen);
}
UINT32
dbgsysNetworkToHostLong(UINT32 netlong) {
return (UINT32)ntohl((u_long)netlong);
uint32_t
dbgsysNetworkToHostLong(uint32_t netlong) {
return (uint32_t)ntohl((u_long)netlong);
}
/*
......
......@@ -25,3 +25,6 @@
/* Use its data structures and constants; don't make direct calls */
#include <winsock2.h>
#define uint32_t UINT32
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册