mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-24 07:54:39 +00:00
unrar5: unpack wip
This commit is contained in:
@@ -637,7 +637,7 @@ bool ReadTables(BitInput Inp,ref UnpackBlockHeader Header, ref UnpackBlockTables
|
||||
BitLength[I]=(byte)Length;
|
||||
}
|
||||
|
||||
MakeDecodeTables(BitLength,Tables.BD,BC);
|
||||
MakeDecodeTables(BitLength,0,Tables.BD,BC);
|
||||
|
||||
byte[] Table = new byte[HUFF_TABLE_SIZE];
|
||||
const uint TableSize=HUFF_TABLE_SIZE;
|
||||
@@ -702,10 +702,10 @@ bool ReadTables(BitInput Inp,ref UnpackBlockHeader Header, ref UnpackBlockTables
|
||||
TablesRead5=true;
|
||||
if (!Inp.ExternalBuffer && Inp.InAddr>ReadTop)
|
||||
return false;
|
||||
MakeDecodeTables(&Table[0],Tables.LD,NC);
|
||||
MakeDecodeTables(&Table[NC],Tables.DD,DC);
|
||||
MakeDecodeTables(&Table[NC+DC],Tables.LDD,LDC);
|
||||
MakeDecodeTables(&Table[NC+DC+LDC],Tables.RD,RC);
|
||||
MakeDecodeTables(Table, 0, Tables.LD,NC);
|
||||
MakeDecodeTables(Table, (int)NC,Tables.DD,DC);
|
||||
MakeDecodeTables(Table, (int)(NC+DC),Tables.LDD,LDC);
|
||||
MakeDecodeTables(Table, (int)(NC+DC+LDC),Tables.RD,RC);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ void UnpInitData(bool Solid)
|
||||
// LengthTable contains the length in bits for every element of alphabet.
|
||||
// Dec is the structure to decode Huffman code/
|
||||
// Size is size of length table and DecodeNum field in Dec structure,
|
||||
void MakeDecodeTables(byte[] LengthTable,DecodeTable Dec,uint Size)
|
||||
void MakeDecodeTables(byte[] LengthTable, int offset, DecodeTable Dec,uint Size)
|
||||
{
|
||||
// Size of alphabet and DecodePos array.
|
||||
Dec.MaxNum=Size;
|
||||
@@ -242,7 +242,7 @@ void MakeDecodeTables(byte[] LengthTable,DecodeTable Dec,uint Size)
|
||||
uint[] LengthCount = new uint[16];
|
||||
//memset(LengthCount,0,sizeof(LengthCount));
|
||||
for (size_t I=0;I<Size;I++)
|
||||
LengthCount[LengthTable[I] & 0xf]++;
|
||||
LengthCount[LengthTable[offset+I] & 0xf]++;
|
||||
|
||||
// We must not calculate the number of zero length codes.
|
||||
LengthCount[0]=0;
|
||||
@@ -289,7 +289,7 @@ void MakeDecodeTables(byte[] LengthTable,DecodeTable Dec,uint Size)
|
||||
for (uint I=0;I<Size;I++)
|
||||
{
|
||||
// Get the current bit length.
|
||||
byte _CurBitLength=(byte)(LengthTable[I] & 0xf);
|
||||
byte _CurBitLength=(byte)(LengthTable[offset+I] & 0xf);
|
||||
|
||||
if (_CurBitLength!=0)
|
||||
{
|
||||
|
||||
@@ -14,6 +14,10 @@ using System.Collections.Generic;
|
||||
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
|
||||
using static SharpCompress.Compressors.Rar.UnpackV2017.UnpackGlobal;
|
||||
|
||||
// TODO: REMOVE THIS... WIP
|
||||
#pragma warning disable 169
|
||||
#pragma warning disable 414
|
||||
|
||||
namespace SharpCompress.Compressors.Rar.UnpackV2017
|
||||
{
|
||||
internal static class UnpackGlobal
|
||||
|
||||
Reference in New Issue
Block a user