diff options
Diffstat (limited to 'src/mscorlib/src/System/Resources/__FastResourceComparer.cs')
-rw-r--r-- | src/mscorlib/src/System/Resources/__FastResourceComparer.cs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/mscorlib/src/System/Resources/__FastResourceComparer.cs b/src/mscorlib/src/System/Resources/__FastResourceComparer.cs index 5bc7333863..e0911fae1d 100644 --- a/src/mscorlib/src/System/Resources/__FastResourceComparer.cs +++ b/src/mscorlib/src/System/Resources/__FastResourceComparer.cs @@ -17,6 +17,7 @@ namespace System.Resources { using System; using System.Collections; using System.Collections.Generic; + using System.Diagnostics; using System.Diagnostics.Contracts; internal sealed class FastResourceComparer : IComparer, IEqualityComparer, IComparer<String>, IEqualityComparer<String> @@ -78,11 +79,10 @@ namespace System.Resources { // Input is one string to compare with, and a byte[] containing chars in // little endian unicode. Pass in the number of valid chars. - [System.Security.SecurityCritical] // auto-generated public unsafe static int CompareOrdinal(String a, byte[] bytes, int bCharLength) { - Contract.Assert(a != null && bytes != null, "FastResourceComparer::CompareOrdinal must have non-null params"); - Contract.Assert(bCharLength * 2 <= bytes.Length, "FastResourceComparer::CompareOrdinal - numChars is too big!"); + Debug.Assert(a != null && bytes != null, "FastResourceComparer::CompareOrdinal must have non-null params"); + Debug.Assert(bCharLength * 2 <= bytes.Length, "FastResourceComparer::CompareOrdinal - numChars is too big!"); // This is a managed version of strcmp, but I can't take advantage // of a terminating 0, unlike strcmp in C. int i = 0; @@ -107,7 +107,6 @@ namespace System.Resources { return a.Length - bCharLength; } - [System.Security.SecurityCritical] // auto-generated public static int CompareOrdinal(byte[] bytes, int aCharLength, String b) { return -CompareOrdinal(b, bytes, aCharLength); @@ -115,12 +114,11 @@ namespace System.Resources { // This method is to handle potentially misaligned data accesses. // The byte* must point to little endian Unicode characters. - [System.Security.SecurityCritical] // auto-generated internal unsafe static int CompareOrdinal(byte* a, int byteLen, String b) { - Contract.Assert((byteLen & 1) == 0, "CompareOrdinal is expecting a UTF-16 string length, which must be even!"); - Contract.Assert(a != null && b != null, "Null args not allowed."); - Contract.Assert(byteLen >= 0, "byteLen must be non-negative."); + Debug.Assert((byteLen & 1) == 0, "CompareOrdinal is expecting a UTF-16 string length, which must be even!"); + Debug.Assert(a != null && b != null, "Null args not allowed."); + Debug.Assert(byteLen >= 0, "byteLen must be non-negative."); int r = 0; int i = 0; |