From 6786f5c6a4c9a617d3dff961b3e43664d32de83f Mon Sep 17 00:00:00 2001 From: Joyless <65855333+Joy-less@users.noreply.github.com> Date: Thu, 9 Apr 2026 18:41:31 +0100 Subject: [PATCH] Update dependencies --- src/Sandbox/Sandbox.csproj | 4 +- src/Zstd.Extern/Zstd.Extern.csproj | 8 +++- .../ZstdSharp.Benchmark.csproj | 8 ++-- src/ZstdSharp.Test/ZstdNetSteamingTests.cs | 40 +++++++++---------- src/ZstdSharp.Test/ZstdSharp.Test.csproj | 15 +++---- src/ZstdSharp/CompressionStream.cs | 2 +- src/ZstdSharp/Unsafe/Bitstream.cs | 2 - src/ZstdSharp/Unsafe/HufDecompress.cs | 2 - src/ZstdSharp/Unsafe/ZstdDecompressBlock.cs | 2 +- src/ZstdSharp/ZstdSharp.csproj | 22 +++++----- 10 files changed, 55 insertions(+), 50 deletions(-) diff --git a/src/Sandbox/Sandbox.csproj b/src/Sandbox/Sandbox.csproj index ab77da0..cb421bd 100644 --- a/src/Sandbox/Sandbox.csproj +++ b/src/Sandbox/Sandbox.csproj @@ -2,8 +2,8 @@ Exe - netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0;net462 - 9.0 + net8.0;net9.0;net10.0;net48 + 14 false diff --git a/src/Zstd.Extern/Zstd.Extern.csproj b/src/Zstd.Extern/Zstd.Extern.csproj index cf958e8..e7da326 100644 --- a/src/Zstd.Extern/Zstd.Extern.csproj +++ b/src/Zstd.Extern/Zstd.Extern.csproj @@ -1,8 +1,12 @@ - netcoreapp3.1;net5.0;netstandard2.0;net462 - 9 + net8.0;net9.0;net10.0;netstandard2.0;netstandard2.1;net48 + 14 + + + + true diff --git a/src/ZstdSharp.Benchmark/ZstdSharp.Benchmark.csproj b/src/ZstdSharp.Benchmark/ZstdSharp.Benchmark.csproj index 8a4f2e3..61fc61a 100644 --- a/src/ZstdSharp.Benchmark/ZstdSharp.Benchmark.csproj +++ b/src/ZstdSharp.Benchmark/ZstdSharp.Benchmark.csproj @@ -2,8 +2,8 @@ Exe - netcoreapp3.1;net5.0;net6.0;net462;net7.0;net8.0;net9.0 - 9.0 + net8.0;net9.0;net10.0;net48 + 14 @@ -15,8 +15,8 @@ - - + + diff --git a/src/ZstdSharp.Test/ZstdNetSteamingTests.cs b/src/ZstdSharp.Test/ZstdNetSteamingTests.cs index ab9313f..b2c0217 100644 --- a/src/ZstdSharp.Test/ZstdNetSteamingTests.cs +++ b/src/ZstdSharp.Test/ZstdNetSteamingTests.cs @@ -48,7 +48,7 @@ public static byte[] GetBuffer(int length, DataFill dataFill) public class ZstdNetSteamingTests { [Fact] - public async void StreamingCompressionZeroAndOneByte() + public async Task StreamingCompressionZeroAndOneByte() { var data = new byte[] {0, 0, 0, 1, 2, 3, 4, 0, 0, 0}; @@ -57,15 +57,15 @@ public async void StreamingCompressionZeroAndOneByte() { compressionStream.Write(data, 0, 0); compressionStream.Write(ReadOnlySpan.Empty); - await compressionStream.WriteAsync(data, 0, 0); - await compressionStream.WriteAsync(ReadOnlyMemory.Empty); + await compressionStream.WriteAsync(data, 0, 0, TestContext.Current.CancellationToken); + await compressionStream.WriteAsync(ReadOnlyMemory.Empty, TestContext.Current.CancellationToken); compressionStream.Write(data, 3, 1); compressionStream.Write(new ReadOnlySpan(data, 4, 1)); compressionStream.Flush(); - await compressionStream.WriteAsync(data, 5, 1); - await compressionStream.WriteAsync(new ReadOnlyMemory(data, 6, 1)); - await compressionStream.FlushAsync(); + await compressionStream.WriteAsync(data, 5, 1, TestContext.Current.CancellationToken); + await compressionStream.WriteAsync(new ReadOnlyMemory(data, 6, 1), TestContext.Current.CancellationToken); + await compressionStream.FlushAsync(TestContext.Current.CancellationToken); } tempStream.Seek(0, SeekOrigin.Begin); @@ -75,13 +75,13 @@ public async void StreamingCompressionZeroAndOneByte() { Assert.Equal(0, decompressionStream.Read(result, 0, 0)); Assert.Equal(0, decompressionStream.Read(Span.Empty)); - Assert.Equal(0, await decompressionStream.ReadAsync(result, 0, 0)); - Assert.Equal(0, await decompressionStream.ReadAsync(Memory.Empty)); + Assert.Equal(0, await decompressionStream.ReadAsync(result, 0, 0, TestContext.Current.CancellationToken)); + Assert.Equal(0, await decompressionStream.ReadAsync(Memory.Empty, TestContext.Current.CancellationToken)); Assert.Equal(1, decompressionStream.Read(result, 3, 1)); Assert.Equal(1, decompressionStream.Read(new Span(result, 4, 1))); - Assert.Equal(1, await decompressionStream.ReadAsync(result, 5, 1)); - Assert.Equal(1, await decompressionStream.ReadAsync(new Memory(result, 6, 1))); + Assert.Equal(1, await decompressionStream.ReadAsync(result, 5, 1, TestContext.Current.CancellationToken)); + Assert.Equal(1, await decompressionStream.ReadAsync(new Memory(result, 6, 1), TestContext.Current.CancellationToken)); } Assert.True(data.SequenceEqual(result)); @@ -346,8 +346,8 @@ public async Task RoundTrip_StreamingToStreamingAsync( } int bytesRead; - while ((bytesRead = await testStream.ReadAsync(buffer, offset, copyBufferSize)) > 0) - await compressionStream.WriteAsync(buffer, offset, bytesRead); + while ((bytesRead = await testStream.ReadAsync(buffer, offset, copyBufferSize, TestContext.Current.CancellationToken)) > 0) + await compressionStream.WriteAsync(buffer, offset, bytesRead, TestContext.Current.CancellationToken); } tempStream.Seek(0, SeekOrigin.Begin); @@ -362,8 +362,8 @@ public async Task RoundTrip_StreamingToStreamingAsync( } int bytesRead; - while ((bytesRead = await decompressionStream.ReadAsync(buffer, offset, copyBufferSize)) > 0) - await resultStream.WriteAsync(buffer, offset, bytesRead); + while ((bytesRead = await decompressionStream.ReadAsync(buffer, offset, copyBufferSize, TestContext.Current.CancellationToken)) > 0) + await resultStream.WriteAsync(buffer, offset, bytesRead, TestContext.Current.CancellationToken); } Assert.True(testStream.ToArray().SequenceEqual(resultStream.ToArray())); @@ -409,15 +409,15 @@ public async Task Pipe_StreamingToStreamingAsync( using (var decomp = new DecompressionStream(pipeClient)) { var data = new byte[] { 0, 1, 2 }; - await comp.WriteAsync(data); - await comp.FlushAsync(); + await comp.WriteAsync(data, TestContext.Current.CancellationToken); + await comp.FlushAsync(TestContext.Current.CancellationToken); var buf = new byte[outputBufSize]; var received = new List(); while (received.Count < data.Length) { - var count = await decomp.ReadAsync(buf); + var count = await decomp.ReadAsync(buf, TestContext.Current.CancellationToken); received.AddRange(buf.Take(count)); } @@ -518,8 +518,8 @@ public async Task FlushAsyncTest() var bs = new BufferedStream(ms, 4096); using var writer = new CompressionStream(bs); var src = new byte[1] { 42 }; - await writer.WriteAsync(src); - await writer.FlushAsync(); + await writer.WriteAsync(src, TestContext.Current.CancellationToken); + await writer.FlushAsync(TestContext.Current.CancellationToken); Assert.True(ms.ToArray().Length > 0); } @@ -530,7 +530,7 @@ public async Task DisposeFlushAsyncTest() var bs = new BufferedStream(ms, 4096); using var writer = new CompressionStream(bs, leaveOpen: true); var src = new byte[1] { 42 }; - await writer.WriteAsync(src); + await writer.WriteAsync(src, TestContext.Current.CancellationToken); await writer.DisposeAsync(); Assert.True(ms.ToArray().Length == 0); bs.Dispose(); diff --git a/src/ZstdSharp.Test/ZstdSharp.Test.csproj b/src/ZstdSharp.Test/ZstdSharp.Test.csproj index f195598..905ca16 100644 --- a/src/ZstdSharp.Test/ZstdSharp.Test.csproj +++ b/src/ZstdSharp.Test/ZstdSharp.Test.csproj @@ -1,9 +1,10 @@  - netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0;net462 + Exe + net8.0;net9.0;net10.0;net48 + 14 false - 9 @@ -15,14 +16,14 @@ - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/ZstdSharp/CompressionStream.cs b/src/ZstdSharp/CompressionStream.cs index 755afd1..cdbaa78 100644 --- a/src/ZstdSharp/CompressionStream.cs +++ b/src/ZstdSharp/CompressionStream.cs @@ -147,7 +147,7 @@ private void WriteInternal(ReadOnlySpan buffer, ZSTD_EndDirective directiv { EnsureNotDisposed(); - var input = new ZSTD_inBuffer_s {pos = 0, size = buffer != null ? (nuint) buffer.Length : 0}; + var input = new ZSTD_inBuffer_s {pos = 0, size = (nuint)buffer.Length}; nuint remaining; do { diff --git a/src/ZstdSharp/Unsafe/Bitstream.cs b/src/ZstdSharp/Unsafe/Bitstream.cs index 47ce07e..c80dd78 100644 --- a/src/ZstdSharp/Unsafe/Bitstream.cs +++ b/src/ZstdSharp/Unsafe/Bitstream.cs @@ -370,7 +370,6 @@ private static BIT_DStream_status BIT_reloadDStream(BIT_DStream_t* bitD) { if (bitD->bitsConsumed > (uint)(sizeof(nuint) * 8)) { - const nuint zeroFilled = 0; bitD->ptr = (sbyte*)&static_zeroFilled[0]; return BIT_DStream_status.BIT_DStream_overflow; } @@ -563,7 +562,6 @@ private static BIT_DStream_status BIT_reloadDStream(ref nuint bitD_bitContainer, { if (bitD_bitsConsumed > (uint)(sizeof(nuint) * 8)) { - const nuint zeroFilled = 0; bitD_ptr = (sbyte*)&static_zeroFilled[0]; return BIT_DStream_status.BIT_DStream_overflow; } diff --git a/src/ZstdSharp/Unsafe/HufDecompress.cs b/src/ZstdSharp/Unsafe/HufDecompress.cs index 282309e..eb008cb 100644 --- a/src/ZstdSharp/Unsafe/HufDecompress.cs +++ b/src/ZstdSharp/Unsafe/HufDecompress.cs @@ -504,7 +504,6 @@ private static void HUF_decompress4X1_usingDTable_internal_fast_c_loop(HUF_Decom for (; ; ) { byte* olimit; - int stream; { assert(op0 <= op1); assert(ip0 >= ilowest); @@ -1446,7 +1445,6 @@ private static void HUF_decompress4X2_usingDTable_internal_fast_c_loop(HUF_Decom for (; ; ) { byte* olimit; - int stream; { assert(op0 <= oend0); assert(ip0 >= ilowest); diff --git a/src/ZstdSharp/Unsafe/ZstdDecompressBlock.cs b/src/ZstdSharp/Unsafe/ZstdDecompressBlock.cs index 328e6f5..b5e2dff 100644 --- a/src/ZstdSharp/Unsafe/ZstdDecompressBlock.cs +++ b/src/ZstdSharp/Unsafe/ZstdDecompressBlock.cs @@ -1412,7 +1412,7 @@ private static nuint ZSTD_decompressSequences_bodySplitLitBuffer(ZSTD_DCtx_s* dc private static nuint ZSTD_decompressSequences_body(ZSTD_DCtx_s* dctx, void* dst, nuint maxDstSize, void* seqStart, nuint seqSize, int nbSeq, ZSTD_longOffset_e isLongOffset) { // HACK, force nbSeq to stack (better register usage) - System.Threading.Thread.VolatileRead(ref nbSeq); + System.Threading.Volatile.Read(ref nbSeq); byte* ip = (byte*)seqStart; byte* iend = ip + seqSize; byte* ostart = (byte*)dst; diff --git a/src/ZstdSharp/ZstdSharp.csproj b/src/ZstdSharp/ZstdSharp.csproj index 3fcf527..5921c7e 100644 --- a/src/ZstdSharp/ZstdSharp.csproj +++ b/src/ZstdSharp/ZstdSharp.csproj @@ -1,8 +1,8 @@  - netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0;netstandard2.1;netstandard2.0;net462 - 9.0 + net8.0;net9.0;net10.0;netstandard2.0;netstandard2.1;net48 + 14 true key.snk Oleg Stepanischev @@ -20,6 +20,10 @@ 0.8.7 + + true + + true TRACE @@ -30,22 +34,22 @@ TRACE - - - + + + - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + +