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
main
Zhongyi Xie 7 years ago committed by Facebook Github Bot
parent 26da3676d9
commit ed4d3393fb
  1. 3
      db/db_iter_stress_test.cc

@ -404,13 +404,14 @@ TEST_F(DBIteratorStressTest, StressTest) {
Random64 rnd(826909345792864532ll);
auto gen_key = [&](int max_key) {
assert(max_key > 0);
int len = 0;
int a = max_key;
while (a) {
a /= 10;
++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');
return s;
};

Loading…
Cancel
Save