From: Rolf Bjarne Kvinge Date: Tue, 15 Mar 2016 12:21:18 +0000 (+0100) Subject: [corlib] Add partial EncodingHelper type to let XI define its own default encoding... X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mono.git;a=commitdiff_plain;h=4c368c394e0d1aba39235e32a49c1feb32a42876 [corlib] Add partial EncodingHelper type to let XI define its own default encoding [#29928] List of original contributors: Sebastien Pouliot --- diff --git a/mcs/class/corlib/System.Text/EncodingHelper.MonoTouch.cs b/mcs/class/corlib/System.Text/EncodingHelper.MonoTouch.cs new file mode 100644 index 00000000000..554b2064a25 --- /dev/null +++ b/mcs/class/corlib/System.Text/EncodingHelper.MonoTouch.cs @@ -0,0 +1,30 @@ +using System; + +namespace System.Text { + + internal static partial class EncodingHelper { + + static volatile Encoding utf8Encoding; + + internal static Encoding UTF8 { + get { + if (utf8Encoding == null) { + lock (lockobj){ + if (utf8Encoding == null){ + utf8Encoding = new UTF8Encoding (true, false); + utf8Encoding.setReadOnly (); + } + } + } + + return utf8Encoding; + } + } + + // The mobile profile has been default'ing to UTF8 since it's creation + internal static Encoding GetDefaultEncoding () + { + return UTF8; + } + } +} \ No newline at end of file diff --git a/mcs/class/corlib/System.Text/EncodingHelper.MonoTouch.opt.cs b/mcs/class/corlib/System.Text/EncodingHelper.MonoTouch.opt.cs deleted file mode 100644 index 9aba0f63ba1..00000000000 --- a/mcs/class/corlib/System.Text/EncodingHelper.MonoTouch.opt.cs +++ /dev/null @@ -1,15 +0,0 @@ -#if MONOTOUCH - -// this file is a shim to enable compiling monotouch profiles without mono-extensions -namespace System.Text -{ - internal static partial class EncodingHelper - { - internal static Encoding GetDefaultEncoding () - { - throw new NotSupportedException (); - } - } -} - -#endif diff --git a/mcs/class/corlib/monotouch_corlib.dll.sources b/mcs/class/corlib/monotouch_corlib.dll.sources index bd0cfeaa270..e802a034dd6 100644 --- a/mcs/class/corlib/monotouch_corlib.dll.sources +++ b/mcs/class/corlib/monotouch_corlib.dll.sources @@ -24,3 +24,4 @@ System/NotSupportedException.iOS.cs CoreFoundation/CFHelpers.cs System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs System.Security.Cryptography.X509Certificates/X509Helper.Apple.cs +System.Text/EncodingHelper.MonoTouch.cs diff --git a/mcs/class/corlib/monotouch_opt_corlib.dll.sources b/mcs/class/corlib/monotouch_opt_corlib.dll.sources deleted file mode 100644 index 46418a319b2..00000000000 --- a/mcs/class/corlib/monotouch_opt_corlib.dll.sources +++ /dev/null @@ -1 +0,0 @@ -System.Text/EncodingHelper.MonoTouch.opt.cs diff --git a/mcs/class/corlib/monotouch_runtime_corlib.dll.sources b/mcs/class/corlib/monotouch_runtime_corlib.dll.sources index bd0cfeaa270..e802a034dd6 100644 --- a/mcs/class/corlib/monotouch_runtime_corlib.dll.sources +++ b/mcs/class/corlib/monotouch_runtime_corlib.dll.sources @@ -24,3 +24,4 @@ System/NotSupportedException.iOS.cs CoreFoundation/CFHelpers.cs System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs System.Security.Cryptography.X509Certificates/X509Helper.Apple.cs +System.Text/EncodingHelper.MonoTouch.cs diff --git a/mcs/class/corlib/monotouch_runtime_opt_corlib.dll.sources b/mcs/class/corlib/monotouch_runtime_opt_corlib.dll.sources deleted file mode 100644 index d32b5060240..00000000000 --- a/mcs/class/corlib/monotouch_runtime_opt_corlib.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include monotouch_opt_corlib.dll.sources diff --git a/mcs/class/corlib/monotouch_tv_corlib.dll.sources b/mcs/class/corlib/monotouch_tv_corlib.dll.sources index bd0cfeaa270..e802a034dd6 100644 --- a/mcs/class/corlib/monotouch_tv_corlib.dll.sources +++ b/mcs/class/corlib/monotouch_tv_corlib.dll.sources @@ -24,3 +24,4 @@ System/NotSupportedException.iOS.cs CoreFoundation/CFHelpers.cs System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs System.Security.Cryptography.X509Certificates/X509Helper.Apple.cs +System.Text/EncodingHelper.MonoTouch.cs diff --git a/mcs/class/corlib/monotouch_tv_opt_corlib.dll.sources b/mcs/class/corlib/monotouch_tv_opt_corlib.dll.sources deleted file mode 100644 index d32b5060240..00000000000 --- a/mcs/class/corlib/monotouch_tv_opt_corlib.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include monotouch_opt_corlib.dll.sources diff --git a/mcs/class/corlib/monotouch_tv_runtime_opt_corlib.dll.sources b/mcs/class/corlib/monotouch_tv_runtime_opt_corlib.dll.sources deleted file mode 100644 index d32b5060240..00000000000 --- a/mcs/class/corlib/monotouch_tv_runtime_opt_corlib.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include monotouch_opt_corlib.dll.sources diff --git a/mcs/class/corlib/monotouch_watch_corlib.dll.sources b/mcs/class/corlib/monotouch_watch_corlib.dll.sources index bd0cfeaa270..e802a034dd6 100644 --- a/mcs/class/corlib/monotouch_watch_corlib.dll.sources +++ b/mcs/class/corlib/monotouch_watch_corlib.dll.sources @@ -24,3 +24,4 @@ System/NotSupportedException.iOS.cs CoreFoundation/CFHelpers.cs System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs System.Security.Cryptography.X509Certificates/X509Helper.Apple.cs +System.Text/EncodingHelper.MonoTouch.cs diff --git a/mcs/class/corlib/monotouch_watch_opt_corlib.dll.sources b/mcs/class/corlib/monotouch_watch_opt_corlib.dll.sources deleted file mode 100644 index d32b5060240..00000000000 --- a/mcs/class/corlib/monotouch_watch_opt_corlib.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include monotouch_opt_corlib.dll.sources diff --git a/mcs/class/corlib/monotouch_watch_runtime_opt_corlib.dll.sources b/mcs/class/corlib/monotouch_watch_runtime_opt_corlib.dll.sources deleted file mode 100644 index d32b5060240..00000000000 --- a/mcs/class/corlib/monotouch_watch_runtime_opt_corlib.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include monotouch_opt_corlib.dll.sources