Actually init arrays.

This commit is contained in:
Sławomir Śpiewak 2024-08-05 15:17:26 +02:00
parent ab67cb5187
commit 071a33eb94
2 changed files with 9 additions and 2 deletions

View File

@ -147,7 +147,7 @@ namespace GameRes.Formats.DxLib
byte[] huffmanBuffer = new byte[headerBuffer.Length]; byte[] huffmanBuffer = new byte[headerBuffer.Length];
byte[] lzBuffer; byte[] lzBuffer;
headerBuffer.CopyTo(huffmanBuffer, 0); headerBuffer.CopyTo(huffmanBuffer, 0);
huffmanBuffer = headerBuffer; //huffmanBuffer = headerBuffer;
HuffmanDecoder decoder = new HuffmanDecoder(huffmanBuffer, (ulong)huffmanBuffer.LongLength); HuffmanDecoder decoder = new HuffmanDecoder(huffmanBuffer, (ulong)huffmanBuffer.LongLength);
lzBuffer = decoder.Unpack(); lzBuffer = decoder.Unpack();
MemoryStream lzStream = new MemoryStream(lzBuffer); MemoryStream lzStream = new MemoryStream(lzBuffer);

View File

@ -35,7 +35,7 @@ using GameRes.Utility;
namespace GameRes.Formats.DxLib namespace GameRes.Formats.DxLib
{ {
internal struct DXA8HuffmanNode internal class DXA8HuffmanNode
{ {
public UInt64 Weight; public UInt64 Weight;
public int bitNumber; public int bitNumber;
@ -44,6 +44,13 @@ namespace GameRes.Formats.DxLib
public int ParentNode; // index of parent node. public int ParentNode; // index of parent node.
public int[] ChildNode; //two children nodes, -1 if not existent. public int[] ChildNode; //two children nodes, -1 if not existent.
DXA8HuffmanNode()
{
bitArray = new byte[32];
ChildNode = new int[2];
}
} }
internal sealed class HuffmanDecoder internal sealed class HuffmanDecoder