forked from qt-creator/qt-creator
FilePath: Fix hash function
For better performance, include also the scheme and host in qHash calculation. Change-Id: I2a69a128597429b88a71943d248ce038b49285f2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -2072,9 +2072,10 @@ QTCREATOR_UTILS_EXPORT bool operator>=(const FilePath &first, const FilePath &se
|
||||
|
||||
QTCREATOR_UTILS_EXPORT size_t qHash(const FilePath &filePath, uint seed)
|
||||
{
|
||||
if (filePath.caseSensitivity() == Qt::CaseInsensitive)
|
||||
return qHash(filePath.path().toCaseFolded(), seed);
|
||||
return qHash(filePath.path(), seed);
|
||||
if (filePath.caseSensitivity() == Qt::CaseSensitive)
|
||||
return qHash(QStringView(filePath.m_data), seed);
|
||||
const size_t schemeHostHash = qHash(QStringView(filePath.m_data).mid(filePath.m_pathLen), seed);
|
||||
return qHash(filePath.path().toCaseFolded(), seed) ^ schemeHostHash;
|
||||
}
|
||||
|
||||
QTCREATOR_UTILS_EXPORT size_t qHash(const FilePath &filePath)
|
||||
|
||||
Reference in New Issue
Block a user