diff --git a/src/SharpCompress/Common/ExtractionMethods.cs b/src/SharpCompress/Common/ExtractionMethods.cs index 81be96f5..0e3492be 100644 --- a/src/SharpCompress/Common/ExtractionMethods.cs +++ b/src/SharpCompress/Common/ExtractionMethods.cs @@ -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)) diff --git a/src/SharpCompress/Common/Rar/Headers/NewSubHeaderType.cs b/src/SharpCompress/Common/Rar/Headers/NewSubHeaderType.cs index 84d50aee..647d43e6 100644 --- a/src/SharpCompress/Common/Rar/Headers/NewSubHeaderType.cs +++ b/src/SharpCompress/Common/Rar/Headers/NewSubHeaderType.cs @@ -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); } } } \ No newline at end of file diff --git a/src/SharpCompress/Common/SevenZip/CMethodId.cs b/src/SharpCompress/Common/SevenZip/CMethodId.cs index 03ce8df6..5069b051 100644 --- a/src/SharpCompress/Common/SevenZip/CMethodId.cs +++ b/src/SharpCompress/Common/SevenZip/CMethodId.cs @@ -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); } diff --git a/src/SharpCompress/Compressors/Deflate/GZipStream.cs b/src/SharpCompress/Compressors/Deflate/GZipStream.cs index 6107db65..903cea2c 100644 --- a/src/SharpCompress/Compressors/Deflate/GZipStream.cs +++ b/src/SharpCompress/Compressors/Deflate/GZipStream.cs @@ -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 } diff --git a/src/SharpCompress/Compressors/Xz/Filters/BlockFilter.cs b/src/SharpCompress/Compressors/Xz/Filters/BlockFilter.cs index bf6d85e5..875d1b44 100644 --- a/src/SharpCompress/Compressors/Xz/Filters/BlockFilter.cs +++ b/src/SharpCompress/Compressors/Xz/Filters/BlockFilter.cs @@ -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) diff --git a/src/SharpCompress/SharpCompress.csproj b/src/SharpCompress/SharpCompress.csproj index cb6f21b1..de803800 100644 --- a/src/SharpCompress/SharpCompress.csproj +++ b/src/SharpCompress/SharpCompress.csproj @@ -6,8 +6,8 @@ 0.26.0 0.26.0 Adam Hathcock - netstandard2.0;netstandard2.1;net461 - netstandard2.0;netstandard2.1 + netstandard2.0;netstandard2.1;netcoreapp3.1;net461 + netstandard2.0;netstandard2.1;netcoreapp3.1; true false SharpCompress @@ -23,6 +23,7 @@ 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. 9 enable + true true true snupkg