diff --git a/table/full_filter_block.cc b/table/full_filter_block.cc index 8a481b7d0..4ccc2e2b4 100644 --- a/table/full_filter_block.cc +++ b/table/full_filter_block.cc @@ -47,7 +47,7 @@ inline void FullFilterBlockBuilder::AddPrefix(const Slice& key) { Slice FullFilterBlockBuilder::Finish() { if (num_added_ != 0) { num_added_ = 0; - return filter_bits_builder_->Finish(&filter_data); + return filter_bits_builder_->Finish(&filter_data_); } return Slice(); } @@ -64,7 +64,7 @@ FullFilterBlockReader::FullFilterBlockReader( filter_bits_reader_.reset(filter_bits_reader); if (delete_contents_after_use) { - filter_data.reset(contents.data()); + filter_data_.reset(contents.data()); } } diff --git a/table/full_filter_block.h b/table/full_filter_block.h index 24d20e032..46ba5d1de 100644 --- a/table/full_filter_block.h +++ b/table/full_filter_block.h @@ -56,7 +56,7 @@ class FullFilterBlockBuilder : public FilterBlockBuilder { uint32_t num_added_; std::unique_ptr filter_bits_builder_; - std::unique_ptr filter_data; + std::unique_ptr filter_data_; void AddKey(const Slice& key); void AddPrefix(const Slice& key); @@ -95,7 +95,7 @@ class FullFilterBlockReader : public FilterBlockReader { std::unique_ptr filter_bits_reader_; Slice contents_; - std::unique_ptr filter_data; + std::unique_ptr filter_data_; bool MayMatch(const Slice& entry); diff --git a/util/bloom.cc b/util/bloom.cc index f19e2a670..19d8edead 100644 --- a/util/bloom.cc +++ b/util/bloom.cc @@ -54,9 +54,8 @@ class FullFilterBitsBuilder : public FilterBitsBuilder { // | ... | num_probes : 1 byte | num_lines : 4 bytes | // +----------------------------------------------------------------+ virtual Slice Finish(std::unique_ptr* buf) override { - char* data = nullptr; uint32_t total_bits, num_lines; - data = ReserveSpace(hash_entries_.size(), &total_bits, &num_lines); + char* data = ReserveSpace(hash_entries_.size(), &total_bits, &num_lines); assert(data); if (total_bits != 0 && num_lines != 0) { @@ -67,7 +66,8 @@ class FullFilterBitsBuilder : public FilterBitsBuilder { data[total_bits/8] = static_cast(num_probes_); EncodeFixed32(data + total_bits/8 + 1, static_cast(num_lines)); - buf->reset(data); + const char* const_data = data; + buf->reset(const_data); hash_entries_.clear(); return Slice(data, total_bits / 8 + 5);