diff options
author | Miguel de Icaza <miguel@gnome.org> | 2007-11-05 17:49:17 +0300 |
---|---|---|
committer | Miguel de Icaza <miguel@gnome.org> | 2007-11-05 17:49:17 +0300 |
commit | 79f4eed6d3250de69c4d8868f17efc36a3388439 (patch) | |
tree | e92ae14d56277cd29f60d283a78c0b391b9812c6 /mcs/class/System/System.IO.Ports | |
parent | 0556dc7ddb3520a7b395bf7be2f4f9edb7accf2a (diff) |
2007-11-05 Miguel de Icaza <miguel@novell.com>
* SerialPort.cs: Cope with multi-character newlines. Fixes #321988.
svn path=/trunk/mcs/; revision=88869
Diffstat (limited to 'mcs/class/System/System.IO.Ports')
-rw-r--r-- | mcs/class/System/System.IO.Ports/ChangeLog | 4 | ||||
-rw-r--r-- | mcs/class/System/System.IO.Ports/SerialPort.cs | 12 |
2 files changed, 5 insertions, 11 deletions
diff --git a/mcs/class/System/System.IO.Ports/ChangeLog b/mcs/class/System/System.IO.Ports/ChangeLog index 8f28ef2dff7..79d6c7646b8 100644 --- a/mcs/class/System/System.IO.Ports/ChangeLog +++ b/mcs/class/System/System.IO.Ports/ChangeLog @@ -1,3 +1,7 @@ +2007-11-05 Miguel de Icaza <miguel@novell.com> + + * SerialPort.cs: Cope with multi-character newlines. Fixes #321988. + 2007-10-13 Miguel de Icaza <miguel@novell.com> * SerialPortStream.cs: Send a break on the Unix case. diff --git a/mcs/class/System/System.IO.Ports/SerialPort.cs b/mcs/class/System/System.IO.Ports/SerialPort.cs index b3e7244e748..36b7e73c8fe 100644 --- a/mcs/class/System/System.IO.Ports/SerialPort.cs +++ b/mcs/class/System/System.IO.Ports/SerialPort.cs @@ -635,17 +635,7 @@ namespace System.IO.Ports public string ReadLine () { - CheckOpen (); - List<byte> bytes_read = new List<byte>(); - byte [] buff = new byte [1]; - - while (true){ - int n = stream.Read (buff, 0, 1); - if (n == -1 || buff [0] == '\n') - break; - bytes_read.Add (buff [0]); - } - return new String (encoding.GetChars (bytes_read.ToArray ())); + return ReadTo (new_line); } public string ReadTo (string value) |