Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/SharpCompress/Algorithms/Adler32.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Six Labors.
// Licensed under the Apache License, Version 2.0.

#if !NETSTANDARD2_0 && !NETSTANDARD2_1 && !NETFRAMEWORK
#if !LEGACY_DOTNET
#define SUPPORTS_RUNTIME_INTRINSICS
#define SUPPORTS_HOTPATH
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/SharpCompress/Archives/SevenZip/SevenZipArchive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public override Task FlushAsync(CancellationToken cancellationToken)
return Task.CompletedTask;
}

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET
public override ValueTask<int> ReadAsync(
Memory<byte> buffer,
CancellationToken cancellationToken = default
Expand Down
2 changes: 1 addition & 1 deletion src/SharpCompress/Common/AsyncBinaryReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void Dispose()
}
}

#if NET6_0_OR_GREATER
#if NET8_0_OR_GREATER
public async ValueTask DisposeAsync()
{
if (_disposed)
Expand Down
4 changes: 2 additions & 2 deletions src/SharpCompress/Common/EntryStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected override void Dispose(bool disposing)
_stream.Dispose();
}

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET
public override async ValueTask DisposeAsync()
{
if (_isDisposed)
Expand Down Expand Up @@ -171,7 +171,7 @@ CancellationToken cancellationToken
return read;
}

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET
public override async ValueTask<int> ReadAsync(
Memory<byte> buffer,
CancellationToken cancellationToken = default
Expand Down
4 changes: 2 additions & 2 deletions src/SharpCompress/Common/Tar/TarReadOnlySubStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected override void Dispose(bool disposing)
base.Dispose(disposing);
}

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET
public override async System.Threading.Tasks.ValueTask DisposeAsync()
{
if (_isDisposed)
Expand Down Expand Up @@ -170,7 +170,7 @@ System.Threading.CancellationToken cancellationToken
return read;
}

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET
public override async System.Threading.Tasks.ValueTask<int> ReadAsync(
System.Memory<byte> buffer,
System.Threading.CancellationToken cancellationToken = default
Expand Down
2 changes: 1 addition & 1 deletion src/SharpCompress/Common/Zip/WinzipAesEncryptionData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ string password
{
_keySize = keySize;

#if NETFRAMEWORK || NETSTANDARD2_0
#if LEGACY_DOTNET
var rfc2898 = new Rfc2898DeriveBytes(password, salt, RFC2898_ITERATIONS);
KeyBytes = rfc2898.GetBytes(KeySizeInBytes);
IvBytes = rfc2898.GetBytes(KeySizeInBytes);
Expand Down
2 changes: 1 addition & 1 deletion src/SharpCompress/Compressors/BZip2/BZip2Stream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public override int Read(byte[] buffer, int offset, int count) =>

public override void SetLength(long value) => stream.SetLength(value);

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET

public override int Read(Span<byte> buffer) => stream.Read(buffer);

Expand Down
6 changes: 3 additions & 3 deletions src/SharpCompress/Compressors/Deflate/DeflateStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public override async Task FlushAsync(CancellationToken cancellationToken)
await _baseStream.FlushAsync(cancellationToken).ConfigureAwait(false);
}

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET
public override async ValueTask DisposeAsync()
{
if (_disposed)
Expand Down Expand Up @@ -370,7 +370,7 @@ CancellationToken cancellationToken
.ConfigureAwait(false);
}

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET
public override async ValueTask<int> ReadAsync(
Memory<byte> buffer,
CancellationToken cancellationToken = default
Expand Down Expand Up @@ -461,7 +461,7 @@ await _baseStream
.ConfigureAwait(false);
}

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET
public override async ValueTask WriteAsync(
ReadOnlyMemory<byte> buffer,
CancellationToken cancellationToken = default
Expand Down
4 changes: 2 additions & 2 deletions src/SharpCompress/Compressors/Deflate/GZipStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ CancellationToken cancellationToken
return n;
}

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET
public override async ValueTask<int> ReadAsync(
Memory<byte> buffer,
CancellationToken cancellationToken = default
Expand Down Expand Up @@ -454,7 +454,7 @@ CancellationToken cancellationToken
await BaseStream.WriteAsync(buffer, offset, count, cancellationToken).ConfigureAwait(false);
}

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET
public override async ValueTask WriteAsync(
ReadOnlyMemory<byte> buffer,
CancellationToken cancellationToken = default
Expand Down
4 changes: 2 additions & 2 deletions src/SharpCompress/Compressors/Deflate/ZlibBaseStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ protected override void Dispose(bool disposing)
}
}

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET
public override async ValueTask DisposeAsync()
{
if (isDisposed)
Expand Down Expand Up @@ -1171,7 +1171,7 @@ CancellationToken cancellationToken
return rc;
}

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET
public override async ValueTask<int> ReadAsync(
Memory<byte> buffer,
CancellationToken cancellationToken = default
Expand Down
6 changes: 1 addition & 5 deletions src/SharpCompress/Compressors/Deflate/ZlibConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,9 @@ internal static class ZlibConstants
public const int Z_BUF_ERROR = -5;

/// <summary>
/// The size of the working buffer used in the ZlibCodec class. Defaults to 8192 bytes.
/// The size of the working buffer used in the ZlibCodec class. Defaults to 16384 bytes.
/// </summary>
#if NETCF
public const int WorkingBufferSizeDefault = 8192;
#else
public const int WorkingBufferSizeDefault = 16384;
#endif

/// <summary>
/// The minimum size of the working buffer used in the ZlibCodec class. Currently it is 128 bytes.
Expand Down
6 changes: 3 additions & 3 deletions src/SharpCompress/Compressors/Deflate/ZlibStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public override async Task FlushAsync(CancellationToken cancellationToken)
await _baseStream.FlushAsync(cancellationToken).ConfigureAwait(false);
}

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET
public override async ValueTask DisposeAsync()
{
if (_disposed)
Expand Down Expand Up @@ -347,7 +347,7 @@ CancellationToken cancellationToken
.ConfigureAwait(false);
}

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET
public override async ValueTask<int> ReadAsync(
Memory<byte> buffer,
CancellationToken cancellationToken = default
Expand Down Expand Up @@ -431,7 +431,7 @@ await _baseStream
.ConfigureAwait(false);
}

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET
public override async ValueTask WriteAsync(
ReadOnlyMemory<byte> buffer,
CancellationToken cancellationToken = default
Expand Down
2 changes: 1 addition & 1 deletion src/SharpCompress/Compressors/Deflate64/Deflate64Stream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ CancellationToken cancellationToken
return count - remainingCount;
}

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET
public override async ValueTask<int> ReadAsync(
Memory<byte> buffer,
CancellationToken cancellationToken = default
Expand Down
2 changes: 1 addition & 1 deletion src/SharpCompress/Compressors/LZMA/LZipStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public override int Read(byte[] buffer, int offset, int count) =>

public override void SetLength(long value) => throw new NotImplementedException();

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET

public override ValueTask<int> ReadAsync(
Memory<byte> buffer,
Expand Down
2 changes: 1 addition & 1 deletion src/SharpCompress/Compressors/LZMA/LzmaDecoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public Decoder()
}
}

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET
[MemberNotNull(nameof(_outWindow))]
#endif
private void CreateDictionary()
Expand Down
2 changes: 1 addition & 1 deletion src/SharpCompress/Compressors/LZMA/LzmaStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ await _decoder
return total;
}

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET
public override async ValueTask<int> ReadAsync(
Memory<byte> buffer,
CancellationToken cancellationToken = default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ System.Threading.CancellationToken cancellationToken
return totalRead;
}

