diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2012-08-02 15:51:52 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-20 21:59:21 +0200 |
commit | 373845dfd8acae0c941432c8cd615b77bcae0a2a (patch) | |
tree | d8d88bdd6657a18f55456bfe2ac5dfff682e76aa /src/corelib/tools/qhash.cpp | |
parent | 291938aea6771a0ce4c11a164583a73c6eef026e (diff) |
Add Q_DECL_NOTHROW to some qHash functions
The hashing functions for QDateTime and QHostAddress did not get the
noexcept keyword because they might allocate memory. QDateTime doesn't
do it now, but it could in the future. QHostAddress does allocate
memory today.
Change-Id: Ia5f80942944bfc2b8c405306c467bfd88ef0e48c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qhash.cpp')
-rw-r--r-- | src/corelib/tools/qhash.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 97f846c6c8..d8169a647b 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -93,7 +93,7 @@ QT_BEGIN_NAMESPACE (for instance, gcc 4.4 does that even at -O0). */ -static inline uint hash(const uchar *p, int len, uint seed) +static inline uint hash(const uchar *p, int len, uint seed) Q_DECL_NOTHROW { uint h = seed; @@ -103,7 +103,7 @@ static inline uint hash(const uchar *p, int len, uint seed) return h; } -static inline uint hash(const QChar *p, int len, uint seed) +static inline uint hash(const QChar *p, int len, uint seed) Q_DECL_NOTHROW { uint h = seed; @@ -113,22 +113,22 @@ static inline uint hash(const QChar *p, int len, uint seed) return h; } -uint qHash(const QByteArray &key, uint seed) +uint qHash(const QByteArray &key, uint seed) Q_DECL_NOTHROW { return hash(reinterpret_cast<const uchar *>(key.constData()), key.size(), seed); } -uint qHash(const QString &key, uint seed) +uint qHash(const QString &key, uint seed) Q_DECL_NOTHROW { return hash(key.unicode(), key.size(), seed); } -uint qHash(const QStringRef &key, uint seed) +uint qHash(const QStringRef &key, uint seed) Q_DECL_NOTHROW { return hash(key.unicode(), key.size(), seed); } -uint qHash(const QBitArray &bitArray, uint seed) +uint qHash(const QBitArray &bitArray, uint seed) Q_DECL_NOTHROW { int m = bitArray.d.size() - 1; uint result = hash(reinterpret_cast<const uchar *>(bitArray.d.constData()), qMax(0, m), seed); @@ -141,7 +141,7 @@ uint qHash(const QBitArray &bitArray, uint seed) return result; } -uint qHash(QLatin1String key, uint seed) +uint qHash(QLatin1String key, uint seed) Q_DECL_NOTHROW { return hash(reinterpret_cast<const uchar *>(key.data()), key.size(), seed); } @@ -242,7 +242,7 @@ static void qt_initialize_qhash_seed() This function must *never* change its results. */ -uint qt_hash(const QString &key) +uint qt_hash(const QString &key) Q_DECL_NOTHROW { const QChar *p = key.unicode(); int n = key.size(); |