mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-22 15:04:43 +00:00
rar5: unpack wip
This commit is contained in:
@@ -303,7 +303,7 @@ void UnpInitData20(bool Solid)
|
||||
UnpChannels=1;
|
||||
|
||||
memset(AudV,0,sizeof(AudV));
|
||||
memset(UnpOldTable20,0,sizeof(UnpOldTable20));
|
||||
Utility.Memset(UnpOldTable20, 0, UnpOldTable20.Length);
|
||||
memset(MD,0,sizeof(MD));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -766,7 +766,7 @@ void UnpInitData30(bool Solid)
|
||||
if (!Solid)
|
||||
{
|
||||
TablesRead3=false;
|
||||
Utility.Memset(UnpOldTable,0,(uint)UnpOldTable.Length);
|
||||
Utility.Memset(UnpOldTable, 0, UnpOldTable.Length);
|
||||
PPMEscChar=2;
|
||||
UnpBlockType=BLOCK_LZ;
|
||||
}
|
||||
@@ -778,16 +778,19 @@ void InitFilters30(bool Solid)
|
||||
{
|
||||
if (!Solid)
|
||||
{
|
||||
OldFilterLengths.SoftReset();
|
||||
//OldFilterLengths.SoftReset();
|
||||
OldFilterLengths.Clear();
|
||||
LastFilter=0;
|
||||
|
||||
for (size_t I=0;I<Filters30.Count;I++)
|
||||
delete Filters30[I];
|
||||
Filters30.SoftReset();
|
||||
//for (size_t I=0;I<Filters30.Count;I++)
|
||||
// delete Filters30[I];
|
||||
//Filters30.SoftReset();
|
||||
Filters30.Clear();
|
||||
}
|
||||
for (size_t I=0;I<PrgStack.Count;I++)
|
||||
delete PrgStack[I];
|
||||
PrgStack.SoftReset();
|
||||
//for (size_t I=0;I<PrgStack.Count;I++)
|
||||
// delete PrgStack[I];
|
||||
//PrgStack.SoftReset();
|
||||
PrgStack.Clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -703,7 +703,8 @@ bool ReadTables(BitInput Inp,UnpackBlockHeader &Header,UnpackBlockTables &Tables
|
||||
|
||||
void InitFilters()
|
||||
{
|
||||
Filters.SoftReset();
|
||||
//Filters.SoftReset();
|
||||
Filters.Clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ public Unpack(/* ComprDataIO *DataIO */)
|
||||
//:Inp(true),VMCodeInp(true)
|
||||
: base(true)
|
||||
{
|
||||
VMCodeInp = new BitInput(true);
|
||||
UnpIO=DataIO;
|
||||
Window=null;
|
||||
Fragmented=false;
|
||||
@@ -198,7 +197,7 @@ void UnpInitData(bool Solid)
|
||||
{
|
||||
if (!Solid)
|
||||
{
|
||||
memset(OldDist,0,sizeof(OldDist));
|
||||
Utility.Memset<uint>(this.OldDist, 0, this.OldDist.Length);
|
||||
OldDistPtr=0;
|
||||
LastDist=LastLength=0;
|
||||
// memset(Window,0,MaxWinSize);
|
||||
|
||||
@@ -264,13 +264,14 @@ internal partial class Unpack
|
||||
byte *ReadBufMT;
|
||||
#endif
|
||||
|
||||
List<byte> FilterSrcMemory = new List<byte>();
|
||||
List<byte> FilterDstMemory = new List<byte>();
|
||||
readonly List<byte> FilterSrcMemory = new List<byte>();
|
||||
readonly List<byte> FilterDstMemory = new List<byte>();
|
||||
|
||||
// Filters code, one entry per filter.
|
||||
List<UnpackFilter> Filters = new List<UnpackFilter>();
|
||||
readonly List<UnpackFilter> Filters = new List<UnpackFilter>();
|
||||
|
||||
uint OldDist[4],OldDistPtr;
|
||||
readonly uint[] OldDist = new uint[4];
|
||||
uint OldDistPtr;
|
||||
uint LastLength;
|
||||
|
||||
// LastDist is necessary only for RAR2 and older with circular OldDist
|
||||
@@ -294,7 +295,7 @@ internal partial class Unpack
|
||||
|
||||
byte[] Window;
|
||||
|
||||
FragmentedWindow FragWindow = new FragmentedWindow();
|
||||
readonly FragmentedWindow FragWindow = new FragmentedWindow();
|
||||
bool Fragmented;
|
||||
|
||||
|
||||
@@ -331,7 +332,7 @@ internal partial class Unpack
|
||||
|
||||
DecodeTable MD[4]; // Decode multimedia data, up to 4 channels.
|
||||
|
||||
byte UnpOldTable20[MC20*4];
|
||||
readonly byte[] UnpOldTable20 = new byte[MC20*4];
|
||||
bool UnpAudioBlock;
|
||||
uint UnpChannels,UnpCurChannel;
|
||||
int UnpChannelDelta;
|
||||
@@ -381,18 +382,18 @@ internal partial class Unpack
|
||||
|
||||
// Buffer to read VM filters code. We moved it here from AddVMCode
|
||||
// function to reduce time spent in BitInput constructor.
|
||||
BitInput VMCodeInp;
|
||||
readonly BitInput VMCodeInp = new BitInput(true);
|
||||
|
||||
// Filters code, one entry per filter.
|
||||
List<UnpackFilter30> Filters30 = new List<UnpackFilter30>();
|
||||
readonly List<UnpackFilter30> Filters30 = new List<UnpackFilter30>();
|
||||
|
||||
// Filters stack, several entrances of same filter are possible.
|
||||
List<UnpackFilter30> PrgStack = new List<UnpackFilter30>();
|
||||
readonly List<UnpackFilter30> PrgStack = new List<UnpackFilter30>();
|
||||
|
||||
// Lengths of preceding data blocks, one length of one last block
|
||||
// for every filter. Used to reduce the size required to write
|
||||
// the data block length if lengths are repeating.
|
||||
List<int> OldFilterLengths = new List<int>();
|
||||
readonly List<int> OldFilterLengths = new List<int>();
|
||||
|
||||
int LastFilter;
|
||||
/***************************** Unpack v 3.0 *********************************/
|
||||
|
||||
@@ -115,6 +115,14 @@ namespace SharpCompress
|
||||
}
|
||||
#endif
|
||||
|
||||
public static void Memset<T>(T[] array, T what, int length)
|
||||
{
|
||||
for(var i = 0; i < length; i++)
|
||||
{
|
||||
array[i] = what;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Fills the array with an specific value.
|
||||
|
||||
Reference in New Issue
Block a user