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

Function ListFile_OpenExternal

src/External/CascLib/src/common/ListFile.cpp:126–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124// Functions for parsing an external listfile
125
126void * ListFile_OpenExternal(LPCTSTR szListFile)
127{
128 PLISTFILE_CACHE pCache = NULL;
129 TFileStream * pStream;
130 ULONGLONG FileSize = 0;
131
132 // Open the external listfile
133 pStream = FileStream_OpenFile(szListFile, STREAM_FLAG_READ_ONLY);
134 if(pStream != NULL)
135 {
136 // Retrieve the size of the external listfile
137 FileStream_GetSize(pStream, &FileSize);
138 if(0 < FileSize && FileSize <= 0x30000000)
139 {
140 // Create the in-memory cache for the entire listfile
141 // The listfile does not have any data loaded yet
142 pCache = ListFile_CreateCache((DWORD)FileSize);
143 if(pCache != NULL)
144 {
145 if(FileStream_Read(pStream, NULL, pCache->pBegin, (DWORD)FileSize))
146 {
147 ListFile_CheckFormat(pCache);
148 }
149 else
150 {
151 CASC_FREE(pCache);
152 }
153 }
154 }
155
156 // Close the file stream
157 FileStream_Close(pStream);
158 }
159
160 return pCache;
161}
162
163void * ListFile_FromBuffer(LPBYTE pbBuffer, DWORD cbBuffer)
164{

Callers 2

DoStorageSearchFunction · 0.85
FetchAndLoadConfigFileFunction · 0.85

Calls 7

FileStream_OpenFileFunction · 0.85
FileStream_GetSizeFunction · 0.85
ListFile_CreateCacheFunction · 0.85
FileStream_ReadFunction · 0.85
ListFile_CheckFormatFunction · 0.85
CASC_FREEFunction · 0.85
FileStream_CloseFunction · 0.85

Tested by

no test coverage detected