Author: miguel
Date: 2006-01-13 15:16:11 -0500 (Fri, 13 Jan 2006)
New Revision: 55545

Modified:
   branches/mono-1-1-13/mcs/class/corlib/System.IO/ChangeLog
   branches/mono-1-1-13/mcs/class/corlib/System.IO/TextWriter.cs
   branches/mono-1-1-13/mcs/class/corlib/Test/System.IO/ChangeLog
   branches/mono-1-1-13/mcs/class/corlib/Test/System.IO/TextWriterTest.cs
   branches/mono-1-1-13/mcs/class/corlib/Test/System.Security.Policy/ChangeLog
   
branches/mono-1-1-13/mcs/class/corlib/Test/System.Security.Policy/HashMembershipConditionTest.cs
Log:
Backport Ben and Hari's changes

Modified: branches/mono-1-1-13/mcs/class/corlib/System.IO/ChangeLog
===================================================================
--- branches/mono-1-1-13/mcs/class/corlib/System.IO/ChangeLog   2006-01-13 
20:05:00 UTC (rev 55544)
+++ branches/mono-1-1-13/mcs/class/corlib/System.IO/ChangeLog   2006-01-13 
20:16:11 UTC (rev 55545)
@@ -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-11  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * Path.cs: Previous fix caused regression of bug #76191. Fixed (again)

Modified: branches/mono-1-1-13/mcs/class/corlib/System.IO/TextWriter.cs
===================================================================
--- branches/mono-1-1-13/mcs/class/corlib/System.IO/TextWriter.cs       
2006-01-13 20:05:00 UTC (rev 55544)
+++ branches/mono-1-1-13/mcs/class/corlib/System.IO/TextWriter.cs       
2006-01-13 20:16:11 UTC (rev 55545)
@@ -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: branches/mono-1-1-13/mcs/class/corlib/Test/System.IO/ChangeLog
===================================================================
--- branches/mono-1-1-13/mcs/class/corlib/Test/System.IO/ChangeLog      
2006-01-13 20:05:00 UTC (rev 55544)
+++ branches/mono-1-1-13/mcs/class/corlib/Test/System.IO/ChangeLog      
2006-01-13 20:16:11 UTC (rev 55545)
@@ -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-02  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * StreamReaderTest.cs: Added test case when reading a new line (see 

Modified: branches/mono-1-1-13/mcs/class/corlib/Test/System.IO/TextWriterTest.cs
===================================================================
--- branches/mono-1-1-13/mcs/class/corlib/Test/System.IO/TextWriterTest.cs      
2006-01-13 20:05:00 UTC (rev 55544)
+++ branches/mono-1-1-13/mcs/class/corlib/Test/System.IO/TextWriterTest.cs      
2006-01-13 20:16:11 UTC (rev 55545)
@@ -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);                    
+               }
        }
 }

Modified: 
branches/mono-1-1-13/mcs/class/corlib/Test/System.Security.Policy/ChangeLog
===================================================================
--- branches/mono-1-1-13/mcs/class/corlib/Test/System.Security.Policy/ChangeLog 
2006-01-13 20:05:00 UTC (rev 55544)
+++ branches/mono-1-1-13/mcs/class/corlib/Test/System.Security.Policy/ChangeLog 
2006-01-13 20:16:11 UTC (rev 55545)
@@ -1,3 +1,8 @@
+2006-01-09  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       * HashMembershipConditionTest.cs (HashValue): Remove 1/256 chance
+       of false negative.
+
 2005-06-23  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * ApplicationSecurityManagerCas.cs: New. CAS unit tests (2.0).

Modified: 
branches/mono-1-1-13/mcs/class/corlib/Test/System.Security.Policy/HashMembershipConditionTest.cs
===================================================================
--- 
branches/mono-1-1-13/mcs/class/corlib/Test/System.Security.Policy/HashMembershipConditionTest.cs
    2006-01-13 20:05:00 UTC (rev 55544)
+++ 
branches/mono-1-1-13/mcs/class/corlib/Test/System.Security.Policy/HashMembershipConditionTest.cs
    2006-01-13 20:16:11 UTC (rev 55545)
@@ -82,14 +82,15 @@
                        HashMembershipCondition hash = new 
HashMembershipCondition (md5, digestMd5);
                        // we can't change the instance data by getting a 
reference inside it
                        byte[] value = hash.HashValue;
-                       value [0] = 0xFF;
+                       value [0] ^= 0xFF;
                        Assert.IsFalse (value [0] == hash.HashValue [0], 
"reference");
                        Assert.AreEqual (BitConverter.ToString (digestMd5), 
BitConverter.ToString (hash.HashValue), "HashValue");
                        // and we can't change the instance data by keeping a 
reference to what we supply
                        hash.HashValue = value;
-                       value [0] = 0x00;
+                       byte old_value = value [0];
+                       value [0] += 42;
                        Assert.IsFalse (value [0] == hash.HashValue [0], 
"reference-2");
-                       Assert.AreEqual (0xFF, hash.HashValue [0], 
"HashValue[0]");
+                       Assert.AreEqual (old_value, hash.HashValue [0], 
"HashValue[0]");
                }
 
                [Test]

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

Reply via email to