Skip to content

Commit

Permalink
Merge pull request #621 from inthemedium/master
Browse files Browse the repository at this point in the history
Add net461 target to clean up issues with system.* nuget dependencies
  • Loading branch information
adamhathcock authored Oct 2, 2021
2 parents 3ecf8a5 + 6983e66 commit fc1ca80
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 18 deletions.
10 changes: 5 additions & 5 deletions src/SharpCompress/Algorithms/Alder32.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
#if !NETSTANDARD2_0 && !NETSTANDARD2_1
#if !NETSTANDARD2_0 && !NETSTANDARD2_1 && !NETFRAMEWORK
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
#endif
Expand All @@ -22,7 +22,7 @@ internal static class Adler32
/// </summary>
public const uint SeedValue = 1U;

#if !NETSTANDARD2_0 && !NETSTANDARD2_1
#if !NETSTANDARD2_0 && !NETSTANDARD2_1 && !NETFRAMEWORK
private const int MinBufferSize = 64;
#endif

Expand Down Expand Up @@ -56,7 +56,7 @@ public static uint Calculate(uint adler, ReadOnlySpan<byte> buffer)
return SeedValue;
}

#if !NETSTANDARD2_0 && !NETSTANDARD2_1
#if !NETSTANDARD2_0 && !NETSTANDARD2_1 && !NETFRAMEWORK
if (Sse3.IsSupported && buffer.Length >= MinBufferSize)
{
return CalculateSse(adler, buffer);
Expand All @@ -69,7 +69,7 @@ public static uint Calculate(uint adler, ReadOnlySpan<byte> buffer)
}

// Based on https://github.com/chromium/chromium/blob/master/third_party/zlib/adler32_simd.c
#if !NETSTANDARD2_0 && !NETSTANDARD2_1
#if !NETSTANDARD2_0 && !NETSTANDARD2_1 && !NETFRAMEWORK
private static unsafe uint CalculateSse(uint adler, ReadOnlySpan<byte> buffer)
{
uint s1 = adler & 0xFFFF;
Expand Down Expand Up @@ -282,4 +282,4 @@ private static uint CalculateScalar(uint adler, ReadOnlySpan<byte> buffer)
return (s2 << 16) | s1;
}
}
}
}
2 changes: 1 addition & 1 deletion src/SharpCompress/Common/ArchiveEncoding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public ArchiveEncoding(Encoding def, Encoding password)
Password = password;
}

#if !NET461
#if !NETFRAMEWORK
static ArchiveEncoding()
{
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
Expand Down
4 changes: 2 additions & 2 deletions src/SharpCompress/Compressors/BZip2/BZip2Stream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public override void SetLength(long value)
stream.SetLength(value);
}

#if !NET461 && !NETSTANDARD2_0
#if !NETFRAMEWORK && !NETSTANDARD2_0

public override int Read(Span<byte> buffer)
{
Expand Down Expand Up @@ -123,4 +123,4 @@ public static bool IsBZip2(Stream stream)
return true;
}
}
}
}
2 changes: 1 addition & 1 deletion src/SharpCompress/Compressors/LZMA/LZipStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public override void Flush()
public override void SetLength(long value) => throw new NotImplementedException();


#if !NET461 && !NETSTANDARD2_0
#if !NETFRAMEWORK && !NETSTANDARD2_0

public override int Read(Span<byte> buffer)
{
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 @@ -42,7 +42,7 @@ public override void Flush()

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

#if !NET461 && !NETSTANDARD2_0
#if !NETFRAMEWORK && !NETSTANDARD2_0

public override void Write(ReadOnlySpan<byte> buffer)
{
Expand Down
4 changes: 2 additions & 2 deletions src/SharpCompress/IO/NonDisposingStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public override void Write(byte[] buffer, int offset, int count)
Stream.Write(buffer, offset, count);
}

#if !NET461 && !NETSTANDARD2_0
#if !NETFRAMEWORK && !NETSTANDARD2_0

public override int Read(Span<byte> buffer)
{
Expand All @@ -72,4 +72,4 @@ public override void Write(ReadOnlySpan<byte> buffer)

#endif
}
}
}
2 changes: 1 addition & 1 deletion src/SharpCompress/Polyfills/StreamExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NET461 || NETSTANDARD2_0
#if NETFRAMEWORK || NETSTANDARD2_0

using System;
using System.Buffers;
Expand Down
2 changes: 1 addition & 1 deletion src/SharpCompress/Polyfills/StringExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NET461 || NETSTANDARD2_0
#if NETFRAMEWORK || NETSTANDARD2_0

namespace SharpCompress
{
Expand Down
10 changes: 6 additions & 4 deletions src/SharpCompress/SharpCompress.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<AssemblyVersion>0.29.0</AssemblyVersion>
<FileVersion>0.29.0</FileVersion>
<Authors>Adam Hathcock</Authors>
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFrameworks>net461;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<AssemblyName>SharpCompress</AssemblyName>
Expand Down Expand Up @@ -35,8 +35,10 @@
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" />
<PackageReference Include="System.Memory" Version="4.5.3" />
<PackageReference Include="System.Buffers" Version="4.4.0" />
<PackageReference Include="System.Memory" Version="4.5.4" />
</ItemGroup>
<ItemGroup Condition=" '$(VersionlessImplicitFrameworkDefine)' == 'NETFRAMEWORK' ">
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" />
<PackageReference Include="System.Memory" Version="4.5.4" />
</ItemGroup>

</Project>

0 comments on commit fc1ca80

Please sign in to comment.