Cross target .NETCOREAPP3.1 and react to new nullablity annotations

This commit is contained in:
Jason Nelson
2020-11-18 09:43:08 -08:00
parent e243a8e88f
commit 087a6aad8c
6 changed files with 11 additions and 9 deletions

View File

@@ -24,7 +24,7 @@ namespace SharpCompress.Common
if (options.ExtractFullPath)
{
string folder = Path.GetDirectoryName(entry.Key);
string folder = Path.GetDirectoryName(entry.Key)!;
string destdir = Path.GetFullPath(Path.Combine(fullDestinationDirectoryPath, folder));
if (!Directory.Exists(destdir))

View File

@@ -37,6 +37,7 @@ namespace SharpCompress.Common.Rar.Headers
{
return false;
}
for (int i = 0; i < bytes.Length; ++i)
{
if (_bytes[i] != bytes[i])
@@ -47,9 +48,9 @@ namespace SharpCompress.Common.Rar.Headers
return true;
}
public bool Equals(NewSubHeaderType other)
public bool Equals(NewSubHeaderType? other)
{
return Equals(other._bytes);
return other is not null && Equals(other._bytes);
}
}
}

View File

@@ -24,7 +24,7 @@
return _id.GetHashCode();
}
public override bool Equals(object obj)
public override bool Equals(object? obj)
{
return obj is CMethodId other && Equals(other);
}

View File

@@ -447,7 +447,7 @@ namespace SharpCompress.Compressors.Deflate
// filename
if (fnLength != 0)
{
Array.Copy(filenameBytes, 0, header, i, fnLength - 1);
Array.Copy(filenameBytes!, 0, header, i, fnLength - 1);
i += fnLength - 1;
header[i++] = 0; // terminate
}
@@ -455,7 +455,7 @@ namespace SharpCompress.Compressors.Deflate
// comment
if (cbLength != 0)
{
Array.Copy(commentBytes, 0, header, i, cbLength - 1);
Array.Copy(commentBytes!, 0, header, i, cbLength - 1);
i += cbLength - 1;
header[i++] = 0; // terminate
}

View File

@@ -39,7 +39,7 @@ namespace SharpCompress.Compressors.Xz.Filters
throw new NotImplementedException($"Filter {filterType} has not yet been implemented");
}
var filter = (BlockFilter)Activator.CreateInstance(FilterMap[filterType]);
var filter = (BlockFilter)Activator.CreateInstance(FilterMap[filterType])!;
var sizeOfProperties = reader.ReadXZInteger();
if (sizeOfProperties > int.MaxValue)

View File

@@ -6,8 +6,8 @@
<AssemblyVersion>0.26.0</AssemblyVersion>
<FileVersion>0.26.0</FileVersion>
<Authors>Adam Hathcock</Authors>
<TargetFrameworks Condition="'$(LibraryFrameworks)'==''">netstandard2.0;netstandard2.1;net461</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks Condition="'$(LibraryFrameworks)'==''">netstandard2.0;netstandard2.1;netcoreapp3.1;net461</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard2.0;netstandard2.1;netcoreapp3.1;</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<AssemblyName>SharpCompress</AssemblyName>
@@ -23,6 +23,7 @@
<Description>SharpCompress is a compression library for NET Standard 2.0/2.1//NET 4.6 that can unrar, decompress 7zip, decompress xz, zip/unzip, tar/untar lzip/unlzip, bzip2/unbzip2 and gzip/ungzip with forward-only reading and file random access APIs. Write support for zip/tar/bzip2/gzip is implemented.</Description>
<LangVersion>9</LangVersion>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>