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

Function Extract

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

Source from the content-addressed store, hash-verified

942}
943
944EFI_STATUS
945Extract (
946 IN VOID *Source,
947 IN UINT32 SrcSize,
948 OUT VOID **Destination,
949 OUT UINT32 *DstSize,
950 IN UINTN Algorithm
951 )
952{
953 VOID *Scratch;
954 UINT32 ScratchSize;
955 EFI_STATUS Status;
956
957 Scratch = NULL;
958 Status = EFI_SUCCESS;
959
960 switch (Algorithm) {
961 case 0:
962 *Destination = (VOID *)malloc(SrcSize);
963 if (*Destination != NULL) {
964 memcpy(*Destination, Source, SrcSize);
965 } else {
966 Status = EFI_OUT_OF_RESOURCES;
967 }
968 break;
969 case 1:
970 Status = EfiGetInfo(Source, SrcSize, DstSize, &ScratchSize);
971 if (Status == EFI_SUCCESS) {
972 Scratch = (VOID *)malloc(ScratchSize);
973 if (Scratch == NULL) {
974 return EFI_OUT_OF_RESOURCES;
975 }
976
977 *Destination = (VOID *)malloc(*DstSize);
978 if (*Destination == NULL) {
979 free (Scratch);
980 return EFI_OUT_OF_RESOURCES;
981 }
982
983 Status = EfiDecompress(Source, SrcSize, *Destination, *DstSize, Scratch, ScratchSize);
984 }
985 break;
986 case 2:
987 Status = TianoGetInfo(Source, SrcSize, DstSize, &ScratchSize);
988 if (Status == EFI_SUCCESS) {
989 Scratch = (VOID *)malloc(ScratchSize);
990 if (Scratch == NULL) {
991 return EFI_OUT_OF_RESOURCES;
992 }
993
994 *Destination = (VOID *)malloc(*DstSize);
995 if (*Destination == NULL) {
996 free (Scratch);
997 return EFI_OUT_OF_RESOURCES;
998 }
999
1000 Status = TianoDecompress(Source, SrcSize, *Destination, *DstSize, Scratch, ScratchSize);
1001 }

Callers 3

TianoCompress.cFile · 0.85
UefiDecompressFunction · 0.85
FrameworkDecompressFunction · 0.85

Calls 7

EfiGetInfoFunction · 0.70
EfiDecompressFunction · 0.70
TianoGetInfoFunction · 0.70
TianoDecompressFunction · 0.70
mallocFunction · 0.50
memcpyFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected