fix sign compare warnings (#5651)
Summary: Fix -Wsign-compare warnings for gcc9. Pull Request resolved: https://github.com/facebook/rocksdb/pull/5651 Test Plan: Tested with ubuntu19.10+gcc9 Differential Revision: D16567428 fbshipit-source-id: 730b2704d42ba0c4e4ea946a3199bbb34be4c25c
This commit is contained in:
parent
399f477818
commit
849a8c0ae0
14
env/io_posix.cc
vendored
14
env/io_posix.cc
vendored
@ -803,8 +803,8 @@ Status PosixMmapFile::InvalidateCache(size_t offset, size_t length) {
|
||||
|
||||
#ifdef ROCKSDB_FALLOCATE_PRESENT
|
||||
Status PosixMmapFile::Allocate(uint64_t offset, uint64_t len) {
|
||||
assert(offset <= std::numeric_limits<off_t>::max());
|
||||
assert(len <= std::numeric_limits<off_t>::max());
|
||||
assert(offset <= static_cast<uint64_t>(std::numeric_limits<off_t>::max()));
|
||||
assert(len <= static_cast<uint64_t>(std::numeric_limits<off_t>::max()));
|
||||
TEST_KILL_RANDOM("PosixMmapFile::Allocate:0", rocksdb_kill_odds);
|
||||
int alloc_status = 0;
|
||||
if (allow_fallocate_) {
|
||||
@ -873,7 +873,7 @@ Status PosixWritableFile::PositionedAppend(const Slice& data, uint64_t offset) {
|
||||
assert(IsSectorAligned(data.size(), GetRequiredBufferAlignment()));
|
||||
assert(IsSectorAligned(data.data(), GetRequiredBufferAlignment()));
|
||||
}
|
||||
assert(offset <= std::numeric_limits<off_t>::max());
|
||||
assert(offset <= static_cast<uint64_t>(std::numeric_limits<off_t>::max()));
|
||||
const char* src = data.data();
|
||||
size_t nbytes = data.size();
|
||||
if (!PosixPositionedWrite(fd_, src, nbytes, static_cast<off_t>(offset))) {
|
||||
@ -1009,8 +1009,8 @@ Status PosixWritableFile::InvalidateCache(size_t offset, size_t length) {
|
||||
|
||||
#ifdef ROCKSDB_FALLOCATE_PRESENT
|
||||
Status PosixWritableFile::Allocate(uint64_t offset, uint64_t len) {
|
||||
assert(offset <= std::numeric_limits<off_t>::max());
|
||||
assert(len <= std::numeric_limits<off_t>::max());
|
||||
assert(offset <= static_cast<uint64_t>(std::numeric_limits<off_t>::max()));
|
||||
assert(len <= static_cast<uint64_t>(std::numeric_limits<off_t>::max()));
|
||||
TEST_KILL_RANDOM("PosixWritableFile::Allocate:0", rocksdb_kill_odds);
|
||||
IOSTATS_TIMER_GUARD(allocate_nanos);
|
||||
int alloc_status = 0;
|
||||
@ -1031,8 +1031,8 @@ Status PosixWritableFile::Allocate(uint64_t offset, uint64_t len) {
|
||||
|
||||
Status PosixWritableFile::RangeSync(uint64_t offset, uint64_t nbytes) {
|
||||
#ifdef ROCKSDB_RANGESYNC_PRESENT
|
||||
assert(offset <= std::numeric_limits<off_t>::max());
|
||||
assert(nbytes <= std::numeric_limits<off_t>::max());
|
||||
assert(offset <= static_cast<uint64_t>(std::numeric_limits<off_t>::max()));
|
||||
assert(nbytes <= static_cast<uint64_t>(std::numeric_limits<off_t>::max()));
|
||||
if (sync_file_range_supported_) {
|
||||
int ret;
|
||||
if (strict_bytes_per_sync_) {
|
||||
|
@ -192,7 +192,8 @@ int GetMaxOpenFiles() {
|
||||
return -1;
|
||||
}
|
||||
// protect against overflow
|
||||
if (no_files_limit.rlim_cur >= std::numeric_limits<int>::max()) {
|
||||
if (static_cast<uintmax_t>(no_files_limit.rlim_cur) >=
|
||||
static_cast<uintmax_t>(std::numeric_limits<int>::max())) {
|
||||
return std::numeric_limits<int>::max();
|
||||
}
|
||||
return static_cast<int>(no_files_limit.rlim_cur);
|
||||
|
Loading…
Reference in New Issue
Block a user