Delete moved files and fix build breaks
authorJan Kotas <jkotas@microsoft.com>
Sat, 6 May 2017 03:48:28 +0000 (20:48 -0700)
committerJan Kotas <jkotas@microsoft.com>
Sat, 6 May 2017 16:20:34 +0000 (09:20 -0700)
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.Collation.cs [new file with mode: 0644]
src/mscorlib/shared/System.Private.CoreLib.Shared.projitems
src/mscorlib/shared/System/Globalization/IdnMapping.Unix.cs
src/mscorlib/shared/System/Globalization/NumberFormatInfo.cs
src/mscorlib/shared/System/Globalization/StringInfo.cs

diff --git a/src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.Collation.cs b/src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.Collation.cs
new file mode 100644 (file)
index 0000000..79aedd7
--- /dev/null
@@ -0,0 +1,69 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Globalization;
+using System.Runtime.InteropServices;
+using System.Security;
+
+internal static partial class Interop
+{
+    internal static partial class GlobalizationInterop
+    {
+        [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetSortHandle")]
+        internal unsafe static extern ResultCode GetSortHandle(byte[] localeName, out SafeSortHandle sortHandle);
+
+        [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_CloseSortHandle")]
+        internal unsafe static extern void CloseSortHandle(IntPtr handle);
+
+        [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_CompareString")]
+        internal unsafe static extern int CompareString(SafeSortHandle sortHandle, char* lpStr1, int cwStr1Len, char* lpStr2, int cwStr2Len, CompareOptions options);
+
+        [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_IndexOf")]
+        internal unsafe static extern int IndexOf(SafeSortHandle sortHandle, string target, int cwTargetLength, char* pSource, int cwSourceLength, CompareOptions options, int* matchLengthPtr);
+
+        [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_LastIndexOf")]
+        internal unsafe static extern int LastIndexOf(SafeSortHandle sortHandle, string target, int cwTargetLength, char* pSource, int cwSourceLength, CompareOptions options);
+
+        [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_IndexOfOrdinalIgnoreCase")]
+        internal unsafe static extern int IndexOfOrdinalIgnoreCase(string target, int cwTargetLength, char* pSource, int cwSourceLength, bool findLast);
+
+        [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_StartsWith")]
+        [return: MarshalAs(UnmanagedType.Bool)]
+        internal unsafe static extern bool StartsWith(SafeSortHandle sortHandle, string target, int cwTargetLength, string source, int cwSourceLength, CompareOptions options);
+
+        [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_EndsWith")]
+        [return: MarshalAs(UnmanagedType.Bool)]
+        internal unsafe static extern bool EndsWith(SafeSortHandle sortHandle, string target, int cwTargetLength, string source, int cwSourceLength, CompareOptions options);
+
+        [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetSortKey")]
+        internal unsafe static extern int GetSortKey(SafeSortHandle sortHandle, string str, int strLength, byte* sortKey, int sortKeyLength, CompareOptions options);
+
+        [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_CompareStringOrdinalIgnoreCase")]
+        internal unsafe static extern int CompareStringOrdinalIgnoreCase(char* lpStr1, int cwStr1Len, char* lpStr2, int cwStr2Len);
+
+        [DllImport(Libraries.GlobalizationInterop, EntryPoint = "GlobalizationNative_GetSortVersion")]
+        internal static extern int GetSortVersion();
+
+        internal class SafeSortHandle : SafeHandle
+        {
+            private SafeSortHandle() :
+                base(IntPtr.Zero, true)
+            {
+            }
+
+            public override bool IsInvalid
+            {
+                get { return handle == IntPtr.Zero; }
+            }
+
+            protected override bool ReleaseHandle()
+            {
+                CloseSortHandle(handle);
+                SetHandle(IntPtr.Zero);
+                return true;
+            }
+        }
+    }
+}
index 9b78005..3e00140 100644 (file)
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\Interop.Libraries.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Globalization.Native\Interop.Calendar.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'"/>
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Globalization.Native\Interop.Casing.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'"/>
+    <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Globalization.Native\Interop.Collation.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'"/>
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Globalization.Native\Interop.Idna.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'"/>
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Globalization.Native\Interop.Locale.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'"/>
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Globalization.Native\Interop.Normalization.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'"/>
index f1ad6f1..2bbda0d 100644 (file)
@@ -39,7 +39,7 @@ namespace System.Globalization
             }
 
             char[] outputHeap = new char[actualLength];
-            fixed (char* pOutputHeap = outputHeap)
+            fixed (char* pOutputHeap = &outputHeap[0])
             {
                 actualLength = Interop.GlobalizationInterop.ToAscii(flags, unicode, count, pOutputHeap, actualLength);
                 if (actualLength == 0 || actualLength > outputHeap.Length)
@@ -66,7 +66,7 @@ namespace System.Globalization
             else
             {
                 char[] output = new char[count];
-                fixed (char* pOutput = output)
+                fixed (char* pOutput = &output[0])
                 {
                     return GetUnicodeCore(ascii, count, flags, pOutput, count, reattempt: true);
                 }
index c44c085..179a7f6 100644 (file)
@@ -84,7 +84,7 @@ namespace System.Globalization
         internal int percentDecimalDigits = 2;
 
         [OptionalField(VersionAdded = 2)]
-        internal int digitSubstitution = (int) DigitShapes.None;
+        internal int digitSubstitution = (int)DigitShapes.None;
 
         internal bool isReadOnly = false;
 
@@ -131,7 +131,7 @@ namespace System.Globalization
             Contract.EndContractBlock();
         }
 
-        private static void VerifyNativeDigits(string [] nativeDig, string propertyName)
+        private static void VerifyNativeDigits(string[] nativeDig, string propertyName)
         {
             if (nativeDig == null)
             {
@@ -157,7 +157,7 @@ namespace System.Globalization
                     {
                         // Not 1 or 2 UTF-16 code points
                         throw new ArgumentException(SR.Argument_InvalidNativeDigitValue, propertyName);
-                    } 
+                    }
                     else if (!char.IsSurrogatePair(nativeDig[i][0], nativeDig[i][1]))
                     {
                         // 2 UTF-6 code points, but not a surrogate pair
@@ -175,8 +175,8 @@ namespace System.Globalization
             }
         }
 
-         private static void VerifyDigitSubstitution(DigitShapes digitSub, string propertyName)
-         {
+        private static void VerifyDigitSubstitution(DigitShapes digitSub, string propertyName)
+        {
             switch (digitSub)
             {
                 case DigitShapes.Context:
@@ -309,7 +309,7 @@ namespace System.Globalization
             set
             {
                 VerifyWritable();
-                VerifyDecimalSeparator(value, "CurrencyDecimalSeparator");
+                VerifyDecimalSeparator(value, nameof(CurrencyDecimalSeparator));
                 currencyDecimalSeparator = value;
             }
         }
@@ -404,13 +404,13 @@ namespace System.Globalization
             {
                 if (value == null)
                 {
-                    throw new ArgumentNullException("PercentGroupSizes",
+                    throw new ArgumentNullException(nameof(PercentGroupSizes),
                         SR.ArgumentNull_Obj);
                 }
                 Contract.EndContractBlock();
                 VerifyWritable();
                 Int32[] inputSizes = (Int32[])value.Clone();
-                CheckGroupSize("PercentGroupSizes", inputSizes);
+                CheckGroupSize(nameof(PercentGroupSizes), inputSizes);
                 percentGroupSizes = inputSizes;
             }
         }
@@ -807,9 +807,9 @@ namespace System.Globalization
             }
         }
 
-        public string [] NativeDigits
+        public string[] NativeDigits
         {
-            get { return (String[]) nativeDigits.Clone(); }
+            get { return (String[])nativeDigits.Clone(); }
             set
             {
                 VerifyWritable();
@@ -820,12 +820,12 @@ namespace System.Globalization
 
         public DigitShapes DigitSubstitution
         {
-            get { return (DigitShapes) digitSubstitution; } 
+            get { return (DigitShapes)digitSubstitution; }
             set
             {
                 VerifyWritable();
                 VerifyDigitSubstitution(value, nameof(DigitSubstitution));
-                digitSubstitution = (int) value;
+                digitSubstitution = (int)value;
             }
         }
 
index f1dd305..ca57b67 100644 (file)
@@ -93,7 +93,7 @@ namespace System.Globalization
             {
                 if (null == value)
                 {
-                    throw new ArgumentNullException("String",
+                    throw new ArgumentNullException(nameof(String),
                         SR.ArgumentNull_String);
                 }
                 Contract.EndContractBlock();
@@ -117,13 +117,13 @@ namespace System.Globalization
             }
         }
 
-        public string SubstringByTextElements(int startingTextElement) 
+        public string SubstringByTextElements(int startingTextElement)
         {
             // If the string is empty, no sense going further. 
-            if (null == this.Indexes) 
+            if (null == this.Indexes)
             {
                 // Just decide which error to give depending on the param they gave us....
-                if (startingTextElement < 0) 
+                if (startingTextElement < 0)
                 {
                     throw new ArgumentOutOfRangeException(nameof(startingTextElement), SR.ArgumentOutOfRange_NeedPosNum);
                 }
@@ -135,7 +135,7 @@ namespace System.Globalization
             return (SubstringByTextElements(startingTextElement, Indexes.Length - startingTextElement));
         }
 
-        public string SubstringByTextElements(int startingTextElement, int lengthInTextElements) 
+        public string SubstringByTextElements(int startingTextElement, int lengthInTextElements)
         {
             if (startingTextElement < 0)
             {