diff options
Diffstat (limited to 'src/corelib/global')
-rw-r--r-- | src/corelib/global/qlogging.cpp | 4 | ||||
-rw-r--r-- | src/corelib/global/qrandom.cpp | 19 |
2 files changed, 14 insertions, 9 deletions
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index cebab1daef..17f2246082 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1803,8 +1803,8 @@ static void qt_message_print(QtMsgType msgType, const QMessageLogContext &contex #ifndef QT_BOOTSTRAPPED Q_TRACE(qt_message_print, msgType, context.category, context.function, context.file, context.line, message); - // qDebug, qWarning, ... macros do not check whether category is enabled - if (isDefaultCategory(context.category)) { + // qDebug, qWarning, ... macros do not check whether category is enabledgc + if (msgType != QtFatalMsg && isDefaultCategory(context.category)) { if (QLoggingCategory *defaultCategory = QLoggingCategory::defaultCategory()) { if (!defaultCategory->isEnabled(msgType)) return; diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp index 711eb8f4d5..e5b2399566 100644 --- a/src/corelib/global/qrandom.cpp +++ b/src/corelib/global/qrandom.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 Intel Corporation. +** Copyright (C) 2019 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -103,17 +103,22 @@ static QT_FUNCTION_TARGET(RDRND) qsizetype qt_random_cpu(void *buffer, qsizetype { unsigned *ptr = reinterpret_cast<unsigned *>(buffer); unsigned *end = ptr + count; + int retries = 10; while (ptr + sizeof(qregisteruint)/sizeof(*ptr) <= end) { - if (_rdrandXX_step(reinterpret_cast<qregisteruint *>(ptr)) == 0) + if (_rdrandXX_step(reinterpret_cast<qregisteruint *>(ptr))) + ptr += sizeof(qregisteruint)/sizeof(*ptr); + else if (--retries == 0) goto out; - ptr += sizeof(qregisteruint)/sizeof(*ptr); } - if (sizeof(*ptr) != sizeof(qregisteruint) && ptr != end) { - if (_rdrand32_step(ptr)) - goto out; - ++ptr; + while (sizeof(*ptr) != sizeof(qregisteruint) && ptr != end) { + bool ok = _rdrand32_step(ptr); + if (!ok && --retries) + continue; + if (ok) + ++ptr; + break; } out: |