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

Method ProcessDecoded

Libraries/unrar/unpack50mt.cpp:448–515  ·  view source on GitHub ↗

Process decoded Huffman block data.

Source from the content-addressed store, hash-verified

446
447// Process decoded Huffman block data.
448bool Unpack::ProcessDecoded(UnpackThreadData &D)
449{
450 UnpackDecodedItem *Item=D.Decoded,*Border=D.Decoded+D.DecodedSize;
451 while (Item<Border)
452 {
453 UnpPtr&=MaxWinMask;
454 if (((WriteBorder-UnpPtr) & MaxWinMask)<MAX_INC_LZ_MATCH && WriteBorder!=UnpPtr)
455 {
456 UnpWriteBuf();
457 if (WrittenFileSize>DestUnpSize)
458 return false;
459 }
460
461 if (Item->Type==UNPDT_LITERAL)
462 {
463#if defined(LITTLE_ENDIAN) && defined(ALLOW_MISALIGNED)
464 if (Item->Length==3 && UnpPtr<MaxWinSize-4)
465 {
466 *(uint32 *)(Window+UnpPtr)=*(uint32 *)Item->Literal;
467 UnpPtr+=4;
468 }
469 else
470#endif
471 for (uint I=0;I<=Item->Length;I++)
472 Window[UnpPtr++ & MaxWinMask]=Item->Literal[I];
473 }
474 else
475 if (Item->Type==UNPDT_MATCH)
476 {
477 InsertOldDist(Item->Distance);
478 LastLength=Item->Length;
479 CopyString(Item->Length,Item->Distance);
480 }
481 else
482 if (Item->Type==UNPDT_REP)
483 {
484 uint Distance=OldDist[Item->Distance];
485 for (uint I=Item->Distance;I>0;I--)
486 OldDist[I]=OldDist[I-1];
487 OldDist[0]=Distance;
488 LastLength=Item->Length;
489 CopyString(Item->Length,Distance);
490 }
491 else
492 if (Item->Type==UNPDT_FULLREP)
493 {
494 if (LastLength!=0)
495 CopyString(LastLength,OldDist[0]);
496 }
497 else
498 if (Item->Type==UNPDT_FILTER)
499 {
500 UnpackFilter Filter;
501
502 Filter.Type=(byte)Item->Length;
503 Filter.BlockStart=Item->Distance;
504
505 Item++;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected