mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Fix wildmatch(), resolves errors matching things like "*.zip" with "duke3d.hrp.zip" for example.
git-svn-id: https://svn.eduke32.com/eduke32@4922 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
4c883f81b6
commit
b3358a90b2
2 changed files with 30 additions and 8 deletions
|
@ -685,7 +685,6 @@ char *Bstrtolower(char *str)
|
||||||
|
|
||||||
|
|
||||||
//Brute-force case-insensitive, slash-insensitive, * and ? wildcard matcher
|
//Brute-force case-insensitive, slash-insensitive, * and ? wildcard matcher
|
||||||
//Given: string i and string j. string j can have wildcards
|
|
||||||
//Returns: 1:matches, 0:doesn't match
|
//Returns: 1:matches, 0:doesn't match
|
||||||
#ifndef WITHKPLIB
|
#ifndef WITHKPLIB
|
||||||
extern char toupperlookup[256];
|
extern char toupperlookup[256];
|
||||||
|
@ -703,14 +702,26 @@ static int32_t wildmatch(const char *match, const char *wild)
|
||||||
return 1;
|
return 1;
|
||||||
else if (*wild == '*')
|
else if (*wild == '*')
|
||||||
{
|
{
|
||||||
while (*wild == '*') wild++;
|
do { wild++; } while (*wild == '*');
|
||||||
if (*wild == '\0') return 1;
|
do
|
||||||
while (*match && toupperlookup[*match] != toupperlookup[*wild]) match++;
|
{
|
||||||
|
if (*wild == '\0')
|
||||||
|
return 1;
|
||||||
|
while (*match && toupperlookup[*match] != toupperlookup[*wild]) match++;
|
||||||
|
if (*match && *(match+1) && toupperlookup[*(match+1)] != toupperlookup[*(wild+1)])
|
||||||
|
{
|
||||||
|
match++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
while (1);
|
||||||
if (toupperlookup[*match] == toupperlookup[*wild])
|
if (toupperlookup[*match] == toupperlookup[*wild])
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} while (1);
|
}
|
||||||
|
while (1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -2419,9 +2419,20 @@ int32_t wildmatch(const char *match, const char *wild)
|
||||||
return 1;
|
return 1;
|
||||||
else if (*wild == '*')
|
else if (*wild == '*')
|
||||||
{
|
{
|
||||||
while (*wild == '*') wild++;
|
do { wild++; } while (*wild == '*');
|
||||||
if (*wild == '\0') return 1;
|
do
|
||||||
while (*match && toupperlookup[*match] != toupperlookup[*wild]) match++;
|
{
|
||||||
|
if (*wild == '\0')
|
||||||
|
return 1;
|
||||||
|
while (*match && toupperlookup[*match] != toupperlookup[*wild]) match++;
|
||||||
|
if (*match && *(match+1) && toupperlookup[*(match+1)] != toupperlookup[*(wild+1)])
|
||||||
|
{
|
||||||
|
match++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
while (1);
|
||||||
if (toupperlookup[*match] == toupperlookup[*wild])
|
if (toupperlookup[*match] == toupperlookup[*wild])
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue