mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
Make fn_has_ext() case insensitive by default.
committer: mfx <mfx> 980609337 +0000
This commit is contained in:
parent
f300b31d8d
commit
34070f0b93
|
@ -212,7 +212,7 @@ char *fn_basename(const char *name)
|
|||
}
|
||||
|
||||
|
||||
bool fn_has_ext(const char *name, const char *ext)
|
||||
bool fn_has_ext(const char *name, const char *ext, bool ignore_case)
|
||||
{
|
||||
const char *n, *e;
|
||||
|
||||
|
@ -220,7 +220,10 @@ bool fn_has_ext(const char *name, const char *ext)
|
|||
for (n = e = name; *n; n++)
|
||||
if (*n == '.')
|
||||
e = n;
|
||||
return (fn_strcmp(ext,e+1) == 0);
|
||||
if (ignore_case)
|
||||
return (strcasecmp(ext,e+1) == 0);
|
||||
else
|
||||
return (fn_strcmp(ext,e+1) == 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ int upx_vsnprintf(char *str, long n, const char *format, va_list ap);
|
|||
char *fn_basename(const char *name);
|
||||
int fn_strcmp(const char *n1, const char *n2);
|
||||
char *fn_strlwr(char *n);
|
||||
bool fn_has_ext(const char *name, const char *ext);
|
||||
bool fn_has_ext(const char *name, const char *ext, bool ignore_case=true);
|
||||
|
||||
bool file_exists(const char *name);
|
||||
bool maketempname(char *ofilename, const char *ifilename,
|
||||
|
|
Loading…
Reference in New Issue
Block a user