From a5e2a725d296d7b67ec6dba6062863aec4da1de2 Mon Sep 17 00:00:00 2001 From: proller Date: Fri, 28 Jun 2019 20:23:11 +0300 Subject: [PATCH] was wrong! ../dbms/src/IO/WriteBufferAIO.cpp:277:54: error: result of comparison 'ssize_t' (aka 'long') > 9223372036854775807 is always false [-Werror,-Wtautological-type-limit-compare] if ((static_cast(flush_buffer.offset()) > std::numeric_limits::max()) || ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- cmake/find_mimalloc.cmake | 2 +- dbms/src/IO/ReadBufferAIO.cpp | 2 +- dbms/src/IO/WriteBufferAIO.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/find_mimalloc.cmake b/cmake/find_mimalloc.cmake index 45ebf90a204..6e3f24625b6 100644 --- a/cmake/find_mimalloc.cmake +++ b/cmake/find_mimalloc.cmake @@ -4,7 +4,7 @@ endif () if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/mimalloc/include/mimalloc.h") message (WARNING "submodule contrib/mimalloc is missing. to fix try run: \n git submodule update --init --recursive") - return () + return() endif () if (ENABLE_MIMALLOC) diff --git a/dbms/src/IO/ReadBufferAIO.cpp b/dbms/src/IO/ReadBufferAIO.cpp index 7aad9b1eebd..f47e04bff75 100644 --- a/dbms/src/IO/ReadBufferAIO.cpp +++ b/dbms/src/IO/ReadBufferAIO.cpp @@ -254,7 +254,7 @@ void ReadBufferAIO::prepare() /// Region of the disk from which we want to read data. const off_t region_begin = first_unread_pos_in_file; - if ((static_cast(requested_byte_count) > std::numeric_limits::max()) || + if ((requested_byte_count > std::numeric_limits::max()) || (first_unread_pos_in_file > (std::numeric_limits::max() - static_cast(requested_byte_count)))) throw Exception("An overflow occurred during file operation", ErrorCodes::LOGICAL_ERROR); diff --git a/dbms/src/IO/WriteBufferAIO.cpp b/dbms/src/IO/WriteBufferAIO.cpp index e163124f418..2fe7da27809 100644 --- a/dbms/src/IO/WriteBufferAIO.cpp +++ b/dbms/src/IO/WriteBufferAIO.cpp @@ -274,7 +274,7 @@ void WriteBufferAIO::prepare() /// Region of the disk in which we want to write data. const off_t region_begin = pos_in_file; - if ((static_cast(flush_buffer.offset()) > std::numeric_limits::max()) || + if ((flush_buffer.offset() > std::numeric_limits::max()) || (pos_in_file > (std::numeric_limits::max() - static_cast(flush_buffer.offset())))) throw Exception("An overflow occurred during file operation", ErrorCodes::LOGICAL_ERROR);