Skip to content

Commit ddc17ef

Browse files
committed
fix ifdefs
1 parent 8d9cb83 commit ddc17ef

File tree

1 file changed

+3
-27
lines changed

1 file changed

+3
-27
lines changed

LiteNetLib/NativeSocket.cs

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ namespace LiteNetLib
99
{
1010
internal static class NativeSocket
1111
{
12-
static
13-
#if LITENETLIB_UNSAFE
14-
unsafe
15-
#endif
16-
class WinSock
12+
static unsafe class WinSock
1713
{
1814
private const string LibName = "ws2_32.dll";
1915

@@ -29,22 +25,14 @@ public static extern int recvfrom(
2925
[DllImport(LibName, SetLastError = true)]
3026
internal static extern int sendto(
3127
IntPtr socketHandle,
32-
#if LITENETLIB_UNSAFE
3328
byte* pinnedBuffer,
34-
#else
35-
[In] byte[] pinnedBuffer,
36-
#endif
3729
[In] int len,
3830
[In] SocketFlags socketFlags,
3931
[In] byte[] socketAddress,
4032
[In] int socketAddressSize);
4133
}
4234

43-
static
44-
#if LITENETLIB_UNSAFE
45-
unsafe
46-
#endif
47-
class UnixSock
35+
static unsafe class UnixSock
4836
{
4937
private const string LibName = "libc";
5038

@@ -60,11 +48,7 @@ public static extern int recvfrom(
6048
[DllImport(LibName, SetLastError = true)]
6149
internal static extern int sendto(
6250
IntPtr socketHandle,
63-
#if LITENETLIB_UNSAFE
6451
byte* pinnedBuffer,
65-
#else
66-
[In] byte[] pinnedBuffer,
67-
#endif
6852
[In] int len,
6953
[In] SocketFlags socketFlags,
7054
[In] byte[] socketAddress,
@@ -152,17 +136,9 @@ public static int RecvFrom(
152136
}
153137

154138
[MethodImpl(MethodImplOptions.AggressiveInlining)]
155-
public
156-
#if LITENETLIB_UNSAFE
157-
unsafe
158-
#endif
159-
static int SendTo(
139+
public static unsafe int SendTo(
160140
IntPtr socketHandle,
161-
#if LITENETLIB_UNSAFE
162141
byte* pinnedBuffer,
163-
#else
164-
byte[] pinnedBuffer,
165-
#endif
166142
int len,
167143
byte[] socketAddress,
168144
int socketAddressSize)

0 commit comments

Comments
 (0)