From 612985aeb27f273ed968dee3d1e8b8122a74e11f Mon Sep 17 00:00:00 2001 From: Riccardo De Agostini Date: Fri, 23 Feb 2024 09:33:09 +0100 Subject: [PATCH] Remove useless assignment to local variable https://github.com/Tenacom/Louis/security/code-scanning/30 --- src/Louis/IO/ReadOnlyMemoryStream.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Louis/IO/ReadOnlyMemoryStream.cs b/src/Louis/IO/ReadOnlyMemoryStream.cs index eee6ac6..b43b328 100644 --- a/src/Louis/IO/ReadOnlyMemoryStream.cs +++ b/src/Louis/IO/ReadOnlyMemoryStream.cs @@ -646,7 +646,6 @@ private int EmulateRead(int count) private void CopyToInternal(Stream destination, int originalPosition) { - var remaining = _position - originalPosition; #if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER // On runtimes that have Stream.Write(ReadOnlySpan), just use that. destination.Write(_data.Span[originalPosition.._position]); @@ -656,6 +655,7 @@ private void CopyToInternal(Stream destination, int originalPosition) // Fortunately, MemoryMarshal can tell us whether this is the case // and provide us with a reference to the array and the starting index // of the ReadOnlyMemory, sparing us the use of ArrayPool for a temporary array. + var remaining = _position - originalPosition; if (MemoryMarshal.TryGetArray(_data, out var dataArray)) { // If our data is actually in an array, write directly from that.