MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / Decode

Function Decode

BaseTools/Source/C/Common/Decompress.c:595–670  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

593}
594
595STATIC
596VOID
597Decode (
598 SCRATCH_DATA *Sd
599 )
600/*++
601
602Routine Description:
603
604 Decode the source data and put the resulting data into the destination buffer.
605
606Arguments:
607
608 Sd - The global scratch data
609
610Returns: (VOID)
611
612 --*/
613{
614 UINT16 BytesRemain;
615 UINT32 DataIdx;
616 UINT16 CharC;
617
618 BytesRemain = (UINT16) (-1);
619
620 DataIdx = 0;
621
622 for (;;) {
623 CharC = DecodeC (Sd);
624 if (Sd->mBadTableFlag != 0) {
625 return ;
626 }
627
628 if (CharC < 256) {
629 //
630 // Process an Original character
631 //
632 Sd->mDstBase[Sd->mOutBuf++] = (UINT8) CharC;
633 if (Sd->mOutBuf >= Sd->mOrigSize) {
634 return ;
635 }
636
637 } else {
638 //
639 // Process a Pointer
640 //
641 CharC = (UINT16) (CharC - (UINT8_MAX + 1 - THRESHOLD));
642
643 BytesRemain = CharC;
644
645 DataIdx = Sd->mOutBuf - DecodeP (Sd) - 1;
646
647 BytesRemain--;
648 while ((INT16) (BytesRemain) >= 0) {
649 if (Sd->mOutBuf >= Sd->mOrigSize) {
650 return ;
651 }
652 if (DataIdx >= Sd->mOrigSize) {

Callers 2

DecompressFunction · 0.70
TianoCompress.cFile · 0.50

Calls 2

DecodeCFunction · 0.70
DecodePFunction · 0.70

Tested by

no test coverage detected