Fix from some C-style casting (#5524)
Summary: Fix from some C-style casting in bloom.cc and ./tools/db_bench_tool.cc Pull Request resolved: https://github.com/facebook/rocksdb/pull/5524 Differential Revision: D16075626 Pulled By: elipoz fbshipit-source-id: 352948885efb64a7ef865942c75c3c727a914207
This commit is contained in:
parent
9f0bd56889
commit
f872009237
@ -2397,16 +2397,19 @@ class Benchmark {
|
||||
return nullptr;
|
||||
}
|
||||
if (FLAGS_use_clock_cache) {
|
||||
auto cache = NewClockCache((size_t)capacity, FLAGS_cache_numshardbits);
|
||||
auto cache =
|
||||
NewClockCache(static_cast<size_t>(capacity), FLAGS_cache_numshardbits);
|
||||
if (!cache) {
|
||||
fprintf(stderr, "Clock cache not supported.");
|
||||
exit(1);
|
||||
}
|
||||
return cache;
|
||||
} else {
|
||||
return NewLRUCache((size_t)capacity, FLAGS_cache_numshardbits,
|
||||
false /*strict_capacity_limit*/,
|
||||
FLAGS_cache_high_pri_pool_ratio);
|
||||
return NewLRUCache(
|
||||
static_cast<size_t>(capacity),
|
||||
FLAGS_cache_numshardbits,
|
||||
false /*strict_capacity_limit*/,
|
||||
FLAGS_cache_high_pri_pool_ratio);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3604,9 +3607,12 @@ class Benchmark {
|
||||
}
|
||||
if (FLAGS_max_bytes_for_level_multiplier_additional_v.size() > 0) {
|
||||
if (FLAGS_max_bytes_for_level_multiplier_additional_v.size() !=
|
||||
(unsigned int)FLAGS_num_levels) {
|
||||
fprintf(stderr, "Insufficient number of fanouts specified %d\n",
|
||||
(int)FLAGS_max_bytes_for_level_multiplier_additional_v.size());
|
||||
static_cast<unsigned int>(FLAGS_num_levels)) {
|
||||
fprintf(
|
||||
stderr,
|
||||
"Insufficient number of fanouts specified %d\n",
|
||||
static_cast<int>(
|
||||
FLAGS_max_bytes_for_level_multiplier_additional_v.size()));
|
||||
exit(1);
|
||||
}
|
||||
options.max_bytes_for_level_multiplier_additional =
|
||||
@ -4791,7 +4797,7 @@ class Benchmark {
|
||||
if (FLAGS_multiread_stride) {
|
||||
int64_t key = GetRandomKey(&thread->rand);
|
||||
if ((key + (entries_per_batch_ - 1) * FLAGS_multiread_stride) >=
|
||||
(int64_t)FLAGS_num) {
|
||||
static_cast<int64_t>(FLAGS_num)) {
|
||||
key = FLAGS_num - entries_per_batch_ * FLAGS_multiread_stride;
|
||||
}
|
||||
for (int64_t i = 0; i < entries_per_batch_; ++i) {
|
||||
@ -5161,9 +5167,10 @@ class Benchmark {
|
||||
FLAGS_num, &lower_bound);
|
||||
options.iterate_lower_bound = &lower_bound;
|
||||
} else {
|
||||
auto min_num =
|
||||
std::min(FLAGS_num, seek_pos + FLAGS_max_scan_distance);
|
||||
GenerateKeyFromInt(
|
||||
(uint64_t)std::min(FLAGS_num, seek_pos + FLAGS_max_scan_distance),
|
||||
FLAGS_num, &upper_bound);
|
||||
static_cast<uint64_t>(min_num), FLAGS_num, &upper_bound);
|
||||
options.iterate_upper_bound = &upper_bound;
|
||||
}
|
||||
}
|
||||
@ -5331,7 +5338,7 @@ class Benchmark {
|
||||
// Wait for the writes to be finished
|
||||
if (!hint_printed) {
|
||||
fprintf(stderr, "Reads are finished. Have %d more writes to do\n",
|
||||
(int)writes_ - written);
|
||||
static_cast<int>(writes_) - written);
|
||||
hint_printed = true;
|
||||
}
|
||||
} else {
|
||||
|
@ -104,7 +104,7 @@ int FullFilterBitsBuilder::CalculateNumEntry(const uint32_t space) {
|
||||
assert(bits_per_key_);
|
||||
assert(space > 0);
|
||||
uint32_t dont_care1, dont_care2;
|
||||
int high = (int) (space * 8 / bits_per_key_ + 1);
|
||||
int high = static_cast<int>(space * 8 / bits_per_key_ + 1);
|
||||
int low = 1;
|
||||
int n = high;
|
||||
for (; n >= low; n--) {
|
||||
@ -120,7 +120,7 @@ int FullFilterBitsBuilder::CalculateNumEntry(const uint32_t space) {
|
||||
inline void FullFilterBitsBuilder::AddHash(uint32_t h, char* data,
|
||||
uint32_t num_lines, uint32_t total_bits) {
|
||||
#ifdef NDEBUG
|
||||
(void)total_bits;
|
||||
static_cast<void>(total_bits);
|
||||
#endif
|
||||
assert(num_lines > 0 && total_bits > 0);
|
||||
|
||||
@ -340,7 +340,7 @@ class BloomFilterPolicy : public FilterPolicy {
|
||||
dst->resize(init_size + bytes, 0);
|
||||
dst->push_back(static_cast<char>(num_probes_)); // Remember # of probes
|
||||
char* array = &(*dst)[init_size];
|
||||
for (size_t i = 0; i < (size_t)n; i++) {
|
||||
for (size_t i = 0; i < static_cast<size_t>(n); i++) {
|
||||
// Use double-hashing to generate a sequence of hash values.
|
||||
// See analysis in [Kirsch,Mitzenmacher 2006].
|
||||
uint32_t h = hash_func_(keys[i]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user