| 562 | //========================================================================== |
| 563 | |
| 564 | int 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 | |
| 597 | int FileSystem::CheckNumForFullName (const char *name, int rfnum) const |
| 598 | { |
no test coverage detected