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

Method InitFileSpans

src/External/CascLib/src/CascOpenFile.cpp:117–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117void TCascFile::InitFileSpans(PCASC_FILE_SPAN pSpans, DWORD dwSpanCount)
118{
119 ULONGLONG FileOffsetBits = 30;
120 ULONGLONG FileOffsetMask = 0;
121 ULONGLONG FileOffset = 0;
122
123 // Initialize the file sizes. Note that if any of the spans has invalid size,
124 // the entire file size will be set to CASC_INVALID_SIZE64.
125 GetFileSpanInfo(pCKeyEntry, &ContentSize, &EncodedSize);
126
127 // Resolve the file offset bits and file offset mask
128 if(hs != NULL)
129 FileOffsetBits = hs->FileOffsetBits;
130 FileOffsetMask = ((ULONGLONG)1 << FileOffsetBits) - 1;
131
132 // Add all span sizes
133 for(DWORD i = 0; i < dwSpanCount; i++, pSpans++)
134 {
135 // Put the archive index and archive offset
136 pSpans->ArchiveIndex = (DWORD)(pCKeyEntry[i].StorageOffset >> FileOffsetBits);
137 pSpans->ArchiveOffs = (DWORD)(pCKeyEntry[i].StorageOffset & FileOffsetMask);
138
139 // Add to the total encoded size
140 if(ContentSize != CASC_INVALID_SIZE64)
141 {
142 pSpans->StartOffset = FileOffset;
143 FileOffset = FileOffset + pCKeyEntry[i].ContentSize;
144 pSpans->EndOffset = FileOffset;
145 }
146 }
147}
148
149void TCascFile::InitCacheStrategy()
150{

Callers

nothing calls this directly

Calls 1

GetFileSpanInfoFunction · 0.70

Tested by

no test coverage detected