Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Move EncodingTable and CodePageDataItem to System.Text namespace #17061

Merged
merged 1 commit into from
Mar 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/mscorlib/System.Private.CoreLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,12 @@
<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" />
Expand Down Expand Up @@ -588,8 +592,6 @@
<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" />
Expand Down
5 changes: 0 additions & 5 deletions src/mscorlib/src/System/String.Comparison.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ private static unsafe int CompareOrdinalIgnoreCaseHelper(String strA, String str
[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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System;
using System.Security;

namespace System.Globalization
namespace System.Text
{
//
// Data item for EncodingTable. Along with EncodingTable, they are used by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
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.
Expand Down Expand Up @@ -63,7 +64,7 @@ private static unsafe int internalGetCodePageFromName(String name)
{
index = ((right - left) / 2) + left;

result = String.nativeCompareOrdinalIgnoreCaseWC(name, encodingDataPtr[index].webName);
result = nativeCompareOrdinalIgnoreCaseWC(name, encodingDataPtr[index].webName);

if (result == 0)
{
Expand All @@ -85,7 +86,7 @@ private static unsafe int internalGetCodePageFromName(String name)
//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);
}
Expand Down Expand Up @@ -212,6 +213,11 @@ internal static unsafe CodePageDataItem GetCodePageDataItem(int codepage)

[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==========================
Expand Down
4 changes: 2 additions & 2 deletions src/vm/ecalllist.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down