7030624: size_t usages in src/windows/native/java/io/io_util_md.c need to be re-visited
authoralanb
Wed, 30 Nov 2011 10:57:51 +0000
changeset 11116 3e486ce0019d
parent 11115 b91324cce2f3
child 11117 b6e68b1344d4
7030624: size_t usages in src/windows/native/java/io/io_util_md.c need to be re-visited Reviewed-by: lancea, chegar
jdk/src/share/native/java/io/io_util.c
jdk/src/windows/native/java/io/io_util_md.c
jdk/src/windows/native/java/io/io_util_md.h
--- a/jdk/src/share/native/java/io/io_util.c	Tue Nov 29 13:49:18 2011 -0800
+++ b/jdk/src/share/native/java/io/io_util.c	Wed Nov 30 10:57:51 2011 +0000
@@ -44,7 +44,7 @@
         JNU_ThrowIOException(env, "Stream Closed");
         return -1;
     }
-    nread = (jint)IO_Read(fd, &ret, 1);
+    nread = 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 = (jint)IO_Read(fd, buf, len);
+        nread = 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 = (jint)IO_Append(fd, &c, 1);
+        n = IO_Append(fd, &c, 1);
     } else {
-        n = (jint)IO_Write(fd, &c, 1);
+        n = 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 = (jint)IO_Append(fd, buf+off, len);
+                n = IO_Append(fd, buf+off, len);
             } else {
-                n = (jint)IO_Write(fd, buf+off, len);
+                n = IO_Write(fd, buf+off, len);
             }
             if (n == JVM_IO_ERR) {
                 JNU_ThrowIOExceptionWithLastError(env, "Write error");
--- a/jdk/src/windows/native/java/io/io_util_md.c	Tue Nov 29 13:49:18 2011 -0800
+++ b/jdk/src/windows/native/java/io/io_util_md.c	Wed Nov 30 10:57:51 2011 +0000
@@ -478,7 +478,7 @@
 }
 
 JNIEXPORT
-size_t
+jint
 handleRead(jlong fd, void *buf, jint len)
 {
     DWORD read = 0;
@@ -499,10 +499,10 @@
         }
         return -1;
     }
-    return read;
+    return (jint)read;
 }
 
-static size_t writeInternal(jlong fd, const void *buf, jint len, jboolean append)
+static jint writeInternal(jlong fd, const void *buf, jint len, jboolean append)
 {
     BOOL result = 0;
     DWORD written = 0;
@@ -527,16 +527,16 @@
     if ((h == INVALID_HANDLE_VALUE) || (result == 0)) {
         return -1;
     }
-    return (size_t)written;
+    return (jint)written;
 }
 
 JNIEXPORT
-size_t handleWrite(jlong fd, const void *buf, jint len) {
+jint handleWrite(jlong fd, const void *buf, jint len) {
     return writeInternal(fd, buf, len, JNI_FALSE);
 }
 
 JNIEXPORT
-size_t handleAppend(jlong fd, const void *buf, jint len) {
+jint handleAppend(jlong fd, const void *buf, jint len) {
     return writeInternal(fd, buf, len, JNI_TRUE);
 }
 
--- a/jdk/src/windows/native/java/io/io_util_md.h	Tue Nov 29 13:49:18 2011 -0800
+++ b/jdk/src/windows/native/java/io/io_util_md.h	Wed Nov 30 10:57:51 2011 +0000
@@ -39,9 +39,9 @@
 int handleAvailable(jlong fd, jlong *pbytes);
 JNIEXPORT int handleSync(jlong fd);
 int handleSetLength(jlong fd, jlong length);
-JNIEXPORT size_t handleRead(jlong fd, void *buf, jint len);
-JNIEXPORT size_t handleWrite(jlong fd, const void *buf, jint len);
-JNIEXPORT size_t handleAppend(jlong fd, const void *buf, jint len);
+JNIEXPORT jint handleRead(jlong fd, void *buf, jint len);
+JNIEXPORT jint handleWrite(jlong fd, const void *buf, jint len);
+JNIEXPORT jint handleAppend(jlong fd, const void *buf, jint len);
 jint handleClose(JNIEnv *env, jobject this, jfieldID fid);
 jlong handleLseek(jlong fd, jlong offset, jint whence);