| 18 | |
| 19 | |
| 20 | void Unpack::InitMT() |
| 21 | { |
| 22 | if (ReadBufMT==NULL) |
| 23 | { |
| 24 | // Even getbits32 can read up to 3 additional bytes after current |
| 25 | // and our block header and table reading code can look much further. |
| 26 | // Let's allocate the additional space here, so we do not need to check |
| 27 | // bounds for every bit field access. |
| 28 | const size_t Overflow=1024; |
| 29 | |
| 30 | ReadBufMT=new byte[UNP_READ_SIZE_MT+Overflow]; |
| 31 | memset(ReadBufMT,0,UNP_READ_SIZE_MT+Overflow); |
| 32 | } |
| 33 | if (UnpThreadData==NULL) |
| 34 | { |
| 35 | uint MaxItems=MaxUserThreads*UNP_BLOCKS_PER_THREAD; |
| 36 | UnpThreadData=new UnpackThreadData[MaxItems]; |
| 37 | memset(UnpThreadData,0,sizeof(UnpackThreadData)*MaxItems); |
| 38 | |
| 39 | for (uint I=0;I<MaxItems;I++) |
| 40 | { |
| 41 | UnpackThreadData *CurData=UnpThreadData+I; |
| 42 | if (CurData->Decoded==NULL) |
| 43 | { |
| 44 | // Typical number of items in RAR blocks does not exceed 0x4000. |
| 45 | CurData->DecodedAllocated=0x4100; |
| 46 | // It will be freed in the object destructor, not in this file. |
| 47 | CurData->Decoded=(UnpackDecodedItem *)malloc(CurData->DecodedAllocated*sizeof(UnpackDecodedItem)); |
| 48 | if (CurData->Decoded==NULL) |
| 49 | ErrHandler.MemoryError(); |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | |
| 56 | void Unpack::Unpack5MT(bool Solid) |
nothing calls this directly
no test coverage detected