| 397 | |
| 398 | |
| 399 | void Unpack::GetFlagsBuf() |
| 400 | { |
| 401 | unsigned int Flags,NewFlagsPlace; |
| 402 | unsigned int FlagsPlace=DecodeNum(Inp.fgetbits(),STARTHF2,DecHf2,PosHf2); |
| 403 | |
| 404 | // Our Huffman table stores 257 items and needs all them in other parts |
| 405 | // of code such as when StMode is on, so the first item is control item. |
| 406 | // While normally we do not use the last item to code the flags byte here, |
| 407 | // we need to check for value 256 when unpacking in case we unpack |
| 408 | // a corrupt archive. |
| 409 | if (FlagsPlace>=sizeof(ChSetC)/sizeof(ChSetC[0])) |
| 410 | return; |
| 411 | |
| 412 | while (1) |
| 413 | { |
| 414 | Flags=ChSetC[FlagsPlace]; |
| 415 | FlagBuf=Flags>>8; |
| 416 | NewFlagsPlace=NToPlC[Flags++ & 0xff]++; |
| 417 | if ((Flags & 0xff) != 0) |
| 418 | break; |
| 419 | CorrHuff(ChSetC,NToPlC); |
| 420 | } |
| 421 | |
| 422 | ChSetC[FlagsPlace]=ChSetC[NewFlagsPlace]; |
| 423 | ChSetC[NewFlagsPlace]=Flags; |
| 424 | } |
| 425 | |
| 426 | |
| 427 | void Unpack::UnpInitData15(int Solid) |