diff base/src/java/io/BufferedInputStream.d @ 112:9f4c18c268b2

Update to compile and execute with dmd 2.052.
author kntroh
date Wed, 16 Mar 2011 21:53:53 +0900
parents 1bf55a6eb092
children
line wrap: on
line diff
--- a/base/src/java/io/BufferedInputStream.d	Sat Nov 13 14:15:51 2010 +0100
+++ b/base/src/java/io/BufferedInputStream.d	Wed Mar 16 21:53:53 2011 +0900
@@ -54,30 +54,34 @@
             istr = null;
         }
     }
-    public synchronized int read(){
-        if( pos >= count ){
-            fill();
+    public int read(){
+        synchronized {
             if( pos >= count ){
-                return -1;
+                fill();
+                if( pos >= count ){
+                    return -1;
+                }
             }
+            return getAndCheckBuf()[pos++] & 0xFF;
         }
-        return getAndCheckBuf()[pos++] & 0xFF;
     }
 
-    public synchronized int read( byte[] b, int off, int len ){
-        return super.read( b, off, len );
+    public int read( byte[] b, int off, int len ){
+        synchronized return super.read( b, off, len );
+    }
+
+    public long skip( long n ){
+        synchronized return this.istr.skip(n);
     }
 
-    public synchronized long skip( long n ){
-        return this.istr.skip(n);
-    }
-
-    public synchronized int available(){
-        int istr_avail = 0;
-        if( istr !is null ){
-            istr_avail = istr.available();
+    public int available(){
+        synchronized {
+            int istr_avail = 0;
+            if( istr !is null ){
+                istr_avail = istr.available();
+            }
+            return istr_avail + (count - pos);
         }
-        return istr_avail + (count - pos);
     }
 
     public synchronized void mark( int readlimit ){