Skip to content

Commit ef5b384

Browse files
author
liuhuahang
committed
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>
1 parent 1b1d961 commit ef5b384

File tree

7 files changed

+13
-8
lines changed

7 files changed

+13
-8
lines changed

db/dbformat.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ class IterKey {
244244

245245
Slice GetKey() const { return Slice(key_, key_size_); }
246246

247-
const size_t Size() { return key_size_; }
247+
size_t Size() { return key_size_; }
248248

249249
void Clear() { key_size_ = 0; }
250250

db/snapshot.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class SnapshotList {
7171
}
7272

7373
// get the sequence number of the most recent snapshot
74-
const SequenceNumber GetNewest() {
74+
SequenceNumber GetNewest() {
7575
if (empty()) {
7676
return 0;
7777
}

table/block_prefix_index.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ Status BlockPrefixIndex::Create(const SliceTransform* internal_prefix_extractor,
210210
return s;
211211
}
212212

213-
const uint32_t BlockPrefixIndex::GetBlocks(const Slice& key,
214-
uint32_t** blocks) {
213+
uint32_t BlockPrefixIndex::GetBlocks(const Slice& key,
214+
uint32_t** blocks) {
215215
Slice prefix = internal_prefix_extractor_->Transform(key);
216216

217217
uint32_t bucket = PrefixToBucket(prefix, num_buckets_);

table/block_prefix_index.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class BlockPrefixIndex {
2323
// the key, based on the prefix.
2424
// Returns the total number of relevant blocks, 0 means the key does
2525
// not exist.
26-
const uint32_t GetBlocks(const Slice& key, uint32_t** blocks);
26+
uint32_t GetBlocks(const Slice& key, uint32_t** blocks);
2727

2828
size_t ApproximateMemoryUsage() const {
2929
return sizeof(BlockPrefixIndex) +

util/histogram.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ HistogramBucketMapper::HistogramBucketMapper()
5353
}
5454
}
5555

56-
const size_t HistogramBucketMapper::IndexForValue(const uint64_t value) const {
56+
size_t HistogramBucketMapper::IndexForValue(const uint64_t value) const {
5757
if (value >= maxBucketValue_) {
5858
return bucketValues_.size() - 1;
5959
} else if ( value >= minBucketValue_ ) {

util/histogram.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ class HistogramBucketMapper {
2323
HistogramBucketMapper();
2424

2525
// converts a value to the bucket index.
26-
const size_t IndexForValue(const uint64_t value) const;
26+
size_t IndexForValue(const uint64_t value) const;
2727
// number of buckets required.
2828

29-
const size_t BucketCount() const {
29+
size_t BucketCount() const {
3030
return bucketValues_.size();
3131
}
3232

@@ -65,6 +65,8 @@ class HistogramImpl {
6565
virtual double StandardDeviation() const;
6666
virtual void Data(HistogramData * const data) const;
6767

68+
virtual ~HistogramImpl() {}
69+
6870
private:
6971
// To be able to use HistogramImpl as thread local variable, its constructor
7072
// has to be static. That's why we're using manually values from BucketMapper

utilities/spatialdb/spatial_db.cc

+3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77

88
#include "rocksdb/utilities/spatial_db.h"
99

10+
#ifndef __STDC_FORMAT_MACROS
1011
#define __STDC_FORMAT_MACROS
12+
#endif
13+
1114
#include <inttypes.h>
1215
#include <string>
1316
#include <vector>

0 commit comments

Comments
 (0)