MCPcopy Create free account
hub / github.com/diasurgical/devilution / CheckWildCard

Function CheckWildCard

3rdParty/StormLib/src/SFileFindFile.cpp:42–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42bool CheckWildCard(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 szWildCardPtr++;
65
66 if(szWildCardPtr[0] == '*')
67 continue;
68
69 if(szWildCardPtr[0] == 0)
70 return true;
71
72 if(AsciiToUpperTable[szWildCardPtr[0]] == AsciiToUpperTable[szString[0]])
73 {
74 if(CheckWildCard(szString, szWildCardPtr))
75 return true;
76 }
77 }
78 else
79 {
80 if(AsciiToUpperTable[szWildCardPtr[0]] != AsciiToUpperTable[szString[0]])
81 return false;
82
83 szWildCard = szWildCardPtr + 1;
84 }
85
86 if(szString[0] == 0)
87 return false;
88 szString++;
89 }
90 else
91 {
92 return (szString[0] == 0) ? true : false;
93 }
94 }
95}
96
97static DWORD GetSearchTableItems(TMPQArchive * ha)
98{

Callers 1

DoMPQSearch_FileEntryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected