From 2008f87f10d51a2f9372aa4a4d72e86ac94e1e81 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 13 May 2024 18:26:53 +0300 Subject: Revert "viewer#819 Avoid reading the same XML file multiple times" This reverts commit a865d423974ea06dffa47798c81e98e7570b02ec. Reason for revert: viewer#1420, reverting to not hold maint-A (is deepCopy not full?) --- indra/llfilesystem/lldir.cpp | 33 +++------------------------------ indra/llfilesystem/lldir.h | 4 +--- 2 files changed, 4 insertions(+), 33 deletions(-) (limited to 'indra/llfilesystem') diff --git a/indra/llfilesystem/lldir.cpp b/indra/llfilesystem/lldir.cpp index 0ba62fb698..41fbb97175 100644 --- a/indra/llfilesystem/lldir.cpp +++ b/indra/llfilesystem/lldir.cpp @@ -70,7 +70,6 @@ LLDir *gDirUtilp = (LLDir *)&gDirUtil; /// Values for findSkinnedFilenames(subdir) parameter const char *LLDir::XUI = "xui", - *LLDir::HTML = "html", *LLDir::TEXTURES = "textures", *LLDir::SKINBASE = ""; @@ -761,13 +760,14 @@ std::vector LLDir::findSkinnedFilenames(const std::string& subdir, else { // We do not recognize this subdir. Investigate. - if (skinExists(subdir, "en")) + std::string subdir_path(add(getDefaultSkinDir(), subdir)); + if (fileExists(add(subdir_path, "en"))) { // defaultSkinDir/subdir contains subdir "en". That's our // default language; this subdir is localized. found = sLocalized.insert(StringMap::value_type(subdir, "en")).first; } - else if (skinExists(subdir, "en-us")) + else if (fileExists(add(subdir_path, "en-us"))) { // defaultSkinDir/subdir contains subdir "en-us" but not "en". // Set as default language; this subdir is localized. @@ -864,33 +864,6 @@ std::vector LLDir::findSkinnedFilenames(const std::string& subdir, return results; } -// virtual -bool LLDir::skinExists(const std::string& subdir, const std::string& skin) const -{ - std::string skin_path(add(getDefaultSkinDir(), subdir, skin)); - return fileExists(skin_path); -} - -// virtual -std::string LLDir::getFileContents(const std::string& filename) const -{ - LLFILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */ - if (fp) - { - fseek(fp, 0, SEEK_END); - U32 length = ftell(fp); - fseek(fp, 0, SEEK_SET); - - std::vector buffer(length); - size_t nread = fread(buffer.data(), 1, length, fp); - fclose(fp); - - return std::string(buffer.data(), nread); - } - - return LLStringUtil::null; -} - std::string LLDir::getTempFilename() const { LLUUID random_uuid; diff --git a/indra/llfilesystem/lldir.h b/indra/llfilesystem/lldir.h index d43921c292..b9a046ba33 100644 --- a/indra/llfilesystem/lldir.h +++ b/indra/llfilesystem/lldir.h @@ -72,8 +72,6 @@ class LLDir // pure virtual functions virtual std::string getCurPath() = 0; virtual bool fileExists(const std::string &filename) const = 0; - virtual bool skinExists(const std::string& subdir, const std::string &skin) const; - virtual std::string getFileContents(const std::string& filename) const; const std::string findFile(const std::string& filename, const std::vector filenames) const; const std::string findFile(const std::string& filename, const std::string& searchPath1 = "", const std::string& searchPath2 = "", const std::string& searchPath3 = "") const; @@ -152,7 +150,7 @@ class LLDir const std::string& filename, ESkinConstraint constraint=CURRENT_SKIN) const; /// Values for findSkinnedFilenames(subdir) parameter - static const char *XUI, *HTML, *TEXTURES, *SKINBASE; + static const char *XUI, *TEXTURES, *SKINBASE; /** * Return the base-language pathname from findSkinnedFilenames(), or * the empty string if no such file exists. Parameters are identical to -- cgit v1.2.3