From: Miguel de Icaza Date: Tue, 28 Jul 2009 05:06:31 +0000 (-0000) Subject: 2009-07-28 Miguel de Icaza X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=e13c61180236f513b58c71ef187ad406d10999b5;p=mono.git 2009-07-28 Miguel de Icaza * UTF8Encoding.cs: Small optimization, reuse the static EncoderFallback and DecoderFallback instead of creating new ones. svn path=/trunk/mcs/; revision=138787 --- diff --git a/mcs/class/corlib/System.Text/ChangeLog b/mcs/class/corlib/System.Text/ChangeLog index 06776774883..b5dc930823d 100644 --- a/mcs/class/corlib/System.Text/ChangeLog +++ b/mcs/class/corlib/System.Text/ChangeLog @@ -1,5 +1,8 @@ 2009-07-28 Miguel de Icaza + * 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. diff --git a/mcs/class/corlib/System.Text/UTF8Encoding.cs b/mcs/class/corlib/System.Text/UTF8Encoding.cs index cf4c66046f8..19c43a2d47d 100644 --- a/mcs/class/corlib/System.Text/UTF8Encoding.cs +++ b/mcs/class/corlib/System.Text/UTF8Encoding.cs @@ -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