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

Method DecodeChar

Libraries/unrar/model.cpp:600–639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

598
599
600int ModelPPM::DecodeChar()
601{
602 if ((byte*)MinContext <= SubAlloc.pText || (byte*)MinContext>SubAlloc.HeapEnd)
603 return(-1);
604 if (MinContext->NumStats != 1)
605 {
606 if ((byte*)MinContext->U.Stats <= SubAlloc.pText || (byte*)MinContext->U.Stats>SubAlloc.HeapEnd)
607 return(-1);
608 if (!MinContext->decodeSymbol1(this))
609 return(-1);
610 }
611 else
612 MinContext->decodeBinSymbol(this);
613 Coder.Decode();
614 while ( !FoundState )
615 {
616 ARI_DEC_NORMALIZE(Coder.code,Coder.low,Coder.range,Coder.UnpackRead);
617 do
618 {
619 OrderFall++;
620 MinContext=MinContext->Suffix;
621 if ((byte*)MinContext <= SubAlloc.pText || (byte*)MinContext>SubAlloc.HeapEnd)
622 return(-1);
623 } while (MinContext->NumStats == NumMasked);
624 if (!MinContext->decodeSymbol2(this))
625 return(-1);
626 Coder.Decode();
627 }
628 int Symbol=FoundState->Symbol;
629 if (!OrderFall && (byte*) FoundState->Successor > SubAlloc.pText)
630 MinContext=MaxContext=FoundState->Successor;
631 else
632 {
633 UpdateModel();
634 if (EscCount == 0)
635 ClearMask();
636 }
637 ARI_DEC_NORMALIZE(Coder.code,Coder.low,Coder.range,Coder.UnpackRead);
638 return(Symbol);
639}

Callers 2

SafePPMDecodeCharMethod · 0.80
Unpack29Method · 0.80

Calls 4

decodeSymbol1Method · 0.80
decodeBinSymbolMethod · 0.80
decodeSymbol2Method · 0.80
DecodeMethod · 0.45

Tested by

no test coverage detected