From 3edc9df97bf8d3aeffc2ca62f95f9c12dda3fedb Mon Sep 17 00:00:00 2001 From: Aaron R Robinson Date: Wed, 17 Aug 2022 12:07:41 -0400 Subject: [PATCH] Handle endianness for character tests --- .../tests/LibraryImportGenerator.Tests/CharacterTests.cs | 8 ++++---- .../tests/TestAssets/NativeExports/Characters.cs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.Tests/CharacterTests.cs b/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.Tests/CharacterTests.cs index 48dcdd175f56a..290131d84a0c5 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.Tests/CharacterTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.Tests/CharacterTests.cs @@ -12,19 +12,19 @@ namespace LibraryImportGenerator.IntegrationTests { partial class NativeExportsNE { - [LibraryImport(NativeExportsNE_Binary, EntryPoint = "unicode_return_as_uint", StringMarshalling = StringMarshalling.Utf16)] + [LibraryImport(NativeExportsNE_Binary, EntryPoint = "ushort_return_as_uint", StringMarshalling = StringMarshalling.Utf16)] public static partial uint ReturnUnicodeAsUInt(char input); [LibraryImport(NativeExportsNE_Binary, EntryPoint = "char_return_as_uint", StringMarshalling = StringMarshalling.Utf16)] public static partial char ReturnUIntAsUnicode(uint input); - [LibraryImport(NativeExportsNE_Binary, EntryPoint = "char_return_as_refuint", StringMarshalling = StringMarshalling.Utf16)] + [LibraryImport(NativeExportsNE_Binary, EntryPoint = "char_return_as_refushort", StringMarshalling = StringMarshalling.Utf16)] public static partial void ReturnUIntAsUnicode_Ref(uint input, ref char res); - [LibraryImport(NativeExportsNE_Binary, EntryPoint = "char_return_as_refuint", StringMarshalling = StringMarshalling.Utf16)] + [LibraryImport(NativeExportsNE_Binary, EntryPoint = "char_return_as_refushort", StringMarshalling = StringMarshalling.Utf16)] public static partial void ReturnUIntAsUnicode_Out(uint input, out char res); - [LibraryImport(NativeExportsNE_Binary, EntryPoint = "char_return_as_refuint", StringMarshalling = StringMarshalling.Utf16)] + [LibraryImport(NativeExportsNE_Binary, EntryPoint = "char_return_as_refushort", StringMarshalling = StringMarshalling.Utf16)] public static partial void ReturnUIntAsUnicode_In(uint input, in char res); [LibraryImport(NativeExportsNE_Binary, EntryPoint = "char_return_as_uint", StringMarshalling = StringMarshalling.Utf8)] diff --git a/src/libraries/System.Runtime.InteropServices/tests/TestAssets/NativeExports/Characters.cs b/src/libraries/System.Runtime.InteropServices/tests/TestAssets/NativeExports/Characters.cs index ed4e18e22e19d..dd811fc0fca56 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/TestAssets/NativeExports/Characters.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/TestAssets/NativeExports/Characters.cs @@ -8,7 +8,7 @@ namespace NativeExports { public static unsafe class Characters { - [UnmanagedCallersOnly(EntryPoint = "unicode_return_as_uint")] + [UnmanagedCallersOnly(EntryPoint = "ushort_return_as_uint")] public static uint ReturnUnicodeAsUInt(ushort input) { return input; @@ -20,10 +20,10 @@ public static uint ReturnUIntAsUInt(uint input) return input; } - [UnmanagedCallersOnly(EntryPoint = "char_return_as_refuint")] - public static void ReturnUIntAsRefUInt(uint input, uint* res) + [UnmanagedCallersOnly(EntryPoint = "char_return_as_refushort")] + public static void ReturnUIntAsRefUInt(uint input, ushort* res) { - *res = input; + *res = (ushort)input; } [UnmanagedCallersOnly(EntryPoint = "char_reverse_buffer_ref")]