Remove unneeded unsafe modifiers

This commit is contained in:
Ben Adams 2016-08-25 08:07:15 +01:00
parent 90b486794c
commit be51e5aecb
5 changed files with 14 additions and 14 deletions

View File

@ -215,7 +215,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure
} }
} }
public unsafe int Seek(ref Vector<byte> byte0Vector) public int Seek(ref Vector<byte> byte0Vector)
{ {
int bytesScanned; int bytesScanned;
return Seek(ref byte0Vector, out bytesScanned); return Seek(ref byte0Vector, out bytesScanned);
@ -433,7 +433,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure
} }
} }
public unsafe int Seek(ref Vector<byte> byte0Vector, ref Vector<byte> byte1Vector) public int Seek(ref Vector<byte> byte0Vector, ref Vector<byte> byte1Vector)
{ {
var limit = new MemoryPoolIterator(); var limit = new MemoryPoolIterator();
return Seek(ref byte0Vector, ref byte1Vector, ref limit); 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<byte> byte0Vector, ref Vector<byte> byte1Vector, ref Vector<byte> byte2Vector) public int Seek(ref Vector<byte> byte0Vector, ref Vector<byte> byte1Vector, ref Vector<byte> byte2Vector)
{ {
var limit = new MemoryPoolIterator(); var limit = new MemoryPoolIterator();
return Seek(ref byte0Vector, ref byte1Vector, ref byte2Vector, ref limit); return Seek(ref byte0Vector, ref byte1Vector, ref byte2Vector, ref limit);

View File

@ -272,7 +272,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void uv_connect_cb(IntPtr req, int status); public delegate void uv_connect_cb(IntPtr req, int status);
protected Action<UvConnectRequest, UvPipeHandle, string, uv_connect_cb> _uv_pipe_connect; protected Action<UvConnectRequest, UvPipeHandle, string, uv_connect_cb> _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(); req.Validate();
handle.Validate(); handle.Validate();
@ -280,7 +280,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking
} }
protected Func<UvPipeHandle, int> _uv_pipe_pending_count; protected Func<UvPipeHandle, int> _uv_pipe_pending_count;
unsafe public int pipe_pending_count(UvPipeHandle handle) public int pipe_pending_count(UvPipeHandle handle)
{ {
handle.Validate(); handle.Validate();
return _uv_pipe_pending_count(handle); return _uv_pipe_pending_count(handle);
@ -315,7 +315,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking
public delegate void uv_write_cb(IntPtr req, int status); 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 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) unsafe public void write(UvRequest req, UvStreamHandle handle, uv_buf_t* bufs, int nbufs, uv_write_cb cb)
{ {
req.Validate(); req.Validate();
@ -324,7 +324,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 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) unsafe public void write2(UvRequest req, UvStreamHandle handle, Libuv.uv_buf_t* bufs, int nbufs, UvStreamHandle sendHandle, uv_write_cb cb)
{ {
req.Validate(); req.Validate();
@ -343,14 +343,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking
} }
protected Func<int, IntPtr> _uv_err_name; protected Func<int, IntPtr> _uv_err_name;
public unsafe string err_name(int err) public string err_name(int err)
{ {
IntPtr ptr = _uv_err_name(err); IntPtr ptr = _uv_err_name(err);
return ptr == IntPtr.Zero ? null : Marshal.PtrToStringAnsi(ptr); return ptr == IntPtr.Zero ? null : Marshal.PtrToStringAnsi(ptr);
} }
protected Func<int, IntPtr> _uv_strerror; protected Func<int, IntPtr> _uv_strerror;
public unsafe string strerror(int err) public string strerror(int err)
{ {
IntPtr ptr = _uv_strerror(err); IntPtr ptr = _uv_strerror(err);
return ptr == IntPtr.Zero ? null : Marshal.PtrToStringAnsi(ptr); return ptr == IntPtr.Zero ? null : Marshal.PtrToStringAnsi(ptr);
@ -391,7 +391,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void uv_walk_cb(IntPtr handle, IntPtr arg); public delegate void uv_walk_cb(IntPtr handle, IntPtr arg);
protected Func<UvLoopHandle, uv_walk_cb, IntPtr, int> _uv_walk; protected Func<UvLoopHandle, uv_walk_cb, IntPtr, int> _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(); loop.Validate();
_uv_walk(loop, walk_cb, arg); _uv_walk(loop, walk_cb, arg);
@ -592,7 +592,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking
public static extern int uv_tcp_getpeername(UvTcpHandle handle, out SockAddr name, ref int namelen); public static extern int uv_tcp_getpeername(UvTcpHandle handle, out SockAddr name, ref int namelen);
[DllImport("libuv", CallingConvention = CallingConvention.Cdecl)] [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)] [DllImport("WS2_32.dll", CallingConvention = CallingConvention.Winapi)]
unsafe public static extern int WSAIoctl( unsafe public static extern int WSAIoctl(

View File

@ -37,7 +37,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking
_uv.async_send(this); _uv.async_send(this);
} }
unsafe private static void AsyncCb(IntPtr handle) private static void AsyncCb(IntPtr handle)
{ {
FromIntPtr<UvAsyncHandle>(handle)._callback.Invoke(); FromIntPtr<UvAsyncHandle>(handle)._callback.Invoke();
} }

View File

@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking
{ {
} }
unsafe protected void CreateHandle( protected void CreateHandle(
Libuv uv, Libuv uv,
int threadId, int threadId,
int size, int size,

View File

@ -60,7 +60,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking
DestroyMemory(memory, gcHandlePtr); DestroyMemory(memory, gcHandlePtr);
} }
unsafe protected static void DestroyMemory(IntPtr memory, IntPtr gcHandlePtr) protected static void DestroyMemory(IntPtr memory, IntPtr gcHandlePtr)
{ {
if (gcHandlePtr != IntPtr.Zero) if (gcHandlePtr != IntPtr.Zero)
{ {