fix a division by zero bug
Summary: fixes the failing clang_analyze contrun test Closes https://github.com/facebook/rocksdb/pull/3872 Differential Revision: D8059241 Pulled By: miasantreble fbshipit-source-id: e8fc1838004fe16a823456188386b8b39429803b
This commit is contained in:
parent
26da3676d9
commit
ed4d3393fb
@ -404,13 +404,14 @@ TEST_F(DBIteratorStressTest, StressTest) {
|
|||||||
Random64 rnd(826909345792864532ll);
|
Random64 rnd(826909345792864532ll);
|
||||||
|
|
||||||
auto gen_key = [&](int max_key) {
|
auto gen_key = [&](int max_key) {
|
||||||
|
assert(max_key > 0);
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int a = max_key;
|
int a = max_key;
|
||||||
while (a) {
|
while (a) {
|
||||||
a /= 10;
|
a /= 10;
|
||||||
++len;
|
++len;
|
||||||
}
|
}
|
||||||
std::string s = ToString(rnd.Next() % (uint64_t)max_key);
|
std::string s = ToString(rnd.Next() % static_cast<uint64_t>(max_key));
|
||||||
s.insert(0, len - (int)s.size(), '0');
|
s.insert(0, len - (int)s.size(), '0');
|
||||||
return s;
|
return s;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user