ProjectPath hashing fix

This commit is contained in:
Jack Andersen 2016-08-28 14:28:24 -10:00
parent 8c8a143f6b
commit 07c21ec489
2 changed files with 22 additions and 33 deletions

View File

@ -773,6 +773,23 @@ class ProjectPath
std::string m_utf8RelPath; std::string m_utf8RelPath;
std::string m_utf8AuxInfo; std::string m_utf8AuxInfo;
#endif #endif
void ComputeHash()
{
#if HECL_UCS2
m_utf8AbsPath = WideToUTF8(m_absPath);
m_utf8RelPath = WideToUTF8(m_relPath);
m_utf8AuxInfo = WideToUTF8(m_auxInfo);
if (m_utf8AuxInfo.size())
m_hash = Hash(m_utf8RelPath + '|' + m_utf8AuxInfo);
else
m_hash = Hash(m_utf8RelPath);
#else
if (m_auxInfo.size())
m_hash = Hash(m_relPath + '|' + m_auxInfo);
else
m_hash = Hash(m_relPath);
#endif
}
public: public:
/** /**
* @brief Empty constructor * @brief Empty constructor
@ -866,10 +883,8 @@ public:
pp.m_relPath += ext; pp.m_relPath += ext;
pp.m_absPath += ext; pp.m_absPath += ext;
} }
#if HECL_UCS2
pp.m_utf8AbsPath = WideToUTF8(pp.m_absPath); pp.ComputeHash();
pp.m_utf8RelPath = WideToUTF8(pp.m_relPath);
#endif
return pp; return pp;
} }

View File

@ -79,20 +79,7 @@ void ProjectPath::assign(Database::Project& project, const SystemString& path)
SanitizePath(m_relPath); SanitizePath(m_relPath);
SanitizePath(m_absPath); SanitizePath(m_absPath);
#if HECL_UCS2 ComputeHash();
m_utf8AbsPath = WideToUTF8(m_absPath);
m_utf8RelPath = WideToUTF8(m_relPath);
m_utf8AuxInfo = WideToUTF8(m_auxInfo);
if (m_utf8AuxInfo.size())
m_hash = Hash(m_utf8RelPath + '|' + m_utf8AuxInfo);
else
m_hash = Hash(m_utf8RelPath);
#else
if (m_auxInfo.size())
m_hash = Hash(m_relPath + '|' + m_auxInfo);
else
m_hash = Hash(m_relPath);
#endif
} }
#if HECL_UCS2 #if HECL_UCS2
@ -122,20 +109,7 @@ void ProjectPath::assign(const ProjectPath& parentPath, const SystemString& path
SanitizePath(m_relPath); SanitizePath(m_relPath);
SanitizePath(m_absPath); SanitizePath(m_absPath);
#if HECL_UCS2 ComputeHash();
m_utf8AbsPath = WideToUTF8(m_absPath);
m_utf8RelPath = WideToUTF8(m_relPath);
m_utf8AuxInfo = WideToUTF8(m_auxInfo);
if (m_utf8AuxInfo.size())
m_hash = Hash(m_utf8RelPath + '|' + m_utf8AuxInfo);
else
m_hash = Hash(m_utf8RelPath);
#else
if (m_auxInfo.size())
m_hash = Hash(m_relPath + '|' + m_auxInfo);
else
m_hash = Hash(m_relPath);
#endif
} }
#if HECL_UCS2 #if HECL_UCS2