[corlib] Add back System/Guid.MonoTouch.cs implementation.
authorRolf Bjarne Kvinge <rolf@xamarin.com>
Tue, 15 Mar 2016 11:45:16 +0000 (12:45 +0100)
committerRodrigo Kumpera <kumpera@gmail.com>
Mon, 28 Mar 2016 22:51:34 +0000 (15:51 -0700)
This is a partial reversal of 82a1747f (for this file only).

mcs/class/corlib/System/Guid.MonoTouch.cs [new file with mode: 0644]
mcs/class/corlib/System/Guid.MonoTouch.opt.cs [deleted file]
mcs/class/corlib/monotouch_corlib.dll.sources
mcs/class/corlib/monotouch_opt_corlib.dll.sources
mcs/class/corlib/monotouch_runtime_corlib.dll.sources
mcs/class/corlib/monotouch_tv_corlib.dll.sources
mcs/class/corlib/monotouch_watch_corlib.dll.sources

diff --git a/mcs/class/corlib/System/Guid.MonoTouch.cs b/mcs/class/corlib/System/Guid.MonoTouch.cs
new file mode 100644 (file)
index 0000000..714bdb6
--- /dev/null
@@ -0,0 +1,25 @@
+#if MONOTOUCH && FULL_AOT_RUNTIME
+
+using Crimson.CommonCrypto;
+
+namespace System
+{
+       partial struct Guid
+       {
+               public static Guid NewGuid ()
+               {
+                       byte[] b = new byte [16];
+                       Cryptor.GetRandom (b);
+
+                       Guid res = new Guid (b);
+                       // Mask in Variant 1-0 in Bit[7..6]
+                       res._d = (byte) ((res._d & 0x3fu) | 0x80u);
+                       // Mask in Version 4 (random based Guid) in Bits[15..13]
+                       res._c = (short) ((res._c & 0x0fffu) | 0x4000u);
+
+                       return res;
+               }
+       }
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/corlib/System/Guid.MonoTouch.opt.cs b/mcs/class/corlib/System/Guid.MonoTouch.opt.cs
deleted file mode 100644 (file)
index beb6a3a..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#if MONOTOUCH && FULL_AOT_RUNTIME
-
-// this file is a shim to enable compiling monotouch profiles without mono-extensions
-namespace System
-{
-       partial struct Guid
-       {
-               public static Guid NewGuid ()
-               {
-                       throw new NotSupportedException ();
-               }
-       }
-}
-
-#endif
index 356dd7710bfc34b6eb178afdbb97648433378741..634c3b34771157479382584fa52009a3fe48168c 100644 (file)
@@ -19,3 +19,4 @@ CommonCrypto/RC4CommonCrypto.cs
 CommonCrypto/MD2Managed.g.cs
 CommonCrypto/MD4Managed.g.cs
 System/Environment.iOS.cs
+System/Guid.MonoTouch.cs
index f4c6bf5322473a02b62fcddf7cddcb5b0b8fa3c9..df73c7f973d8984790ed909c25b2afec5d702227 100644 (file)
@@ -1,3 +1,2 @@
-System/Guid.MonoTouch.opt.cs
 System.Text/EncodingHelper.MonoTouch.opt.cs
 System.Security.Cryptography.X509Certificates/X509Helper.MonoTouch.opt.cs
index 356dd7710bfc34b6eb178afdbb97648433378741..634c3b34771157479382584fa52009a3fe48168c 100644 (file)
@@ -19,3 +19,4 @@ CommonCrypto/RC4CommonCrypto.cs
 CommonCrypto/MD2Managed.g.cs
 CommonCrypto/MD4Managed.g.cs
 System/Environment.iOS.cs
+System/Guid.MonoTouch.cs
index 356dd7710bfc34b6eb178afdbb97648433378741..634c3b34771157479382584fa52009a3fe48168c 100644 (file)
@@ -19,3 +19,4 @@ CommonCrypto/RC4CommonCrypto.cs
 CommonCrypto/MD2Managed.g.cs
 CommonCrypto/MD4Managed.g.cs
 System/Environment.iOS.cs
+System/Guid.MonoTouch.cs
index 356dd7710bfc34b6eb178afdbb97648433378741..634c3b34771157479382584fa52009a3fe48168c 100644 (file)
@@ -19,3 +19,4 @@ CommonCrypto/RC4CommonCrypto.cs
 CommonCrypto/MD2Managed.g.cs
 CommonCrypto/MD4Managed.g.cs
 System/Environment.iOS.cs
+System/Guid.MonoTouch.cs