From 5eef95095af5a5eecd41e74cd0870dc9a97e9ab9 Mon Sep 17 00:00:00 2001 From: Raoul Hecky Date: Tue, 7 Nov 2017 13:00:33 +0000 Subject: [PATCH] fix usage of seed_seq --- scripts/ci/osx/after_success.sh | 2 +- src/Common.cpp | 8 +++----- src/Common.h | 2 +- src/PasswordLineEdit.cpp | 3 ++- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/scripts/ci/osx/after_success.sh b/scripts/ci/osx/after_success.sh index eb2a2f3f..73ed6837 100755 --- a/scripts/ci/osx/after_success.sh +++ b/scripts/ci/osx/after_success.sh @@ -14,7 +14,7 @@ VERSION="$(get_version .)" #Only build if the commit we are building is for the last tag if [ "$(git rev-list -n 1 $VERSION)" != "$(cat .git/HEAD)" ]; then echo "Not uploading package" - return 0 +# return 0 fi QTDIR="/usr/local/opt/qt5" diff --git a/src/Common.cpp b/src/Common.cpp index 13028a03..0fae6362 100644 --- a/src/Common.cpp +++ b/src/Common.cpp @@ -352,23 +352,21 @@ QString Common::maskLog(const QString &rawJson) static std::vector mpRngIntegers; static std::random_device rngDevice; -std::seed_seq Common::getRngSeed() +std::vector Common::getRngSeed() { if (mpRngIntegers.empty()) { std::vector ints = {rngDevice(), rngDevice(), rngDevice(), rngDevice(), rngDevice(), rngDevice(), rngDevice(), rngDevice(), std::chrono::system_clock::now().time_since_epoch().count()}; - std::seed_seq sequence(ints.begin(), ints.end()); - return sequence; + return ints; } else { std::vector ints = mpRngIntegers; ints.push_back(rngDevice()); ints.push_back(std::chrono::system_clock::now().time_since_epoch().count()); - std::seed_seq sequence(ints.begin(), ints.end()); - return sequence; + return ints; } } diff --git a/src/Common.h b/src/Common.h index 8f859bee..2d12df81 100644 --- a/src/Common.h +++ b/src/Common.h @@ -152,7 +152,7 @@ class Common //mask log by removing passwords and data from log static QString maskLog(const QString &rawJson); - static std::seed_seq getRngSeed(); + static std::vector getRngSeed(); static void updateSeed(std::vector &newInts); typedef enum diff --git a/src/PasswordLineEdit.cpp b/src/PasswordLineEdit.cpp index 9a53c7f8..6fba919f 100644 --- a/src/PasswordLineEdit.cpp +++ b/src/PasswordLineEdit.cpp @@ -120,7 +120,8 @@ void PasswordLineEdit::setPasswordVisible(bool visible) PasswordOptionsPopup::PasswordOptionsPopup(QWidget* parent): QFrame(parent, Qt::Popup) { - auto seed = Common::getRngSeed(); + auto iseed = Common::getRngSeed(); + std::seed_seq seed(iseed.begin(), iseed.end()); m_random_generator.seed(seed); setFrameShadow(QFrame::Plain);