aboutsummaryrefslogtreecommitdiff
path: root/lib/Utils
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2023-07-28 11:59:28 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2023-07-28 11:59:28 -0400
commitf0c2337358fc43ad9c79294c539c4ddec4280011 (patch)
tree3125d7fece381c0ab86012bc0b1c848fee0170eb /lib/Utils
parentcd7d9f3ec65737b96c713b1b84ef972e901c4ea3 (diff)
Compressor control refactor, reduce copy
Diffstat (limited to 'lib/Utils')
-rw-r--r--lib/Utils/src/Extensions/IoExtensions.cs5
-rw-r--r--lib/Utils/tests/VNLib.UtilsTests.csproj6
2 files changed, 5 insertions, 6 deletions
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<byte> offset = buffer[..(int)Math.Min(bufferSize, count - total)];
+ Memory<byte> 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 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
- <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
- <PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
- <PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
+ <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
+ <PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
+ <PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>