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

Function ListFile_GetNext

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

Source from the content-addressed store, hash-verified

252}
253
254size_t ListFile_GetNext(void * pvListFile, char * szBuffer, size_t nMaxChars, PDWORD PtrFileDataId)
255{
256 PLISTFILE_CACHE pCache = (PLISTFILE_CACHE)pvListFile;
257 const char * szTemp;
258 size_t nLength = 0;
259 DWORD dwErrCode = ERROR_SUCCESS;
260
261 // Check for parameters
262 for(;;)
263 {
264 DWORD FileDataId = CASC_INVALID_ID;
265
266 // If this is a CSV-format listfile, we need to extract the FileDataId
267 // Lines that contain bogus data, invalid numbers or too big values will be skipped
268 if(pCache->Flags & LISTFILE_FLAG_USES_FILEDATAID)
269 {
270 // Retrieve the data ID from the current position
271 dwErrCode = ListFile_GetFileDataId(pCache, &FileDataId);
272 if(dwErrCode == ERROR_NO_MORE_FILES)
273 break;
274
275 // If there was an error, skip the current line
276 if(dwErrCode != ERROR_SUCCESS || FileDataId == CASC_INVALID_ID)
277 {
278 ListFile_GetNextLine(pvListFile, &szTemp, &szTemp);
279 continue;
280 }
281 }
282
283 // Read the (next) line
284 nLength = ListFile_GetNextLine(pvListFile, szBuffer, nMaxChars);
285 if(nLength == 0)
286 {
287 dwErrCode = GetCascError();
288 break;
289 }
290
291 // Give the file data id and return true
292 PtrFileDataId[0] = FileDataId;
293 return nLength;
294 }
295
296 if(dwErrCode != ERROR_SUCCESS)
297 SetCascError(dwErrCode);
298 return nLength;
299}
300
301LPBYTE ListFile_GetData(void * pvListFile, PDWORD PtrDataSize)
302{

Callers 1

SearchMethod · 0.85

Calls 4

ListFile_GetFileDataIdFunction · 0.85
ListFile_GetNextLineFunction · 0.85
GetCascErrorFunction · 0.85
SetCascErrorFunction · 0.85

Tested by

no test coverage detected