From 224e1940ae575c0b217b7f733576ae4dbce0fa08 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Thu, 9 May 2024 03:58:34 +0200 Subject: [PATCH] Useless changes --- .clang-tidy | 1 + contrib/abseil-cpp-cmake/CMakeLists.txt | 4 ++-- programs/install/Install.cpp | 10 ++++---- programs/odbc-bridge/getIdentifierQuote.cpp | 2 +- .../static-files-disk-uploader.cpp | 2 -- src/Access/Common/AccessFlags.cpp | 16 ++++++------- src/Common/AsynchronousMetrics.cpp | 2 +- src/Common/PODArray.h | 2 +- .../Nodes/DynamicResourceManager.cpp | 2 +- src/Common/ZooKeeper/TestKeeper.cpp | 2 +- src/Compression/CompressionCodecT64.cpp | 24 ++++++++++++------- src/Disks/IO/AsynchronousBoundedReadBuffer.h | 2 +- src/Functions/IFunction.cpp | 2 +- src/Functions/array/arrayIndex.h | 2 +- src/IO/ReadBufferFromFileDescriptor.cpp | 2 +- src/IO/WriteHelpers.cpp | 6 ++--- src/IO/parseDateTimeBestEffort.cpp | 4 ++-- src/Interpreters/Cache/IFileCachePriority.h | 1 - src/Interpreters/Cache/LRUFileCachePriority.h | 2 +- src/Interpreters/ExternalLoader.h | 6 ++--- src/Interpreters/InterpreterRenameQuery.cpp | 1 - src/Parsers/ASTFunction.cpp | 6 ++--- src/Parsers/ASTTablesInSelectQuery.cpp | 2 -- src/Parsers/Access/ParserGrantQuery.cpp | 2 +- .../KustoFunctions/KQLDataTypeFunctions.cpp | 1 - .../KustoFunctions/KQLDateTimeFunctions.h | 2 +- src/Parsers/parseQuery.cpp | 4 +--- src/Storages/StorageProxy.h | 2 +- 28 files changed, 57 insertions(+), 57 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 44690ee181f..2086f3202c5 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -130,6 +130,7 @@ Checks: [ '-readability-redundant-inline-specifier', '-readability-redundant-member-init', '-bugprone-crtp-constructor-accessibility', + '-bugprone-suspicious-stringview-data-usage', '-zircon-*' ] diff --git a/contrib/abseil-cpp-cmake/CMakeLists.txt b/contrib/abseil-cpp-cmake/CMakeLists.txt index e6c3268c57a..7372195bb0d 100644 --- a/contrib/abseil-cpp-cmake/CMakeLists.txt +++ b/contrib/abseil-cpp-cmake/CMakeLists.txt @@ -52,7 +52,7 @@ function(absl_cc_library) ) target_include_directories(${_NAME} - PUBLIC "${ABSL_COMMON_INCLUDE_DIRS}") + SYSTEM PUBLIC "${ABSL_COMMON_INCLUDE_DIRS}") target_compile_options(${_NAME} PRIVATE ${ABSL_CC_LIB_COPTS}) target_compile_definitions(${_NAME} PUBLIC ${ABSL_CC_LIB_DEFINES}) @@ -61,7 +61,7 @@ function(absl_cc_library) # Generating header-only library add_library(${_NAME} INTERFACE) target_include_directories(${_NAME} - INTERFACE "${ABSL_COMMON_INCLUDE_DIRS}") + SYSTEM INTERFACE "${ABSL_COMMON_INCLUDE_DIRS}") target_link_libraries(${_NAME} INTERFACE diff --git a/programs/install/Install.cpp b/programs/install/Install.cpp index 6bed114238a..d6576927a20 100644 --- a/programs/install/Install.cpp +++ b/programs/install/Install.cpp @@ -323,7 +323,7 @@ int mainEntryClickHouseInstall(int argc, char ** argv) { fmt::print("Symlink {} already exists but it points to {}. Will replace the old symlink to {}.\n", main_bin_path.string(), points_to.string(), binary_self_canonical_path.string()); - fs::remove(main_bin_path); + (void)fs::remove(main_bin_path); } } } @@ -489,7 +489,7 @@ int mainEntryClickHouseInstall(int argc, char ** argv) { fmt::print("Symlink {} already exists but it points to {}. Will replace the old symlink to {}.\n", symlink_path.string(), points_to.string(), main_bin_path.string()); - fs::remove(symlink_path); + (void)fs::remove(symlink_path); } } } @@ -1006,7 +1006,7 @@ namespace else { fmt::print("{} file exists but damaged, ignoring.\n", pid_file.string()); - fs::remove(pid_file); + (void)fs::remove(pid_file); } } else @@ -1014,7 +1014,7 @@ namespace /// Create a directory for pid file. /// It's created by "install" but we also support cases when ClickHouse is already installed different way. fs::path pid_path = pid_file; - pid_path.remove_filename(); + pid_path = pid_path.remove_filename(); fs::create_directories(pid_path); /// All users are allowed to read pid file (for clickhouse status command). fs::permissions(pid_path, fs::perms::owner_all | fs::perms::group_read | fs::perms::others_read, fs::perm_options::replace); @@ -1098,7 +1098,7 @@ namespace else { fmt::print("{} file exists but damaged, ignoring.\n", pid_file.string()); - fs::remove(pid_file); + (void)fs::remove(pid_file); } } catch (const Exception & e) diff --git a/programs/odbc-bridge/getIdentifierQuote.cpp b/programs/odbc-bridge/getIdentifierQuote.cpp index 15bd055e615..c0c833e5b8c 100644 --- a/programs/odbc-bridge/getIdentifierQuote.cpp +++ b/programs/odbc-bridge/getIdentifierQuote.cpp @@ -37,7 +37,7 @@ std::string getIdentifierQuote(nanodbc::ConnectionHolderPtr connection_holder) IdentifierQuotingStyle getQuotingStyle(nanodbc::ConnectionHolderPtr connection) { auto identifier_quote = getIdentifierQuote(connection); - if (identifier_quote.length() == 0) + if (identifier_quote.empty()) return IdentifierQuotingStyle::None; else if (identifier_quote[0] == '`') return IdentifierQuotingStyle::Backticks; diff --git a/programs/static-files-disk-uploader/static-files-disk-uploader.cpp b/programs/static-files-disk-uploader/static-files-disk-uploader.cpp index dfe68c819fc..f7696dd37f1 100644 --- a/programs/static-files-disk-uploader/static-files-disk-uploader.cpp +++ b/programs/static-files-disk-uploader/static-files-disk-uploader.cpp @@ -111,13 +111,11 @@ void processTableFiles(const fs::path & data_path, fs::path dst_path, bool test_ std::shared_ptr directory_meta; if (test_mode) { - auto files_root = dst_path / prefix; directory_meta = std::make_shared(HTTPConnectionGroupType::HTTP, Poco::URI(dst_path / directory_prefix / ".index"), Poco::Net::HTTPRequest::HTTP_PUT); } else { dst_path = fs::canonical(dst_path); - auto files_root = dst_path / prefix; fs::create_directories(dst_path / directory_prefix); directory_meta = std::make_shared(dst_path / directory_prefix / ".index"); } diff --git a/src/Access/Common/AccessFlags.cpp b/src/Access/Common/AccessFlags.cpp index 9d846821e42..23c52d86f4e 100644 --- a/src/Access/Common/AccessFlags.cpp +++ b/src/Access/Common/AccessFlags.cpp @@ -115,15 +115,15 @@ namespace { UNKNOWN = -2, GROUP = -1, - GLOBAL, - DATABASE, - TABLE, + GLOBAL = 0, + DATABASE = 1, + TABLE = 2, VIEW = TABLE, - COLUMN, - DICTIONARY, - NAMED_COLLECTION, - USER_NAME, - TABLE_ENGINE, + COLUMN = 3, + DICTIONARY = 4, + NAMED_COLLECTION = 5, + USER_NAME = 6, + TABLE_ENGINE = 7, }; struct Node; diff --git a/src/Common/AsynchronousMetrics.cpp b/src/Common/AsynchronousMetrics.cpp index 6b26f65deab..4c71b9846c7 100644 --- a/src/Common/AsynchronousMetrics.cpp +++ b/src/Common/AsynchronousMetrics.cpp @@ -1159,7 +1159,7 @@ void AsynchronousMetrics::update(TimePoint update_time, bool force_update) core_id = std::stoi(s.substr(core_id_start)); } - else if (s.rfind("cpu MHz", 0) == 0) + else if (s.starts_with("cpu MHz")) { if (auto colon = s.find_first_of(':')) { diff --git a/src/Common/PODArray.h b/src/Common/PODArray.h index 02281eb776a..b4069027ad1 100644 --- a/src/Common/PODArray.h +++ b/src/Common/PODArray.h @@ -424,7 +424,7 @@ public: if (unlikely(this->c_end + sizeof(T) > this->c_end_of_storage)) this->reserveForNextSize(std::forward(allocator_params)...); - new (t_end()) T(std::forward(x)); + new (reinterpret_cast(t_end())) T(std::forward(x)); this->c_end += sizeof(T); } diff --git a/src/Common/Scheduler/Nodes/DynamicResourceManager.cpp b/src/Common/Scheduler/Nodes/DynamicResourceManager.cpp index 3ab85c81428..b568b9245ba 100644 --- a/src/Common/Scheduler/Nodes/DynamicResourceManager.cpp +++ b/src/Common/Scheduler/Nodes/DynamicResourceManager.cpp @@ -61,7 +61,7 @@ DynamicResourceManager::State::Resource::Resource( // Create nodes bool has_root = false; - for (auto [path, key] : path2key) + for (const auto & [path, key] : path2key) { // Validate path size_t slash = path.rfind('/'); diff --git a/src/Common/ZooKeeper/TestKeeper.cpp b/src/Common/ZooKeeper/TestKeeper.cpp index fce29a21e15..d02ad4523ad 100644 --- a/src/Common/ZooKeeper/TestKeeper.cpp +++ b/src/Common/ZooKeeper/TestKeeper.cpp @@ -888,7 +888,7 @@ void TestKeeper::multi( const Requests & requests, MultiCallback callback) { - return multi(std::span(requests), std::move(callback)); + multi(std::span(requests), std::move(callback)); } void TestKeeper::multi( diff --git a/src/Compression/CompressionCodecT64.cpp b/src/Compression/CompressionCodecT64.cpp index 9e9b32cf34b..8040e2c4d50 100644 --- a/src/Compression/CompressionCodecT64.cpp +++ b/src/Compression/CompressionCodecT64.cpp @@ -689,21 +689,29 @@ void CompressionCodecT64::doDecompressData(const char * src, UInt32 src_size, ch switch (baseType(saved_type_id)) { case TypeIndex::Int8: - return decompressData(src, src_size, dst, uncompressed_size, saved_variant); + decompressData(src, src_size, dst, uncompressed_size, saved_variant); + return; case TypeIndex::Int16: - return decompressData(src, src_size, dst, uncompressed_size, saved_variant); + decompressData(src, src_size, dst, uncompressed_size, saved_variant); + return; case TypeIndex::Int32: - return decompressData(src, src_size, dst, uncompressed_size, saved_variant); + decompressData(src, src_size, dst, uncompressed_size, saved_variant); + return; case TypeIndex::Int64: - return decompressData(src, src_size, dst, uncompressed_size, saved_variant); + decompressData(src, src_size, dst, uncompressed_size, saved_variant); + return; case TypeIndex::UInt8: - return decompressData(src, src_size, dst, uncompressed_size, saved_variant); + decompressData(src, src_size, dst, uncompressed_size, saved_variant); + return; case TypeIndex::UInt16: - return decompressData(src, src_size, dst, uncompressed_size, saved_variant); + decompressData(src, src_size, dst, uncompressed_size, saved_variant); + return; case TypeIndex::UInt32: - return decompressData(src, src_size, dst, uncompressed_size, saved_variant); + decompressData(src, src_size, dst, uncompressed_size, saved_variant); + return; case TypeIndex::UInt64: - return decompressData(src, src_size, dst, uncompressed_size, saved_variant); + decompressData(src, src_size, dst, uncompressed_size, saved_variant); + return; default: break; } diff --git a/src/Disks/IO/AsynchronousBoundedReadBuffer.h b/src/Disks/IO/AsynchronousBoundedReadBuffer.h index 6dc76352aca..9a802348998 100644 --- a/src/Disks/IO/AsynchronousBoundedReadBuffer.h +++ b/src/Disks/IO/AsynchronousBoundedReadBuffer.h @@ -44,7 +44,7 @@ public: void setReadUntilPosition(size_t position) override; /// [..., position). - void setReadUntilEnd() override { return setReadUntilPosition(getFileSize()); } + void setReadUntilEnd() override { setReadUntilPosition(getFileSize()); } size_t getFileOffsetOfBufferEnd() const override { return file_offset_of_buffer_end; } diff --git a/src/Functions/IFunction.cpp b/src/Functions/IFunction.cpp index d4c6b8f4ba6..7694875b535 100644 --- a/src/Functions/IFunction.cpp +++ b/src/Functions/IFunction.cpp @@ -454,7 +454,7 @@ FunctionBasePtr IFunctionOverloadResolver::build(const ColumnsWithTypeAndName & void IFunctionOverloadResolver::getLambdaArgumentTypes(DataTypes & arguments [[maybe_unused]]) const { checkNumberOfArguments(arguments.size()); - return getLambdaArgumentTypesImpl(arguments); + getLambdaArgumentTypesImpl(arguments); } DataTypePtr IFunctionOverloadResolver::getReturnTypeWithoutLowCardinality(const ColumnsWithTypeAndName & arguments) const diff --git a/src/Functions/array/arrayIndex.h b/src/Functions/array/arrayIndex.h index cd537763b4a..70d76fc4484 100644 --- a/src/Functions/array/arrayIndex.h +++ b/src/Functions/array/arrayIndex.h @@ -975,7 +975,7 @@ private: break; } - return result_type->createColumnConst(item_arg->size(), static_cast(current)); + return result_type->createColumnConst(item_arg->size(), current); } else { diff --git a/src/IO/ReadBufferFromFileDescriptor.cpp b/src/IO/ReadBufferFromFileDescriptor.cpp index 57442a15853..76a80f145e7 100644 --- a/src/IO/ReadBufferFromFileDescriptor.cpp +++ b/src/IO/ReadBufferFromFileDescriptor.cpp @@ -173,7 +173,7 @@ off_t ReadBufferFromFileDescriptor::seek(off_t offset, int whence) if (new_pos + (working_buffer.end() - pos) == file_offset_of_buffer_end) return new_pos; - if (file_offset_of_buffer_end - working_buffer.size() <= static_cast(new_pos) + if (file_offset_of_buffer_end - working_buffer.size() <= new_pos && new_pos <= file_offset_of_buffer_end) { /// Position is still inside the buffer. diff --git a/src/IO/WriteHelpers.cpp b/src/IO/WriteHelpers.cpp index 88c706a590f..622f93719ac 100644 --- a/src/IO/WriteHelpers.cpp +++ b/src/IO/WriteHelpers.cpp @@ -102,17 +102,17 @@ static inline void writeProbablyQuotedStringImpl(StringRef s, WriteBuffer & buf, void writeProbablyBackQuotedString(StringRef s, WriteBuffer & buf) { - writeProbablyQuotedStringImpl(s, buf, [](StringRef s_, WriteBuffer & buf_) { return writeBackQuotedString(s_, buf_); }); + writeProbablyQuotedStringImpl(s, buf, [](StringRef s_, WriteBuffer & buf_) { writeBackQuotedString(s_, buf_); }); } void writeProbablyDoubleQuotedString(StringRef s, WriteBuffer & buf) { - writeProbablyQuotedStringImpl(s, buf, [](StringRef s_, WriteBuffer & buf_) { return writeDoubleQuotedString(s_, buf_); }); + writeProbablyQuotedStringImpl(s, buf, [](StringRef s_, WriteBuffer & buf_) { writeDoubleQuotedString(s_, buf_); }); } void writeProbablyBackQuotedStringMySQL(StringRef s, WriteBuffer & buf) { - writeProbablyQuotedStringImpl(s, buf, [](StringRef s_, WriteBuffer & buf_) { return writeBackQuotedStringMySQL(s_, buf_); }); + writeProbablyQuotedStringImpl(s, buf, [](StringRef s_, WriteBuffer & buf_) { writeBackQuotedStringMySQL(s_, buf_); }); } void writePointerHex(const void * ptr, WriteBuffer & buf) diff --git a/src/IO/parseDateTimeBestEffort.cpp b/src/IO/parseDateTimeBestEffort.cpp index 83928b32f2f..70401fdf72d 100644 --- a/src/IO/parseDateTimeBestEffort.cpp +++ b/src/IO/parseDateTimeBestEffort.cpp @@ -712,12 +712,12 @@ bool tryParseDateTimeBestEffortUS(time_t & res, ReadBuffer & in, const DateLUTIm void parseDateTime64BestEffort(DateTime64 & res, UInt32 scale, ReadBuffer & in, const DateLUTImpl & local_time_zone, const DateLUTImpl & utc_time_zone) { - return parseDateTime64BestEffortImpl(res, scale, in, local_time_zone, utc_time_zone); + parseDateTime64BestEffortImpl(res, scale, in, local_time_zone, utc_time_zone); } void parseDateTime64BestEffortUS(DateTime64 & res, UInt32 scale, ReadBuffer & in, const DateLUTImpl & local_time_zone, const DateLUTImpl & utc_time_zone) { - return parseDateTime64BestEffortImpl(res, scale, in, local_time_zone, utc_time_zone); + parseDateTime64BestEffortImpl(res, scale, in, local_time_zone, utc_time_zone); } bool tryParseDateTime64BestEffort(DateTime64 & res, UInt32 scale, ReadBuffer & in, const DateLUTImpl & local_time_zone, const DateLUTImpl & utc_time_zone) diff --git a/src/Interpreters/Cache/IFileCachePriority.h b/src/Interpreters/Cache/IFileCachePriority.h index bb7b220c1f9..5d8eb9dd54a 100644 --- a/src/Interpreters/Cache/IFileCachePriority.h +++ b/src/Interpreters/Cache/IFileCachePriority.h @@ -5,7 +5,6 @@ #include #include #include -#include #include #include diff --git a/src/Interpreters/Cache/LRUFileCachePriority.h b/src/Interpreters/Cache/LRUFileCachePriority.h index 6f322355d36..e0691cade43 100644 --- a/src/Interpreters/Cache/LRUFileCachePriority.h +++ b/src/Interpreters/Cache/LRUFileCachePriority.h @@ -81,7 +81,7 @@ public: }; PriorityDumpPtr dump(const CachePriorityGuard::Lock &) override; - void pop(const CachePriorityGuard::Lock & lock) { remove(queue.begin(), lock); } + void pop(const CachePriorityGuard::Lock & lock) { remove(queue.begin(), lock); } // NOLINT bool modifySizeLimits(size_t max_size_, size_t max_elements_, double size_ratio_, const CachePriorityGuard::Lock &) override; diff --git a/src/Interpreters/ExternalLoader.h b/src/Interpreters/ExternalLoader.h index ea801afc931..49b5e68d821 100644 --- a/src/Interpreters/ExternalLoader.h +++ b/src/Interpreters/ExternalLoader.h @@ -110,17 +110,17 @@ public: /// Returns the result of loading the object. /// The function doesn't load anything, it just returns the current load result as is. - template , void>> + template , void>> // NOLINT ReturnType getLoadResult(const String & name) const; using FilterByNameFunction = std::function; /// Returns all the load results as a map. /// The function doesn't load anything, it just returns the current load results as is. - template , void>> + template , void>> // NOLINT ReturnType getLoadResults() const { return getLoadResults(FilterByNameFunction{}); } - template , void>> + template , void>> // NOLINT ReturnType getLoadResults(const FilterByNameFunction & filter) const; /// Returns all loaded objects as a map. diff --git a/src/Interpreters/InterpreterRenameQuery.cpp b/src/Interpreters/InterpreterRenameQuery.cpp index b63672f1757..eeb762b4d7e 100644 --- a/src/Interpreters/InterpreterRenameQuery.cpp +++ b/src/Interpreters/InterpreterRenameQuery.cpp @@ -40,7 +40,6 @@ BlockIO InterpreterRenameQuery::execute() getContext()->checkAccess(getRequiredAccess(rename.database ? RenameType::RenameDatabase : RenameType::RenameTable)); - String path = getContext()->getPath(); String current_database = getContext()->getCurrentDatabase(); /** In case of error while renaming, it is possible that only part of tables was renamed diff --git a/src/Parsers/ASTFunction.cpp b/src/Parsers/ASTFunction.cpp index cdc9a471e98..602ef8c232b 100644 --- a/src/Parsers/ASTFunction.cpp +++ b/src/Parsers/ASTFunction.cpp @@ -671,7 +671,8 @@ void ASTFunction::formatImplWithoutAlias(const FormatSettings & settings, Format if (written) { - return finishFormatWithWindow(settings, state, frame); + finishFormatWithWindow(settings, state, frame); + return; } settings.ostr << (settings.hilite ? hilite_function : "") << name; @@ -753,8 +754,7 @@ void ASTFunction::formatImplWithoutAlias(const FormatSettings & settings, Format settings.ostr << (settings.hilite ? hilite_function : "") << ')'; settings.ostr << (settings.hilite ? hilite_none : ""); - - return finishFormatWithWindow(settings, state, frame); + finishFormatWithWindow(settings, state, frame); } bool ASTFunction::hasSecretParts() const diff --git a/src/Parsers/ASTTablesInSelectQuery.cpp b/src/Parsers/ASTTablesInSelectQuery.cpp index 8ca2ee0efae..e782bad797e 100644 --- a/src/Parsers/ASTTablesInSelectQuery.cpp +++ b/src/Parsers/ASTTablesInSelectQuery.cpp @@ -285,8 +285,6 @@ void ASTTablesInSelectQueryElement::formatImpl(const FormatSettings & settings, void ASTTablesInSelectQuery::formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const { - std::string indent_str = settings.one_line ? "" : std::string(4 * frame.indent, ' '); - for (const auto & child : children) child->formatImpl(settings, state, frame); } diff --git a/src/Parsers/Access/ParserGrantQuery.cpp b/src/Parsers/Access/ParserGrantQuery.cpp index 799cd65dd5c..42af7d1cda4 100644 --- a/src/Parsers/Access/ParserGrantQuery.cpp +++ b/src/Parsers/Access/ParserGrantQuery.cpp @@ -219,7 +219,7 @@ namespace void throwIfNotGrantable(AccessRightsElements & elements) { - boost::range::remove_erase_if(elements, [](AccessRightsElement & element) + boost::range::remove_erase_if(elements, [](AccessRightsElement & element) // NOLINT { if (element.empty()) return true; diff --git a/src/Parsers/Kusto/KustoFunctions/KQLDataTypeFunctions.cpp b/src/Parsers/Kusto/KustoFunctions/KQLDataTypeFunctions.cpp index cca4fb3ce33..3b1f96b4ea6 100644 --- a/src/Parsers/Kusto/KustoFunctions/KQLDataTypeFunctions.cpp +++ b/src/Parsers/Kusto/KustoFunctions/KQLDataTypeFunctions.cpp @@ -137,7 +137,6 @@ bool DatatypeInt::convertImpl(String & out, IParser::Pos & pos) const String fn_name = getKQLFunctionName(pos); if (fn_name.empty()) return false; - String guid_str; ++pos; if (pos->type == TokenType::QuotedIdentifier || pos->type == TokenType::StringLiteral) diff --git a/src/Parsers/Kusto/KustoFunctions/KQLDateTimeFunctions.h b/src/Parsers/Kusto/KustoFunctions/KQLDateTimeFunctions.h index 77ed110700b..05de6e120e2 100644 --- a/src/Parsers/Kusto/KustoFunctions/KQLDateTimeFunctions.h +++ b/src/Parsers/Kusto/KustoFunctions/KQLDateTimeFunctions.h @@ -240,7 +240,7 @@ void inline getTokens(String format, std::vector & res) pos = str.find_first_not_of("abcdefghijklmnopqrstuvwxyzQWERTYUIOPASDFGHJKLZXCVBNM"); } // Cover the last (or only) token - if (str.length() > 0) + if (!str.empty()) { token = str; res.insert(res.begin(), token); diff --git a/src/Parsers/parseQuery.cpp b/src/Parsers/parseQuery.cpp index 2a6abc23406..66bd76687aa 100644 --- a/src/Parsers/parseQuery.cpp +++ b/src/Parsers/parseQuery.cpp @@ -92,9 +92,7 @@ void writeQueryWithHighlightedErrorPositions( } else { - ssize_t bytes_to_hilite = UTF8::seqLength(*current_position_to_hilite); - if (bytes_to_hilite > end - current_position_to_hilite) - bytes_to_hilite = end - current_position_to_hilite; + ssize_t bytes_to_hilite = std::min(UTF8::seqLength(*current_position_to_hilite), end - current_position_to_hilite); /// Bright on red background. out << "\033[41;1m"; diff --git a/src/Storages/StorageProxy.h b/src/Storages/StorageProxy.h index a8e7fd528dd..5cd86f7ad2c 100644 --- a/src/Storages/StorageProxy.h +++ b/src/Storages/StorageProxy.h @@ -62,7 +62,7 @@ public: size_t max_block_size, size_t num_streams) override { - return getNested()->read(query_plan, column_names, storage_snapshot, query_info, context, processed_stage, max_block_size, num_streams); + getNested()->read(query_plan, column_names, storage_snapshot, query_info, context, processed_stage, max_block_size, num_streams); } SinkToStoragePtr write(const ASTPtr & query, const StorageMetadataPtr & metadata_snapshot, ContextPtr context, bool async_insert) override