summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qchar.h3
-rw-r--r--src/corelib/tools/qdatetime.cpp3
-rw-r--r--src/corelib/tools/qhash.cpp10
-rw-r--r--src/corelib/tools/qstring.h3
4 files changed, 12 insertions, 7 deletions
diff --git a/src/corelib/tools/qchar.h b/src/corelib/tools/qchar.h
index 9ef4ee91c6..11969e12d3 100644
--- a/src/corelib/tools/qchar.h
+++ b/src/corelib/tools/qchar.h
@@ -353,7 +353,8 @@ public:
inline Direction direction() const { return QChar::direction(ucs); }
inline JoiningType joiningType() const { return QChar::joiningType(ucs); }
#if QT_DEPRECATED_SINCE(5, 3)
- QT_DEPRECATED inline Joining joining() const {
+ QT_DEPRECATED inline Joining joining() const
+ {
switch (QChar::joiningType(ucs)) {
case QChar::Joining_Causing: return QChar::Center;
case QChar::Joining_Dual: return QChar::Dual;
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 801876629c..d6f1d6c942 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -2405,6 +2405,9 @@ static bool qt_localtime(qint64 msecsSinceEpoch, QDate *localDate, QTime *localT
local.tm_year = sysTime.wYear - 1900;
}
#elif !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
+ // localtime() is required to work as if tzset() was called before it.
+ // localtime_r() does not have this requirement, so make an explicit call.
+ qt_tzset();
// Use the reentrant version of localtime() where available
// as is thread-safe and doesn't use a shared static data area
tm *res = 0;
diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp
index 928707660b..e227a483c4 100644
--- a/src/corelib/tools/qhash.cpp
+++ b/src/corelib/tools/qhash.cpp
@@ -125,7 +125,7 @@ static uint crc32(const Char *ptr, size_t len, uint h)
# else
p += 4;
for ( ; p <= e; p += 4)
- h = _mm_crc32_u32(h, *reinterpret_cast<const uint *>(p));
+ h = _mm_crc32_u32(h, *reinterpret_cast<const uint *>(p - 4));
p -= 4;
len = e - p;
# endif
@@ -227,12 +227,13 @@ uint qHash(QLatin1String key, uint seed) Q_DECL_NOTHROW
*/
static uint qt_create_qhash_seed()
{
+ uint seed = 0;
+
+#ifndef QT_BOOTSTRAPPED
QByteArray envSeed = qgetenv("QT_HASH_SEED");
if (!envSeed.isNull())
return envSeed.toUInt();
- uint seed = 0;
-
#ifdef Q_OS_UNIX
int randomfd = qt_safe_open("/dev/urandom", O_RDONLY);
if (randomfd == -1)
@@ -259,17 +260,16 @@ static uint qt_create_qhash_seed()
seed ^= timestamp;
seed ^= (timestamp >> 32);
-#ifndef QT_BOOTSTRAPPED
quint64 pid = QCoreApplication::applicationPid();
seed ^= pid;
seed ^= (pid >> 32);
-#endif // QT_BOOTSTRAPPED
quintptr seedPtr = reinterpret_cast<quintptr>(&seed);
seed ^= seedPtr;
#if QT_POINTER_SIZE == 8
seed ^= (seedPtr >> 32);
#endif
+#endif // QT_BOOTSTRAPPED
return seed;
}
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 359d0c49e5..3985bc76fe 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -949,7 +949,8 @@ public:
QChar::Direction direction() const { return QChar(*this).direction(); }
QChar::JoiningType joiningType() const { return QChar(*this).joiningType(); }
#if QT_DEPRECATED_SINCE(5, 3)
- QT_DEPRECATED QChar::Joining joining() const {
+ QT_DEPRECATED QChar::Joining joining() const
+ {
switch (QChar(*this).joiningType()) {
case QChar::Joining_Causing: return QChar::Center;
case QChar::Joining_Dual: return QChar::Dual;