From 14a7edc2ad4cdccb0964d766d64e1f0b5135e79b Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Thu, 7 Oct 2010 14:36:17 +0100 Subject: [PATCH] 6989466: Miscellaneous compiler warnings in java/lang, java/util, java/io, sun/misc native code Reviewed-by: andrew, mchung, ohair --- jdk/src/share/native/common/jdk_util.c | 2 +- jdk/src/share/native/common/jni_util.c | 6 ++--- jdk/src/share/native/java/lang/Class.c | 6 ++--- jdk/src/share/native/java/lang/ClassLoader.c | 6 ++--- jdk/src/share/native/java/lang/System.c | 2 +- .../native/java/lang/fdlibm/include/fdlibm.h | 2 ++ .../share/native/java/lang/reflect/Proxy.c | 6 ++--- jdk/src/share/native/java/nio/Bits.c | 24 +++++++++---------- jdk/src/share/native/sun/management/Flag.c | 3 +-- jdk/src/share/native/sun/misc/VM.c | 5 ++-- jdk/src/share/native/sun/misc/VMSupport.c | 2 -- .../native/java/io/UnixFileSystem_md.c | 5 ++-- .../solaris/native/java/io/canonicalize_md.c | 2 +- .../solaris/native/java/lang/java_props_md.c | 6 +++-- .../solaris/native/sun/net/sdp/SdpSupport.c | 2 +- jdk/src/solaris/native/sun/nio/ch/Net.c | 9 +++---- jdk/src/solaris/native/sun/nio/ch/SctpNet.c | 2 +- .../ch/UnixAsynchronousSocketChannelImpl.c | 4 ++-- jdk/src/windows/native/common/jni_util_md.c | 2 +- .../windows/native/java/lang/java_props_md.c | 4 ++-- .../windows/native/java/util/TimeZone_md.c | 9 +++---- .../sun/nio/ch/ServerSocketChannelImpl.c | 1 - .../native/sun/nio/ch/WindowsSelectorImpl.c | 2 +- 23 files changed, 57 insertions(+), 55 deletions(-) diff --git a/jdk/src/share/native/common/jdk_util.c b/jdk/src/share/native/common/jdk_util.c index 616909eee46..8c7c8a1da1c 100644 --- a/jdk/src/share/native/common/jdk_util.c +++ b/jdk/src/share/native/common/jdk_util.c @@ -76,7 +76,7 @@ JDK_GetVersionInfo0(jdk_version_info* info, size_t info_size) { } - memset(info, 0, sizeof(info_size)); + memset(info, 0, info_size); info->jdk_version = ((jdk_major_version & 0xFF) << 24) | ((jdk_minor_version & 0xFF) << 16) | ((jdk_micro_version & 0xFF) << 8) | diff --git a/jdk/src/share/native/common/jni_util.c b/jdk/src/share/native/common/jni_util.c index bc5c3039719..fb903bbdcce 100644 --- a/jdk/src/share/native/common/jni_util.c +++ b/jdk/src/share/native/common/jni_util.c @@ -433,7 +433,7 @@ getString8859_1Chars(JNIEnv *env, jstring jstr) for (i=0; iGetStringUTFLength(env, classname); unicode_len = (*env)->GetStringLength(env, classname); - if (len >= sizeof(buf)) { + if (len >= (jsize)sizeof(buf)) { clname = malloc(len + 1); if (clname == NULL) { JNU_ThrowOutOfMemoryError(env, NULL); diff --git a/jdk/src/share/native/java/lang/ClassLoader.c b/jdk/src/share/native/java/lang/ClassLoader.c index 63c85813801..7e87af176ce 100644 --- a/jdk/src/share/native/java/lang/ClassLoader.c +++ b/jdk/src/share/native/java/lang/ClassLoader.c @@ -331,7 +331,7 @@ Java_java_lang_ClassLoader_00024NativeLibrary_load if (handle) { const char *onLoadSymbols[] = JNI_ONLOAD_SYMBOLS; JNI_OnLoad_t JNI_OnLoad; - int i; + unsigned int i; for (i = 0; i < sizeof(onLoadSymbols) / sizeof(char *); i++) { JNI_OnLoad = (JNI_OnLoad_t) JVM_FindLibraryEntry(handle, onLoadSymbols[i]); @@ -369,7 +369,7 @@ Java_java_lang_ClassLoader_00024NativeLibrary_load cause = (*env)->ExceptionOccurred(env); if (cause) { (*env)->ExceptionClear(env); - (*env)->SetLongField(env, this, handleID, (jlong)NULL); + (*env)->SetLongField(env, this, handleID, (jlong)0); (*env)->Throw(env, cause); } goto done; @@ -392,7 +392,7 @@ Java_java_lang_ClassLoader_00024NativeLibrary_unload const char *onUnloadSymbols[] = JNI_ONUNLOAD_SYMBOLS; void *handle; JNI_OnUnload_t JNI_OnUnload; - int i; + unsigned int i; if (!initIDs(env)) return; diff --git a/jdk/src/share/native/java/lang/System.c b/jdk/src/share/native/java/lang/System.c index 96dfa20c81c..245b1bc5356 100644 --- a/jdk/src/share/native/java/lang/System.c +++ b/jdk/src/share/native/java/lang/System.c @@ -109,7 +109,7 @@ Java_java_lang_System_identityHashCode(JNIEnv *env, jobject this, jobject x) #error "ERROR: No override of JAVA_SPECIFICATION_VENDOR is allowed" #else #define JAVA_SPECIFICATION_VENDOR "Oracle Corporation" -#endif +#endif static int fmtdefault; // boolean value jobject fillI18nProps(JNIEnv *env, jobject props, char *baseKey, diff --git a/jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h b/jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h index a2433fdb912..7a11f52a3ed 100644 --- a/jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h +++ b/jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h @@ -46,11 +46,13 @@ #define __LOp(x) *(1+(int*)x) #endif +#ifndef __P #ifdef __STDC__ #define __P(p) p #else #define __P(p) () #endif +#endif /* * ANSI/POSIX diff --git a/jdk/src/share/native/java/lang/reflect/Proxy.c b/jdk/src/share/native/java/lang/reflect/Proxy.c index ec6f013934b..3f023a423a6 100644 --- a/jdk/src/share/native/java/lang/reflect/Proxy.c +++ b/jdk/src/share/native/java/lang/reflect/Proxy.c @@ -82,9 +82,9 @@ Java_java_lang_reflect_Proxy_defineClass0(JNIEnv *env, goto free_body; if (name != NULL) { - int len = (*env)->GetStringUTFLength(env, name); - int unicode_len = (*env)->GetStringLength(env, name); - if (len >= sizeof(buf)) { + jsize len = (*env)->GetStringUTFLength(env, name); + jsize unicode_len = (*env)->GetStringLength(env, name); + if (len >= (jsize)sizeof(buf)) { utfName = malloc(len + 1); if (utfName == NULL) { JNU_ThrowOutOfMemoryError(env, NULL); diff --git a/jdk/src/share/native/java/nio/Bits.c b/jdk/src/share/native/java/nio/Bits.c index 12e2aff1179..838a764da56 100644 --- a/jdk/src/share/native/java/nio/Bits.c +++ b/jdk/src/share/native/java/nio/Bits.c @@ -72,7 +72,7 @@ Java_java_nio_Bits_copyFromShortArray(JNIEnv *env, jobject this, jobject src, jlong srcPos, jlong dstAddr, jlong length) { jbyte *bytes; - size_t i, size; + size_t size; jshort *srcShort, *dstShort, *endShort; jshort tmpShort; @@ -83,7 +83,7 @@ Java_java_nio_Bits_copyFromShortArray(JNIEnv *env, jobject this, jobject src, if (length > MBYTE) size = MBYTE; else - size = length; + size = (size_t)length; GETCRITICAL(bytes, env, src); @@ -107,7 +107,7 @@ Java_java_nio_Bits_copyToShortArray(JNIEnv *env, jobject this, jlong srcAddr, jobject dst, jlong dstPos, jlong length) { jbyte *bytes; - size_t i, size; + size_t size; jshort *srcShort, *dstShort, *endShort; jshort tmpShort; @@ -118,7 +118,7 @@ Java_java_nio_Bits_copyToShortArray(JNIEnv *env, jobject this, jlong srcAddr, if (length > MBYTE) size = MBYTE; else - size = length; + size = (size_t)length; GETCRITICAL(bytes, env, dst); @@ -142,7 +142,7 @@ Java_java_nio_Bits_copyFromIntArray(JNIEnv *env, jobject this, jobject src, jlong srcPos, jlong dstAddr, jlong length) { jbyte *bytes; - size_t i, size; + size_t size; jint *srcInt, *dstInt, *endInt; jint tmpInt; @@ -153,7 +153,7 @@ Java_java_nio_Bits_copyFromIntArray(JNIEnv *env, jobject this, jobject src, if (length > MBYTE) size = MBYTE; else - size = length; + size = (size_t)length; GETCRITICAL(bytes, env, src); @@ -177,7 +177,7 @@ Java_java_nio_Bits_copyToIntArray(JNIEnv *env, jobject this, jlong srcAddr, jobject dst, jlong dstPos, jlong length) { jbyte *bytes; - size_t i, size; + size_t size; jint *srcInt, *dstInt, *endInt; jint tmpInt; @@ -188,7 +188,7 @@ Java_java_nio_Bits_copyToIntArray(JNIEnv *env, jobject this, jlong srcAddr, if (length > MBYTE) size = MBYTE; else - size = length; + size = (size_t)length; GETCRITICAL(bytes, env, dst); @@ -212,7 +212,7 @@ Java_java_nio_Bits_copyFromLongArray(JNIEnv *env, jobject this, jobject src, jlong srcPos, jlong dstAddr, jlong length) { jbyte *bytes; - size_t i, size; + size_t size; jlong *srcLong, *dstLong, *endLong; jlong tmpLong; @@ -223,7 +223,7 @@ Java_java_nio_Bits_copyFromLongArray(JNIEnv *env, jobject this, jobject src, if (length > MBYTE) size = MBYTE; else - size = length; + size = (size_t)length; GETCRITICAL(bytes, env, src); @@ -247,7 +247,7 @@ Java_java_nio_Bits_copyToLongArray(JNIEnv *env, jobject this, jlong srcAddr, jobject dst, jlong dstPos, jlong length) { jbyte *bytes; - size_t i, size; + size_t size; jlong *srcLong, *dstLong, *endLong; jlong tmpLong; @@ -258,7 +258,7 @@ Java_java_nio_Bits_copyToLongArray(JNIEnv *env, jobject this, jlong srcAddr, if (length > MBYTE) size = MBYTE; else - size = length; + size = (size_t)length; GETCRITICAL(bytes, env, dst); diff --git a/jdk/src/share/native/sun/management/Flag.c b/jdk/src/share/native/sun/management/Flag.c index ac8dd708b2d..7a1fab59721 100644 --- a/jdk/src/share/native/sun/management/Flag.c +++ b/jdk/src/share/native/sun/management/Flag.c @@ -25,6 +25,7 @@ #include #include +#include #include #include "management.h" #include "sun_management_Flag.h" @@ -80,8 +81,6 @@ JNIEXPORT jint JNICALL Java_sun_management_Flag_getFlags (JNIEnv *env, jclass cls, jobjectArray names, jobjectArray flags, jint count) { - char errmsg[128]; - jint num_flags, i, index; jmmVMGlobal* globals; size_t gsize; diff --git a/jdk/src/share/native/sun/misc/VM.c b/jdk/src/share/native/sun/misc/VM.c index 5d736e39070..28b378cce83 100644 --- a/jdk/src/share/native/sun/misc/VM.c +++ b/jdk/src/share/native/sun/misc/VM.c @@ -23,6 +23,8 @@ * questions. */ +#include + #include "jni.h" #include "jni_util.h" #include "jlong.h" @@ -113,7 +115,6 @@ typedef void (JNICALL *GetJvmVersionInfo_fp)(JNIEnv*, jvm_version_info*, size_t) JNIEXPORT void JNICALL Java_sun_misc_VM_initialize(JNIEnv *env, jclass cls) { - char errmsg[128]; GetJvmVersionInfo_fp func_p; if (!JDK_InitJvmHandle()) { @@ -123,8 +124,6 @@ Java_sun_misc_VM_initialize(JNIEnv *env, jclass cls) { func_p = (GetJvmVersionInfo_fp) JDK_FindJvmEntry("JVM_GetVersionInfo"); if (func_p != NULL) { - char errmsg[100]; - jfieldID fid; jvm_version_info info; memset(&info, 0, sizeof(info)); diff --git a/jdk/src/share/native/sun/misc/VMSupport.c b/jdk/src/share/native/sun/misc/VMSupport.c index c25986a6de1..e37ff936032 100644 --- a/jdk/src/share/native/sun/misc/VMSupport.c +++ b/jdk/src/share/native/sun/misc/VMSupport.c @@ -38,8 +38,6 @@ static INIT_AGENT_PROPERTIES_FN InitAgentProperties_fp = NULL; JNIEXPORT jobject JNICALL Java_sun_misc_VMSupport_initAgentProperties(JNIEnv *env, jclass cls, jobject props) { - char errmsg[128]; - if (InitAgentProperties_fp == NULL) { if (!JDK_InitJvmHandle()) { JNU_ThrowInternalError(env, diff --git a/jdk/src/solaris/native/java/io/UnixFileSystem_md.c b/jdk/src/solaris/native/java/io/UnixFileSystem_md.c index 8eebc6b5977..4dc9ee865e0 100644 --- a/jdk/src/solaris/native/java/io/UnixFileSystem_md.c +++ b/jdk/src/solaris/native/java/io/UnixFileSystem_md.c @@ -119,7 +119,7 @@ Java_java_io_UnixFileSystem_checkAccess(JNIEnv *env, jobject this, jobject file, jint a) { jboolean rv = JNI_FALSE; - int mode; + int mode = 0; switch (a) { case java_io_FileSystem_ACCESS_READ: mode = R_OK; @@ -151,7 +151,8 @@ Java_java_io_UnixFileSystem_setPermission(JNIEnv *env, jobject this, jboolean rv = JNI_FALSE; WITH_FIELD_PLATFORM_STRING(env, file, ids.path, path) { - int amode, mode; + int amode = 0; + int mode; switch (access) { case java_io_FileSystem_ACCESS_READ: if (owneronly) diff --git a/jdk/src/solaris/native/java/io/canonicalize_md.c b/jdk/src/solaris/native/java/io/canonicalize_md.c index a333cc7b2e6..45e1f9ce26e 100644 --- a/jdk/src/solaris/native/java/io/canonicalize_md.c +++ b/jdk/src/solaris/native/java/io/canonicalize_md.c @@ -246,7 +246,7 @@ canonicalize(char *original, char *resolved, int len) if (r != NULL) { /* Append unresolved subpath to resolved subpath */ int rn = strlen(r); - if (rn + strlen(p) >= len) { + if (rn + (int)strlen(p) >= len) { /* Buffer overflow */ errno = ENAMETOOLONG; return -1; diff --git a/jdk/src/solaris/native/java/lang/java_props_md.c b/jdk/src/solaris/native/java/lang/java_props_md.c index 979a73ce23c..de6faf8c5b4 100644 --- a/jdk/src/solaris/native/java/lang/java_props_md.c +++ b/jdk/src/solaris/native/java/lang/java_props_md.c @@ -46,7 +46,9 @@ #include "java_props.h" #ifdef __linux__ -#define CODESET _NL_CTYPE_CODESET_NAME + #ifndef CODESET + #define CODESET _NL_CTYPE_CODESET_NAME + #endif #else #ifdef ALT_CODESET_KEY #define CODESET ALT_CODESET_KEY @@ -289,7 +291,7 @@ static int ParseLocale(int cat, char ** std_language, char ** std_country, char java_props_t * GetJavaProperties(JNIEnv *env) { - static java_props_t sprops = {0}; + static java_props_t sprops; char *v; /* tmp var */ if (sprops.user_dir) { diff --git a/jdk/src/solaris/native/sun/net/sdp/SdpSupport.c b/jdk/src/solaris/native/sun/net/sdp/SdpSupport.c index dd2750be5f7..65fce3ebeff 100644 --- a/jdk/src/solaris/native/sun/net/sdp/SdpSupport.c +++ b/jdk/src/solaris/native/sun/net/sdp/SdpSupport.c @@ -68,7 +68,7 @@ static int create(JNIEnv* env) */ if (ipv6_available()) { JNU_ThrowIOException(env, "IPv6 not supported"); - return; + return -1; } s = socket(AF_INET_SDP, SOCK_STREAM, 0); #else diff --git a/jdk/src/solaris/native/sun/nio/ch/Net.c b/jdk/src/solaris/native/sun/nio/ch/Net.c index dc3d7c4ac34..05811a3162f 100644 --- a/jdk/src/solaris/native/sun/nio/ch/Net.c +++ b/jdk/src/solaris/native/sun/nio/ch/Net.c @@ -298,7 +298,8 @@ Java_sun_nio_ch_Net_getIntOption0(JNIEnv *env, jclass clazz, jobject fdo, struct linger linger; u_char carg; void *arg; - int arglen, n; + socklen_t arglen; + int n; /* Option value is an int except for a few specific cases */ @@ -317,7 +318,7 @@ Java_sun_nio_ch_Net_getIntOption0(JNIEnv *env, jclass clazz, jobject fdo, } if (mayNeedConversion) { - n = NET_GetSockOpt(fdval(env, fdo), level, opt, arg, &arglen); + n = NET_GetSockOpt(fdval(env, fdo), level, opt, arg, (int*)&arglen); } else { n = getsockopt(fdval(env, fdo), level, opt, arg, &arglen); } @@ -527,7 +528,7 @@ JNIEXPORT jint JNICALL Java_sun_nio_ch_Net_getInterface4(JNIEnv* env, jobject this, jobject fdo) { struct in_addr in; - int arglen = sizeof(struct in_addr); + socklen_t arglen = sizeof(struct in_addr); int n; n = getsockopt(fdval(env, fdo), IPPROTO_IP, IP_MULTICAST_IF, (void*)&in, &arglen); @@ -556,7 +557,7 @@ JNIEXPORT jint JNICALL Java_sun_nio_ch_Net_getInterface6(JNIEnv* env, jobject this, jobject fdo) { int index; - int arglen = sizeof(index); + socklen_t arglen = sizeof(index); int n; n = getsockopt(fdval(env, fdo), IPPROTO_IPV6, IPV6_MULTICAST_IF, (void*)&index, &arglen); diff --git a/jdk/src/solaris/native/sun/nio/ch/SctpNet.c b/jdk/src/solaris/native/sun/nio/ch/SctpNet.c index a39cc9e33e1..f462ae3445d 100644 --- a/jdk/src/solaris/native/sun/nio/ch/SctpNet.c +++ b/jdk/src/solaris/native/sun/nio/ch/SctpNet.c @@ -537,7 +537,7 @@ JNIEXPORT int JNICALL Java_sun_nio_ch_SctpNet_getIntOption0 int result; struct linger linger; void *arg; - unsigned int arglen; + int arglen; if (mapSocketOption(opt, &klevel, &kopt) < 0) { JNU_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", diff --git a/jdk/src/solaris/native/sun/nio/ch/UnixAsynchronousSocketChannelImpl.c b/jdk/src/solaris/native/sun/nio/ch/UnixAsynchronousSocketChannelImpl.c index 4ff6259c508..4106d0277fa 100644 --- a/jdk/src/solaris/native/sun/nio/ch/UnixAsynchronousSocketChannelImpl.c +++ b/jdk/src/solaris/native/sun/nio/ch/UnixAsynchronousSocketChannelImpl.c @@ -40,10 +40,10 @@ Java_sun_nio_ch_UnixAsynchronousSocketChannelImpl_checkConnect(JNIEnv *env, jobject this, int fd) { int error = 0; - int n = sizeof(error); + socklen_t arglen = sizeof(error); int result; - result = getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &n); + result = getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &arglen); if (result < 0) { JNU_ThrowIOExceptionWithLastError(env, "getsockopt"); } else { diff --git a/jdk/src/windows/native/common/jni_util_md.c b/jdk/src/windows/native/common/jni_util_md.c index 96ca60d7df8..4f22836d0b2 100644 --- a/jdk/src/windows/native/common/jni_util_md.c +++ b/jdk/src/windows/native/common/jni_util_md.c @@ -79,7 +79,7 @@ BOOL useNativeConverter(JNIEnv *env) { } jstring nativeNewStringPlatform(JNIEnv *env, const char *str) { - static String_char_constructor = NULL; + static jmethodID String_char_constructor; if (useNativeConverter(env)) { // use native Unicode conversion so Kernel isn't required during // System.initProperties diff --git a/jdk/src/windows/native/java/lang/java_props_md.c b/jdk/src/windows/native/java/lang/java_props_md.c index 300ab224498..50835ee6e28 100644 --- a/jdk/src/windows/native/java/lang/java_props_md.c +++ b/jdk/src/windows/native/java/lang/java_props_md.c @@ -489,7 +489,7 @@ GetJavaProperties(JNIEnv* env) break; } sprintf(buf, "%d.%d", ver.dwMajorVersion, ver.dwMinorVersion); - sprops.os_version = strdup(buf); + sprops.os_version = _strdup(buf); #if _M_IA64 sprops.os_arch = "ia64"; #elif _M_AMD64 @@ -500,7 +500,7 @@ GetJavaProperties(JNIEnv* env) sprops.os_arch = "unknown"; #endif - sprops.patch_level = strdup(ver.szCSDVersion); + sprops.patch_level = _strdup(ver.szCSDVersion); sprops.desktop = "windows"; } diff --git a/jdk/src/windows/native/java/util/TimeZone_md.c b/jdk/src/windows/native/java/util/TimeZone_md.c index eb859efcf37..8bd269f76f4 100644 --- a/jdk/src/windows/native/java/util/TimeZone_md.c +++ b/jdk/src/windows/native/java/util/TimeZone_md.c @@ -26,6 +26,7 @@ #include #include #include +#include "jvm.h" #include "TimeZone_md.h" #define VALUE_UNKNOWN 0 @@ -463,7 +464,7 @@ static char *matchJavaTZ(const char *java_home_dir, int value_type, char *tzName /* * Found the time zone in the mapping table. */ - javaTZName = strdup(items[TZ_JAVA_NAME]); + javaTZName = _strdup(items[TZ_JAVA_NAME]); break; } /* @@ -473,7 +474,7 @@ static char *matchJavaTZ(const char *java_home_dir, int value_type, char *tzName strncpy(bestMatch, items[TZ_JAVA_NAME], MAX_ZONE_CHAR); } else if (country != NULL && strcmp(items[TZ_REGION], country) == 0) { if (value_type == VALUE_MAPID) { - javaTZName = strdup(items[TZ_JAVA_NAME]); + javaTZName = _strdup(items[TZ_JAVA_NAME]); break; } strncpy(bestMatch, items[TZ_JAVA_NAME], MAX_ZONE_CHAR); @@ -490,7 +491,7 @@ static char *matchJavaTZ(const char *java_home_dir, int value_type, char *tzName fclose(fp); if (javaTZName == NULL && bestMatch[0] != '\0') { - javaTZName = strdup(bestMatch); + javaTZName = _strdup(bestMatch); } return javaTZName; @@ -515,7 +516,7 @@ char *findJavaTZ_md(const char *java_home_dir, const char *country) if (result != VALUE_UNKNOWN) { if (result == VALUE_GMTOFFSET) { - std_timezone = strdup(winZoneName); + std_timezone = _strdup(winZoneName); } else { std_timezone = matchJavaTZ(java_home_dir, result, winZoneName, winMapID, country); diff --git a/jdk/src/windows/native/sun/nio/ch/ServerSocketChannelImpl.c b/jdk/src/windows/native/sun/nio/ch/ServerSocketChannelImpl.c index 6026671f4bb..770cd3d7360 100644 --- a/jdk/src/windows/native/sun/nio/ch/ServerSocketChannelImpl.c +++ b/jdk/src/windows/native/sun/nio/ch/ServerSocketChannelImpl.c @@ -84,7 +84,6 @@ Java_sun_nio_ch_ServerSocketChannelImpl_accept0(JNIEnv *env, jobject this, jobject remote_ia; int remote_port; jobject isa; - jobject ia; int addrlen = sizeof(sa); memset((char *)&sa, 0, sizeof(sa)); diff --git a/jdk/src/windows/native/sun/nio/ch/WindowsSelectorImpl.c b/jdk/src/windows/native/sun/nio/ch/WindowsSelectorImpl.c index 2a83f02f9d6..7b28f27dab4 100644 --- a/jdk/src/windows/native/sun/nio/ch/WindowsSelectorImpl.c +++ b/jdk/src/windows/native/sun/nio/ch/WindowsSelectorImpl.c @@ -223,7 +223,7 @@ Java_sun_nio_ch_WindowsSelectorImpl_discardUrgentData(JNIEnv* env, jobject this, jboolean discarded = JNI_FALSE; int n; do { - n = recv(s, &data, sizeof(data), MSG_OOB); + n = recv(s, (char*)&data, sizeof(data), MSG_OOB); if (n > 0) { discarded = JNI_TRUE; }