* StreamReader.cs : Encoding.GetMaxCharCount() does not always return
the maximum max char count for Decoder.GetChars() since it might
contain pending buffer by flush. Fixed bug #338370.
svn path=/trunk/mcs/; revision=88712
+2007-11-02 Atsushi Enomoto <atsushi@ximian.com>
+
+ * StreamReader.cs : Encoding.GetMaxCharCount() does not always return
+ the maximum max char count for Decoder.GetChars() since it might
+ contain pending buffer by flush. Fixed bug #338370.
+
2007-11-01 Miguel de Icaza <miguel@novell.com>
* Path.cs (GetDirectoryName): The paths returned from this routine
do_checks = detect_encoding_from_bytemarks ? 1 : 0;
do_checks += (preamble.Length == 0) ? 0 : 2;
- decoded_buffer = new char [encoding.GetMaxCharCount (buffer_size)];
+ // since GetChars() might add flushed character, it
+ // should have additional char buffer for extra 1
+ // (probably 1 is ok, but might be insufficient. I'm not sure)
+ decoded_buffer = new char [encoding.GetMaxCharCount (buffer_size) + 1];
decoded_count = 0;
pos = 0;
}