Merge pull request #2765 from akoeplinger/mcs-fix-test-windows-backslash
[mono.git] / mcs / class / corlib / System.Security / SecureString.cs
index 7b1d142ac1de0037dc2b5cd21fcac92c85a321b9..765f61981df9a2f11fbca50627965f35295e4174 100644 (file)
@@ -33,9 +33,7 @@ using System.Runtime.InteropServices;
 using System.Runtime.ConstrainedExecution;
 using System.Security.Cryptography;
 using System.Security.Permissions;
-#if NET_4_0
 using System.Runtime.ExceptionServices;
-#endif
 
 namespace System.Security {
 
@@ -91,9 +89,7 @@ namespace System.Security {
                        }
                }
 
-#if NET_4_0
                [HandleProcessCorruptedStateExceptions]
-#endif
                public void AppendChar (char c)
                {
                        if (disposed)
@@ -150,9 +146,7 @@ namespace System.Security {
                        length = 0;
                }
 
-#if NET_4_0
                [HandleProcessCorruptedStateExceptions]
-#endif
                public void InsertAt (int index, char c)
                {
                        if (disposed)
@@ -194,9 +188,7 @@ namespace System.Security {
                        read_only = true;
                }
 
-#if NET_4_0
                [HandleProcessCorruptedStateExceptions]
-#endif
                public void RemoveAt (int index)
                {
                        if (disposed)
@@ -210,7 +202,7 @@ namespace System.Security {
 
                        try {
                                Decrypt ();
-                               Buffer.BlockCopy (data, index + 1, data, index, data.Length - index - 1);
+                               Buffer.BlockCopy (data, index * 2 + 2, data, index * 2, data.Length - index * 2 - 2);
                                Alloc (--length, true);
                        }
                        finally {
@@ -218,9 +210,7 @@ namespace System.Security {
                        }
                }
 
-#if NET_4_0
                [HandleProcessCorruptedStateExceptions]
-#endif
                public void SetAt (int index, char c)
                {
                        if (disposed)