diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-12-19 20:18:14 -0500 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2020-02-04 03:33:18 -0500 |
| commit | 72394faa750ac05871f62583c7c922879a20bc7b (patch) | |
| tree | c392c4e9c3f82e75df0bf77b0d990e8f2a739877 /src/shared | |
| parent | 2d276cad0b46d68e6886645559cd47c0165392fe (diff) | |
some optimizations to avoid case conversions and memory allocations
Diffstat (limited to 'src/shared')
| -rw-r--r-- | src/shared/directoryentry.cpp | 6 | ||||
| -rw-r--r-- | src/shared/directoryentry.h | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/shared/directoryentry.cpp b/src/shared/directoryentry.cpp index 146662ad..c6b29fbb 100644 --- a/src/shared/directoryentry.cpp +++ b/src/shared/directoryentry.cpp @@ -875,9 +875,11 @@ DirectoryEntry *DirectoryEntry::findSubDirectoryRecursive(const std::wstring &pa }
-const FileEntry::Ptr DirectoryEntry::findFile(const std::wstring &name) const
+const FileEntry::Ptr DirectoryEntry::findFile(
+ const std::wstring &name, bool alreadyLowerCase) const
{
- auto iter = m_Files.find(ToLower(name));
+ auto iter = m_Files.find(alreadyLowerCase ? name : ToLower(name));
+
if (iter != m_Files.end()) {
return m_FileRegister->getFile(iter->second);
} else {
diff --git a/src/shared/directoryentry.h b/src/shared/directoryentry.h index 52265583..d33b495a 100644 --- a/src/shared/directoryentry.h +++ b/src/shared/directoryentry.h @@ -278,7 +278,7 @@ public: * @param name name of the file
* @return fileentry object for the file or nullptr if no file matches
*/
- const FileEntry::Ptr findFile(const std::wstring &name) const;
+ const FileEntry::Ptr findFile(const std::wstring &name, bool alreadyLowerCase=false) const;
bool hasFile(const std::wstring& name) const;
bool containsArchive(std::wstring archiveName);
|
