diff --git a/src/d_iwad.cpp b/src/d_iwad.cpp index 4bb53e3fed..d6b1b092d1 100644 --- a/src/d_iwad.cpp +++ b/src/d_iwad.cpp @@ -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); } } diff --git a/src/resourcefiles/file_7z.cpp b/src/resourcefiles/file_7z.cpp index 21c11ed25a..81b7405826 100644 --- a/src/resourcefiles/file_7z.cpp +++ b/src/resourcefiles/file_7z.cpp @@ -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); } diff --git a/src/resourcefiles/file_directory.cpp b/src/resourcefiles/file_directory.cpp index 024ef06336..0b74bda7be 100644 --- a/src/resourcefiles/file_directory.cpp +++ b/src/resourcefiles/file_directory.cpp @@ -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 diff --git a/src/resourcefiles/file_zip.cpp b/src/resourcefiles/file_zip.cpp index 7ae0e90a58..bbca89d409 100644 --- a/src/resourcefiles/file_zip.cpp +++ b/src/resourcefiles/file_zip.cpp @@ -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); } diff --git a/src/resourcefiles/resourcefile.cpp b/src/resourcefiles/resourcefile.cpp index 15a4337b1d..41d7f8a99c 100644 --- a/src/resourcefiles/resourcefile.cpp +++ b/src/resourcefiles/resourcefile.cpp @@ -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. diff --git a/src/resourcefiles/resourcefile.h b/src/resourcefiles/resourcefile.h index 517b5eef43..bcd030e8f6 100644 --- a/src/resourcefiles/resourcefile.h +++ b/src/resourcefiles/resourcefile.h @@ -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; diff --git a/src/w_wad.cpp b/src/w_wad.cpp index abbac57636..ccb851a0b1 100644 --- a/src/w_wad.cpp +++ b/src/w_wad.cpp @@ -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;