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

Function LoadVfsRootEntry

src/External/CascLib/src/CascFiles.cpp:455–495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

453}
454
455static DWORD LoadVfsRootEntry(TCascStorage * hs, const char * szVariableName, const char * szDataPtr, const char * szDataEnd, void * pvParam)
456{
457 PCASC_CKEY_ENTRY pCKeyEntry;
458 CASC_ARRAY * pArray = (CASC_ARRAY *)pvParam;
459 const char * szVarPtr = szVariableName;
460 const char * szVarEnd = szVarPtr + strlen(szVarPtr);
461 DWORD VfsRootIndex = CASC_INVALID_INDEX;
462
463 // Skip the "vfs-" part
464 if(!strncmp(szVariableName, "vfs-", 4))
465 {
466 // Then, there must be a decimal number as index
467 if((szVarPtr = CaptureDecimalInteger(szVarPtr + 4, szVarEnd, &VfsRootIndex)) != NULL)
468 {
469 // We expect the array to be initialized
470 assert(pArray->IsInitialized());
471
472 // The index of the key must not be NULL
473 if(VfsRootIndex != 0)
474 {
475 // Make sure that he entry is in the array
476 pCKeyEntry = (PCASC_CKEY_ENTRY)pArray->ItemAt(VfsRootIndex - 1);
477 if(pCKeyEntry == NULL)
478 {
479 // Insert a new entry
480 pCKeyEntry = (PCASC_CKEY_ENTRY)pArray->InsertAt(VfsRootIndex - 1);
481 if(pCKeyEntry == NULL)
482 return ERROR_NOT_ENOUGH_MEMORY;
483
484 // Initialize the new entry
485 pCKeyEntry->Init();
486 }
487
488 // Call just a normal parse function
489 return LoadCKeyEntry(hs, szVariableName, szDataPtr, szDataEnd, pCKeyEntry);
490 }
491 }
492 }
493
494 return ERROR_SUCCESS;
495}
496
497static DWORD LoadBuildProductId(TCascStorage * hs, const char * /* szVariableName */, const char * szDataBegin, const char * szDataEnd, void * /* pvParam */)
498{

Callers

nothing calls this directly

Calls 6

CaptureDecimalIntegerFunction · 0.85
LoadCKeyEntryFunction · 0.85
IsInitializedMethod · 0.45
ItemAtMethod · 0.45
InsertAtMethod · 0.45
InitMethod · 0.45

Tested by

no test coverage detected