Author: benm
Date: 2006-01-13 10:16:01 -0500 (Fri, 13 Jan 2006)
New Revision: 55513

Modified:
   trunk/mcs/class/corlib/System.IO/ChangeLog
   trunk/mcs/class/corlib/System.IO/TextWriter.cs
   trunk/mcs/class/corlib/Test/System.IO/ChangeLog
   trunk/mcs/class/corlib/Test/System.IO/TextWriterTest.cs
Log:
In Test/System.IO:
2006-01-13  Ben Maurer  <[EMAIL PROTECTED]>

        * TextWriterTest.cs: Make sure TextWriter calls the char[],int,int
        overload when calling the char[].

In System.IO:
2006-01-13  Ben Maurer  <[EMAIL PROTECTED]>

        * TextWriter.cs: Call char[],int,int from the Write(char[]) method
        both for msft compat and for performance. Thanks to "Mike Glenn" 
        <[EMAIL PROTECTED]> for pointing.



Modified: trunk/mcs/class/corlib/System.IO/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.IO/ChangeLog  2006-01-13 15:09:28 UTC (rev 
55512)
+++ trunk/mcs/class/corlib/System.IO/ChangeLog  2006-01-13 15:16:01 UTC (rev 
55513)
@@ -1,3 +1,9 @@
+2006-01-13  Ben Maurer  <[EMAIL PROTECTED]>
+
+       * TextWriter.cs: Call char[],int,int from the Write(char[]) method
+       both for msft compat and for performance. Thanks to "Mike Glenn" 
+       <[EMAIL PROTECTED]> for pointing.
+
 2006-01-12  Ben Maurer  <[EMAIL PROTECTED]>
 
        * File.cs: Support for Read/WriteAllText

Modified: trunk/mcs/class/corlib/System.IO/TextWriter.cs
===================================================================
--- trunk/mcs/class/corlib/System.IO/TextWriter.cs      2006-01-13 15:09:28 UTC 
(rev 55512)
+++ trunk/mcs/class/corlib/System.IO/TextWriter.cs      2006-01-13 15:16:01 UTC 
(rev 55513)
@@ -117,10 +117,9 @@
 
                 public virtual void Write (char[] value)
                {
-                       if (value != null) {
-                               for (int i = 0; i < value.Length; ++i)
-                                       Write (value [i]);
-                       }
+                       if (value == null)
+                               return;
+                       Write (value, 0, value.Length);
                }
                
                 public virtual void Write (decimal value)

Modified: trunk/mcs/class/corlib/Test/System.IO/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/Test/System.IO/ChangeLog     2006-01-13 15:09:28 UTC 
(rev 55512)
+++ trunk/mcs/class/corlib/Test/System.IO/ChangeLog     2006-01-13 15:16:01 UTC 
(rev 55513)
@@ -1,3 +1,8 @@
+2006-01-13  Ben Maurer  <[EMAIL PROTECTED]>
+
+       * TextWriterTest.cs: Make sure TextWriter calls the char[],int,int
+       overload when calling the char[].
+
 2006-01-12  Ben Maurer  <[EMAIL PROTECTED]>
 
        * FileTest.cs: Tests tests for read/writealltext.

Modified: trunk/mcs/class/corlib/Test/System.IO/TextWriterTest.cs
===================================================================
--- trunk/mcs/class/corlib/Test/System.IO/TextWriterTest.cs     2006-01-13 
15:09:28 UTC (rev 55512)
+++ trunk/mcs/class/corlib/Test/System.IO/TextWriterTest.cs     2006-01-13 
15:16:01 UTC (rev 55513)
@@ -50,5 +50,26 @@
                        w.UpdateLine2 ();
                        AssertEquals ('Y', w.NewLine [0]);
                }
+
+               class ArrayOrCharTester : TextWriter {
+                       public bool called_array;
+                       public override Encoding Encoding { get { return 
Encoding.UTF8; }}
+
+                       public override void Write (char [] x, int a, int b)
+                       {
+                               called_array = true;
+                       }
+                       public override void Write (char c)
+                       {
+                       }
+               }
+
+               [Test]
+               public void TestCharArrayCallsArrayIntInt ()
+               {
+                       ArrayOrCharTester x = new ArrayOrCharTester ();
+                       x.Write (new char [] {'a','b','c'});
+                       AssertEquals (true, x.called_array);                    
+               }
        }
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to