Improve type conversion (#4367)

Summary:
Use `static_cast<type>(var)` instead of `(type)var`.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/4367

Differential Revision: D9833391

Pulled By: riversand963

fbshipit-source-id: 3d33fc2c290e7e0f3d1d45b256a881d1bc5a7df2
This commit is contained in:
Yanqin Jin 2018-09-14 11:03:03 -07:00 committed by Facebook Github Bot
parent 2353c5c821
commit 82057b0d8f

View File

@ -286,7 +286,7 @@ bool Reader::ReadMore(size_t* drop_size, int *error) {
read_error_ = true;
*error = kEof;
return false;
} else if (buffer_.size() < (size_t)kBlockSize) {
} else if (buffer_.size() < static_cast<size_t>(kBlockSize)) {
eof_ = true;
eof_offset_ = buffer_.size();
}
@ -311,7 +311,7 @@ bool Reader::ReadMore(size_t* drop_size, int *error) {
unsigned int Reader::ReadPhysicalRecord(Slice* result, size_t* drop_size) {
while (true) {
// We need at least the minimum header size
if (buffer_.size() < (size_t)kHeaderSize) {
if (buffer_.size() < static_cast<size_t>(kHeaderSize)) {
int r;
if (!ReadMore(drop_size, &r)) {
return r;
@ -332,7 +332,7 @@ unsigned int Reader::ReadPhysicalRecord(Slice* result, size_t* drop_size) {
}
header_size = kRecyclableHeaderSize;
// We need enough for the larger header
if (buffer_.size() < (size_t)kRecyclableHeaderSize) {
if (buffer_.size() < static_cast<size_t>(kRecyclableHeaderSize)) {
int r;
if (!ReadMore(drop_size, &r)) {
return r;