Skip to content

Commit 4b8280c

Browse files
committed
Some grooming.
1 parent 61fd54f commit 4b8280c

File tree

3 files changed

+2
-9
lines changed

3 files changed

+2
-9
lines changed

Jint/Native/Intl/Icu.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ namespace Jint.Native.Intl;
88
// We use DllImport to bind directly to its functions (e.g. uloc_toLanguageTag) so we can
99
// reuse the OS-provided ICU implementation instead of reimplementing the spec in C#.
1010
// The wrapper below converts managed strings to UTF-8, calls ICU, and returns the canonical tag.
11-
1211
internal static class ICU
1312
{
1413
private const string MacLib = "/usr/lib/libicucore.dylib";
@@ -48,8 +47,6 @@ public enum UErrorCode : int
4847
[MethodImpl(MethodImplOptions.AggressiveInlining)]
4948
public static string PtrToAnsiString(IntPtr p) => Marshal.PtrToStringAnsi(p)!;
5049

51-
52-
// Older runtimes: pass IntPtr and pin a UTF-8 buffer manually.
5350
[DllImport(UcLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "uloc_toLanguageTag")]
5451
private static extern unsafe int uloc_toLanguageTag_ptr(
5552
byte* localeIdUtf8, // const char* (UTF-8)
@@ -77,15 +74,15 @@ private static extern unsafe int uloc_forLanguageTag_ptr(
7774
out int parsedLength,
7875
ref UErrorCode err);
7976

80-
public static unsafe int uloc_forLanguageTag(
81-
string langtag, byte[] localeId, int localeIdCapacity, out int parsedLength, ref UErrorCode err)
77+
public static unsafe int uloc_forLanguageTag(string langtag, byte[] localeId, int localeIdCapacity, out int parsedLength, ref UErrorCode err)
8278
{
8379
var inBytes = System.Text.Encoding.UTF8.GetBytes(langtag + "\0");
8480
fixed (byte* p = inBytes)
8581
{
8682
return uloc_forLanguageTag_ptr(p, localeId, localeIdCapacity, out parsedLength, ref err);
8783
}
8884
}
85+
8986
[DllImport(UcLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "uloc_canonicalize")]
9087
private static extern unsafe int uloc_canonicalize_ptr(
9188
byte* localeIdUtf8, // const char* (UTF-8, NUL-terminated)

Jint/Native/Intl/IcuHelpers.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ namespace Jint.Native.Intl
88
/// </summary>
99
internal static class IcuHelpers
1010
{
11-
1211
/// <summary>
1312
/// Equivalent to WebKit's languageTagForLocaleID(localeID, isImmortal=false).
1413
/// Calls ICU uloc_toLanguageTag(localeId, strict=false), then applies the same
@@ -51,7 +50,6 @@ public static string LanguageTagForLocaleId(string localeId)
5150
"kb", "kc", "kh", "kk", "kn", "ca"
5251
};
5352

54-
5553
// Canonicalize subdivision aliases (used for rg/sd values).
5654
private static string CanonicalizeSubdivision(string value)
5755
{

Jint/Native/Intl/IntlInstance.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using Jint.Runtime;
66
using Jint.Runtime.Descriptors;
77
using Jint.Runtime.Interop;
8-
using System.Text;
98

109
namespace Jint.Native.Intl;
1110

@@ -137,5 +136,4 @@ private JsValue GetCanonicalLocales(JsValue thisObject, JsCallArguments argument
137136

138137
return arr;
139138
}
140-
141139
}

0 commit comments

Comments
 (0)