diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-04-13 18:59:59 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2017-06-12 06:14:40 +0000 |
commit | 769722778120623e2a873a14e3db2e5e53098fce (patch) | |
tree | 8f14eb0792f6481c819ab5db4418082dae20e86c /src | |
parent | 030782e1a8c44c6be2a95c88d5a4a3a37b3b6173 (diff) |
Use QtPrivate::FunctionPointer to get the type of srand's first arg
Avoids #ifdefs and guesswork.
Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5210efaea7d00
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/global/qrandom.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp index 573e762fc9..99a91c2221 100644 --- a/src/corelib/global/qrandom.cpp +++ b/src/corelib/global/qrandom.cpp @@ -42,6 +42,7 @@ #include "qrandom.h" #include "qrandom_p.h" +#include <qobjectdefs.h> #include <qthreadstorage.h> #if QT_HAS_INCLUDE(<random>) @@ -730,13 +731,7 @@ void QRandomGenerator::fillRange_helper(void *buffer, void *bufferEnd) } #if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0) - -# if defined(Q_OS_INTEGRITY) && defined(__GHS_VERSION_NUMBER) && (__GHS_VERSION_NUMBER < 500) -// older versions of INTEGRITY used a long instead of a uint for the seed. -typedef long SeedStorageType; -# else -typedef uint SeedStorageType; -# endif +using SeedStorageType = QtPrivate::FunctionPointer<decltype(&srand)>::Arguments::Car; typedef QThreadStorage<SeedStorageType *> SeedStorage; Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value |