harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r938409 - in /harmony/enhanced/java/trunk/classlib/modules: luni/src/main/java/java/io/RandomAccessFile.java luni/src/main/native/luni/windows/OSFileSystemWin32.c nio/src/main/java/common/org/apache/harmony/nio/internal/FileChannelImpl.java
Date Tue, 27 Apr 2010 11:00:03 GMT
Author: hindessm
Date: Tue Apr 27 11:00:02 2010
New Revision: 938409

URL: http://svn.apache.org/viewvc?rev=938409&view=rev
Log:
Make windows file size native use non-repositioning call and remove the
locking from the java code.

Modified:
    harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/io/RandomAccessFile.java
    harmony/enhanced/java/trunk/classlib/modules/luni/src/main/native/luni/windows/OSFileSystemWin32.c
    harmony/enhanced/java/trunk/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/FileChannelImpl.java

Modified: harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/io/RandomAccessFile.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/io/RandomAccessFile.java?rev=938409&r1=938408&r2=938409&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/io/RandomAccessFile.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/io/RandomAccessFile.java
Tue Apr 27 11:00:02 2010
@@ -262,9 +262,7 @@ public class RandomAccessFile implements
      */
     public long length() throws IOException {
         openCheck();
-        synchronized (repositionLock) {
-            return fileSystem.size(fd.descriptor);
-        }
+        return fileSystem.size(fd.descriptor);
     }
 
     /**

Modified: harmony/enhanced/java/trunk/classlib/modules/luni/src/main/native/luni/windows/OSFileSystemWin32.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/luni/src/main/native/luni/windows/OSFileSystemWin32.c?rev=938409&r1=938408&r2=938409&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/luni/src/main/native/luni/windows/OSFileSystemWin32.c
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/luni/src/main/native/luni/windows/OSFileSystemWin32.c
Tue Apr 27 11:00:02 2010
@@ -306,19 +306,11 @@ JNIEXPORT jlong JNICALL Java_org_apache_
 JNIEXPORT jlong JNICALL Java_org_apache_harmony_luni_platform_OSFileSystem_sizeImpl
 (JNIEnv *env, jobject thiz, jlong fd)
 {
-    jlong currentPosition =
-      Java_org_apache_harmony_luni_platform_OSFileSystem_seekImpl(env,
-          thiz, fd, 0,
-          org_apache_harmony_luni_platform_IFileSystem_SEEK_CUR);
-
-    jlong endPosition =
-      Java_org_apache_harmony_luni_platform_OSFileSystem_seekImpl(env,
-          thiz, fd, 0,
-          org_apache_harmony_luni_platform_IFileSystem_SEEK_END);
-    
-    Java_org_apache_harmony_luni_platform_OSFileSystem_seekImpl(env,
-          thiz, fd, currentPosition,
-          org_apache_harmony_luni_platform_IFileSystem_SEEK_SET);
-    
-    return (jlong) endPosition;
+  BY_HANDLE_FILE_INFORMATION info;
+  HANDLE hfile = (HANDLE)fd;    	
+  if (GetFileInformationByHandle(hfile, (LPBY_HANDLE_FILE_INFORMATION) &info)) {
+    return (jlong) ((info.nFileSizeHigh<<0x20) + info.nFileSizeLow);
+  } else {
+    return (jlong)-1;
+  }
 }

Modified: harmony/enhanced/java/trunk/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/FileChannelImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/FileChannelImpl.java?rev=938409&r1=938408&r2=938409&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/FileChannelImpl.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/FileChannelImpl.java
Tue Apr 27 11:00:02 2010
@@ -370,9 +370,7 @@ public abstract class FileChannelImpl ex
      */
     public long size() throws IOException {
         openCheck();
-        synchronized (repositioningLock) {
-            return fileSystem.size(handle);
-        }
+        return fileSystem.size(handle);
     }
 
     public long transferFrom(ReadableByteChannel src, long position, long count)



Mime
View raw message