mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
Use FString for FResourceLump::FullName
This commit is contained in:
parent
a08e439551
commit
966d0b7034
7 changed files with 14 additions and 23 deletions
|
@ -302,11 +302,11 @@ int FIWadManager::ScanIWAD (const char *iwad)
|
|||
FResourceLump *lump = iwadfile->GetLump(ii);
|
||||
|
||||
CheckLumpName(lump->Name);
|
||||
if (lump->FullName != NULL)
|
||||
if (lump->FullName.IsNotEmpty())
|
||||
{
|
||||
if (strnicmp(lump->FullName, "maps/", 5) == 0)
|
||||
{
|
||||
FString mapname(lump->FullName+5, strcspn(lump->FullName+5, "."));
|
||||
FString mapname(&lump->FullName[5], strcspn(&lump->FullName[5], "."));
|
||||
CheckLumpName(mapname);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -206,7 +206,7 @@ int STACK_ARGS F7ZFile::lumpcmp(const void * a, const void * b)
|
|||
F7ZLump * rec1 = (F7ZLump *)a;
|
||||
F7ZLump * rec2 = (F7ZLump *)b;
|
||||
|
||||
return stricmp(rec1->FullName, rec2->FullName);
|
||||
return rec1->FullName.CompareNoCase(rec2->FullName);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ int STACK_ARGS FDirectory::lumpcmp(const void * a, const void * b)
|
|||
FDirectoryLump * rec1 = (FDirectoryLump *)a;
|
||||
FDirectoryLump * rec2 = (FDirectoryLump *)b;
|
||||
|
||||
return stricmp(rec1->FullName, rec2->FullName);
|
||||
return rec1->FullName.CompareNoCase(rec2->FullName);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -154,7 +154,7 @@ int STACK_ARGS FZipFile::lumpcmp(const void * a, const void * b)
|
|||
FZipLump * rec1 = (FZipLump *)a;
|
||||
FZipLump * rec2 = (FZipLump *)b;
|
||||
|
||||
return stricmp(rec1->FullName, rec2->FullName);
|
||||
return rec1->FullName.CompareNoCase(rec2->FullName);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -74,11 +74,6 @@ public:
|
|||
|
||||
FResourceLump::~FResourceLump()
|
||||
{
|
||||
if (FullName != NULL)
|
||||
{
|
||||
delete [] FullName;
|
||||
FullName = NULL;
|
||||
}
|
||||
if (Cache != NULL && RefCount >= 0)
|
||||
{
|
||||
delete [] Cache;
|
||||
|
@ -102,7 +97,7 @@ void FResourceLump::LumpNameSetup(const char *iname)
|
|||
base = base.Left(base.LastIndexOf('.'));
|
||||
uppercopy(Name, base);
|
||||
Name[8] = 0;
|
||||
FullName = copystring(iname);
|
||||
FullName = iname;
|
||||
|
||||
// Map some directories to WAD namespaces.
|
||||
// Note that some of these namespaces don't exist in WADS.
|
||||
|
|
|
@ -13,7 +13,7 @@ struct FResourceLump
|
|||
friend class FResourceFile;
|
||||
|
||||
int LumpSize;
|
||||
char * FullName; // only valid for files loaded from a .zip file
|
||||
FString FullName; // only valid for files loaded from a non-wad archive
|
||||
union
|
||||
{
|
||||
char Name[9];
|
||||
|
@ -30,7 +30,6 @@ struct FResourceLump
|
|||
|
||||
FResourceLump()
|
||||
{
|
||||
FullName = NULL;
|
||||
Cache = NULL;
|
||||
Owner = NULL;
|
||||
Flags = 0;
|
||||
|
|
|
@ -290,14 +290,9 @@ void FWadCollection::AddFile (const char *filename, FileReader *wadinfo)
|
|||
FResourceLump *lump = resfile->GetLump(i);
|
||||
if (lump->Flags & LUMPF_EMBEDDED)
|
||||
{
|
||||
char path[256];
|
||||
|
||||
mysnprintf(path, countof(path), "%s:", filename);
|
||||
char *wadstr = path + strlen(path);
|
||||
|
||||
FString path;
|
||||
path.Format("%s:%s", filename, lump->FullName.GetChars());
|
||||
FileReader *embedded = lump->NewReader();
|
||||
strcpy(wadstr, lump->FullName);
|
||||
|
||||
AddFile(path, embedded);
|
||||
}
|
||||
}
|
||||
|
@ -345,7 +340,9 @@ void FWadCollection::AddFile (const char *filename, FileReader *wadinfo)
|
|||
sprintf(cksumout + (j * 2), "%02X", cksum[j]);
|
||||
}
|
||||
|
||||
fprintf(hashfile, "file: %s, lump: %s, hash: %s, size: %d\n", filename, lump->FullName ? lump->FullName : lump->Name, cksumout, lump->LumpSize);
|
||||
fprintf(hashfile, "file: %s, lump: %s, hash: %s, size: %d\n", filename,
|
||||
lump->FullName.IsNotEmpty() ? lump->FullName.GetChars() : lump->Name,
|
||||
cksumout, lump->LumpSize);
|
||||
|
||||
delete reader;
|
||||
}
|
||||
|
@ -737,7 +734,7 @@ void FWadCollection::InitHashChains (void)
|
|||
FirstLumpIndex[j] = i;
|
||||
|
||||
// Do the same for the full paths
|
||||
if (LumpInfo[i].lump->FullName!=NULL)
|
||||
if (LumpInfo[i].lump->FullName.IsNotEmpty())
|
||||
{
|
||||
j = MakeKey(LumpInfo[i].lump->FullName) % NumLumps;
|
||||
NextLumpIndex_FullName[i] = FirstLumpIndex_FullName[j];
|
||||
|
@ -1088,7 +1085,7 @@ const char *FWadCollection::GetLumpFullName (int lump) const
|
|||
{
|
||||
if ((size_t)lump >= NumLumps)
|
||||
return NULL;
|
||||
else if (LumpInfo[lump].lump->FullName != NULL)
|
||||
else if (LumpInfo[lump].lump->FullName.IsNotEmpty())
|
||||
return LumpInfo[lump].lump->FullName;
|
||||
else
|
||||
return LumpInfo[lump].lump->Name;
|
||||
|
|
Loading…
Reference in a new issue