From ada13c19fd9437978d4d469dd8a0551b0d1f638d Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 21 Sep 2021 12:02:26 +0200 Subject: [PATCH] [libcalamares] Simplify filling the entropy buffer --- src/libcalamares/utils/Entropy.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libcalamares/utils/Entropy.cpp b/src/libcalamares/utils/Entropy.cpp index d28230a85..67a0718f5 100644 --- a/src/libcalamares/utils/Entropy.cpp +++ b/src/libcalamares/utils/Entropy.cpp @@ -18,15 +18,17 @@ CalamaresUtils::EntropySource CalamaresUtils::getEntropy( int size, QByteArray& b ) { + constexpr const char filler = char( 0xcb ); + + b.fill( filler ); b.clear(); if ( size < 1 ) { return EntropySource::None; } - b.resize( size ); + b.fill( filler, size ); char* buffer = b.data(); - std::fill( buffer, buffer + size, 0xcb ); qint64 readSize = 0; QFile urandom( "/dev/urandom" );