MCPcopy Create free account
hub / github.com/ZDoom/Raze / CheckNumForFullName

Method CheckNumForFullName

source/common/filesystem/source/filesystem.cpp:564–595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

562//==========================================================================
563
564int FileSystem::CheckNumForFullName (const char *name, bool trynormal, int namespc, bool ignoreext) const
565{
566 uint32_t i;
567
568 if (name == NULL)
569 {
570 return -1;
571 }
572 if (*name == '/') name++; // ignore leading slashes in file names.
573 uint32_t *fli = ignoreext ? FirstLumpIndex_NoExt : FirstLumpIndex_FullName;
574 uint32_t *nli = ignoreext ? NextLumpIndex_NoExt : NextLumpIndex_FullName;
575 auto len = strlen(name);
576
577 for (i = fli[MakeHash(name) % NumEntries]; i != NULL_INDEX; i = nli[i])
578 {
579 if (strnicmp(name, FileInfo[i].LongName, len)) continue;
580 if (FileInfo[i].LongName[len] == 0) break; // this is a full match
581 if (ignoreext && FileInfo[i].LongName[len] == '.')
582 {
583 // is this the last '.' in the last path element, indicating that the remaining part of the name is only an extension?
584 if (strpbrk(FileInfo[i].LongName + len + 1, "./") == nullptr) break;
585 }
586 }
587
588 if (i != NULL_INDEX) return i;
589
590 if (trynormal && strlen(name) <= 8 && !strpbrk(name, "./"))
591 {
592 return CheckNumForName(name, namespc);
593 }
594 return -1;
595}
596
597int FileSystem::CheckNumForFullName (const char *name, int rfnum) const
598{

Callers 15

DefFileFunction · 0.80
ParseMapInfoMethod · 0.80
LookupMusicFunction · 0.80
RazeSoundEngineMethod · 0.80
ParseVavoomSkyboxFunction · 0.80
DoParseDefsMethod · 0.80
RunEndoomFunction · 0.80
C_SetDefaultKeysFunction · 0.80
OpenMethod · 0.80
SetupWgOpnFunction · 0.80
GetMIDISourceFunction · 0.80
FLumpPatchSetReaderMethod · 0.80

Calls 2

MakeHashFunction · 0.85
stricmpFunction · 0.85

Tested by

no test coverage detected