From 2f0e9e20f7528c65643ee5c560f35806123886e0 Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Mon, 30 Jan 2023 23:08:52 +0200 Subject: [PATCH] Fix --- src/FetchBannerlordVersion.Native/Bindings.cs | 6 +++--- test/FetchBannerlordVersion.Native.Tests/Utils2.cs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/FetchBannerlordVersion.Native/Bindings.cs b/src/FetchBannerlordVersion.Native/Bindings.cs index 98ea404..d17adfb 100644 --- a/src/FetchBannerlordVersion.Native/Bindings.cs +++ b/src/FetchBannerlordVersion.Native/Bindings.cs @@ -9,7 +9,7 @@ namespace FetchBannerlordVersion.Native { public static unsafe partial class Bindings { - [UnmanagedCallersOnly(EntryPoint = "bfv_get_change_set", CallConvs = new [] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "bfv_get_change_set", CallConvs = new[] { typeof(CallConvCdecl) })] public static return_value_uint32* GetChangeSet(param_string* p_game_folder_path, param_string* p_lib_assembly) { Logger.LogInput(p_game_folder_path, p_lib_assembly); @@ -30,7 +30,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "bfv_get_version", CallConvs = new [] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "bfv_get_version", CallConvs = new[] { typeof(CallConvCdecl) })] public static return_value_string* GetVersion(param_string* p_game_folder_path, param_string* p_lib_assembly) { Logger.LogInput(p_game_folder_path, p_lib_assembly); @@ -51,7 +51,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "bfv_get_version_type", CallConvs = new [] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "bfv_get_version_type", CallConvs = new[] { typeof(CallConvCdecl) })] public static return_value_uint32* GetVersionType(param_string* p_game_folder_path, param_string* p_lib_assembly) { Logger.LogInput(p_game_folder_path, p_lib_assembly); diff --git a/test/FetchBannerlordVersion.Native.Tests/Utils2.cs b/test/FetchBannerlordVersion.Native.Tests/Utils2.cs index a55326e..6aa1c73 100644 --- a/test/FetchBannerlordVersion.Native.Tests/Utils2.cs +++ b/test/FetchBannerlordVersion.Native.Tests/Utils2.cs @@ -9,21 +9,21 @@ public static partial class Utils2 { private const string DllPath = "../../../../../src/FetchBannerlordVersion.Native/bin/Release/net7.0/win-x64/native/FetchBannerlordVersion.Native.dll"; - + static unsafe Utils2() { Allocator.SetCustom(&alloc, &dealloc); } - + [LibraryImport(DllPath), UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] private static unsafe partial void* alloc(nuint size); [LibraryImport(DllPath), UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] private static unsafe partial void dealloc(void* ptr); [LibraryImport(DllPath), UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] private static unsafe partial int alloc_alive_count(); - + public static int LibraryAliveCount() => alloc_alive_count(); - + public static unsafe ReadOnlySpan ToSpan(param_string* value) => new SafeStringMallocHandle((char*) value, false).ToSpan(); public static unsafe string GetResult(return_value_string* ret)