Fix -Wshorten-64-to-32 for musl

On musl uint_fast32_t is uint32_t, while for glibc it is unsigned long
long.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2022-10-15 23:26:20 +02:00
parent 4e76629aaf
commit 089bf39132
2 changed files with 3 additions and 3 deletions

View File

@ -353,7 +353,7 @@ struct PoolWithFailoverBase<TNestedPool>::PoolState
}
private:
std::minstd_rand rng = std::minstd_rand(randomSeed());
std::minstd_rand rng = std::minstd_rand(static_cast<uint_fast32_t>(randomSeed()));
};
template <typename TNestedPool>

View File

@ -42,8 +42,8 @@ PoolWithFailover::PoolWithFailover(
/// which triggers massive re-constructing of connection pools.
/// The state of PRNGs like std::mt19937 is considered to be quite heavy
/// thus here we attempt to optimize its construction.
static thread_local std::mt19937 rnd_generator(
std::hash<std::thread::id>{}(std::this_thread::get_id()) + std::clock());
static thread_local std::mt19937 rnd_generator(static_cast<uint_fast32_t>(
std::hash<std::thread::id>{}(std::this_thread::get_id()) + std::clock()));
for (auto & [_, replicas] : replicas_by_priority)
{
if (replicas.size() > 1)