2009-07-28 Miguel de Icaza <miguel@novell.com>
authorMiguel de Icaza <miguel@gnome.org>
Tue, 28 Jul 2009 05:06:31 +0000 (05:06 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Tue, 28 Jul 2009 05:06:31 +0000 (05:06 -0000)
* UTF8Encoding.cs: Small optimization, reuse the static
EncoderFallback and DecoderFallback instead of creating new ones.

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

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

index 0677677488379e0c46132c22edf9f2f3f595e19d..b5dc930823d312a26f1d7a3a6773c3d318987b68 100644 (file)
@@ -1,5 +1,8 @@
 2009-07-28  Miguel de Icaza  <miguel@novell.com>
 
+       * UTF8Encoding.cs: Small optimization, reuse the static
+       EncoderFallback and DecoderFallback instead of creating new ones. 
+
        * UTF8Encoding.cs: Use Equals to compare the objects as the
        fallback objects do not overload operator ==.    The comparison
        was previously failing.
index cf4c66046f8fbda4cc13837a3fa9040616b5ac0b..19c43a2d47dbb6a914c9f9d8317042d7bf1a1b82 100644 (file)
@@ -57,9 +57,9 @@ public class UTF8Encoding : Encoding
                emitIdentifier = encoderShouldEmitUTF8Identifier;
 #if NET_2_0
                if (throwOnInvalidBytes)
-                       SetFallbackInternal (null, new DecoderExceptionFallback ());
+                       SetFallbackInternal (null, DecoderFallback.ExceptionFallback);
                else
-                       SetFallbackInternal (null, new DecoderReplacementFallback ("\uFFFD"));
+                       SetFallbackInternal (null, DecoderFallback.StandardSafeFallback);
 #else
                throwOnInvalid = throwOnInvalidBytes;
 #endif