2009-07-28 Miguel de Icaza <miguel@novell.com>
authorMiguel de Icaza <miguel@gnome.org>
Tue, 28 Jul 2009 05:04:08 +0000 (05:04 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Tue, 28 Jul 2009 05:04:08 +0000 (05:04 -0000)
* UTF8Encoding.cs: Use Equals to compare the objects as the
fallback objects do not overload operator ==.    The comparison
was previously failing.

svn path=/trunk/mcs/; revision=138786

mcs/class/corlib/System.Text/ChangeLog
mcs/class/corlib/System.Text/UTF8Encoding.cs
mcs/class/corlib/Test/System.Text/UTF8EncodingTest.cs

index 144686053c477757687392a39273e2cb16a6c6f7..0677677488379e0c46132c22edf9f2f3f595e19d 100644 (file)
@@ -1,3 +1,9 @@
+2009-07-28  Miguel de Icaza  <miguel@novell.com>
+
+       * UTF8Encoding.cs: Use Equals to compare the objects as the
+       fallback objects do not overload operator ==.    The comparison
+       was previously failing.
+
 2009-07-26 Gonzalo Paniagua Javier <gonzalo@novell.com>
 
        * StringBuilder.cs: don't throw on null values in ctor(string, int).
 2009-07-26 Gonzalo Paniagua Javier <gonzalo@novell.com>
 
        * StringBuilder.cs: don't throw on null values in ctor(string, int).
index 27dc336e36e531ce1ff2b6c34baf96a19500139c..cf4c66046f8fbda4cc13837a3fa9040616b5ac0b 100644 (file)
@@ -1019,9 +1019,9 @@ fail_no_space:
                if (enc != null) {
 #if NET_2_0
                        return (codePage == enc.codePage &&
                if (enc != null) {
 #if NET_2_0
                        return (codePage == enc.codePage &&
-                                       emitIdentifier == enc.emitIdentifier &&
-                                       DecoderFallback == enc.DecoderFallback &&
-                                       EncoderFallback == enc.EncoderFallback);
+                               emitIdentifier == enc.emitIdentifier &&
+                               DecoderFallback.Equals (enc.DecoderFallback) &&
+                               EncoderFallback.Equals (enc.EncoderFallback));
 #else
                        return (codePage == enc.codePage &&
                                        emitIdentifier == enc.emitIdentifier &&
 #else
                        return (codePage == enc.codePage &&
                                        emitIdentifier == enc.emitIdentifier &&
index f4fb2f2dabcdf3cdf798649ed8cad8bb9eb8dc57..66085bca2cb0231fed7d8ae16c3a947be900111b 100644 (file)
@@ -59,6 +59,12 @@ namespace MonoTests.System.Text
                        Assert.IsTrue (utf8.IsMailNewsSave);
                }
 
                        Assert.IsTrue (utf8.IsMailNewsSave);
                }
 
+               [Test]
+               public void TestCompat ()
+               {
+                       Assert.IsTrue (new UTF8Encoding ().Equals (new UTF8Encoding ()));
+               }
+               
                [Test]
                public void TestEncodingGetBytes1()
                {
                [Test]
                public void TestEncodingGetBytes1()
                {