MCPcopy Create free account
hub / github.com/Kenix3/libultraship / SFileCheckWildCard

Function SFileCheckWildCard

extern/StormLib/src/SFileFindFile.cpp:42–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42bool SFileCheckWildCard(const char * szString, const char * szWildCard)
43{
44 const char * szWildCardPtr;
45
46 for(;;)
47 {
48 // If there is '?' in the wildcard, we skip one char
49 while(szWildCard[0] == '?')
50 {
51 if(szString[0] == 0)
52 return false;
53
54 szWildCard++;
55 szString++;
56 }
57
58 // Handle '*'
59 szWildCardPtr = szWildCard;
60 if(szWildCardPtr[0] != 0)
61 {
62 if(szWildCardPtr[0] == '*')
63 {
64 while(szWildCardPtr[0] == '*')
65 szWildCardPtr++;
66
67 if(szWildCardPtr[0] == 0)
68 return true;
69
70 if(AsciiToUpperTable[szWildCardPtr[0]] == AsciiToUpperTable[szString[0]])
71 {
72 if(SFileCheckWildCard(szString, szWildCardPtr))
73 return true;
74 }
75 }
76 else
77 {
78 if(AsciiToUpperTable[szWildCardPtr[0]] != AsciiToUpperTable[szString[0]])
79 return false;
80
81 szWildCard = szWildCardPtr + 1;
82 }
83
84 if(szString[0] == 0)
85 return false;
86 szString++;
87 }
88 else
89 {
90 return (szString[0] == 0) ? true : false;
91 }
92 }
93}
94
95static DWORD GetSearchTableItems(TMPQArchive * ha)
96{

Callers 3

DoListFileSearchFunction · 0.85
DoMPQSearch_FileEntryFunction · 0.85
FindLoadedFilesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected