From 4d1aac074771a77fc1430dd7ba472478b9f6e4cc Mon Sep 17 00:00:00 2001 From: jxlkar Date: Sun, 14 Jan 2024 19:06:44 +0800 Subject: [PATCH] fix CI build --- src/types/redis_zset.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/types/redis_zset.cc b/src/types/redis_zset.cc index f2b1dab14b4..57c154acc8d 100644 --- a/src/types/redis_zset.cc +++ b/src/types/redis_zset.cc @@ -903,16 +903,17 @@ rocksdb::Status ZSet::RandMember(const Slice &user_key, int64_t command_count, s = GetAllMemberScores(user_key, &samples); if (!s.ok() || samples.empty()) return s; - member_scores->reserve(std::min(samples.size(), count)); + auto size = static_cast(samples.size()); + member_scores->reserve(std::min(size, count)); if (!unique || count == 1) { std::mt19937 gen(std::random_device{}()); - std::uniform_int_distribution dist(0, samples.size() - 1); + std::uniform_int_distribution dist(0, size - 1); for (uint64_t i = 0; i < count; i++) { uint64_t index = dist(gen); member_scores->emplace_back(samples[index]); } - } else if (samples.size() <= count) { + } else if (size <= count) { for (auto &sample : samples) { member_scores->push_back(sample); }