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

Commit

Permalink
Delete moved files and fix build breaks
Browse files Browse the repository at this point in the history
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
  • Loading branch information
jkotas committed May 6, 2017
1 parent 7babb04 commit c853b03
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 19 deletions.
@@ -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;
}
}
}
}
Expand Up @@ -520,6 +520,7 @@
<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'"/>
Expand Down
4 changes: 2 additions & 2 deletions src/mscorlib/shared/System/Globalization/IdnMapping.Unix.cs
Expand Up @@ -39,7 +39,7 @@ private unsafe string GetAsciiCore(char* unicode, int count)
}

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)
Expand All @@ -66,7 +66,7 @@ private unsafe string GetUnicodeCore(char* ascii, int count)
else
{
char[] output = new char[count];
fixed (char* pOutput = output)
fixed (char* pOutput = &output[0])
{
return GetUnicodeCore(ascii, count, flags, pOutput, count, reattempt: true);
}
Expand Down
24 changes: 12 additions & 12 deletions src/mscorlib/shared/System/Globalization/NumberFormatInfo.cs
Expand Up @@ -84,7 +84,7 @@ sealed public class NumberFormatInfo : IFormatProvider, ICloneable
internal int percentDecimalDigits = 2;

[OptionalField(VersionAdded = 2)]
internal int digitSubstitution = (int) DigitShapes.None;
internal int digitSubstitution = (int)DigitShapes.None;

internal bool isReadOnly = false;

Expand Down Expand Up @@ -131,7 +131,7 @@ private static void VerifyGroupSeparator(String groupSep, String propertyName)
Contract.EndContractBlock();
}

private static void VerifyNativeDigits(string [] nativeDig, string propertyName)
private static void VerifyNativeDigits(string[] nativeDig, string propertyName)
{
if (nativeDig == null)
{
Expand All @@ -157,7 +157,7 @@ private static void VerifyNativeDigits(string [] nativeDig, string propertyName)
{
// 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
Expand All @@ -175,8 +175,8 @@ private static void VerifyNativeDigits(string [] nativeDig, string propertyName)
}
}

private static void VerifyDigitSubstitution(DigitShapes digitSub, string propertyName)
{
private static void VerifyDigitSubstitution(DigitShapes digitSub, string propertyName)
{
switch (digitSub)
{
case DigitShapes.Context:
Expand Down Expand Up @@ -309,7 +309,7 @@ public String CurrencyDecimalSeparator
set
{
VerifyWritable();
VerifyDecimalSeparator(value, "CurrencyDecimalSeparator");
VerifyDecimalSeparator(value, nameof(CurrencyDecimalSeparator));
currencyDecimalSeparator = value;
}
}
Expand Down Expand Up @@ -404,13 +404,13 @@ public int[] PercentGroupSizes
{
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;
}
}
Expand Down Expand Up @@ -807,9 +807,9 @@ public String PerMilleSymbol
}
}

public string [] NativeDigits
public string[] NativeDigits
{
get { return (String[]) nativeDigits.Clone(); }
get { return (String[])nativeDigits.Clone(); }
set
{
VerifyWritable();
Expand All @@ -820,12 +820,12 @@ public String PerMilleSymbol

public DigitShapes DigitSubstitution
{
get { return (DigitShapes) digitSubstitution; }
get { return (DigitShapes)digitSubstitution; }
set
{
VerifyWritable();
VerifyDigitSubstitution(value, nameof(DigitSubstitution));
digitSubstitution = (int) value;
digitSubstitution = (int)value;
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/mscorlib/shared/System/Globalization/StringInfo.cs
Expand Up @@ -93,7 +93,7 @@ public string String
{
if (null == value)
{
throw new ArgumentNullException("String",
throw new ArgumentNullException(nameof(String),
SR.ArgumentNull_String);
}
Contract.EndContractBlock();
Expand All @@ -117,13 +117,13 @@ public int LengthInTextElements
}
}

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);
}
Expand All @@ -135,7 +135,7 @@ public string SubstringByTextElements(int startingTextElement)
return (SubstringByTextElements(startingTextElement, Indexes.Length - startingTextElement));
}

public string SubstringByTextElements(int startingTextElement, int lengthInTextElements)
public string SubstringByTextElements(int startingTextElement, int lengthInTextElements)
{
if (startingTextElement < 0)
{
Expand Down

0 comments on commit c853b03

Please sign in to comment.