#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
#if !LEGACY_DOTNET
public override async System.Threading.Tasks.ValueTask<int> ReadAsync(
Memory<byte> buffer,
System.Threading.CancellationToken cancellationToken = default
Expand Down
2 changes: 1 addition & 1 deletion src/SharpCompress/Compressors/Rar/RarBLAKE2spStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ System.Threading.CancellationToken cancellationToken
return result;
}

#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
#if !LEGACY_DOTNET
public override async System.Threading.Tasks.ValueTask<int> ReadAsync(
Memory<byte> buffer,
System.Threading.CancellationToken cancellationToken = default
Expand Down
2 changes: 1 addition & 1 deletion src/SharpCompress/Compressors/Rar/RarCrcStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ System.Threading.CancellationToken cancellationToken
return result;
}

#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
#if !LEGACY_DOTNET
public override async System.Threading.Tasks.ValueTask<int> ReadAsync(
Memory<byte> buffer,
System.Threading.CancellationToken cancellationToken = default
Expand Down
2 changes: 1 addition & 1 deletion src/SharpCompress/Compressors/Rar/RarStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ System.Threading.CancellationToken cancellationToken
return outTotal;
}

#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
#if !LEGACY_DOTNET
public override async System.Threading.Tasks.ValueTask<int> ReadAsync(
Memory<byte> buffer,
System.Threading.CancellationToken cancellationToken = default
Expand Down
8 changes: 4 additions & 4 deletions src/SharpCompress/Compressors/ZStandard/CompressionStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void LoadDictionary(byte[] dict)

~CompressionStream() => Dispose(false);

#if !NETSTANDARD2_0 && !NETFRAMEWORK
#if !LEGACY_DOTNET
public override async ValueTask DisposeAsync()
#else
public async ValueTask DisposeAsync()
Expand Down Expand Up @@ -145,7 +145,7 @@ private async ValueTask FlushInternalAsync(
public override void Write(byte[] buffer, int offset, int count) =>
Write(new ReadOnlySpan<byte>(buffer, offset, count));

#if !NETSTANDARD2_0 && !NETFRAMEWORK
#if !LEGACY_DOTNET
public override void Write(ReadOnlySpan<byte> buffer) =>
WriteInternal(buffer, ZSTD_EndDirective.ZSTD_e_continue);
#else
Expand Down Expand Up @@ -176,7 +176,7 @@ private void WriteInternal(ReadOnlySpan<byte> buffer, ZSTD_EndDirective directiv
);
}

#if !NETSTANDARD2_0 && !NETFRAMEWORK
#if !LEGACY_DOTNET
private async ValueTask WriteInternalAsync(
ReadOnlyMemory<byte>? buffer,
ZSTD_EndDirective directive,
Expand Down Expand Up @@ -218,7 +218,7 @@ await innerStream
);
}

