Permalink
Browse files

2006-04-29 Atsushi Enomoto <atsushi@ximian.com>

	* UnexceptionalStreamReader.cs (Read): Fix for #78218, where we
	consumed characters from the input even when the count was not set
	to zero, causing some characters to be missing in some
	circumstances. 

svn path=/branches/mono-1-1-13/mcs/; revision=60077
  • Loading branch information...
1 parent ac73df9 commit ebcbcb5d6cd6f184c92734919fd29e4657b53fca @migueldeicaza migueldeicaza committed Apr 29, 2006
Showing with 11 additions and 4 deletions.
  1. +7 −0 mcs/class/corlib/System.IO/ChangeLog
  2. +4 −4 mcs/class/corlib/System.IO/UnexceptionalStreamReader.cs
View
7 mcs/class/corlib/System.IO/ChangeLog
@@ -1,3 +1,10 @@
+2006-04-29 Atsushi Enomoto <atsushi@ximian.com>
+
+ * UnexceptionalStreamReader.cs (Read): Fix for #78218, where we
+ consumed characters from the input even when the count was not set
+ to zero, causing some characters to be missing in some
+ circumstances.
+
2006-04-21 Zoltan Varga <vargaz@gmail.com>
* FileStream.cs: Add new net 2.0 ctor.
View
8 mcs/class/corlib/System.IO/UnexceptionalStreamReader.cs
@@ -128,16 +128,16 @@ public override int Read ()
throw new ArgumentException ("index + count > dest_buffer.Length");
int chars_read = 0;
- int c = Read ();
- while ((c != -1) && (count > 0)) {
+ while (count > 0) {
+ int c = Read ();
+ if (c < 0)
+ break;
chars_read++;
count--;
dest_buffer [index] = (char) c;
if (CheckEOL (dest_buffer [index++]))
return chars_read;
-
- c = Read ();
}
return chars_read;
}

0 comments on commit ebcbcb5

Please sign in to comment.