From f6b9d9355e1c9a2e2ec1168976956eea2d82248c Mon Sep 17 00:00:00 2001 From: Maysam Yabandeh Date: Wed, 5 Jul 2017 11:07:29 -0700 Subject: [PATCH] Fix clang error in PartitionedFilterBlockBuilder Summary: Closes https://github.com/facebook/rocksdb/pull/2536 Differential Revision: D5371271 Pulled By: maysamyabandeh fbshipit-source-id: f1355ac658a79c9982a24986f0925c9e24fc39d5 --- table/block_based_table_builder.cc | 6 +++--- table/partitioned_filter_block_test.cc | 10 ++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/table/block_based_table_builder.cc b/table/block_based_table_builder.cc index 6545c7b8f2..7841593395 100644 --- a/table/block_based_table_builder.cc +++ b/table/block_based_table_builder.cc @@ -81,9 +81,9 @@ FilterBlockBuilder* CreateFilterBlockBuilder( // as partition size. assert(table_opt.block_size_deviation <= 100); auto partition_size = - (const uint32_t)(table_opt.metadata_block_size * - (100 - table_opt.block_size_deviation)); - partition_size = std::max(partition_size, (const uint32_t)1); + static_cast(table_opt.metadata_block_size * + (100 - table_opt.block_size_deviation)); + partition_size = std::max(partition_size, static_cast(1)); return new PartitionedFilterBlockBuilder( opt.prefix_extractor, table_opt.whole_key_filtering, filter_bits_builder, table_opt.index_block_restart_interval, diff --git a/table/partitioned_filter_block_test.cc b/table/partitioned_filter_block_test.cc index 288a75a950..352b2d7233 100644 --- a/table/partitioned_filter_block_test.cc +++ b/table/partitioned_filter_block_test.cc @@ -89,12 +89,10 @@ class PartitionedFilterBlockTest : public testing::Test { PartitionedFilterBlockBuilder* NewBuilder( PartitionedIndexBuilder* const p_index_builder) { - uint32_t partition_size = - table_options_.metadata_block_size > - (uint64_t)table_options_.block_size_deviation - ? table_options_.metadata_block_size - - table_options_.block_size_deviation - : 1; + assert(table_opt.block_size_deviation <= 100); + auto partition_size = static_cast( + table_opt.metadata_block_size * (100 - table_opt.block_size_deviation)); + partition_size = std::max(partition_size, static_cast(1)); return new PartitionedFilterBlockBuilder( nullptr, table_options_.whole_key_filtering, table_options_.filter_policy->GetFilterBitsBuilder(),