Skip to content

Commit

Permalink
fix ifdefs
Browse files Browse the repository at this point in the history
  • Loading branch information
RevenantX committed Dec 23, 2023
1 parent 8d9cb83 commit ddc17ef
Showing 1 changed file with 3 additions and 27 deletions.
30 changes: 3 additions & 27 deletions LiteNetLib/NativeSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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";

Expand All @@ -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,
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit ddc17ef

Please sign in to comment.