IsFileExtension(): Review issue with no-extension files

This commit is contained in:
Ray 2020-01-12 13:56:03 +01:00
parent a748c3bf25
commit 22b7713287

View file

@ -1834,15 +1834,15 @@ bool IsFileExtension(const char *fileName, const char *ext)
{ {
bool result = false; bool result = false;
const char *fileExt = GetExtension(fileName); const char *fileExt = GetExtension(fileName);
char fileExtLower[16] = { 0 };
strcpy(fileExtLower, TextToLower(fileExt));
if (fileExt != NULL) if (fileExt != NULL)
{ {
int extCount = 0; int extCount = 0;
const char **checkExts = TextSplit(ext, ';', &extCount); const char **checkExts = TextSplit(ext, ';', &extCount);
char fileExtLower[16] = { 0 };
strcpy(fileExtLower, TextToLower(fileExt));
for (int i = 0; i < extCount; i++) for (int i = 0; i < extCount; i++)
{ {
if (TextIsEqual(fileExtLower, TextToLower(checkExts[i] + 1))) if (TextIsEqual(fileExtLower, TextToLower(checkExts[i] + 1)))