From 328fa609d0fc8ea607ca1f848710a3d9304b8e65 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Wed, 12 Feb 2014 10:51:50 -0800 Subject: [PATCH] 8030010: cleanup native code warnings Co-authored-by: Francis Andre Reviewed-by: alanb, lancea --- jdk/src/share/bin/java.c | 5 ++--- jdk/src/share/bin/parse_manifest.c | 4 ++-- jdk/src/share/instrument/InvocationAdapter.c | 1 - jdk/src/share/native/java/lang/ClassLoader.c | 8 ++++---- jdk/src/share/native/java/lang/Throwable.c | 2 +- jdk/src/windows/native/common/jdk_util_md.c | 1 - jdk/src/windows/native/java/io/WinNTFileSystem_md.c | 1 - jdk/src/windows/native/java/lang/ProcessImpl_md.c | 2 +- 8 files changed, 10 insertions(+), 14 deletions(-) diff --git a/jdk/src/share/bin/java.c b/jdk/src/share/bin/java.c index b72fa0e6d26..79912d52d0a 100644 --- a/jdk/src/share/bin/java.c +++ b/jdk/src/share/bin/java.c @@ -345,10 +345,10 @@ JLI_Launch(int argc, char ** argv, /* main argc, argc */ } \ } while (JNI_FALSE) -#define CHECK_EXCEPTION_RETURN(CER_return_value) \ +#define CHECK_EXCEPTION_RETURN() \ do { \ if ((*env)->ExceptionOccurred(env)) { \ - return CER_return_value; \ + return; \ } \ } while (JNI_FALSE) @@ -1258,7 +1258,6 @@ static jclass GetApplicationClass(JNIEnv *env) { jmethodID mid; - jobject result; jclass cls = GetLauncherHelperClass(env); NULL_CHECK0(cls); NULL_CHECK0(mid = (*env)->GetStaticMethodID(env, cls, diff --git a/jdk/src/share/bin/parse_manifest.c b/jdk/src/share/bin/parse_manifest.c index 4926824e36b..c17249c0b30 100644 --- a/jdk/src/share/bin/parse_manifest.c +++ b/jdk/src/share/bin/parse_manifest.c @@ -233,7 +233,7 @@ compute_cen(int fd, Byte *bp) jlong base_offset; jlong offset; char buffer[MINREAD]; - p = buffer; + p = (Byte*) buffer; /* * Read the END Header, which is the starting point for ZIP files. * (Clearly designed to make writing a zip file easier than reading @@ -276,7 +276,7 @@ compute_cen(int fd, Byte *bp) if (JLI_Lseek(fd, offset, SEEK_SET) < (jlong)0) { return (-1); } - p = buffer; + p = (Byte*) buffer; base_offset = base_offset - ZIP64_ENDSIZ(p) - ZIP64_ENDOFF(p) - ZIP64_ENDHDR; } else { base_offset = base_offset - ENDSIZ(p) - ENDOFF(p); diff --git a/jdk/src/share/instrument/InvocationAdapter.c b/jdk/src/share/instrument/InvocationAdapter.c index f1923d7cc3f..878adeced8c 100644 --- a/jdk/src/share/instrument/InvocationAdapter.c +++ b/jdk/src/share/instrument/InvocationAdapter.c @@ -153,7 +153,6 @@ Agent_OnLoad(JavaVM *vm, char *tail, void * reserved) { char * options; jarAttribute* attributes; char * premainClass; - char * agentClass; char * bootClassPath; /* diff --git a/jdk/src/share/native/java/lang/ClassLoader.c b/jdk/src/share/native/java/lang/ClassLoader.c index 8e0b950406a..7701cce4bea 100644 --- a/jdk/src/share/native/java/lang/ClassLoader.c +++ b/jdk/src/share/native/java/lang/ClassLoader.c @@ -325,7 +325,7 @@ static void *findJniFunction(JNIEnv *env, void *handle, void *entryName = NULL; char *jniFunctionName; int i; - int len; + size_t len; // Check for JNI_On(Un)Load<_libname> function if (isLoad) { @@ -501,9 +501,9 @@ Java_java_lang_ClassLoader_00024NativeLibrary_findBuiltinLib { const char *cname; char *libName; - int prefixLen = (int) strlen(JNI_LIB_PREFIX); - int suffixLen = (int) strlen(JNI_LIB_SUFFIX); - int len; + size_t prefixLen = strlen(JNI_LIB_PREFIX); + size_t suffixLen = strlen(JNI_LIB_SUFFIX); + size_t len; jstring lib; void *ret; const char *onLoadSymbols[] = JNI_ONLOAD_SYMBOLS; diff --git a/jdk/src/share/native/java/lang/Throwable.c b/jdk/src/share/native/java/lang/Throwable.c index aaf3c265865..768c7e114a4 100644 --- a/jdk/src/share/native/java/lang/Throwable.c +++ b/jdk/src/share/native/java/lang/Throwable.c @@ -44,7 +44,7 @@ * `this' so you can write 'throw e.fillInStackTrace();' */ JNIEXPORT jobject JNICALL -Java_java_lang_Throwable_fillInStackTrace(JNIEnv *env, jobject throwable, int dummy) +Java_java_lang_Throwable_fillInStackTrace(JNIEnv *env, jobject throwable, jint dummy) { JVM_FillInStackTrace(env, throwable); return throwable; diff --git a/jdk/src/windows/native/common/jdk_util_md.c b/jdk/src/windows/native/common/jdk_util_md.c index 65d20f55b3b..0eae2158f97 100644 --- a/jdk/src/windows/native/common/jdk_util_md.c +++ b/jdk/src/windows/native/common/jdk_util_md.c @@ -42,7 +42,6 @@ void* JDK_FindJvmEntry(const char* name) { JNIEXPORT HMODULE JDK_LoadSystemLibrary(const char* name) { HMODULE handle = NULL; char path[MAX_PATH]; - int ret; if (GetSystemDirectory(path, sizeof(path)) != 0) { strcat(path, "\\"); diff --git a/jdk/src/windows/native/java/io/WinNTFileSystem_md.c b/jdk/src/windows/native/java/io/WinNTFileSystem_md.c index ec7d9d7294b..cfaeccdd030 100644 --- a/jdk/src/windows/native/java/io/WinNTFileSystem_md.c +++ b/jdk/src/windows/native/java/io/WinNTFileSystem_md.c @@ -360,7 +360,6 @@ Java_java_io_WinNTFileSystem_getBooleanAttributes(JNIEnv *env, jobject this, jobject file) { jint rv = 0; - jint pathlen; WCHAR *pathbuf = fileToNTPath(env, file, ids.path); if (pathbuf == NULL) diff --git a/jdk/src/windows/native/java/lang/ProcessImpl_md.c b/jdk/src/windows/native/java/lang/ProcessImpl_md.c index da7d00b081a..04db1e341b4 100644 --- a/jdk/src/windows/native/java/lang/ProcessImpl_md.c +++ b/jdk/src/windows/native/java/lang/ProcessImpl_md.c @@ -79,7 +79,7 @@ win32Error(JNIEnv *env, const WCHAR *functionName) /*Good suggestion about 2-bytes-per-symbol in localized error reports*/ char utf8_javaMessage[MESSAGE_LENGTH*2]; const int errnum = (int)GetLastError(); - int n = os_error_message(errnum, utf16_OSErrorMsg, ARRAY_SIZE(utf16_OSErrorMsg)); + size_t n = os_error_message(errnum, utf16_OSErrorMsg, ARRAY_SIZE(utf16_OSErrorMsg)); n = (n > 0) ? swprintf(utf16_javaMessage, MESSAGE_LENGTH, L"%s error=%d, %s", functionName, errnum, utf16_OSErrorMsg) : swprintf(utf16_javaMessage, MESSAGE_LENGTH, L"%s failed, error=%d", functionName, errnum);