changeset 9282:551518f53b91

8030010: cleanup native code warnings Reviewed-by: alanb, lancea Contributed-by: Francis Andre <francis.andre.kampbell@orange.fr>, mandy.chung@oracle.com
author mchung
date Wed, 12 Feb 2014 10:51:50 -0800
parents 464546283c91
children 55be92779e68 fb29aee785ba
files src/share/bin/java.c src/share/bin/parse_manifest.c src/share/instrument/InvocationAdapter.c src/share/native/java/lang/ClassLoader.c src/share/native/java/lang/Throwable.c src/windows/native/common/jdk_util_md.c src/windows/native/java/io/WinNTFileSystem_md.c src/windows/native/java/lang/ProcessImpl_md.c
diffstat 8 files changed, 10 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/bin/java.c	Wed Feb 12 17:51:31 2014 +0000
+++ b/src/share/bin/java.c	Wed Feb 12 10:51:50 2014 -0800
@@ -345,10 +345,10 @@
         } \
     } 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 @@
 GetApplicationClass(JNIEnv *env)
 {
     jmethodID mid;
-    jobject result;
     jclass cls = GetLauncherHelperClass(env);
     NULL_CHECK0(cls);
     NULL_CHECK0(mid = (*env)->GetStaticMethodID(env, cls,
--- a/src/share/bin/parse_manifest.c	Wed Feb 12 17:51:31 2014 +0000
+++ b/src/share/bin/parse_manifest.c	Wed Feb 12 10:51:50 2014 -0800
@@ -233,7 +233,7 @@
     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 @@
         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);
--- a/src/share/instrument/InvocationAdapter.c	Wed Feb 12 17:51:31 2014 +0000
+++ b/src/share/instrument/InvocationAdapter.c	Wed Feb 12 10:51:50 2014 -0800
@@ -153,7 +153,6 @@
         char *          options;
         jarAttribute*   attributes;
         char *          premainClass;
-        char *          agentClass;
         char *          bootClassPath;
 
         /*
--- a/src/share/native/java/lang/ClassLoader.c	Wed Feb 12 17:51:31 2014 +0000
+++ b/src/share/native/java/lang/ClassLoader.c	Wed Feb 12 10:51:50 2014 -0800
@@ -325,7 +325,7 @@
     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 @@
 {
     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;
--- a/src/share/native/java/lang/Throwable.c	Wed Feb 12 17:51:31 2014 +0000
+++ b/src/share/native/java/lang/Throwable.c	Wed Feb 12 10:51:50 2014 -0800
@@ -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;
--- a/src/windows/native/common/jdk_util_md.c	Wed Feb 12 17:51:31 2014 +0000
+++ b/src/windows/native/common/jdk_util_md.c	Wed Feb 12 10:51:50 2014 -0800
@@ -42,7 +42,6 @@
 JNIEXPORT HMODULE JDK_LoadSystemLibrary(const char* name) {
     HMODULE handle = NULL;
     char path[MAX_PATH];
-    int ret;
 
     if (GetSystemDirectory(path, sizeof(path)) != 0) {
         strcat(path, "\\");
--- a/src/windows/native/java/io/WinNTFileSystem_md.c	Wed Feb 12 17:51:31 2014 +0000
+++ b/src/windows/native/java/io/WinNTFileSystem_md.c	Wed Feb 12 10:51:50 2014 -0800
@@ -360,7 +360,6 @@
                                                   jobject file)
 {
     jint rv = 0;
-    jint pathlen;
 
     WCHAR *pathbuf = fileToNTPath(env, file, ids.path);
     if (pathbuf == NULL)
--- a/src/windows/native/java/lang/ProcessImpl_md.c	Wed Feb 12 17:51:31 2014 +0000
+++ b/src/windows/native/java/lang/ProcessImpl_md.c	Wed Feb 12 10:51:50 2014 -0800
@@ -79,7 +79,7 @@
     /*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);