MCPcopy Create free account
hub / github.com/Scobalula/Greyhound / CopyCKeyEntryToFindData

Function CopyCKeyEntryToFindData

src/External/CascLib/src/CascFindFile.cpp:65–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65static bool CopyCKeyEntryToFindData(PCASC_FIND_DATA pFindData, PCASC_CKEY_ENTRY pCKeyEntry)
66{
67 ULONGLONG ContentSize = 0;
68 ULONGLONG EncodedSize = 0;
69
70 // Supply both keys
71 CopyMemory16(pFindData->CKey, pCKeyEntry->CKey);
72 CopyMemory16(pFindData->EKey, pCKeyEntry->EKey);
73
74 // Supply the tag mask
75 pFindData->TagBitMask = pCKeyEntry->TagBitMask;
76
77 // Supply the plain name. Only do that if the found name is not a CKey/EKey
78 if(pFindData->szFileName[0] != 0)
79 pFindData->szPlainName = (char *)GetPlainFileName(pFindData->szFileName);
80
81 // If we retrieved the file size directly from the root provider, use it
82 // Otherwise, supply EncodedSize or ContentSize, whichever is available (but ContentSize > EncodedSize)
83 pFindData->dwSpanCount = GetFileSpanInfo(pCKeyEntry, &ContentSize, &EncodedSize);
84 if(pFindData->FileSize == CASC_INVALID_SIZE64)
85 {
86 if(ContentSize != CASC_INVALID_SIZE64)
87 pFindData->FileSize = ContentSize;
88 else
89 pFindData->FileSize = EncodedSize;
90 }
91
92 // Set flag indicating that the file is locally available
93 pFindData->bFileAvailable = (pCKeyEntry->Flags & CASC_CE_FILE_IS_LOCAL);
94
95 // Supply a fake file name, if there is none supplied by the root handler
96 if(pFindData->szFileName[0] == 0)
97 SupplyFakeFileName(pFindData, pCKeyEntry);
98 return true;
99}
100
101// Perform searching using root-specific provider.
102// The provider may need the listfile

Callers 2

DoStorageSearch_RootFileFunction · 0.85
DoStorageSearch_CKeyFunction · 0.85

Calls 4

CopyMemory16Function · 0.85
GetPlainFileNameFunction · 0.85
SupplyFakeFileNameFunction · 0.85
GetFileSpanInfoFunction · 0.70

Tested by

no test coverage detected