diff --git a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Infrastructure/MemoryPoolIterator.cs b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Infrastructure/MemoryPoolIterator.cs index 78efd5adca..ccc54cf52a 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Infrastructure/MemoryPoolIterator.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Infrastructure/MemoryPoolIterator.cs @@ -215,7 +215,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure } } - public unsafe int Seek(ref Vector byte0Vector) + public int Seek(ref Vector byte0Vector) { int bytesScanned; return Seek(ref byte0Vector, out bytesScanned); @@ -433,7 +433,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure } } - public unsafe int Seek(ref Vector byte0Vector, ref Vector byte1Vector) + public int Seek(ref Vector byte0Vector, ref Vector byte1Vector) { var limit = new MemoryPoolIterator(); return Seek(ref byte0Vector, ref byte1Vector, ref limit); @@ -574,7 +574,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure } } - public unsafe int Seek(ref Vector byte0Vector, ref Vector byte1Vector, ref Vector byte2Vector) + public int Seek(ref Vector byte0Vector, ref Vector byte1Vector, ref Vector byte2Vector) { var limit = new MemoryPoolIterator(); return Seek(ref byte0Vector, ref byte1Vector, ref byte2Vector, ref limit); diff --git a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/Libuv.cs b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/Libuv.cs index 9c918491cc..8901af40e2 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/Libuv.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/Libuv.cs @@ -280,7 +280,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate void uv_connect_cb(IntPtr req, int status); protected Action _uv_pipe_connect; - unsafe public void pipe_connect(UvConnectRequest req, UvPipeHandle handle, string name, uv_connect_cb cb) + public void pipe_connect(UvConnectRequest req, UvPipeHandle handle, string name, uv_connect_cb cb) { req.Validate(); handle.Validate(); @@ -288,7 +288,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking } protected Func _uv_pipe_pending_count; - unsafe public int pipe_pending_count(UvPipeHandle handle) + public int pipe_pending_count(UvPipeHandle handle) { handle.Validate(); return _uv_pipe_pending_count(handle); @@ -325,7 +325,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking public delegate void uv_write_cb(IntPtr req, int status); unsafe protected delegate int uv_write_func(UvRequest req, UvStreamHandle handle, uv_buf_t* bufs, int nbufs, uv_write_cb cb); - unsafe protected uv_write_func _uv_write; + protected uv_write_func _uv_write; unsafe public void write(UvRequest req, UvStreamHandle handle, uv_buf_t* bufs, int nbufs, uv_write_cb cb) { req.Validate(); @@ -334,7 +334,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking } unsafe protected delegate int uv_write2_func(UvRequest req, UvStreamHandle handle, uv_buf_t* bufs, int nbufs, UvStreamHandle sendHandle, uv_write_cb cb); - unsafe protected uv_write2_func _uv_write2; + protected uv_write2_func _uv_write2; unsafe public void write2(UvRequest req, UvStreamHandle handle, Libuv.uv_buf_t* bufs, int nbufs, UvStreamHandle sendHandle, uv_write_cb cb) { req.Validate(); @@ -353,14 +353,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking } protected Func _uv_err_name; - public unsafe string err_name(int err) + public string err_name(int err) { IntPtr ptr = _uv_err_name(err); return ptr == IntPtr.Zero ? null : Marshal.PtrToStringAnsi(ptr); } protected Func _uv_strerror; - public unsafe string strerror(int err) + public string strerror(int err) { IntPtr ptr = _uv_strerror(err); return ptr == IntPtr.Zero ? null : Marshal.PtrToStringAnsi(ptr); @@ -401,7 +401,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate void uv_walk_cb(IntPtr handle, IntPtr arg); protected Func _uv_walk; - unsafe public void walk(UvLoopHandle loop, uv_walk_cb walk_cb, IntPtr arg) + public void walk(UvLoopHandle loop, uv_walk_cb walk_cb, IntPtr arg) { loop.Validate(); _uv_walk(loop, walk_cb, arg); @@ -602,7 +602,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking public static extern int uv_tcp_getpeername(UvTcpHandle handle, out SockAddr name, ref int namelen); [DllImport("libuv", CallingConvention = CallingConvention.Cdecl)] - unsafe public static extern int uv_walk(UvLoopHandle loop, uv_walk_cb walk_cb, IntPtr arg); + public static extern int uv_walk(UvLoopHandle loop, uv_walk_cb walk_cb, IntPtr arg); [DllImport("WS2_32.dll", CallingConvention = CallingConvention.Winapi)] unsafe public static extern int WSAIoctl( diff --git a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/UvAsyncHandle.cs b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/UvAsyncHandle.cs index 93c1efcc64..da0ae7c3d4 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/UvAsyncHandle.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/UvAsyncHandle.cs @@ -37,7 +37,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking _uv.async_send(this); } - unsafe private static void AsyncCb(IntPtr handle) + private static void AsyncCb(IntPtr handle) { FromIntPtr(handle)._callback.Invoke(); } diff --git a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/UvHandle.cs b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/UvHandle.cs index 3db7dc21a3..0203ac610c 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/UvHandle.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/UvHandle.cs @@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking { } - unsafe protected void CreateHandle( + protected void CreateHandle( Libuv uv, int threadId, int size, diff --git a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/UvMemory.cs b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/UvMemory.cs index ecd15751e5..5b490ada94 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/UvMemory.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Networking/UvMemory.cs @@ -60,7 +60,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking DestroyMemory(memory, gcHandlePtr); } - unsafe protected static void DestroyMemory(IntPtr memory, IntPtr gcHandlePtr) + protected static void DestroyMemory(IntPtr memory, IntPtr gcHandlePtr) { if (gcHandlePtr != IntPtr.Zero) {