From db676a7e5f4edc87fef2bc24fe698c99e3c6de01 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Mon, 9 Dec 2024 15:20:50 +0000 Subject: [PATCH] merge bitcoin#26814: remove windows-only compat.h usage in random --- src/random.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/random.cpp b/src/random.cpp index ec8a46b328770..e98b068d3cee0 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -9,24 +9,23 @@ #include #include #include -#include -#ifdef WIN32 -#include -#include -#endif #include #include -#include #include -#include // for Mutex -#include // for GetTimeMicros() +#include +#include +#include +#include #include #include #include #include -#ifndef WIN32 +#ifdef WIN32 +#include +#include +#else #include #endif @@ -729,7 +728,7 @@ bool Random_SanityCheck() * GetOSRand() overwrites all 32 bytes of the output given a maximum * number of tries. */ - static const ssize_t MAX_TRIES = 1024; + static constexpr int MAX_TRIES{1024}; uint8_t data[NUM_OS_RANDOM_BYTES]; bool overwritten[NUM_OS_RANDOM_BYTES] = {}; /* Tracks which bytes have been overwritten at least once */ int num_overwritten;