Browse Source

Fixed parsing bug/behavior.

release/0.19
JustinAJ 11 years ago
parent
commit
e410038a42
  1. 36
      Jupiter/Functions.c

36
Jupiter/Functions.c

@ -234,7 +234,14 @@ bool strmatch(const char *f, const char *s)
if (*f == '*') if (*f == '*')
{ {
f++; f++;
while (*f == '?')
{
if (*s == 0) return false;
f++;
s++;
}
if (*f == 0) return true; if (*f == 0) return true;
if (*f == '*') continue;
while (*f != *s) while (*f != *s)
{ {
if (*s == 0) return false; if (*s == 0) return false;
@ -245,7 +252,7 @@ bool strmatch(const char *f, const char *s)
f++; f++;
s++; s++;
} }
return *f == *s; return *s == 0;
} }
bool strmatchi(const char *f, const char *s) bool strmatchi(const char *f, const char *s)
@ -256,7 +263,14 @@ bool strmatchi(const char *f, const char *s)
if (*f == '*') if (*f == '*')
{ {
f++; f++;
while (*f == '?')
{
if (*s == 0) return false;
f++;
s++;
}
if (*f == 0) return true; if (*f == 0) return true;
if (*f == '*') continue;
fUpper = toupper(*f); fUpper = toupper(*f);
while (fUpper != toupper(*s)) while (fUpper != toupper(*s))
{ {
@ -268,7 +282,7 @@ bool strmatchi(const char *f, const char *s)
f++; f++;
s++; s++;
} }
return *f == *s; return *s == 0;
} }
bool wstrmatch(const wchar_t *f, const wchar_t *s) bool wstrmatch(const wchar_t *f, const wchar_t *s)
@ -278,7 +292,14 @@ bool wstrmatch(const wchar_t *f, const wchar_t *s)
if (*f == L'*') if (*f == L'*')
{ {
f++; f++;
while (*f == L'?')
{
if (*s == 0) return false;
f++;
s++;
}
if (*f == 0) return true; if (*f == 0) return true;
if (*f == L'*') continue;
while (*f != *s) while (*f != *s)
{ {
if (*s == 0) return false; if (*s == 0) return false;
@ -289,7 +310,7 @@ bool wstrmatch(const wchar_t *f, const wchar_t *s)
f++; f++;
s++; s++;
} }
return *f == *s; return *s == 0;
} }
bool wstrmatchi(const wchar_t *f, const wchar_t *s) bool wstrmatchi(const wchar_t *f, const wchar_t *s)
@ -300,7 +321,14 @@ bool wstrmatchi(const wchar_t *f, const wchar_t *s)
if (*f == L'*') if (*f == L'*')
{ {
f++; f++;
while (*f == L'?')
{
if (*s == 0) return false;
f++;
s++;
}
if (*f == 0) return true; if (*f == 0) return true;
if (*f == L'*') continue;
fUpper = towupper(*f); fUpper = towupper(*f);
while (fUpper != towupper(*s)) while (fUpper != towupper(*s))
{ {
@ -312,7 +340,7 @@ bool wstrmatchi(const wchar_t *f, const wchar_t *s)
f++; f++;
s++; s++;
} }
return *f == *s; return *s == 0;
} }
char *charToChar(const char *a, int b, int c) char *charToChar(const char *a, int b, int c)

Loading…
Cancel
Save