Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmarkapps/PlatformBenchmarks/BufferExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ internal static unsafe void WriteNumeric<T>(ref this BufferWriter<T> buffer, uin

// Fast path, try copying to the available memory directly
var advanceBy = 0;
fixed (byte* output = &MemoryMarshal.GetReference(span))
fixed (byte* output = span)
{
var start = output;
if (number < 10 && bytesLeftInBlock >= 1)
Expand Down
6 changes: 3 additions & 3 deletions src/Kestrel.Core/Internal/Http/HttpParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public unsafe bool ParseRequestLine(TRequestHandler handler, in ReadOnlySequence
}

// Fix and parse the span
fixed (byte* data = &MemoryMarshal.GetReference(span))
fixed (byte* data = span)
{
ParseRequestLine(handler, data, span.Length);
}
Expand Down Expand Up @@ -206,7 +206,7 @@ public unsafe bool ParseHeaders(TRequestHandler handler, in ReadOnlySequence<byt
var span = reader.CurrentSegment;
var remaining = span.Length - reader.CurrentSegmentIndex;

fixed (byte* pBuffer = &MemoryMarshal.GetReference(span))
fixed (byte* pBuffer = span)
{
while (remaining > 0)
{
Expand Down Expand Up @@ -298,7 +298,7 @@ public unsafe bool ParseHeaders(TRequestHandler handler, in ReadOnlySequence<byt
var headerSpan = buffer.Slice(current, lineEnd).ToSpan();
length = headerSpan.Length;

fixed (byte* pHeader = &MemoryMarshal.GetReference(headerSpan))
fixed (byte* pHeader = headerSpan)
{
TakeSingleHeader(pHeader, length, handler);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Kestrel.Core/Internal/Http/HttpRequestHeaders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private void SetValueUnknown(string key, in StringValues value)

public unsafe void Append(Span<byte> name, string value)
{
fixed (byte* namePtr = &MemoryMarshal.GetReference(name))
fixed (byte* namePtr = name)
{
Append(namePtr, name.Length, value);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Kestrel.Core/Internal/Http/PathNormalizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private static unsafe string GetUtf8String(Span<byte> path)
{
// .NET 451 doesn't have pointer overloads for Encoding.GetString so we
// copy to an array
fixed (byte* pointer = &MemoryMarshal.GetReference(path))
fixed (byte* pointer = path)
{
return Encoding.UTF8.GetString(pointer, path.Length);
}
Expand All @@ -65,7 +65,7 @@ private static unsafe string GetUtf8String(Span<byte> path)
// In-place implementation of the algorithm from https://tools.ietf.org/html/rfc3986#section-5.2.4
public static unsafe int RemoveDotSegments(Span<byte> input)
{
fixed (byte* start = &MemoryMarshal.GetReference(input))
fixed (byte* start = input)
{
var end = start + input.Length;
return RemoveDotSegments(start, end);
Expand Down
6 changes: 3 additions & 3 deletions src/Kestrel.Core/Internal/Http/PipelineExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ internal static unsafe void WriteAsciiNoValidation(ref this BufferWriter<PipeWri
if (sourceLength <= destLength)
{
fixed (char* input = data)
fixed (byte* output = &MemoryMarshal.GetReference(dest))
fixed (byte* output = dest)
{
EncodeAsciiCharsToBytes(input, output, sourceLength);
}
Expand All @@ -78,7 +78,7 @@ internal static unsafe void WriteNumeric(ref this BufferWriter<PipeWriter> buffe

// Fast path, try copying to the available memory directly
var simpleWrite = true;
fixed (byte* output = &MemoryMarshal.GetReference(span))
fixed (byte* output = span)
{
var start = output;
if (number < 10 && bytesLeftInBlock >= 1)
Expand Down Expand Up @@ -158,7 +158,7 @@ private unsafe static void WriteAsciiMultiWrite(ref this BufferWriter<PipeWriter
continue;
}

fixed (byte* output = &MemoryMarshal.GetReference(buffer.Span))
fixed (byte* output = buffer.Span)
{
EncodeAsciiCharsToBytes(inputSlice, output, writable);
}
Expand Down
10 changes: 5 additions & 5 deletions src/Kestrel.Core/Internal/Infrastructure/HttpUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public static unsafe string GetAsciiStringNonNullCharacters(this Span<byte> span
var asciiString = new string('\0', span.Length);

fixed (char* output = asciiString)
fixed (byte* buffer = &MemoryMarshal.GetReference(span))
fixed (byte* buffer = span)
{
// This version if AsciiUtilities returns null if there are any null (0 byte) characters
// in the string
Expand All @@ -117,7 +117,7 @@ public static unsafe string GetAsciiOrUTF8StringNonNullCharacters(this Span<byte
var resultString = new string('\0', span.Length);

fixed (char* output = resultString)
fixed (byte* buffer = &MemoryMarshal.GetReference(span))
fixed (byte* buffer = span)
{
// This version if AsciiUtilities returns null if there are any null (0 byte) characters
// in the string
Expand Down Expand Up @@ -175,7 +175,7 @@ public static string GetAsciiStringEscaped(this Span<byte> span, int maxChars)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe bool GetKnownMethod(this Span<byte> span, out HttpMethod method, out int length)
{
fixed (byte* data = &MemoryMarshal.GetReference(span))
fixed (byte* data = span)
{
method = GetKnownMethod(data, span.Length, out length);
return method != HttpMethod.Custom;
Expand Down Expand Up @@ -310,7 +310,7 @@ public static HttpMethod GetKnownMethod(string value)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe bool GetKnownVersion(this Span<byte> span, out HttpVersion knownVersion, out byte length)
{
fixed (byte* data = &MemoryMarshal.GetReference(span))
fixed (byte* data = span)
{
knownVersion = GetKnownVersion(data, span.Length);
if (knownVersion != HttpVersion.Unknown)
Expand Down Expand Up @@ -369,7 +369,7 @@ internal static unsafe HttpVersion GetKnownVersion(byte* location, int length)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe bool GetKnownHttpScheme(this Span<byte> span, out HttpScheme knownScheme)
{
fixed (byte* data = &MemoryMarshal.GetReference(span))
fixed (byte* data = span)
{
return GetKnownHttpScheme(data, span.Length, out knownScheme);
}
Expand Down