qHash: always use the seed in the catch-all template
authorGiuseppe D'Angelo <dangelog@gmail.com>
Wed, 4 Apr 2012 15:21:03 +0000 (16:21 +0100)
committerQt by Nokia <qt-info@nokia.com>
Fri, 6 Apr 2012 20:51:24 +0000 (22:51 +0200)
This pertubates the results of the calls to the one-argument
version of qHash through the catch-all template.

Change-Id: I7037b25d545e6f1360384a83ff895f4bb62ed195
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
src/corelib/tools/qhash.h

index 8fe66aa..42c33f6 100644 (file)
@@ -109,7 +109,7 @@ template <typename T1, typename T2> inline uint qHash(const QPair<T1, T2> &key)
     return ((h1 << 16) | (h1 >> 16)) ^ h2;
 }
 
-template<typename T> inline uint qHash(const T &t, uint) { return qHash(t); }
+template<typename T> inline uint qHash(const T &t, uint seed) { return (qHash(t) ^ seed); }
 
 struct Q_CORE_EXPORT QHashData
 {