From ddc17ef288123b8f5c4afd8ae31c35e532c4d544 Mon Sep 17 00:00:00 2001 From: Ruslan Pyrch Date: Sat, 23 Dec 2023 22:20:23 +0200 Subject: [PATCH] fix ifdefs --- LiteNetLib/NativeSocket.cs | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/LiteNetLib/NativeSocket.cs b/LiteNetLib/NativeSocket.cs index f9d7b541..e2959cb5 100644 --- a/LiteNetLib/NativeSocket.cs +++ b/LiteNetLib/NativeSocket.cs @@ -9,11 +9,7 @@ namespace LiteNetLib { internal static class NativeSocket { - static -#if LITENETLIB_UNSAFE - unsafe -#endif - class WinSock + static unsafe class WinSock { private const string LibName = "ws2_32.dll"; @@ -29,22 +25,14 @@ class WinSock [DllImport(LibName, SetLastError = true)] internal static extern int sendto( IntPtr socketHandle, -#if LITENETLIB_UNSAFE byte* pinnedBuffer, -#else - [In] byte[] pinnedBuffer, -#endif [In] int len, [In] SocketFlags socketFlags, [In] byte[] socketAddress, [In] int socketAddressSize); } - static -#if LITENETLIB_UNSAFE - unsafe -#endif - class UnixSock + static unsafe class UnixSock { private const string LibName = "libc"; @@ -60,11 +48,7 @@ class UnixSock [DllImport(LibName, SetLastError = true)] internal static extern int sendto( IntPtr socketHandle, -#if LITENETLIB_UNSAFE byte* pinnedBuffer, -#else - [In] byte[] pinnedBuffer, -#endif [In] int len, [In] SocketFlags socketFlags, [In] byte[] socketAddress, @@ -152,17 +136,9 @@ static NativeSocket() } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public -#if LITENETLIB_UNSAFE - unsafe -#endif - static int SendTo( + public static unsafe int SendTo( IntPtr socketHandle, -#if LITENETLIB_UNSAFE byte* pinnedBuffer, -#else - byte[] pinnedBuffer, -#endif int len, byte[] socketAddress, int socketAddressSize)