Fix warnings from nullabilty

This commit is contained in:
Matt Nadareski
2023-09-04 21:14:41 -04:00
parent 46824bd91d
commit 0e23d131fe
212 changed files with 3018 additions and 1 deletions

View File

@@ -6,7 +6,11 @@ namespace SabreTools.Models.Compression.LZ
/// <see href="https://github.com/wine-mirror/wine/blob/master/dlls/kernel32/lzexpand.c"/>
public sealed class FileHeaader
{
#if NET48
public string Magic;
#else
public string? Magic;
#endif
public byte CompressionType;

View File

@@ -7,7 +7,11 @@ namespace SabreTools.Models.Compression.LZ
/// <summary>
/// Internal backing stream
/// </summary>
#if NET48
public Stream Source { get; set; }
#else
public Stream? Source { get; set; }
#endif
/// <summary>
/// The last char of the filename for replacement
@@ -32,7 +36,11 @@ namespace SabreTools.Models.Compression.LZ
/// <summary>
/// The rotating LZ table
/// </summary>
#if NET48
public byte[] Table { get; set; }
#else
public byte[]? Table { get; set; }
#endif
/// <summary>
/// CURrent TABle ENTry
@@ -57,7 +65,11 @@ namespace SabreTools.Models.Compression.LZ
/// <summary>
/// GETLEN bytes
/// </summary>
#if NET48
public byte[] Window { get; set; }
#else
public byte[]? Window { get; set; }
#endif
/// <summary>
/// Current read

View File

@@ -10,49 +10,81 @@ namespace SabreTools.Models.Compression.LZX
/// <summary>
/// Generic block header
/// </summary>
#if NET48
public BlockHeader Header;
#else
public BlockHeader? Header;
#endif
/// <summary>
/// Aligned offset tree
/// </summary>
/// <remarks>8 elements, 3 bits each</remarks>
#if NET48
public byte[] AlignedOffsetTree;
#else
public byte[]? AlignedOffsetTree;
#endif
/// <summary>
/// Pretree for first 256 elements of main tree
/// </summary>
/// <remarks>20 elements, 4 bits each</remarks>
#if NET48
public byte[] PretreeFirst256;
#else
public byte[]? PretreeFirst256;
#endif
/// <summary>
/// Path lengths of first 256 elements of main tree
/// </summary>
/// <remarks>Encoded using pretree</remarks>
#if NET48
public int[] PathLengthsFirst256;
#else
public int[]? PathLengthsFirst256;
#endif
/// <summary>
/// Pretree for remainder of main tree
/// </summary>
/// <remarks>20 elements, 4 bits each</remarks>
#if NET48
public byte[] PretreeRemainder;
#else
public byte[]? PretreeRemainder;
#endif
/// <summary>
/// Path lengths of remaining elements of main tree
/// </summary>
/// <remarks>Encoded using pretree</remarks>
#if NET48
public int[] PathLengthsRemainder;
#else
public int[]? PathLengthsRemainder;
#endif
/// <summary>
/// Pretree for length tree
/// </summary>
/// <remarks>20 elements, 4 bits each</remarks>
#if NET48
public byte[] PretreeLengthTree;
#else
public byte[]? PretreeLengthTree;
#endif
/// <summary>
/// Path lengths of elements in length tree
/// </summary>
/// <remarks>Encoded using pretree</remarks>
#if NET48
public int[] PathLengthsLengthTree;
#else
public int[]? PathLengthsLengthTree;
#endif
// Entry Comments Size
// ---------------------------------------------------------------------------------------

View File

@@ -19,7 +19,11 @@ namespace SabreTools.Models.Compression.LZX
/// <summary>
/// Generic block header
/// </summary>
#if NET48
public BlockHeader Header;
#else
public BlockHeader? Header;
#endif
/// <summary>
/// Padding to align following field on 16-bit boundary
@@ -49,7 +53,11 @@ namespace SabreTools.Models.Compression.LZX
/// Can use the direct memcpy function, as specified in [IEEE1003.1]
/// </summary>
/// <remarks>Encoded directly in the byte stream, not in the bitstream of byte-swapped 16-bit words</remarks>
#if NET48
public byte[] RawDataBytes;
#else
public byte[]? RawDataBytes;
#endif
/// <summary>
/// Only if uncompressed size is odd

View File

@@ -9,43 +9,71 @@ namespace SabreTools.Models.Compression.LZX
/// <summary>
/// Generic block header
/// </summary>
#if NET48
public BlockHeader Header;
#else
public BlockHeader? Header;
#endif
/// <summary>
/// Pretree for first 256 elements of main tree
/// </summary>
/// <remarks>20 elements, 4 bits each</remarks>
#if NET48
public byte[] PretreeFirst256;
#else
public byte[]? PretreeFirst256;
#endif
/// <summary>
/// Path lengths of first 256 elements of main tree
/// </summary>
/// <remarks>Encoded using pretree</remarks>
#if NET48
public int[] PathLengthsFirst256;
#else
public int[]? PathLengthsFirst256;
#endif
/// <summary>
/// Pretree for remainder of main tree
/// </summary>
/// <remarks>20 elements, 4 bits each</remarks>
#if NET48
public byte[] PretreeRemainder;
#else
public byte[]? PretreeRemainder;
#endif
/// <summary>
/// Path lengths of remaining elements of main tree
/// </summary>
/// <remarks>Encoded using pretree</remarks>
#if NET48
public int[] PathLengthsRemainder;
#else
public int[]? PathLengthsRemainder;
#endif
/// <summary>
/// Pretree for length tree
/// </summary>
/// <remarks>20 elements, 4 bits each</remarks>
#if NET48
public byte[] PretreeLengthTree;
#else
public byte[]? PretreeLengthTree;
#endif
/// <summary>
/// Path lengths of elements in length tree
/// </summary>
/// <remarks>Encoded using pretree</remarks>
#if NET48
public int[] PathLengthsLengthTree;
#else
public int[]? PathLengthsLengthTree;
#endif
// Entry Comments Size
// ---------------------------------------------------------------------------------------

View File

@@ -9,11 +9,19 @@ namespace SabreTools.Models.Compression.MSZIP
/// <summary>
/// Huffman code lengths for the literal / length alphabet
/// </summary>
#if NET48
public int[] LiteralLengths;
#else
public int[]? LiteralLengths;
#endif
/// <summary>
/// Huffman distance codes for the literal / length alphabet
/// </summary>
#if NET48
public int[] DistanceCodes;
#else
public int[]? DistanceCodes;
#endif
}
}

