MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / Unpack29

Method Unpack29

Libraries/unrar/unpack30.cpp:16–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14
15
16void Unpack::Unpack29(bool Solid)
17{
18 static unsigned char LDecode[]={0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224};
19 static unsigned char LBits[]= {0,0,0,0,0,0,0,0,1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5};
20 static int DDecode[DC];
21 static byte DBits[DC];
22 static int DBitLengthCounts[]= {4,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,14,0,12};
23 static unsigned char SDDecode[]={0,4,8,16,32,64,128,192};
24 static unsigned char SDBits[]= {2,2,3, 4, 5, 6, 6, 6};
25 unsigned int Bits;
26
27 if (DDecode[1]==0)
28 {
29 int Dist=0,BitLength=0,Slot=0;
30 for (int I=0;I<ASIZE(DBitLengthCounts);I++,BitLength++)
31 for (int J=0;J<DBitLengthCounts[I];J++,Slot++,Dist+=(1<<BitLength))
32 {
33 DDecode[Slot]=Dist;
34 DBits[Slot]=BitLength;
35 }
36 }
37
38 FileExtracted=true;
39
40 if (!Suspended)
41 {
42 UnpInitData(Solid);
43 if (!UnpReadBuf30())
44 return;
45 if ((!Solid || !TablesRead3) && !ReadTables30())
46 return;
47 }
48
49 while (true)
50 {
51 UnpPtr&=MaxWinMask;
52
53 if (Inp.InAddr>ReadBorder)
54 {
55 if (!UnpReadBuf30())
56 break;
57 }
58 if (((WrPtr-UnpPtr) & MaxWinMask)<260 && WrPtr!=UnpPtr)
59 {
60 UnpWriteBuf30();
61 if (WrittenFileSize>DestUnpSize)
62 return;
63 if (Suspended)
64 {
65 FileExtracted=false;
66 return;
67 }
68 }
69 if (UnpBlockType==BLOCK_PPM)
70 {
71 // Here speed is critical, so we do not use SafePPMDecodeChar,
72 // because sometimes even the inline function can introduce
73 // some additional penalty.

Callers

nothing calls this directly

Calls 4

DecodeCharMethod · 0.80
CleanUpMethod · 0.80
getbitsMethod · 0.80
addbitsMethod · 0.80

Tested by

no test coverage detected