From 72a2e5d5326f5ba12d81fd39a9c17fe5eb5f316d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 13 Dec 2023 16:59:15 +0100 Subject: [PATCH] fixed remaining issues in resource file loading. --- src/common/filesystem/source/file_directory.cpp | 2 +- src/common/filesystem/source/file_wad.cpp | 16 ++++++++-------- src/common/filesystem/source/files.cpp | 2 +- src/common/filesystem/source/resourcefile.cpp | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/common/filesystem/source/file_directory.cpp b/src/common/filesystem/source/file_directory.cpp index ab0f8ae049..0339e3a71a 100644 --- a/src/common/filesystem/source/file_directory.cpp +++ b/src/common/filesystem/source/file_directory.cpp @@ -108,7 +108,7 @@ int FDirectory::AddDirectory(const char *dirpath, LumpFilterInfo* filter, FileSy { // extract the base path from the first entry to cover changes made in ScanDirectory. auto full = entry.FilePath.find(entry.FilePathRel); - std::string path(entry.FilePath, full); + std::string path(entry.FilePath, 0, full); mBasePath = stringpool->Strdup(path.c_str()); } if (!entry.isDirectory) diff --git a/src/common/filesystem/source/file_wad.cpp b/src/common/filesystem/source/file_wad.cpp index a65e992ff5..1970e7a401 100644 --- a/src/common/filesystem/source/file_wad.cpp +++ b/src/common/filesystem/source/file_wad.cpp @@ -159,14 +159,14 @@ bool FWadFile::Open(LumpFilterInfo*, FileSystemMessageFunc Printf) GenerateHash(); // Do this before the lump processing below. - SetNamespace("S_START", "S_END", ns_sprites, Printf); - SetNamespace("F_START", "F_END", ns_flats, Printf, true); - SetNamespace("C_START", "C_END", ns_colormaps, Printf); - SetNamespace("A_START", "A_END", ns_acslibrary, Printf); - SetNamespace("TX_START", "TX_END", ns_newtextures, Printf); - SetNamespace("V_START", "V_END", ns_strifevoices, Printf); - SetNamespace("HI_START", "HI_END", ns_hires, Printf); - SetNamespace("VX_START", "VX_END", ns_voxels, Printf); + SetNamespace("s_start", "s_end", ns_sprites, Printf); + SetNamespace("f_start", "f_end", ns_flats, Printf, true); + SetNamespace("c_start", "c_end", ns_colormaps, Printf); + SetNamespace("a_start", "a_end", ns_acslibrary, Printf); + SetNamespace("tx_start", "tx_end", ns_newtextures, Printf); + SetNamespace("v_start", "v_end", ns_strifevoices, Printf); + SetNamespace("hi_start", "hi_end", ns_hires, Printf); + SetNamespace("vx_start", "vx_end", ns_voxels, Printf); SkinHack(Printf); return true; diff --git a/src/common/filesystem/source/files.cpp b/src/common/filesystem/source/files.cpp index 9f0d24fc2b..e375d0b192 100644 --- a/src/common/filesystem/source/files.cpp +++ b/src/common/filesystem/source/files.cpp @@ -326,7 +326,7 @@ char *MemoryReader::Gets(char *strbuf, ptrdiff_t len) int BufferingReader::FillBuffer(ptrdiff_t newpos) { if (newpos > Length) newpos = Length; - if (newpos < bufferpos) return 0; + if (newpos <= bufferpos) return 0; auto read = baseReader->Read(&buf[bufferpos], newpos - bufferpos); bufferpos += read; if (bufferpos == Length) diff --git a/src/common/filesystem/source/resourcefile.cpp b/src/common/filesystem/source/resourcefile.cpp index a13f62e647..4d9619f994 100644 --- a/src/common/filesystem/source/resourcefile.cpp +++ b/src/common/filesystem/source/resourcefile.cpp @@ -468,7 +468,7 @@ bool FResourceFile::FindPrefixRange(const char* filter, uint32_t maxlump, uint32 while (min <= max) { mid = min + (max - min) / 2; - auto lump = &Entries[mid]; + auto lump = &lumps[mid]; cmp = strnicmp(lump->FileName, filter, strlen(filter)); if (cmp == 0) break; @@ -488,7 +488,7 @@ bool FResourceFile::FindPrefixRange(const char* filter, uint32_t maxlump, uint32 while (min <= max) { mid = min + (max - min) / 2; - auto lump = &Entries[mid]; + auto lump = &lumps[mid]; cmp = strnicmp(lump->FileName, filter, strlen(filter)); // Go left on matches and right on misses. if (cmp == 0) @@ -503,7 +503,7 @@ bool FResourceFile::FindPrefixRange(const char* filter, uint32_t maxlump, uint32 while (min <= max) { mid = min + (max - min) / 2; - auto lump = &Entries[mid]; + auto lump = &lumps[mid]; cmp = strnicmp(lump->FileName, filter, strlen(filter)); // Go right on matches and left on misses. if (cmp == 0)