fix a few compile warnings
1, const qualifiers on return types make no sense and will trigger a compile warning: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] 2, class HistogramImpl has virtual functions and thus should have a virtual destructor 3, with some toolchain, the macro __STDC_FORMAT_MACROS is predefined and thus should be checked before define Change-Id: I69747a03bfae88671bfbb2637c80d17600159c99 Signed-off-by: liuhuahang <liuhuahang@zerus.co>
This commit is contained in:
parent
1b1d9619ff
commit
ef5b384729
@ -244,7 +244,7 @@ class IterKey {
|
||||
|
||||
Slice GetKey() const { return Slice(key_, key_size_); }
|
||||
|
||||
const size_t Size() { return key_size_; }
|
||||
size_t Size() { return key_size_; }
|
||||
|
||||
void Clear() { key_size_ = 0; }
|
||||
|
||||
|
@ -71,7 +71,7 @@ class SnapshotList {
|
||||
}
|
||||
|
||||
// get the sequence number of the most recent snapshot
|
||||
const SequenceNumber GetNewest() {
|
||||
SequenceNumber GetNewest() {
|
||||
if (empty()) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -210,8 +210,8 @@ Status BlockPrefixIndex::Create(const SliceTransform* internal_prefix_extractor,
|
||||
return s;
|
||||
}
|
||||
|
||||
const uint32_t BlockPrefixIndex::GetBlocks(const Slice& key,
|
||||
uint32_t** blocks) {
|
||||
uint32_t BlockPrefixIndex::GetBlocks(const Slice& key,
|
||||
uint32_t** blocks) {
|
||||
Slice prefix = internal_prefix_extractor_->Transform(key);
|
||||
|
||||
uint32_t bucket = PrefixToBucket(prefix, num_buckets_);
|
||||
|
@ -23,7 +23,7 @@ class BlockPrefixIndex {
|
||||
// the key, based on the prefix.
|
||||
// Returns the total number of relevant blocks, 0 means the key does
|
||||
// not exist.
|
||||
const uint32_t GetBlocks(const Slice& key, uint32_t** blocks);
|
||||
uint32_t GetBlocks(const Slice& key, uint32_t** blocks);
|
||||
|
||||
size_t ApproximateMemoryUsage() const {
|
||||
return sizeof(BlockPrefixIndex) +
|
||||
|
@ -53,7 +53,7 @@ HistogramBucketMapper::HistogramBucketMapper()
|
||||
}
|
||||
}
|
||||
|
||||
const size_t HistogramBucketMapper::IndexForValue(const uint64_t value) const {
|
||||
size_t HistogramBucketMapper::IndexForValue(const uint64_t value) const {
|
||||
if (value >= maxBucketValue_) {
|
||||
return bucketValues_.size() - 1;
|
||||
} else if ( value >= minBucketValue_ ) {
|
||||
|
@ -23,10 +23,10 @@ class HistogramBucketMapper {
|
||||
HistogramBucketMapper();
|
||||
|
||||
// converts a value to the bucket index.
|
||||
const size_t IndexForValue(const uint64_t value) const;
|
||||
size_t IndexForValue(const uint64_t value) const;
|
||||
// number of buckets required.
|
||||
|
||||
const size_t BucketCount() const {
|
||||
size_t BucketCount() const {
|
||||
return bucketValues_.size();
|
||||
}
|
||||
|
||||
@ -65,6 +65,8 @@ class HistogramImpl {
|
||||
virtual double StandardDeviation() const;
|
||||
virtual void Data(HistogramData * const data) const;
|
||||
|
||||
virtual ~HistogramImpl() {}
|
||||
|
||||
private:
|
||||
// To be able to use HistogramImpl as thread local variable, its constructor
|
||||
// has to be static. That's why we're using manually values from BucketMapper
|
||||
|
@ -7,7 +7,10 @@
|
||||
|
||||
#include "rocksdb/utilities/spatial_db.h"
|
||||
|
||||
#ifndef __STDC_FORMAT_MACROS
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
Loading…
Reference in New Issue
Block a user