Skip to content

Commit 64b378c

Browse files
committed
Clean up compile-time warnings (gcc 7.1)
* max_file_size was already a size_t, so return that. * ecx was somehow being listed as used-uninitialized
1 parent 4953164 commit 64b378c

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

db/memtable.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void MemTable::Add(SequenceNumber s, ValueType type,
101101
p += 8;
102102
p = EncodeVarint32(p, val_size);
103103
memcpy(p, value.data(), val_size);
104-
assert((p + val_size) - buf == encoded_len);
104+
assert(size_t((p + val_size)) == encoded_len + size_t(buf));
105105
table_.Insert(buf);
106106
}
107107

db/version_set.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
namespace leveldb {
2222

23-
static int TargetFileSize(const Options* options) {
23+
static size_t TargetFileSize(const Options* options) {
2424
return options->max_file_size;
2525
}
2626

port/port_posix_sse.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static inline bool HaveSSE42() {
5454
__cpuid(cpu_info, 1);
5555
return (cpu_info[2] & (1 << 20)) != 0;
5656
#elif defined(__GNUC__)
57-
unsigned int eax, ebx, ecx, edx;
57+
unsigned int eax, ebx, ecx = 0, edx;
5858
__get_cpuid(1, &eax, &ebx, &ecx, &edx);
5959
return (ecx & (1 << 20)) != 0;
6060
#else

util/logging.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ bool ConsumeDecimalNumber(Slice* in, uint64_t* val) {
4949
uint64_t v = 0;
5050
int digits = 0;
5151
while (!in->empty()) {
52-
char c = (*in)[0];
52+
unsigned char c = (*in)[0];
5353
if (c >= '0' && c <= '9') {
5454
++digits;
5555
const int delta = (c - '0');

0 commit comments

Comments
 (0)