View File

@@ -14,7 +14,11 @@ namespace SabreTools.Models.Compression.MSZIP
/// <summary>
/// Huffman code lengths for the literal / length alphabet
/// </summary>
#if NET48
public uint[] LiteralLengths
#else
public uint[]? LiteralLengths
#endif
{
get
{
@@ -52,7 +56,11 @@ namespace SabreTools.Models.Compression.MSZIP
/// <summary>
/// Huffman distance codes for the literal / length alphabet
/// </summary>
#if NET48
public uint[] DistanceCodes
#else
public uint[]? DistanceCodes
#endif
{
get
{
@@ -82,12 +90,20 @@ namespace SabreTools.Models.Compression.MSZIP
/// <summary>
/// Huffman code lengths for the literal / length alphabet
/// </summary>
#if NET48
private uint[] _literalLengths = null;
#else
private uint[]? _literalLengths = null;
#endif
/// <summary>
/// Huffman distance codes for the literal / length alphabet
/// </summary>
#if NET48
private uint[] _distanceCodes = null;
#else
private uint[]? _distanceCodes = null;
#endif
#endregion
}

View File

@@ -8,8 +8,16 @@ namespace SabreTools.Models.Compression.Quantum
public int Entries;
#if NET48
public ModelSymbol[] Symbols;
#else
public ModelSymbol[]? Symbols;
#endif
#if NET48
public ushort[] LookupTable = new ushort[256];
#else
public ushort[]? LookupTable = new ushort[256];
#endif
}
}