Merge pull request #1040 from bureau14/master

Fixes warnings and ensure correct int behavior on 32-bit platforms.
This commit is contained in:
dhruba borthakur 2016-03-17 03:23:30 -07:00
commit 33d568611d
7 changed files with 13 additions and 12 deletions

View File

@ -79,7 +79,7 @@ ManagedIterator::ManagedIterator(DBImpl* db, const ReadOptions& read_options,
release_supported_(true) { release_supported_(true) {
read_options_.managed = false; read_options_.managed = false;
if ((!read_options_.tailing) && (read_options_.snapshot == nullptr)) { if ((!read_options_.tailing) && (read_options_.snapshot == nullptr)) {
assert(read_options_.snapshot = db_->GetSnapshot()); assert(nullptr != (read_options_.snapshot = db_->GetSnapshot()));
snapshot_created_ = true; snapshot_created_ = true;
} }
cfh_.SetCFD(cfd); cfh_.SetCFD(cfd);
@ -210,7 +210,8 @@ void ManagedIterator::RebuildIterator() {
void ManagedIterator::UpdateCurrent() { void ManagedIterator::UpdateCurrent() {
assert(mutable_iter_ != nullptr); assert(mutable_iter_ != nullptr);
if (!(valid_ = mutable_iter_->Valid())) { valid_ = mutable_iter_->Valid();
if (!valid_) {
status_ = mutable_iter_->status(); status_ = mutable_iter_->status();
return; return;
} }

View File

@ -345,8 +345,8 @@ Status MemTableList::InstallMemtableFlushResults(
imm_flush_needed.store(true, std::memory_order_release); imm_flush_needed.store(true, std::memory_order_release);
} }
++mem_id; ++mem_id;
} while (!current_->memlist_.empty() && (m = current_->memlist_.back()) && } while (!current_->memlist_.empty() && (nullptr != (m = current_->memlist_.back())) &&
m->file_number_ == file_number); (m->file_number_ == file_number));
} }
commit_in_progress_ = false; commit_in_progress_ = false;
return s; return s;

View File

@ -90,8 +90,8 @@ class FilePicker {
const Comparator* user_comparator, const Comparator* user_comparator,
const InternalKeyComparator* internal_comparator) const InternalKeyComparator* internal_comparator)
: num_levels_(num_levels), : num_levels_(num_levels),
curr_level_(-1), curr_level_(static_cast<unsigned int>(-1)),
hit_file_level_(-1), hit_file_level_(static_cast<unsigned int>(-1)),
search_left_bound_(0), search_left_bound_(0),
search_right_bound_(FileIndexer::kLevelMaxIndex), search_right_bound_(FileIndexer::kLevelMaxIndex),
#ifndef NDEBUG #ifndef NDEBUG

View File

@ -110,7 +110,7 @@ std::string BlockBasedTableFactory::GetPrintableTableOptions() const {
snprintf(buffer, kBufferSize, " flush_block_policy_factory: %s (%p)\n", snprintf(buffer, kBufferSize, " flush_block_policy_factory: %s (%p)\n",
table_options_.flush_block_policy_factory->Name(), table_options_.flush_block_policy_factory->Name(),
table_options_.flush_block_policy_factory.get()); static_cast<void*>(table_options_.flush_block_policy_factory.get()));
ret.append(buffer); ret.append(buffer);
snprintf(buffer, kBufferSize, " cache_index_and_filter_blocks: %d\n", snprintf(buffer, kBufferSize, " cache_index_and_filter_blocks: %d\n",
table_options_.cache_index_and_filter_blocks); table_options_.cache_index_and_filter_blocks);
@ -128,7 +128,7 @@ std::string BlockBasedTableFactory::GetPrintableTableOptions() const {
table_options_.no_block_cache); table_options_.no_block_cache);
ret.append(buffer); ret.append(buffer);
snprintf(buffer, kBufferSize, " block_cache: %p\n", snprintf(buffer, kBufferSize, " block_cache: %p\n",
table_options_.block_cache.get()); static_cast<void*>(table_options_.block_cache.get()));
ret.append(buffer); ret.append(buffer);
if (table_options_.block_cache) { if (table_options_.block_cache) {
snprintf(buffer, kBufferSize, " block_cache_size: %" ROCKSDB_PRIszt "\n", snprintf(buffer, kBufferSize, " block_cache_size: %" ROCKSDB_PRIszt "\n",
@ -136,7 +136,7 @@ std::string BlockBasedTableFactory::GetPrintableTableOptions() const {
ret.append(buffer); ret.append(buffer);
} }
snprintf(buffer, kBufferSize, " block_cache_compressed: %p\n", snprintf(buffer, kBufferSize, " block_cache_compressed: %p\n",
table_options_.block_cache_compressed.get()); static_cast<void*>(table_options_.block_cache_compressed.get()));
ret.append(buffer); ret.append(buffer);
if (table_options_.block_cache_compressed) { if (table_options_.block_cache_compressed) {
snprintf(buffer, kBufferSize, snprintf(buffer, kBufferSize,

View File

@ -26,7 +26,7 @@ const size_t Arena::kInlineSize;
#endif #endif
const size_t Arena::kMinBlockSize = 4096; const size_t Arena::kMinBlockSize = 4096;
const size_t Arena::kMaxBlockSize = 2 << 30; const size_t Arena::kMaxBlockSize = 2u << 30;
static const int kAlignUnit = sizeof(void*); static const int kAlignUnit = sizeof(void*);
size_t OptimizeBlockSize(size_t block_size) { size_t OptimizeBlockSize(size_t block_size) {

View File

@ -102,7 +102,7 @@ class Random64 {
// return "base" random bits. The effect is to pick a number in the // return "base" random bits. The effect is to pick a number in the
// range [0,2^max_log-1] with exponential bias towards smaller numbers. // range [0,2^max_log-1] with exponential bias towards smaller numbers.
uint64_t Skewed(int max_log) { uint64_t Skewed(int max_log) {
return Uniform(1 << Uniform(max_log + 1)); return Uniform(uint64_t(1) << Uniform(max_log + 1));
} }
}; };

View File

@ -113,7 +113,7 @@ class Uint64ComparatorImpl : public Comparator {
}; };
} // namespace } // namespace
static port::OnceType once = LEVELDB_ONCE_INIT; static port::OnceType once;
static const Comparator* uint64comp; static const Comparator* uint64comp;
static void InitModule() { static void InitModule() {