8074821: Resolve disabled warnings for libnio
Enable the indicated warnings and correct the code which provoked them. Reviewed-by: alanb
This commit is contained in:
parent
68703f6458
commit
ada1a8eecd
@ -69,9 +69,6 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBNIO, \
|
||||
OPTIMIZATION := HIGH, \
|
||||
CFLAGS := $(CFLAGS_JDKLIB) \
|
||||
$(BUILD_LIBNIO_CFLAGS), \
|
||||
DISABLED_WARNINGS_gcc := type-limits, \
|
||||
DISABLED_WARNINGS_clang := tautological-compare, \
|
||||
DISABLED_WARNINGS_microsoft := 4244 4996, \
|
||||
MAPFILE := $(BUILD_LIBNIO_MAPFILE), \
|
||||
LDFLAGS := $(LDFLAGS_JDKLIB) $(BUILD_LIBNIO_LDFLAGS) \
|
||||
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -391,8 +391,7 @@ public class Net {
|
||||
private static native boolean isIPv6Available0();
|
||||
|
||||
/*
|
||||
* Returns 1 for Windows versions that support exclusive binding by default, 0
|
||||
* for those that do not, and -1 for Solaris/Linux/Mac OS
|
||||
* Returns 1 for Windows and -1 for Solaris/Linux/Mac OS
|
||||
*/
|
||||
private static native int isExclusiveBindAvailable();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -129,7 +129,8 @@ Java_sun_nio_ch_IOUtil_fdLimit(JNIEnv *env, jclass this)
|
||||
JNU_ThrowIOExceptionWithLastError(env, "getrlimit failed");
|
||||
return -1;
|
||||
}
|
||||
if (rlp.rlim_max < 0 || rlp.rlim_max > java_lang_Integer_MAX_VALUE) {
|
||||
if (rlp.rlim_max == RLIM_INFINITY ||
|
||||
rlp.rlim_max > (rlim_t)java_lang_Integer_MAX_VALUE) {
|
||||
return java_lang_Integer_MAX_VALUE;
|
||||
} else {
|
||||
return (jint)rlp.rlim_max;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -57,16 +57,6 @@ Java_sun_nio_ch_Iocp_initIDs(JNIEnv* env, jclass this)
|
||||
CHECK_NULL(completionStatus_overlapped);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_sun_nio_ch_Iocp_osMajorVersion(JNIEnv* env, jclass this)
|
||||
{
|
||||
OSVERSIONINFOEX ver;
|
||||
ver.dwOSVersionInfoSize = sizeof(ver);
|
||||
GetVersionEx((OSVERSIONINFO *) &ver);
|
||||
return (ver.dwPlatformId == VER_PLATFORM_WIN32_NT) ?
|
||||
(jint)(ver.dwMajorVersion) : (jint)0;
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_sun_nio_ch_Iocp_createIoCompletionPort(JNIEnv* env, jclass this,
|
||||
jlong handle, jlong existingPort, jint completionKey, jint concurrency)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -88,28 +88,14 @@ JNIEXPORT jboolean JNICALL
|
||||
Java_sun_nio_ch_Net_isIPv6Available0(JNIEnv* env, jclass cl)
|
||||
{
|
||||
/*
|
||||
* Return true if Windows Vista or newer, and IPv6 is configured
|
||||
* Return true if IPv6 is configured
|
||||
*/
|
||||
OSVERSIONINFO ver;
|
||||
ver.dwOSVersionInfoSize = sizeof(ver);
|
||||
GetVersionEx(&ver);
|
||||
if ((ver.dwPlatformId == VER_PLATFORM_WIN32_NT) &&
|
||||
(ver.dwMajorVersion >= 6) && ipv6_available())
|
||||
{
|
||||
return JNI_TRUE;
|
||||
}
|
||||
return JNI_FALSE;
|
||||
return ipv6_available() ? JNI_TRUE : JNI_FALSE;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_sun_nio_ch_Net_isExclusiveBindAvailable(JNIEnv *env, jclass clazz) {
|
||||
OSVERSIONINFO ver;
|
||||
int version;
|
||||
ver.dwOSVersionInfoSize = sizeof(ver);
|
||||
GetVersionEx(&ver);
|
||||
version = ver.dwMajorVersion * 10 + ver.dwMinorVersion;
|
||||
//if os <= xp exclusive binding is off by default
|
||||
return version >= 60 ? 1 : 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -567,7 +553,7 @@ Java_sun_nio_ch_Net_poll(JNIEnv* env, jclass this, jobject fdo, jint events, jlo
|
||||
fd_set rd, wr, ex;
|
||||
jint fd = fdval(env, fdo);
|
||||
|
||||
t.tv_sec = timeout / 1000;
|
||||
t.tv_sec = (long)(timeout / 1000);
|
||||
t.tv_usec = (timeout % 1000) * 1000;
|
||||
|
||||
FD_ZERO(&rd);
|
||||
|
Loading…
Reference in New Issue
Block a user