#if !NETSTANDARD2_0 && !NETFRAMEWORK
#if !LEGACY_DOTNET

public override Task WriteAsync(
byte[] buffer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected override void Dispose(bool disposing)
public override int Read(byte[] buffer, int offset, int count) =>
Read(new Span<byte>(buffer, offset, count));

#if !NETSTANDARD2_0 && !NETFRAMEWORK
#if !LEGACY_DOTNET
public override int Read(Span<byte> buffer)
#else
public int Read(Span<byte> buffer)
Expand Down Expand Up @@ -158,7 +158,7 @@ public int Read(Span<byte> buffer)
}
}

#if !NETSTANDARD2_0 && !NETFRAMEWORK
#if !LEGACY_DOTNET
public override Task<int> ReadAsync(
byte[] buffer,
int offset,
Expand Down Expand Up @@ -276,7 +276,7 @@ private void EnsureNotDisposed()
throw new ObjectDisposedException(nameof(DecompressionStream));
}

#if NETSTANDARD2_0 || NETFRAMEWORK
#if LEGACY_DOTNET
public virtual Task DisposeAsync()
{
try
Expand Down
6 changes: 3 additions & 3 deletions src/SharpCompress/Compressors/ZStandard/UnsafeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static unsafe class UnsafeHelper
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void* malloc(ulong size)
{
#if NET6_0_OR_GREATER
#if NET8_0_OR_GREATER
var ptr = NativeMemory.Alloc((nuint)size);
#else
var ptr = (void*)Marshal.AllocHGlobal((nint)size);
Expand All @@ -31,7 +31,7 @@ public static unsafe class UnsafeHelper
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void* calloc(ulong num, ulong size)
{
#if NET6_0_OR_GREATER
#if NET8_0_OR_GREATER
return NativeMemory.AllocZeroed((nuint)num, (nuint)size);
#else
var total = num * size;
Expand All @@ -53,7 +53,7 @@ public static void memset(void* memPtr, byte val, uint size) =>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void free(void* ptr)
{
#if NET6_0_OR_GREATER
#if NET8_0_OR_GREATER
NativeMemory.Free(ptr);
#else
Marshal.FreeHGlobal((IntPtr)ptr);
Expand Down
2 changes: 1 addition & 1 deletion src/SharpCompress/Crypto/Crc32Stream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public override int Read(byte[] buffer, int offset, int count) =>

public override void SetLength(long value) => throw new NotSupportedException();

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET

public override void Write(ReadOnlySpan<byte> buffer)
{
Expand Down
2 changes: 1 addition & 1 deletion src/SharpCompress/IO/BufferedSubStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ CancellationToken cancellationToken
return count;
}

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET
public override async ValueTask<int> ReadAsync(
Memory<byte> buffer,
CancellationToken cancellationToken = default
Expand Down
6 changes: 3 additions & 3 deletions src/SharpCompress/IO/ProgressReportingStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public override int Read(byte[] buffer, int offset, int count)
return bytesRead;
}

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET
public override int Read(Span<byte> buffer)
{
var bytesRead = _baseStream.Read(buffer);
Expand Down Expand Up @@ -95,7 +95,7 @@ CancellationToken cancellationToken
return bytesRead;
}

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET
public override async ValueTask<int> ReadAsync(
Memory<byte> buffer,
CancellationToken cancellationToken = default
Expand Down Expand Up @@ -147,7 +147,7 @@ protected override void Dispose(bool disposing)
base.Dispose(disposing);
}

#if !NETFRAMEWORK && !NETSTANDARD2_0
#if !LEGACY_DOTNET
public override async ValueTask DisposeAsync()
{
if (!_leaveOpen)
Expand Down
Loading