Move EncodingTable and CodePageDataItem to System.Text namespace (#17061)
authorJan Kotas <jkotas@microsoft.com>
Tue, 20 Mar 2018 10:34:35 +0000 (03:34 -0700)
committerGitHub <noreply@github.com>
Tue, 20 Mar 2018 10:34:35 +0000 (03:34 -0700)
This is the more logical namespace for it and it matches the namespace that these live under in CoreRT.

src/mscorlib/System.Private.CoreLib.csproj
src/mscorlib/src/System/String.Comparison.cs
src/mscorlib/src/System/Text/CodePageDataItem.Unix.cs [moved from src/mscorlib/src/System/Globalization/EncodingDataItem.Unix.cs with 98% similarity]
src/mscorlib/src/System/Text/CodePageDataItem.cs [moved from src/mscorlib/src/System/Globalization/EncodingDataItem.cs with 99% similarity]
src/mscorlib/src/System/Text/EncodingTable.Unix.cs [moved from src/mscorlib/src/System/Globalization/EncodingTable.Unix.cs with 99% similarity]
src/mscorlib/src/System/Text/EncodingTable.cs [moved from src/mscorlib/src/System/Globalization/EncodingTable.cs with 94% similarity]
src/vm/ecalllist.h

index 79b36c3..038f09f 100644 (file)
     <Compile Include="$(BclSourcesRoot)\System\Globalization\GlobalizationMode.cs" />
   </ItemGroup>
   <ItemGroup Condition="'$(FeatureCoreFxGlobalization)' != 'true'">
-    <Compile Include="$(BclSourcesRoot)\System\Globalization\EncodingDataItem.cs" />
-    <Compile Include="$(BclSourcesRoot)\System\Globalization\EncodingTable.cs" />
+    <Compile Include="$(BclSourcesRoot)\System\Text\CodePageDataItem.cs" />
+    <Compile Include="$(BclSourcesRoot)\System\Text\EncodingTable.cs" />
+  </ItemGroup>
+  <ItemGroup Condition="'$(FeatureCoreFxGlobalization)' == 'true'">
+    <Compile Include="$(BclSourcesRoot)\System\Text\CodePageDataItem.Unix.cs" />
+    <Compile Include="$(BclSourcesRoot)\System\Text\EncodingTable.Unix.cs" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="$(BclSourcesRoot)\System\Threading\SynchronizationContext.cs" />
     <Compile Include="$(BclSourcesRoot)\Interop\Unix\Interop.Libraries.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Globalization\CompareInfo.Unix.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Globalization\CultureInfo.Unix.cs" />
-    <Compile Include="$(BclSourcesRoot)\System\Globalization\EncodingTable.Unix.cs" />
-    <Compile Include="$(BclSourcesRoot)\System\Globalization\EncodingDataItem.Unix.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Globalization\GlobalizationMode.Unix.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\Versioning\CompatibilitySwitch.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Threading\ClrThreadPoolBoundHandle.Unix.cs" />
index b85af82..14aa4b7 100644 (file)
@@ -65,11 +65,6 @@ namespace System
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         internal static extern int CompareOrdinalHelper(String strA, int indexA, int countA, String strB, int indexB, int countB);
 
-        //This will not work in case-insensitive mode for any character greater than 0x7F.  
-        //We'll throw an ArgumentException.
-        [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        internal static extern unsafe int nativeCompareOrdinalIgnoreCaseWC(String strA, sbyte* strBBytes);
-
         //
         //
         // NATIVE INSTANCE METHODS
@@ -2,7 +2,7 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
-namespace System.Globalization
+namespace System.Text
 {
     internal class CodePageDataItem
     {
@@ -6,7 +6,7 @@ using System.Text;
 using System;
 using System.Security;
 
-namespace System.Globalization
+namespace System.Text
 {
     //
     // Data item for EncodingTable.  Along with EncodingTable, they are used by 
@@ -4,9 +4,10 @@
 
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.Globalization;
 using System.Text;
 
-namespace System.Globalization
+namespace System.Text
 {
     internal static class EncodingTable
     {
@@ -6,13 +6,14 @@ using System;
 using System.Text;
 using System.Collections;
 using System.Collections.Generic;
+using System.Globalization;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 using System.Runtime.Versioning;
 using System.Security;
 using System.Threading;
 
-namespace System.Globalization
+namespace System.Text
 {
     //
     // Data table for encoding classes.  Used by System.Text.Encoding.
@@ -63,7 +64,7 @@ namespace System.Globalization
             {
                 index = ((right - left) / 2) + left;
 
-                result = String.nativeCompareOrdinalIgnoreCaseWC(name, encodingDataPtr[index].webName);
+                result = nativeCompareOrdinalIgnoreCaseWC(name, encodingDataPtr[index].webName);
 
                 if (result == 0)
                 {
@@ -85,7 +86,7 @@ namespace System.Globalization
             //Walk the remaining elements (it'll be 3 or fewer).
             for (; left <= right; left++)
             {
-                if (String.nativeCompareOrdinalIgnoreCaseWC(name, encodingDataPtr[left].webName) == 0)
+                if (nativeCompareOrdinalIgnoreCaseWC(name, encodingDataPtr[left].webName) == 0)
                 {
                     return (encodingDataPtr[left].codePage);
                 }
@@ -212,6 +213,11 @@ namespace System.Globalization
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         private static extern unsafe InternalCodePageDataItem* GetCodePageData();
+
+        //This will not work in case-insensitive mode for any character greater than 0x7F.  
+        //We'll throw an ArgumentException.
+        [MethodImplAttribute(MethodImplOptions.InternalCall)]
+        private static extern unsafe int nativeCompareOrdinalIgnoreCaseWC(String strA, sbyte* strBBytes);
     }
 
     /*=================================InternalEncodingDataItem==========================
index f14a5a2..7e96bc7 100644 (file)
@@ -107,7 +107,6 @@ FCFuncStart(gStringFuncs)
     FCDynamicSig(COR_CTOR_METHOD_NAME, &gsig_IM_PtrSByt_Int_Int_RetVoid, CORINFO_INTRINSIC_Illegal, ECall::CtorSBytePtrStartLengthManaged)
     FCDynamicSig(COR_CTOR_METHOD_NAME, &gsig_IM_PtrSByt_Int_Int_Encoding_RetVoid, CORINFO_INTRINSIC_Illegal, ECall::CtorSBytePtrStartLengthEncodingManaged)
     FCFuncElement("IsFastSort", COMString::IsFastSort)
-    FCFuncElement("nativeCompareOrdinalIgnoreCaseWC", COMString::FCCompareOrdinalIgnoreCaseWC)
     FCIntrinsic("get_Length", COMString::Length, CORINFO_INTRINSIC_StringLength)
     FCIntrinsic("get_Chars", COMString::GetCharAt, CORINFO_INTRINSIC_StringGetChar)
     FCFuncElement("IsAscii", COMString::IsAscii)
@@ -798,6 +797,7 @@ FCFuncStart(gEncodingTableFuncs)
     FCFuncElement("GetNumEncodingItems", COMNlsInfo::nativeGetNumEncodingItems)
     FCFuncElement("GetEncodingData", COMNlsInfo::nativeGetEncodingTableDataPointer)
     FCFuncElement("GetCodePageData", COMNlsInfo::nativeGetCodePageTableDataPointer)
+    FCFuncElement("nativeCompareOrdinalIgnoreCaseWC", COMString::FCCompareOrdinalIgnoreCaseWC)
 FCFuncEnd()
 #endif // !defined(FEATURE_COREFX_GLOBALIZATION)
 
@@ -1290,7 +1290,7 @@ FCClassElement("DefaultBinder", "System", gCOMDefaultBinderFuncs)
 FCClassElement("Delegate", "System", gDelegateFuncs)
 FCClassElement("DependentHandle", "System.Runtime.CompilerServices", gDependentHandleFuncs)
 #if !defined(FEATURE_COREFX_GLOBALIZATION)
-FCClassElement("EncodingTable", "System.Globalization", gEncodingTableFuncs)
+FCClassElement("EncodingTable", "System.Text", gEncodingTableFuncs)
 #endif // !defined(FEATURE_COREFX_GLOBALIZATION)
 FCClassElement("Enum", "System", gEnumFuncs)
 FCClassElement("Environment", "System", gEnvironmentFuncs)