Merge branch 'benaadams/less-unsafe' into dev

This commit is contained in:
Stephen Halter 2016-08-26 14:44:18 -07:00
commit 08d7f66108
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;
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();
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();
return Seek(ref byte0Vector, ref byte1Vector, ref byte2Vector, ref limit);

View File

@ -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<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();
handle.Validate();
@ -288,7 +288,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Networking
}
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();
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<int, IntPtr> _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<int, IntPtr> _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<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();
_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(

View File

@ -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<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,
int threadId,
int size,

View File

@ -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)
{