From 3fa68af31695f496791da911e2291e2de62b408a Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Thu, 19 Nov 2015 11:47:12 -0800 Subject: [PATCH] Enable MS compiler warning c4244. Mostly due to the fact that there are differences in sizes of int,long on 64 bit systems vs GNU. --- CMakeLists.txt | 2 +- db/compaction_job_stats_test.cc | 5 +++-- db/version_set.cc | 10 +++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bbaefd222..ca7c7a0b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,8 +59,8 @@ add_custom_command(OUTPUT ${BUILD_VERSION_CC} add_custom_target(GenerateBuildVersion DEPENDS ${BUILD_VERSION_CC}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi /nologo /EHsc /GS /Gd /GR /GF /fp:precise /Zc:wchar_t /Zc:forScope /errorReport:queue") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FC /d2Zi+ /W3 /WX /wd4127 /wd4267 /wd4800 /wd4996") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FC /d2Zi+ /W3 /WX /wd4127 /wd4800 /wd4996") # Used to run CI build and tests so we can run faster set(OPTIMIZE_DEBUG_DEFAULT 0) # Debug build is unoptimized by default use -DOPTDBG=1 to optimize diff --git a/db/compaction_job_stats_test.cc b/db/compaction_job_stats_test.cc index 14a7b9b4b..2685f6e45 100644 --- a/db/compaction_job_stats_test.cc +++ b/db/compaction_job_stats_test.cc @@ -551,8 +551,9 @@ uint64_t EstimatedFileSize( const size_t kFooterSize = 512; uint64_t data_size = - static_cast(num_records * (key_size + - value_size * compression_ratio + kPerKeyOverhead)); + static_cast( + num_records * (key_size + value_size * compression_ratio + + kPerKeyOverhead)); return data_size + kFooterSize + num_records * bloom_bits_per_key / 8 // filter block diff --git a/db/version_set.cc b/db/version_set.cc index 87d525581..40adcda5f 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -738,22 +738,22 @@ uint64_t VersionStorageInfo::GetEstimatedActiveKeys() const { // (2) keys are directly overwritten // (3) deletion on non-existing keys // (4) low number of samples - if (num_samples_ == 0) { + if (current_num_samples_ == 0) { return 0; } - if (accumulated_num_non_deletions_ <= accumulated_num_deletions_) { + if (current_num_non_deletions_ <= current_num_deletions_) { return 0; } - uint64_t est = accumulated_num_non_deletions_ - accumulated_num_deletions_; + uint64_t est = current_num_non_deletions_ - current_num_deletions_; uint64_t file_count = 0; for (int level = 0; level < num_levels_; ++level) { file_count += files_[level].size(); } - if (num_samples_ < file_count) { + if (current_num_samples_ < file_count) { // casting to avoid overflowing return static_cast( @@ -888,7 +888,7 @@ void Version::Get(const ReadOptions& read_options, const LookupKey& k, GetContext get_context( user_comparator(), merge_operator_, info_log_, db_statistics_, status->ok() ? GetContext::kNotFound : GetContext::kMerge, user_key, - value, value_found, merge_context, this->env_, seq); + value, value_found, merge_context, this->env_); FilePicker fp( storage_info_.files_, user_key, ikey, &storage_info_.level_files_brief_,