diff --git a/src/SharpCompress/Compressors/Deflate64/Deflate64Stream.cs b/src/SharpCompress/Compressors/Deflate64/Deflate64Stream.cs index e18e85b5..3de390c6 100644 --- a/src/SharpCompress/Compressors/Deflate64/Deflate64Stream.cs +++ b/src/SharpCompress/Compressors/Deflate64/Deflate64Stream.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. - using System; using System.Diagnostics; using System.IO; @@ -65,7 +64,7 @@ public sealed class Deflate64Stream : Stream, IStreamStack throw new ArgumentException("Deflate64: input stream is not readable", nameof(stream)); } - _inflater = new InflaterManaged( true); + _inflater = new InflaterManaged(true); _stream = stream; _buffer = new byte[DEFAULT_BUFFER_SIZE]; @@ -74,7 +73,6 @@ public sealed class Deflate64Stream : Stream, IStreamStack #endif } - public override bool CanRead => _stream.CanRead; public override bool CanWrite => false; @@ -180,9 +178,6 @@ public sealed class Deflate64Stream : Stream, IStreamStack private static void ThrowStreamClosedException() => throw new ObjectDisposedException(null, "Deflate64: stream has been disposed"); - - - [MethodImpl(MethodImplOptions.NoInlining)] private static void ThrowCannotWriteToDeflateManagedStreamException() => throw new InvalidOperationException("Deflate64: cannot write to this stream"); @@ -229,7 +224,6 @@ public sealed class Deflate64Stream : Stream, IStreamStack } finally { - try { _inflater.Dispose(); diff --git a/tests/SharpCompress.Test/Mocks/ForwardOnlyStream.cs b/tests/SharpCompress.Test/Mocks/ForwardOnlyStream.cs index d4b6dda3..c99d623b 100644 --- a/tests/SharpCompress.Test/Mocks/ForwardOnlyStream.cs +++ b/tests/SharpCompress.Test/Mocks/ForwardOnlyStream.cs @@ -57,7 +57,7 @@ public class ForwardOnlyStream : SharpCompressStream, IStreamStack public override bool CanRead => true; public override bool CanSeek => false; - public override bool CanWrite => false; + public override bool CanWrite => true; public override void Flush() { } diff --git a/tests/SharpCompress.Test/Zip/Zip64AsyncTests.cs b/tests/SharpCompress.Test/Zip/Zip64AsyncTests.cs index b939f068..ee392c5d 100644 --- a/tests/SharpCompress.Test/Zip/Zip64AsyncTests.cs +++ b/tests/SharpCompress.Test/Zip/Zip64AsyncTests.cs @@ -23,16 +23,14 @@ public class Zip64AsyncTests : WriterTests // 4GiB + 1 private const long FOUR_GB_LIMIT = ((long)uint.MaxValue) + 1; - [Fact] + //[Fact] [Trait("format", "zip64")] public async Task Zip64_Single_Large_File_Async() => - // One single file, requires zip64 await RunSingleTestAsync(1, FOUR_GB_LIMIT, setZip64: true, forwardOnly: false); - [Fact] + //[Fact] [Trait("format", "zip64")] public async Task Zip64_Two_Large_Files_Async() => - // One single file, requires zip64 await RunSingleTestAsync(2, FOUR_GB_LIMIT, setZip64: true, forwardOnly: false); [Fact] @@ -44,7 +42,6 @@ public class Zip64AsyncTests : WriterTests [Fact] [Trait("format", "zip64")] public async Task Zip64_Two_Small_files_stream_Async() => - // Multiple files, does not require zip64, and works with streams await RunSingleTestAsync(2, FOUR_GB_LIMIT / 2, setZip64: false, forwardOnly: true); [Fact] @@ -179,12 +176,10 @@ public class Zip64AsyncTests : WriterTests { var b = (int)Math.Min(left, data.Length); // Use synchronous Write to match the sync version and avoid ForwardOnlyStream issues - str.Write(data, 0, b); + await str.WriteAsync(data, 0, b); left -= b; } } - // Adding await to make it properly async, even though the writes are sync - await Task.CompletedTask; } public async Task> ReadForwardOnlyAsync(string filename) diff --git a/tests/SharpCompress.Test/Zip/Zip64Tests.cs b/tests/SharpCompress.Test/Zip/Zip64Tests.cs index a89b1128..e92c8d52 100644 --- a/tests/SharpCompress.Test/Zip/Zip64Tests.cs +++ b/tests/SharpCompress.Test/Zip/Zip64Tests.cs @@ -22,31 +22,37 @@ public class Zip64Tests : WriterTests // 4GiB + 1 private const long FOUR_GB_LIMIT = ((long)uint.MaxValue) + 1; + //[Fact] [Trait("format", "zip64")] public void Zip64_Single_Large_File() => // One single file, requires zip64 RunSingleTest(1, FOUR_GB_LIMIT, setZip64: true, forwardOnly: false); + //[Fact] [Trait("format", "zip64")] public void Zip64_Two_Large_Files() => // One single file, requires zip64 RunSingleTest(2, FOUR_GB_LIMIT, setZip64: true, forwardOnly: false); + [Fact] [Trait("format", "zip64")] public void Zip64_Two_Small_files() => // Multiple files, does not require zip64 RunSingleTest(2, FOUR_GB_LIMIT / 2, setZip64: false, forwardOnly: false); + [Fact] [Trait("format", "zip64")] public void Zip64_Two_Small_files_stream() => // Multiple files, does not require zip64, and works with streams RunSingleTest(2, FOUR_GB_LIMIT / 2, setZip64: false, forwardOnly: true); + [Fact] [Trait("format", "zip64")] public void Zip64_Two_Small_Files_Zip64() => // Multiple files, use zip64 even though it is not required RunSingleTest(2, FOUR_GB_LIMIT / 2, setZip64: true, forwardOnly: false); + [Fact] [Trait("format", "zip64")] public void Zip64_Single_Large_File_Fail() { @@ -59,6 +65,7 @@ public class Zip64Tests : WriterTests catch (NotSupportedException) { } } + [Fact] [Trait("zip64", "true")] public void Zip64_Single_Large_File_Zip64_Streaming_Fail() { @@ -71,6 +78,7 @@ public class Zip64Tests : WriterTests catch (NotSupportedException) { } } + [Fact] [Trait("zip64", "true")] public void Zip64_Single_Large_File_Streaming_Fail() {