| 1 | void Unpack::Unpack5(bool Solid) |
| 2 | { |
| 3 | FileExtracted=true; |
| 4 | |
| 5 | if (!Suspended) |
| 6 | { |
| 7 | UnpInitData(Solid); |
| 8 | if (!UnpReadBuf()) |
| 9 | return; |
| 10 | |
| 11 | // Check TablesRead5 to be sure that we read tables at least once |
| 12 | // regardless of current block header TablePresent flag. |
| 13 | // So we can safefly use these tables below. |
| 14 | if (!ReadBlockHeader(Inp,BlockHeader) || |
| 15 | !ReadTables(Inp,BlockHeader,BlockTables) || !TablesRead5) |
| 16 | return; |
| 17 | } |
| 18 | |
| 19 | while (true) |
| 20 | { |
| 21 | UnpPtr&=MaxWinMask; |
| 22 | |
| 23 | if (Inp.InAddr>=ReadBorder) |
| 24 | { |
| 25 | bool FileDone=false; |
| 26 | |
| 27 | // We use 'while', because for empty block containing only Huffman table, |
| 28 | // we'll be on the block border once again just after reading the table. |
| 29 | while (Inp.InAddr>BlockHeader.BlockStart+BlockHeader.BlockSize-1 || |
| 30 | Inp.InAddr==BlockHeader.BlockStart+BlockHeader.BlockSize-1 && |
| 31 | Inp.InBit>=BlockHeader.BlockBitSize) |
| 32 | { |
| 33 | if (BlockHeader.LastBlockInFile) |
| 34 | { |
| 35 | FileDone=true; |
| 36 | break; |
| 37 | } |
| 38 | if (!ReadBlockHeader(Inp,BlockHeader) || !ReadTables(Inp,BlockHeader,BlockTables)) |
| 39 | return; |
| 40 | } |
| 41 | if (FileDone || !UnpReadBuf()) |
| 42 | break; |
| 43 | } |
| 44 | |
| 45 | if (((WriteBorder-UnpPtr) & MaxWinMask)<MAX_INC_LZ_MATCH && WriteBorder!=UnpPtr) |
| 46 | { |
| 47 | UnpWriteBuf(); |
| 48 | if (WrittenFileSize>DestUnpSize) |
| 49 | return; |
| 50 | if (Suspended) |
| 51 | { |
| 52 | FileExtracted=false; |
| 53 | return; |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | uint MainSlot=DecodeNumber(Inp,&BlockTables.LD); |
| 58 | if (MainSlot<256) |
| 59 | { |
| 60 | if (Fragmented) |
nothing calls this directly
no test coverage detected