diff options
Diffstat (limited to 'source/core/slang-file-system.cpp')
| -rw-r--r-- | source/core/slang-file-system.cpp | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/source/core/slang-file-system.cpp b/source/core/slang-file-system.cpp index e6d84cac1..7c3cd83bb 100644 --- a/source/core/slang-file-system.cpp +++ b/source/core/slang-file-system.cpp @@ -319,11 +319,8 @@ CacheFileSystem::CacheFileSystem(ISlangFileSystem* fileSystem, UniqueIdentityMod CacheFileSystem::~CacheFileSystem() { - for (const auto& pair : m_uniqueIdentityMap) - { - PathInfo* pathInfo = pair.value; + for (const auto& [_, pathInfo] : m_uniqueIdentityMap) delete pathInfo; - } } void CacheFileSystem::setInnerFileSystem(ISlangFileSystem* fileSystem, UniqueIdentityMode uniqueIdentityMode, PathStyle pathStyle) @@ -374,11 +371,8 @@ void CacheFileSystem::setInnerFileSystem(ISlangFileSystem* fileSystem, UniqueIde void CacheFileSystem::clearCache() { - for (const auto& pair : m_uniqueIdentityMap) - { - PathInfo* pathInfo = pair.value; + for (const auto& [_, pathInfo] : m_uniqueIdentityMap) delete pathInfo; - } m_uniqueIdentityMap.clear(); m_pathMap.clear(); @@ -434,11 +428,10 @@ SlangResult CacheFileSystem::enumeratePathContents(const char* path, FileSystemC simplifiedPath = ""; } - for (auto& pair : m_pathMap) + for (const auto& [currentPath, pathInfo] : m_pathMap) { // NOTE! The currentPath can be a *non* simplified path (the m_pathMap is the cache of paths simplified and other to a file/directory) // Also note that there will always be the simplified version of the path in cache. - const String& currentPath = pair.key; // If it doesn't start with simplified path, then it can't be a hit if (!currentPath.startsWith(simplifiedPath)) @@ -468,8 +461,6 @@ SlangResult CacheFileSystem::enumeratePathContents(const char* path, FileSystemC // Let's check that fact... SLANG_ASSERT(foundPath[remaining.getLength()] == 0); - PathInfo* pathInfo = pair.value; - SlangPathType pathType; if (SLANG_FAILED(_getPathType(pathInfo, currentPath.getBuffer(), &pathType))) { @@ -548,7 +539,7 @@ SlangResult CacheFileSystem::_calcUniqueIdentity(const String& path, String& out } // Calculate the hash on the contents - const uint64_t hash = getHashCode64((const char*)outFileContents->getBufferPointer(), outFileContents->getBufferSize()); + const StableHashCode64 hash = getStableHashCode64((const char*)outFileContents->getBufferPointer(), outFileContents->getBufferSize()); String hashString = Path::getFileName(path); hashString = hashString.toLower(); @@ -556,7 +547,7 @@ SlangResult CacheFileSystem::_calcUniqueIdentity(const String& path, String& out hashString.append(':'); // The uniqueIdentity is a combination of name and hash - hashString.append(hash, 16); + hashString.append(hash); outUniqueIdentity = hashString; return SLANG_OK; |
