Only check if the directory is not empty, use strncasecmp for case insensitive comparing, and remove debug print

This commit is contained in:
Steel Titanium 2020-01-31 20:21:09 -05:00
parent 7c83e5e420
commit a2c15c5cb2
No known key found for this signature in database
GPG key ID: 924BA411F18DFDBE

View file

@ -1691,7 +1691,7 @@ W_VerifyName (const char *name, lumpchecklist_t *checklist, boolean status)
size_t j; size_t j;
for (j = 0; checklist[j].len && checklist[j].name; ++j) for (j = 0; checklist[j].len && checklist[j].name; ++j)
{ {
if (( strncmp(name, checklist[j].name, if (( strncasecmp(name, checklist[j].name,
checklist[j].len) != false ) == status) checklist[j].len) != false ) == status)
{ {
return true; return true;
@ -1803,20 +1803,13 @@ W_VerifyPK3 (FILE *fp, lumpchecklist_t *checklist, boolean status)
if (fgets(fullname, zentry.namelen + 1, fp) != fullname) if (fgets(fullname, zentry.namelen + 1, fp) != fullname)
return true; return true;
// Check for folders first, if it's blacklisted it will return false
if (W_VerifyName(fullname, folderblacklist, status))
{
CONS_Printf("Blacklisted folder found - %s\n", fullname);
return false;
}
// Strip away file address and extension for the 8char name. // Strip away file address and extension for the 8char name.
if ((trimname = strrchr(fullname, '/')) != 0) if ((trimname = strrchr(fullname, '/')) != 0)
trimname++; trimname++;
else else
trimname = fullname; // Care taken for root files. trimname = fullname; // Care taken for root files.
if (*trimname) // Ignore directories if (*trimname) // Ignore directories, well kinda
{ {
if ((dotpos = strrchr(trimname, '.')) == 0) if ((dotpos = strrchr(trimname, '.')) == 0)
dotpos = fullname + strlen(fullname); // Watch for files without extension. dotpos = fullname + strlen(fullname); // Watch for files without extension.
@ -1826,6 +1819,10 @@ W_VerifyPK3 (FILE *fp, lumpchecklist_t *checklist, boolean status)
if (! W_VerifyName(lumpname, checklist, status)) if (! W_VerifyName(lumpname, checklist, status))
return false; return false;
// Check for directories next, if it's blacklisted it will return false
if (W_VerifyName(fullname, folderblacklist, status))
return false;
} }
free(fullname); free(fullname);