From 114a1b879219a243c3a37d667fa40e0c3c5403b1 Mon Sep 17 00:00:00 2001 From: Andrew Kryczka Date: Fri, 8 Apr 2016 13:09:19 -0700 Subject: [PATCH] Fix build errors for windows Summary: - Need to use unsigned long long for 64-bit literals on windows - Need size_t for backup meta-file length since clang doesn't let us assign size_t to int Test Plan: backupable_db_test and options_test Reviewers: IslamAbdelRahman, yhchiang, sdong Reviewed By: sdong Subscribers: andrewkr, dhruba, leveldb Differential Revision: https://reviews.facebook.net/D56391 --- util/options.cc | 4 ++-- utilities/backupable/backupable_db.cc | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/util/options.cc b/util/options.cc index 3ef6f1ca73..356736afd4 100644 --- a/util/options.cc +++ b/util/options.cc @@ -104,8 +104,8 @@ ColumnFamilyOptions::ColumnFamilyOptions() max_grandparent_overlap_factor(10), soft_rate_limit(0.0), hard_rate_limit(0.0), - soft_pending_compaction_bytes_limit(64 * 1073741824ul), - hard_pending_compaction_bytes_limit(256 * 1073741824ul), + soft_pending_compaction_bytes_limit(64 * 1073741824ull), + hard_pending_compaction_bytes_limit(256 * 1073741824ull), rate_limit_delay_max_milliseconds(1000), arena_block_size(0), disable_auto_compactions(false), diff --git a/utilities/backupable/backupable_db.cc b/utilities/backupable/backupable_db.cc index da6972d947..461894c068 100644 --- a/utilities/backupable/backupable_db.cc +++ b/utilities/backupable/backupable_db.cc @@ -1702,7 +1702,7 @@ Status BackupEngineImpl::BackupMeta::StoreToFile(bool sync) { } unique_ptr buf(new char[max_backup_meta_file_size_]); - int len = 0, buf_size = max_backup_meta_file_size_; + size_t len = 0, buf_size = max_backup_meta_file_size_; len += snprintf(buf.get(), buf_size, "%" PRId64 "\n", timestamp_); len += snprintf(buf.get() + len, buf_size - len, "%" PRIu64 "\n", sequence_number_); @@ -1710,7 +1710,7 @@ Status BackupEngineImpl::BackupMeta::StoreToFile(bool sync) { std::string hex_encoded_metadata = Slice(app_metadata_).ToString(/* hex */ true); if (hex_encoded_metadata.size() + kMetaDataPrefix.size() + 1 > - (size_t)(buf_size - len)) { + buf_size - len) { return Status::Corruption("Buffer too small to fit backup metadata"); } memcpy(buf.get() + len, kMetaDataPrefix.data(), kMetaDataPrefix.size()); @@ -1728,7 +1728,7 @@ Status BackupEngineImpl::BackupMeta::StoreToFile(bool sync) { file->filename.c_str(), file->checksum_value); } - s = backup_meta_file->Append(Slice(buf.get(), (size_t)len)); + s = backup_meta_file->Append(Slice(buf.get(), len)); if (s.ok() && sync) { s = backup_meta_file->Sync(); }