diff options
author | Jan Kotas <jkotas@microsoft.com> | 2017-10-10 12:57:03 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-10 12:57:03 -0700 |
commit | 0b7ded9771e6e4b513f6784d7c13ecf8b06094fd (patch) | |
tree | 83fb349bfee9dad3ff4c90521be97f8b82ac7d63 | |
parent | 9916f7dec4f475552d693ddaaccd2c7e1cce303e (diff) | |
download | coreclr-0b7ded9771e6e4b513f6784d7c13ecf8b06094fd.tar.gz coreclr-0b7ded9771e6e4b513f6784d7c13ecf8b06094fd.tar.bz2 coreclr-0b7ded9771e6e4b513f6784d7c13ecf8b06094fd.zip |
Move CompareInfo.cs to shared corelib partition (#14407)
-rw-r--r-- | src/mscorlib/System.Private.CoreLib.csproj | 1 | ||||
-rw-r--r-- | src/mscorlib/shared/System.Private.CoreLib.Shared.projitems | 1 | ||||
-rw-r--r-- | src/mscorlib/shared/System/Globalization/CompareInfo.cs (renamed from src/mscorlib/src/System/Globalization/CompareInfo.cs) | 20 |
3 files changed, 10 insertions, 12 deletions
diff --git a/src/mscorlib/System.Private.CoreLib.csproj b/src/mscorlib/System.Private.CoreLib.csproj index ca4b19e1d2..33ceb3cbbd 100644 --- a/src/mscorlib/System.Private.CoreLib.csproj +++ b/src/mscorlib/System.Private.CoreLib.csproj @@ -463,7 +463,6 @@ <Compile Include="$(BclSourcesRoot)\System\Globalization\BidiCategory.cs" /> <Compile Include="$(BclSourcesRoot)\System\Globalization\CharUnicodeInfo.cs" /> <Compile Include="$(BclSourcesRoot)\System\Globalization\CharUnicodeInfoData.cs" /> - <Compile Include="$(BclSourcesRoot)\System\Globalization\CompareInfo.cs" /> <Compile Include="$(BclSourcesRoot)\System\Globalization\CompareInfo.Invariant.cs" /> <Compile Include="$(BclSourcesRoot)\System\Globalization\CultureData.cs" /> <Compile Include="$(BclSourcesRoot)\System\Globalization\CultureInfo.cs" /> diff --git a/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems b/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems index 8f315167d2..003f4993e1 100644 --- a/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems +++ b/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems @@ -115,6 +115,7 @@ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CalendarWeekRule.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CalendricalCalculationsHelper.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\ChineseLunisolarCalendar.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CompareInfo.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CultureNotFoundException.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CultureTypes.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\DateTimeFormat.cs" /> diff --git a/src/mscorlib/src/System/Globalization/CompareInfo.cs b/src/mscorlib/shared/System/Globalization/CompareInfo.cs index 47284f4d1c..84fadd376e 100644 --- a/src/mscorlib/src/System/Globalization/CompareInfo.cs +++ b/src/mscorlib/shared/System/Globalization/CompareInfo.cs @@ -51,8 +51,8 @@ namespace System.Globalization ~(CompareOptions.IgnoreCase | CompareOptions.IgnoreSymbols | CompareOptions.IgnoreNonSpace | CompareOptions.IgnoreWidth | CompareOptions.IgnoreKanaType); - // Mask used to check if we have the right flags. - private const CompareOptions ValidSortkeyCtorMaskOffFlags = + // Mask used to check if we have the right flags. + private const CompareOptions ValidSortkeyCtorMaskOffFlags = ~(CompareOptions.IgnoreCase | CompareOptions.IgnoreSymbols | CompareOptions.IgnoreNonSpace | CompareOptions.IgnoreWidth | CompareOptions.IgnoreKanaType | CompareOptions.StringSort); @@ -61,12 +61,11 @@ namespace System.Globalization // ie: en-US would have an en-US sort. For haw-US (custom), then we serialize it as haw-US. // The interesting part is that since haw-US doesn't have its own sort, it has to point at another // locale, which is what SCOMPAREINFO does. - [OptionalField(VersionAdded = 2)] private string m_name; // The name used to construct this CompareInfo. Do not rename (binary serialization) [NonSerialized] - private string _sortName; // The name that defines our behavior. + private string _sortName; // The name that defines our behavior [OptionalField(VersionAdded = 3)] private SortVersion m_SortVersion; // Do not rename (binary serialization) @@ -74,7 +73,7 @@ namespace System.Globalization // _invariantMode is defined for the perf reason as accessing the instance field is faster than access the static property GlobalizationMode.Invariant [NonSerialized] private readonly bool _invariantMode = GlobalizationMode.Invariant; - + private int culture; // Do not rename (binary serialization). The fields sole purpose is to support Desktop serialization. internal CompareInfo(CultureInfo culture) @@ -102,7 +101,7 @@ namespace System.Globalization { throw new ArgumentNullException(nameof(assembly)); } - if (assembly != typeof(Object).Module.Assembly) + if (assembly != typeof(Object).Module.Assembly) { throw new ArgumentException(SR.Argument_OnlyMscorlib); } @@ -189,7 +188,7 @@ namespace System.Globalization public static unsafe bool IsSortable(string text) { - if (text == null) + if (text == null) { // A null param is invalid here. throw new ArgumentNullException(nameof(text)); @@ -205,21 +204,20 @@ namespace System.Globalization { return true; } - + fixed (char *pChar = text) { return IsSortable(pChar, text.Length); } } - [OnDeserializing] private void OnDeserializing(StreamingContext ctx) { m_name = null; } - void IDeserializationCallback.OnDeserialization(Object sender) + void IDeserializationCallback.OnDeserialization(object sender) { OnDeserialized(); } @@ -522,7 +520,7 @@ namespace System.Globalization return CompareOrdinal(string1, offset1, length1, string2, offset2, length2); } - + return CompareString( string1.AsReadOnlySpan().Slice(offset1, length1), string2.AsReadOnlySpan().Slice(offset2, length2), |