summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2023-09-25 16:13:53 +0300
committerKatja Marttila <katja.marttila@qt.io>2023-09-29 10:50:50 +0300
commit84ba61dc7f60300ff7eee3c311a74ca7f64872be (patch)
tree3f2cae96a17e2990f8e3631e83f11d510953abe4
parent12384d00b301d4f905ec6fec9f55599bb19c492c (diff)
Fix qHash return value
qHash return value in Qt6 is size_t. Making relevant changes so that no warnings occur when building with Qt5 or Qt6. Change-Id: Ia4d8de49b163a59b58ec7c1eea83979b174b1bd1 Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
-rw-r--r--src/libs/installer/componentalias.cpp2
-rw-r--r--src/libs/installer/componentalias.h2
-rw-r--r--src/libs/installer/installer_global.h8
-rw-r--r--src/libs/installer/packagesource.cpp4
-rw-r--r--src/libs/installer/packagesource.h4
-rw-r--r--src/libs/installer/progresscoordinator.cpp4
-rw-r--r--src/libs/installer/repository.cpp4
-rw-r--r--src/libs/installer/repository.h6
-rw-r--r--src/libs/installer/repositorycategory.cpp4
-rw-r--r--src/libs/installer/repositorycategory.h7
-rw-r--r--tests/auto/installer/solver/tst_solver.cpp4
11 files changed, 28 insertions, 21 deletions
diff --git a/src/libs/installer/componentalias.cpp b/src/libs/installer/componentalias.cpp
index 85797ca33..040ead6a1 100644
--- a/src/libs/installer/componentalias.cpp
+++ b/src/libs/installer/componentalias.cpp
@@ -81,7 +81,7 @@ AliasSource::AliasSource(const AliasSource &other)
/*!
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-uint qHash(const AliasSource &key, uint seed)
+hashValue qHash(const AliasSource &key, hashValue seed)
{
return qHash(key.filename, seed) ^ key.priority;
}
diff --git a/src/libs/installer/componentalias.h b/src/libs/installer/componentalias.h
index 17754f192..e5f2e0d61 100644
--- a/src/libs/installer/componentalias.h
+++ b/src/libs/installer/componentalias.h
@@ -58,7 +58,7 @@ struct INSTALLER_EXPORT AliasSource
int priority;
};
-INSTALLER_EXPORT uint qHash(const AliasSource &key, uint seed);
+INSTALLER_EXPORT hashValue qHash(const AliasSource &key, hashValue seed);
INSTALLER_EXPORT bool operator==(const AliasSource &lhs, const AliasSource &rhs);
class INSTALLER_EXPORT AliasFinder
diff --git a/src/libs/installer/installer_global.h b/src/libs/installer/installer_global.h
index ea6865042..285eff910 100644
--- a/src/libs/installer/installer_global.h
+++ b/src/libs/installer/installer_global.h
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2023 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -40,4 +40,10 @@
# define INSTALLER_EXPORT
#endif
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+typedef uint hashValue;
+#else
+typedef size_t hashValue;
+#endif
+
#endif //INSTALLER_GLOBAL_H
diff --git a/src/libs/installer/packagesource.cpp b/src/libs/installer/packagesource.cpp
index 3b9fbe813..5bc61f8e4 100644
--- a/src/libs/installer/packagesource.cpp
+++ b/src/libs/installer/packagesource.cpp
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2022 The Qt Company Ltd.
+** Copyright (C) 2023 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -69,7 +69,7 @@ namespace QInstaller {
/*!
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-uint qHash(const PackageSource &key, uint seed)
+hashValue qHash(const PackageSource &key, hashValue seed)
{
return qHash(key.url, seed) ^ key.priority;
}
diff --git a/src/libs/installer/packagesource.h b/src/libs/installer/packagesource.h
index 1193c1f76..92245d906 100644
--- a/src/libs/installer/packagesource.h
+++ b/src/libs/installer/packagesource.h
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2022 The Qt Company Ltd.
+** Copyright (C) 2023 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -49,7 +49,7 @@ struct INSTALLER_EXPORT PackageSource
int priority;
};
-INSTALLER_EXPORT uint qHash(const PackageSource &key, uint seed);
+INSTALLER_EXPORT hashValue qHash(const PackageSource &key, hashValue seed);
INSTALLER_EXPORT bool operator==(const PackageSource &lhs, const PackageSource &rhs);
} // namespace QInstaller
diff --git a/src/libs/installer/progresscoordinator.cpp b/src/libs/installer/progresscoordinator.cpp
index 8b02711b1..afcec1908 100644
--- a/src/libs/installer/progresscoordinator.cpp
+++ b/src/libs/installer/progresscoordinator.cpp
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2021 The Qt Company Ltd.
+** Copyright (C) 2023 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -40,7 +40,7 @@
using namespace QInstaller;
QT_BEGIN_NAMESPACE
-uint qHash(QPointer<QObject> key)
+hashValue qHash(QPointer<QObject> key)
{
return qHash(key.data());
}
diff --git a/src/libs/installer/repository.cpp b/src/libs/installer/repository.cpp
index fc02bd2ef..ca090ab05 100644
--- a/src/libs/installer/repository.cpp
+++ b/src/libs/installer/repository.cpp
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2020 The Qt Company Ltd.
+** Copyright (C) 2023 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -35,7 +35,7 @@
#include <QDir>
/*!
- \fn inline uint QInstaller::qHash(const Repository &repository)
+ \fn inline hashValue QInstaller::qHash(const Repository &repository)
Returns a hash of the \a repository.
*/
diff --git a/src/libs/installer/repository.h b/src/libs/installer/repository.h
index 1edb83449..80698e447 100644
--- a/src/libs/installer/repository.h
+++ b/src/libs/installer/repository.h
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2020 The Qt Company Ltd.
+** Copyright (C) 2023 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -74,7 +74,7 @@ public:
bool operator==(const Repository &other) const;
bool operator!=(const Repository &other) const;
- uint qHash(const Repository &repository);
+ hashValue qHash(const Repository &repository);
const Repository &operator=(const Repository &other);
friend INSTALLER_EXPORT QDataStream &operator>>(QDataStream &istream, Repository &repository);
@@ -92,7 +92,7 @@ private:
QByteArray m_xmlChecksum;
};
-inline uint qHash(const Repository &repository)
+inline hashValue qHash(const Repository &repository)
{
return qHash(repository.url());
}
diff --git a/src/libs/installer/repositorycategory.cpp b/src/libs/installer/repositorycategory.cpp
index ef1f4fe07..c9bee6e3a 100644
--- a/src/libs/installer/repositorycategory.cpp
+++ b/src/libs/installer/repositorycategory.cpp
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2022 The Qt Company Ltd.
+** Copyright (C) 2023 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -35,7 +35,7 @@
#include <QStringList>
/*!
- \fn inline uint QInstaller::qHash(const RepositoryCategory &repository)
+ \fn inline hashValue QInstaller::qHash(const RepositoryCategory &repository)
Returns a hash of the repository category \a repository.
*/
diff --git a/src/libs/installer/repositorycategory.h b/src/libs/installer/repositorycategory.h
index dc45527eb..993ae78aa 100644
--- a/src/libs/installer/repositorycategory.h
+++ b/src/libs/installer/repositorycategory.h
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2022 The Qt Company Ltd.
+** Copyright (C) 2023 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -31,6 +31,7 @@
#include "installer_global.h"
#include "repository.h"
+#include "qinstallerglobal.h"
#include <QtCore/QMetaType>
#include <QtCore/QUrl>
@@ -63,7 +64,7 @@ public:
bool operator==(const RepositoryCategory &other) const;
bool operator!=(const RepositoryCategory &other) const;
- uint qHash(const RepositoryCategory &repository);
+ hashValue qHash(const RepositoryCategory &repository);
friend INSTALLER_EXPORT QDataStream &operator>>(QDataStream &istream, RepositoryCategory &repository);
friend INSTALLER_EXPORT QDataStream &operator<<(QDataStream &ostream, const RepositoryCategory &repository);
@@ -75,7 +76,7 @@ private:
bool m_enabled;
};
-inline uint qHash(const RepositoryCategory &repository)
+inline hashValue qHash(const RepositoryCategory &repository)
{
return qHash(repository.displayname());
}
diff --git a/tests/auto/installer/solver/tst_solver.cpp b/tests/auto/installer/solver/tst_solver.cpp
index 85fb387e2..4548af3f1 100644
--- a/tests/auto/installer/solver/tst_solver.cpp
+++ b/tests/auto/installer/solver/tst_solver.cpp
@@ -48,7 +48,7 @@ public:
Data() {}
explicit Data(const QString &data)
: m_data(data) {}
- inline uint qHash(const Data &test);
+ inline hashValue qHash(const Data &test);
QString data() const { return m_data; }
bool operator==(const Data &rhs) const { return m_data == rhs.m_data; }
const Data &operator=(const Data &rhs) { if (this != &rhs) { m_data = rhs.m_data; } return *this; }
@@ -56,7 +56,7 @@ public:
private:
QString m_data;
};
-inline uint qHash(const Data &data)
+inline hashValue qHash(const Data &data)
{
return qHash(data.data());
}