changeset 3655:f9f321a7502c

7017454: Residual warnings in sun/nio/** and java/io native code (win64) Reviewed-by: chegar
author alanb
date Mon, 07 Feb 2011 18:01:32 +0000
parents 32f1c5f67aae
children 08e1914d5852
files src/share/native/java/io/io_util.c src/windows/native/java/io/WinNTFileSystem_md.c src/windows/native/java/io/canonicalize_md.c src/windows/native/java/io/io_util_md.c src/windows/native/sun/nio/ch/Iocp.c src/windows/native/sun/nio/fs/RegistryFileTypeDetector.c src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c
diffstat 7 files changed, 32 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/java/io/io_util.c	Mon Feb 07 13:55:40 2011 +0000
+++ b/src/share/native/java/io/io_util.c	Mon Feb 07 18:01:32 2011 +0000
@@ -44,7 +44,7 @@
         JNU_ThrowIOException(env, "Stream Closed");
         return -1;
     }
-    nread = IO_Read(fd, &ret, 1);
+    nread = (jint)IO_Read(fd, &ret, 1);
     if (nread == 0) { /* EOF */
         return -1;
     } else if (nread == JVM_IO_ERR) { /* error */
@@ -108,7 +108,7 @@
         JNU_ThrowIOException(env, "Stream Closed");
         nread = -1;
     } else {
-        nread = IO_Read(fd, buf, len);
+        nread = (jint)IO_Read(fd, buf, len);
         if (nread > 0) {
             (*env)->SetByteArrayRegion(env, bytes, off, nread, (jbyte *)buf);
         } else if (nread == JVM_IO_ERR) {
@@ -137,9 +137,9 @@
         return;
     }
     if (append == JNI_TRUE) {
-        n = IO_Append(fd, &c, 1);
+        n = (jint)IO_Append(fd, &c, 1);
     } else {
-        n = IO_Write(fd, &c, 1);
+        n = (jint)IO_Write(fd, &c, 1);
     }
     if (n == JVM_IO_ERR) {
         JNU_ThrowIOExceptionWithLastError(env, "Write error");
@@ -190,9 +190,9 @@
                 break;
             }
             if (append == JNI_TRUE) {
-                n = IO_Append(fd, buf+off, len);
+                n = (jint)IO_Append(fd, buf+off, len);
             } else {
-                n = IO_Write(fd, buf+off, len);
+                n = (jint)IO_Write(fd, buf+off, len);
             }
             if (n == JVM_IO_ERR) {
                 JNU_ThrowIOExceptionWithLastError(env, "Write error");
--- a/src/windows/native/java/io/WinNTFileSystem_md.c	Mon Feb 07 13:55:40 2011 +0000
+++ b/src/windows/native/java/io/WinNTFileSystem_md.c	Mon Feb 07 18:01:32 2011 +0000
@@ -220,19 +220,19 @@
         /*we estimate the max length of memory needed as
           "currentDir. length + pathname.length"
          */
-        int len = wcslen(path);
+        int len = (int)wcslen(path);
         len += currentDirLength(path, len);
         if (len  > MAX_PATH_LENGTH - 1) {
             WCHAR *cp = (WCHAR*)malloc(len * sizeof(WCHAR));
             if (cp != NULL) {
                 if (wcanonicalize(path, cp, len) >= 0) {
-                    rv = (*env)->NewString(env, cp, wcslen(cp));
+                    rv = (*env)->NewString(env, cp, (jsize)wcslen(cp));
                 }
                 free(cp);
             }
         } else
         if (wcanonicalize(path, canonicalPath, MAX_PATH_LENGTH) >= 0) {
-            rv = (*env)->NewString(env, canonicalPath, wcslen(canonicalPath));
+            rv = (*env)->NewString(env, canonicalPath, (jsize)wcslen(canonicalPath));
         }
     } END_UNICODE_STRING(env, path);
     if (rv == NULL) {
@@ -251,14 +251,14 @@
     WCHAR canonicalPath[MAX_PATH_LENGTH];
     WITH_UNICODE_STRING(env, canonicalPrefixString, canonicalPrefix) {
         WITH_UNICODE_STRING(env, pathWithCanonicalPrefixString, pathWithCanonicalPrefix) {
-            int len = wcslen(canonicalPrefix) + MAX_PATH;
+            int len = (int)wcslen(canonicalPrefix) + MAX_PATH;
             if (len > MAX_PATH_LENGTH) {
                 WCHAR *cp = (WCHAR*)malloc(len * sizeof(WCHAR));
                 if (cp != NULL) {
                     if (wcanonicalizeWithPrefix(canonicalPrefix,
                                                 pathWithCanonicalPrefix,
                                                 cp, len) >= 0) {
-                      rv = (*env)->NewString(env, cp, wcslen(cp));
+                      rv = (*env)->NewString(env, cp, (jsize)wcslen(cp));
                     }
                     free(cp);
                 }
@@ -266,7 +266,7 @@
             if (wcanonicalizeWithPrefix(canonicalPrefix,
                                         pathWithCanonicalPrefix,
                                         canonicalPath, MAX_PATH_LENGTH) >= 0) {
-                rv = (*env)->NewString(env, canonicalPath, wcslen(canonicalPath));
+                rv = (*env)->NewString(env, canonicalPath, (jsize)wcslen(canonicalPath));
             }
         } END_UNICODE_STRING(env, pathWithCanonicalPrefix);
     } END_UNICODE_STRING(env, canonicalPrefix);
@@ -358,7 +358,7 @@
         } else { /* pagefile.sys is a special case */
             if (GetLastError() == ERROR_SHARING_VIOLATION) {
                 rv = java_io_FileSystem_BA_EXISTS;
-                if ((pathlen = wcslen(pathbuf)) >= SPECIALFILE_NAMELEN &&
+                if ((pathlen = (jint)wcslen(pathbuf)) >= SPECIALFILE_NAMELEN &&
                     (_wcsicmp(pathbuf + pathlen - SPECIALFILE_NAMELEN,
                               L"pagefile.sys") == 0) ||
                     (_wcsicmp(pathbuf + pathlen - SPECIALFILE_NAMELEN,
@@ -625,7 +625,7 @@
     }
 
     /* Remove trailing space chars from directory name */
-    len = wcslen(search_path);
+    len = (int)wcslen(search_path);
     while (search_path[len-1] == ' ') {
         len--;
     }
@@ -668,7 +668,7 @@
                                 || !wcscmp(find_data.cFileName, L".."))
            continue;
         name = (*env)->NewString(env, find_data.cFileName,
-                                 wcslen(find_data.cFileName));
+                                 (jsize)wcslen(find_data.cFileName));
         if (name == NULL)
             return NULL; // error;
         if (len == maxlen) {
@@ -819,7 +819,7 @@
     jchar *pf = p;
     if (p == NULL) return NULL;
     if (iswalpha(*p) && (p[1] == L':')) p += 2;
-    ret = (*env)->NewString(env, p, wcslen(p));
+    ret = (*env)->NewString(env, p, (jsize)wcslen(p));
     free (pf);
     return ret;
 }
--- a/src/windows/native/java/io/canonicalize_md.c	Mon Feb 07 13:55:40 2011 +0000
+++ b/src/windows/native/java/io/canonicalize_md.c	Mon Feb 07 18:01:32 2011 +0000
@@ -479,7 +479,7 @@
         assert(*src == L'\\');        /* Invariant */
         *p = L'\0';            /* Temporarily clear separator */
 
-        if ((pathlen = wcslen(path)) > MAX_PATH - 1) {
+        if ((pathlen = (int)wcslen(path)) > MAX_PATH - 1) {
             pathbuf = getPrefixed(path, pathlen);
             h = FindFirstFileW(pathbuf, &fd);    /* Look up prefix */
             free(pathbuf);
@@ -538,7 +538,7 @@
     dend = dst + size;   /* Don't go to or past here */
 
 
-    if ((pathlen=wcslen(pathWithCanonicalPrefix)) > MAX_PATH - 1) {
+    if ((pathlen=(int)wcslen(pathWithCanonicalPrefix)) > MAX_PATH - 1) {
         pathbuf = getPrefixed(pathWithCanonicalPrefix, pathlen);
         h = FindFirstFileW(pathbuf, &fd);    /* Look up prefix */
         free(pathbuf);
--- a/src/windows/native/java/io/io_util_md.c	Mon Feb 07 13:55:40 2011 +0000
+++ b/src/windows/native/java/io/io_util_md.c	Mon Feb 07 18:01:32 2011 +0000
@@ -104,7 +104,7 @@
         else return 0; /* invalid drive name. */
         dir = currentDir(di);
         if (dir != NULL){
-            dirlen = wcslen(dir);
+            dirlen = (int)wcslen(dir);
             free(dir);
         }
         return dirlen;
@@ -115,7 +115,7 @@
             int dirlen = -1;
             dir = _wgetcwd(NULL, MAX_PATH);
             if (dir != NULL) {
-                curDirLenCached = wcslen(dir);
+                curDirLenCached = (int)wcslen(dir);
                 free(dir);
             }
         }
@@ -165,7 +165,7 @@
     int max_path = 248; /* CreateDirectoryW() has the limit of 248 */
 
     WITH_UNICODE_STRING(env, path, ps) {
-        pathlen = wcslen(ps);
+        pathlen = (int)wcslen(ps);
         if (pathlen != 0) {
             if (pathlen > 2 &&
                 (ps[0] == L'\\' && ps[1] == L'\\' ||   //UNC
--- a/src/windows/native/sun/nio/ch/Iocp.c	Mon Feb 07 13:55:40 2011 +0000
+++ b/src/windows/native/sun/nio/ch/Iocp.c	Mon Feb 07 18:01:32 2011 +0000
@@ -72,9 +72,10 @@
 Java_sun_nio_ch_Iocp_createIoCompletionPort(JNIEnv* env, jclass this,
     jlong handle, jlong existingPort, jint completionKey, jint concurrency)
 {
+    ULONG_PTR ck = completionKey;
     HANDLE port = CreateIoCompletionPort((HANDLE)jlong_to_ptr(handle),
                                          (HANDLE)jlong_to_ptr(existingPort),
-                                         (DWORD)completionKey,
+                                         ck,
                                          (DWORD)concurrency);
     if (port == NULL) {
         JNU_ThrowIOExceptionWithLastError(env, "CreateIoCompletionPort failed");
@@ -96,7 +97,7 @@
     jlong completionPort, jobject obj)
 {
     DWORD bytesTransferred;
-    DWORD completionKey;
+    ULONG_PTR completionKey;
     OVERLAPPED *lpOverlapped;
     BOOL res;
 
--- a/src/windows/native/sun/nio/fs/RegistryFileTypeDetector.c	Mon Feb 07 13:55:40 2011 +0000
+++ b/src/windows/native/sun/nio/fs/RegistryFileTypeDetector.c	Mon Feb 07 18:01:32 2011 +0000
@@ -51,7 +51,7 @@
         res = RegQueryValueExW(hKey, lpValueName, NULL, &type, (LPBYTE)&data, &size);
         if (res == ERROR_SUCCESS) {
             if (type == REG_SZ) {
-                jsize len = wcslen((WCHAR*)data);
+                jsize len = (jsize)wcslen((WCHAR*)data);
                 result = (*env)->NewString(env, (const jchar*)&data, len);
             }
         }
--- a/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c	Mon Feb 07 13:55:40 2011 +0000
+++ b/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c	Mon Feb 07 18:01:32 2011 +0000
@@ -368,7 +368,7 @@
 
     HANDLE handle = FindFirstFileW(lpFileName, &data);
     if (handle != INVALID_HANDLE_VALUE) {
-        jstring name = (*env)->NewString(env, data.cFileName, wcslen(data.cFileName));
+        jstring name = (*env)->NewString(env, data.cFileName, (jsize)wcslen(data.cFileName));
         if (name == NULL)
             return;
         (*env)->SetLongField(env, obj, findFirst_handle, ptr_to_jlong(handle));
@@ -401,7 +401,7 @@
     WIN32_FIND_DATAW* data = (WIN32_FIND_DATAW*)jlong_to_ptr(dataAddress);
 
     if (FindNextFileW(h, data) != 0) {
-        return (*env)->NewString(env, data->cFileName, wcslen(data->cFileName));
+        return (*env)->NewString(env, data->cFileName, (jsize)wcslen(data->cFileName));
     } else {
     if (GetLastError() != ERROR_NO_MORE_FILES)
         throwWindowsException(env, GetLastError());
@@ -424,7 +424,7 @@
 
     handle = (*FindFirstStream_func)(lpFileName, FindStreamInfoStandard, &data, 0);
     if (handle != INVALID_HANDLE_VALUE) {
-        jstring name = (*env)->NewString(env, data.cStreamName, wcslen(data.cStreamName));
+        jstring name = (*env)->NewString(env, data.cStreamName, (jsize)wcslen(data.cStreamName));
         if (name == NULL)
             return;
         (*env)->SetLongField(env, obj, findStream_handle, ptr_to_jlong(handle));
@@ -452,7 +452,7 @@
     }
 
     if ((*FindNextStream_func)(h, &data) != 0) {
-        return (*env)->NewString(env, data.cStreamName, wcslen(data.cStreamName));
+        return (*env)->NewString(env, data.cStreamName, (jsize)wcslen(data.cStreamName));
     } else {
         if (GetLastError() != ERROR_HANDLE_EOF)
             throwWindowsException(env, GetLastError());
@@ -1224,9 +1224,10 @@
 Java_sun_nio_fs_WindowsNativeDispatcher_CreateIoCompletionPort(JNIEnv* env, jclass this,
     jlong fileHandle, jlong existingPort, jint completionKey)
 {
+    ULONG_PTR ck = completionKey;
     HANDLE port = CreateIoCompletionPort((HANDLE)jlong_to_ptr(fileHandle),
                                          (HANDLE)jlong_to_ptr(existingPort),
-                                         (DWORD)completionKey,
+                                         ck,
                                          0);
     if (port == NULL) {
         throwWindowsException(env, GetLastError());
@@ -1239,7 +1240,7 @@
     jlong completionPort, jobject obj)
 {
     DWORD bytesTransferred;
-    DWORD completionKey;
+    ULONG_PTR completionKey;
     OVERLAPPED *lpOverlapped;
     BOOL res;