diff options
Diffstat (limited to 'table')
-rw-r--r-- | table/block.cc | 4 | ||||
-rw-r--r-- | table/block_builder.cc | 2 | ||||
-rw-r--r-- | table/format.cc | 4 |
3 files changed, 6 insertions, 4 deletions
diff --git a/table/block.cc b/table/block.cc index 0525d2d..92b2877 100644 --- a/table/block.cc +++ b/table/block.cc @@ -62,7 +62,9 @@ static inline const char* DecodeEntry(const char* p, const char* limit, if ((p = GetVarint32Ptr(p, limit, value_length)) == NULL) return NULL; } - if (limit - p < (*non_shared + *value_length)) return NULL; + if (static_cast<uint32>(limit - p) < (*non_shared + *value_length)) { + return NULL; + } return p; } diff --git a/table/block_builder.cc b/table/block_builder.cc index ae18b36..dc958c8 100644 --- a/table/block_builder.cc +++ b/table/block_builder.cc @@ -62,7 +62,7 @@ size_t BlockBuilder::CurrentSizeEstimate() const { Slice BlockBuilder::Finish() { // Append restart array - for (int i = 0; i < restarts_.size(); i++) { + for (size_t i = 0; i < restarts_.size(); i++) { PutFixed32(&buffer_, restarts_[i]); } PutFixed32(&buffer_, restarts_.size()); diff --git a/table/format.cc b/table/format.cc index 8c6b0f3..63971db 100644 --- a/table/format.cc +++ b/table/format.cc @@ -36,7 +36,7 @@ void Footer::EncodeTo(std::string* dst) const { metaindex_handle_.EncodeTo(dst); index_handle_.EncodeTo(dst); dst->resize(2 * BlockHandle::kMaxEncodedLength); // Padding - PutFixed32(dst, static_cast<uint32_t>(kTableMagicNumber)); + PutFixed32(dst, static_cast<uint32_t>(kTableMagicNumber & 0xffffffffu)); PutFixed32(dst, static_cast<uint32_t>(kTableMagicNumber >> 32)); assert(dst->size() == original_size + kEncodedLength); } @@ -71,7 +71,7 @@ Status ReadBlock(RandomAccessFile* file, // Read the block contents as well as the type/crc footer. // See table_builder.cc for the code that built this structure. - size_t n = handle.size(); + size_t n = static_cast<size_t>(handle.size()); char* buf = new char[n + kBlockTrailerSize]; Slice contents; Status s = file->Read(handle.offset(), n + kBlockTrailerSize, &contents, buf); |