[corlib] Add partial EncodingHelper type to let XI define its own default encoding...
authorRolf Bjarne Kvinge <rolf@xamarin.com>
Tue, 15 Mar 2016 12:21:18 +0000 (13:21 +0100)
committerRodrigo Kumpera <kumpera@gmail.com>
Mon, 28 Mar 2016 22:51:36 +0000 (15:51 -0700)
List of original contributors:

Sebastien Pouliot <sebastien@xamarin.com>

12 files changed:
mcs/class/corlib/System.Text/EncodingHelper.MonoTouch.cs [new file with mode: 0644]
mcs/class/corlib/System.Text/EncodingHelper.MonoTouch.opt.cs [deleted file]
mcs/class/corlib/monotouch_corlib.dll.sources
mcs/class/corlib/monotouch_opt_corlib.dll.sources [deleted file]
mcs/class/corlib/monotouch_runtime_corlib.dll.sources
mcs/class/corlib/monotouch_runtime_opt_corlib.dll.sources [deleted file]
mcs/class/corlib/monotouch_tv_corlib.dll.sources
mcs/class/corlib/monotouch_tv_opt_corlib.dll.sources [deleted file]
mcs/class/corlib/monotouch_tv_runtime_opt_corlib.dll.sources [deleted file]
mcs/class/corlib/monotouch_watch_corlib.dll.sources
mcs/class/corlib/monotouch_watch_opt_corlib.dll.sources [deleted file]
mcs/class/corlib/monotouch_watch_runtime_opt_corlib.dll.sources [deleted file]

diff --git a/mcs/class/corlib/System.Text/EncodingHelper.MonoTouch.cs b/mcs/class/corlib/System.Text/EncodingHelper.MonoTouch.cs
new file mode 100644 (file)
index 0000000..554b206
--- /dev/null
@@ -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 (file)
index 9aba0f6..0000000
+++ /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
index bd0cfeaa270ac447778efbd5dc9c96cc787532d5..e802a034dd64f2aa7f7a9a97dd76b0aaf3ed4294 100644 (file)
@@ -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 (file)
index 46418a3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-System.Text/EncodingHelper.MonoTouch.opt.cs
index bd0cfeaa270ac447778efbd5dc9c96cc787532d5..e802a034dd64f2aa7f7a9a97dd76b0aaf3ed4294 100644 (file)
@@ -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 (file)
index d32b506..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include monotouch_opt_corlib.dll.sources
index bd0cfeaa270ac447778efbd5dc9c96cc787532d5..e802a034dd64f2aa7f7a9a97dd76b0aaf3ed4294 100644 (file)
@@ -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 (file)
index d32b506..0000000
+++ /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 (file)
index d32b506..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include monotouch_opt_corlib.dll.sources
index bd0cfeaa270ac447778efbd5dc9c96cc787532d5..e802a034dd64f2aa7f7a9a97dd76b0aaf3ed4294 100644 (file)
@@ -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 (file)
index d32b506..0000000
+++ /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 (file)
index d32b506..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include monotouch_opt_corlib.dll.sources