Kaynağa Gözat

2003-09-19 Gonzalo Paniagua Javier <[email protected]>

	* BinaryReader.cs: return the correct number of bytes read when there
	are some bytes from peeking.

svn path=/trunk/mcs/; revision=18183
Gonzalo Paniagua Javier 22 yıl önce
ebeveyn
işleme
1cd5afc014

+ 5 - 2
mcs/class/corlib/System.IO/BinaryReader.cs

@@ -148,13 +148,16 @@ namespace System.IO {
 				throw new ArgumentOutOfRangeException("count is less than 0");
 			}
 
+			int fromPeek = 0;
 			while (m_peekIndex < m_peekLimit) {
-				buffer[index++] = m_peekBuffer[m_peekIndex++]; count--; 
+				buffer[index++] = m_peekBuffer[m_peekIndex++];
+				count--; 
+				fromPeek++;
 			}
 
 			int bytes_read=m_stream.Read(buffer, index, count);
 
-			return(bytes_read);
+			return(bytes_read + fromPeek);
 		}
 
 		public virtual int Read(char[] buffer, int index, int count) {

+ 5 - 0
mcs/class/corlib/System.IO/ChangeLog

@@ -1,3 +1,8 @@
+2003-09-19  Gonzalo Paniagua Javier <[email protected]>
+
+	* BinaryReader.cs: return the correct number of bytes read when there
+	are some bytes from peeking.
+
 2003-09-11  Lluis Sanchez Gual  <[email protected]>
 
 	* BufferedStream.cs, FileStream.cs, MemoryStream.cs, Stream.cs: