From f0c2337358fc43ad9c79294c539c4ddec4280011 Mon Sep 17 00:00:00 2001 From: vnugent Date: Fri, 28 Jul 2023 11:59:28 -0400 Subject: Compressor control refactor, reduce copy --- lib/Utils/src/Extensions/IoExtensions.cs | 5 ++--- lib/Utils/tests/VNLib.UtilsTests.csproj | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'lib/Utils') diff --git a/lib/Utils/src/Extensions/IoExtensions.cs b/lib/Utils/src/Extensions/IoExtensions.cs index 637cfab..bcbe810 100644 --- a/lib/Utils/src/Extensions/IoExtensions.cs +++ b/lib/Utils/src/Extensions/IoExtensions.cs @@ -1,5 +1,5 @@ /* -* Copyright (c) 2022 Vaughn Nugent +* Copyright (c) 2023 Vaughn Nugent * * Library: VNLib * Package: VNLib.Utils @@ -328,12 +328,11 @@ namespace VNLib.Utils.Extensions * bytes from the source */ long total = 0; - int bufferSize = buffer.Length; int read; while (true) { //get offset wrapper of the total buffer or remaining count - Memory offset = buffer[..(int)Math.Min(bufferSize, count - total)]; + Memory offset = buffer[..(int)Math.Min(buffer.Length, count - total)]; //read read = await source.ReadAsync(offset, token); //Guard diff --git a/lib/Utils/tests/VNLib.UtilsTests.csproj b/lib/Utils/tests/VNLib.UtilsTests.csproj index 5651bb3..c29915d 100644 --- a/lib/Utils/tests/VNLib.UtilsTests.csproj +++ b/lib/Utils/tests/VNLib.UtilsTests.csproj @@ -16,9 +16,9 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive -- cgit