From 24420947d9e144f52a931a98a43e64228de9ac4c Mon Sep 17 00:00:00 2001 From: Sandeep Joshi Date: Wed, 30 Mar 2016 23:13:00 +0530 Subject: [PATCH] Replace kHeader by WriteBatchInternal::kHeader in few more places kHeader was moved from write_batch.cc to header file because it is being used wherever the number "12" was being used to check for record size --- db/write_batch.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/db/write_batch.cc b/db/write_batch.cc index 4b8f87a5e..f27c81fe9 100644 --- a/db/write_batch.cc +++ b/db/write_batch.cc @@ -144,7 +144,7 @@ bool WriteBatch::Handler::Continue() { void WriteBatch::Clear() { rep_.clear(); - rep_.resize(kHeader); + rep_.resize(WriteBatchInternal::kHeader); content_flags_.store(0, std::memory_order_relaxed); @@ -247,11 +247,11 @@ Status ReadRecordFromWriteBatch(Slice* input, char* tag, Status WriteBatch::Iterate(Handler* handler) const { Slice input(rep_); - if (input.size() < kHeader) { + if (input.size() < WriteBatchInternal::kHeader) { return Status::Corruption("malformed WriteBatch (too small)"); } - input.remove_prefix(kHeader); + input.remove_prefix(WriteBatchInternal::kHeader); Slice key, value, blob; int found = 0; Status s; @@ -327,7 +327,7 @@ void WriteBatchInternal::SetSequence(WriteBatch* b, SequenceNumber seq) { EncodeFixed64(&b->rep_[0], seq); } -size_t WriteBatchInternal::GetFirstOffset(WriteBatch* b) { return kHeader; } +size_t WriteBatchInternal::GetFirstOffset(WriteBatch* b) { return WriteBatchInternal::kHeader; } void WriteBatchInternal::Put(WriteBatch* b, uint32_t column_family_id, const Slice& key, const Slice& value) { @@ -830,15 +830,15 @@ Status WriteBatchInternal::InsertInto(const WriteBatch* batch, } void WriteBatchInternal::SetContents(WriteBatch* b, const Slice& contents) { - assert(contents.size() >= kHeader); + assert(contents.size() >= WriteBatchInternal::kHeader); b->rep_.assign(contents.data(), contents.size()); b->content_flags_.store(ContentFlags::DEFERRED, std::memory_order_relaxed); } void WriteBatchInternal::Append(WriteBatch* dst, const WriteBatch* src) { SetCount(dst, Count(dst) + Count(src)); - assert(src->rep_.size() >= kHeader); - dst->rep_.append(src->rep_.data() + kHeader, src->rep_.size() - kHeader); + assert(src->rep_.size() >= WriteBatchInternal::kHeader); + dst->rep_.append(src->rep_.data() + WriteBatchInternal::kHeader, src->rep_.size() - WriteBatchInternal::kHeader); dst->content_flags_.store( dst->content_flags_.load(std::memory_order_relaxed) | src->content_flags_.load(std::memory_order_relaxed), @@ -850,7 +850,7 @@ size_t WriteBatchInternal::AppendedByteSize(size_t leftByteSize, if (leftByteSize == 0 || rightByteSize == 0) { return leftByteSize + rightByteSize; } else { - return leftByteSize + rightByteSize - kHeader; + return leftByteSize + rightByteSize - WriteBatchInternal::kHeader; } }