Merge pull request #820 from brendanzagaeski/master
[mono.git] / mcs / class / corlib / System.IO / BinaryReader.cs
index d48bb2685654783ca8ddaf2cde72d7bbdcb6a25b..d7b92b38541e42a0d7888c6f06acf15fb94c85f1 100644 (file)
@@ -517,11 +517,11 @@ namespace System.IO {
                        do {
                                int readLen = Math.Min (MaxBufferSize, len);
                                
-                               int n = m_stream.Read (charByteBuffer, 0, readLen);
-                               if (n == 0)
+                               readLen = m_stream.Read (charByteBuffer, 0, readLen);
+                               if (readLen == 0)
                                        throw new EndOfStreamException();
                                
-                               int cch = decoder.GetChars (charByteBuffer, 0, n, charBuffer, 0);
+                               int cch = decoder.GetChars (charByteBuffer, 0, readLen, charBuffer, 0);
 
                                if (sb == null && readLen == len) // ok, we got out the easy way, dont bother with the sb
                                        return new String (charBuffer, 0, cch);