From 11bca94b4b0374ee8f1e4ec28d7140abf4521583 Mon Sep 17 00:00:00 2001 From: Nobuyuki Iwanaga Date: Sat, 20 Jan 2018 08:29:32 +0900 Subject: CharUnicodeInfo.GetUnicodeCategory(int codePoint) (#15911) * CharUnicodeInfo.GetUnicodeCategory(int codePoint) https://github.com/dotnet/corefx/issues/26173 - renamed UnicodeCategory.InternalGetUnicodeCategory to GetUnicodeCategory - renamed its parameter ch to codePoint - made it public * fix build break --- src/mscorlib/shared/System/Char.cs | 2 +- src/mscorlib/shared/System/Globalization/CharUnicodeInfo.cs | 10 +++++----- src/mscorlib/src/System/Globalization/CompareInfo.Unix.cs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mscorlib/shared/System/Char.cs b/src/mscorlib/shared/System/Char.cs index 6059830fbd..179ac40282 100644 --- a/src/mscorlib/shared/System/Char.cs +++ b/src/mscorlib/shared/System/Char.cs @@ -853,7 +853,7 @@ namespace System { return (GetLatin1UnicodeCategory(c)); } - return CharUnicodeInfo.InternalGetUnicodeCategory(c); + return CharUnicodeInfo.GetUnicodeCategory((int)c); } public static UnicodeCategory GetUnicodeCategory(String s, int index) diff --git a/src/mscorlib/shared/System/Globalization/CharUnicodeInfo.cs b/src/mscorlib/shared/System/Globalization/CharUnicodeInfo.cs index 3881272287..0cd8429bbc 100644 --- a/src/mscorlib/shared/System/Globalization/CharUnicodeInfo.cs +++ b/src/mscorlib/shared/System/Globalization/CharUnicodeInfo.cs @@ -276,7 +276,7 @@ namespace System.Globalization public static UnicodeCategory GetUnicodeCategory(char ch) { - return (InternalGetUnicodeCategory(ch)); + return (GetUnicodeCategory((int)ch)); } public static UnicodeCategory GetUnicodeCategory(String s, int index) @@ -290,9 +290,9 @@ namespace System.Globalization return InternalGetUnicodeCategory(s, index); } - internal static unsafe UnicodeCategory InternalGetUnicodeCategory(int ch) + public static UnicodeCategory GetUnicodeCategory(int codePoint) { - return ((UnicodeCategory)InternalGetCategoryValue(ch, UNICODE_CATEGORY_OFFSET)); + return ((UnicodeCategory)InternalGetCategoryValue(codePoint, UNICODE_CATEGORY_OFFSET)); } @@ -352,7 +352,7 @@ namespace System.Globalization Debug.Assert(value != null, "value can not be null"); Debug.Assert(index < value.Length, "index < value.Length"); - return (InternalGetUnicodeCategory(InternalConvertToUtf32(value, index))); + return (GetUnicodeCategory(InternalConvertToUtf32(value, index))); } internal static BidiCategory GetBidiCategory(String s, int index) @@ -381,7 +381,7 @@ namespace System.Globalization Debug.Assert(str.Length > 0, "str.Length > 0"); ; Debug.Assert(index >= 0 && index < str.Length, "index >= 0 && index < str.Length"); - return (InternalGetUnicodeCategory(InternalConvertToUtf32(str, index, out charLength))); + return (GetUnicodeCategory(InternalConvertToUtf32(str, index, out charLength))); } internal static bool IsCombiningCategory(UnicodeCategory uc) diff --git a/src/mscorlib/src/System/Globalization/CompareInfo.Unix.cs b/src/mscorlib/src/System/Globalization/CompareInfo.Unix.cs index 7fbd49f656..19e358804f 100644 --- a/src/mscorlib/src/System/Globalization/CompareInfo.Unix.cs +++ b/src/mscorlib/src/System/Globalization/CompareInfo.Unix.cs @@ -329,7 +329,7 @@ namespace System.Globalization if (index == length - 1 || !Char.IsLowSurrogate(text[index+1])) return false; // unpaired surrogate - uc = CharUnicodeInfo.InternalGetUnicodeCategory(Char.ConvertToUtf32(text[index], text[index+1])); + uc = CharUnicodeInfo.GetUnicodeCategory(Char.ConvertToUtf32(text[index], text[index+1])); if (uc == UnicodeCategory.PrivateUse || uc == UnicodeCategory.OtherNotAssigned) return false; -- cgit v1.2.3