diff --git a/dbms/src/AggregateFunctions/AggregateFunctionTopK.h b/dbms/src/AggregateFunctions/AggregateFunctionTopK.h index e4cf0d9e442..ac20f48dd12 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionTopK.h +++ b/dbms/src/AggregateFunctions/AggregateFunctionTopK.h @@ -165,12 +165,13 @@ public: set.resize(reserved); // Specialized here because there's no deserialiser for StringRef - size_t count = 0; - readVarUInt(count, buf); - for (size_t i = 0; i < count; ++i) + size_t size = 0; + readVarUInt(size, buf); + for (size_t i = 0; i < size; ++i) { auto ref = readStringBinaryInto(*arena, buf); - UInt64 count, error; + UInt64 count; + UInt64 error; readVarUInt(count, buf); readVarUInt(error, buf); set.insert(ref, count, error); diff --git a/dbms/src/Common/Config/ConfigProcessor.cpp b/dbms/src/Common/Config/ConfigProcessor.cpp index e25c5faa412..1e0cb91340b 100644 --- a/dbms/src/Common/Config/ConfigProcessor.cpp +++ b/dbms/src/Common/Config/ConfigProcessor.cpp @@ -169,9 +169,9 @@ void ConfigProcessor::mergeRecursive(XMLDocumentPtr config, Node * config_root, bool remove = false; if (with_node->nodeType() == Node::ELEMENT_NODE) { - Element * with_element = dynamic_cast(with_node); - remove = with_element->hasAttribute("remove"); - bool replace = with_element->hasAttribute("replace"); + Element & with_element = dynamic_cast(*with_node); + remove = with_element.hasAttribute("remove"); + bool replace = with_element.hasAttribute("replace"); if (remove && replace) throw Poco::Exception("both remove and replace attributes set for element <" + with_node->nodeName() + ">"); @@ -189,7 +189,7 @@ void ConfigProcessor::mergeRecursive(XMLDocumentPtr config, Node * config_root, } else if (replace) { - with_element->removeAttribute("replace"); + with_element.removeAttribute("replace"); NodePtr new_node = config->importNode(with_node, true); config_root->replaceChild(new_node, config_node); } @@ -294,17 +294,17 @@ void ConfigProcessor::doIncludesRecursive( } else { - Element * element = dynamic_cast(node); + Element & element = dynamic_cast(*node); - element->removeAttribute("incl"); - element->removeAttribute("from_zk"); + element.removeAttribute("incl"); + element.removeAttribute("from_zk"); if (replace) { while (Node * child = node->firstChild()) node->removeChild(child); - element->removeAttribute("replace"); + element.removeAttribute("replace"); } const NodeListPtr children = node_to_include->childNodes(); @@ -317,7 +317,7 @@ void ConfigProcessor::doIncludesRecursive( const NamedNodeMapPtr from_attrs = node_to_include->attributes(); for (size_t i = 0, size = from_attrs->length(); i < size; ++i) { - element->setAttributeNode(dynamic_cast(config->importNode(from_attrs->item(i), true))); + element.setAttributeNode(dynamic_cast(config->importNode(from_attrs->item(i), true))); } included_something = true; diff --git a/dbms/src/Common/RadixSort.h b/dbms/src/Common/RadixSort.h index c31cd8824c1..dd75477cf30 100644 --- a/dbms/src/Common/RadixSort.h +++ b/dbms/src/Common/RadixSort.h @@ -54,7 +54,7 @@ struct RadixSortFloatTransform static KeyBits forward(KeyBits x) { - return x ^ (-((x >> (sizeof(KeyBits) * 8 - 1) | (KeyBits(1) << (sizeof(KeyBits) * 8 - 1))))); + return x ^ (-(x >> (sizeof(KeyBits) * 8 - 1) | (KeyBits(1) << (sizeof(KeyBits) * 8 - 1)))); } static KeyBits backward(KeyBits x) diff --git a/dbms/src/Functions/FunctionsArray.h b/dbms/src/Functions/FunctionsArray.h index 865864fb890..94e20bc4a57 100644 --- a/dbms/src/Functions/FunctionsArray.h +++ b/dbms/src/Functions/FunctionsArray.h @@ -1038,7 +1038,6 @@ public: return std::make_shared>(); } - /// Perform function on the given block. void executeImpl(Block & block, const ColumnNumbers & arguments, size_t result, size_t /*input_rows_count*/) override { /// If one or both arguments passed to this function are nullable, @@ -1056,8 +1055,7 @@ public: /// values. bool is_nullable; - const ColumnArray * col_array = nullptr; - col_array = checkAndGetColumn(block.getByPosition(arguments[0]).column.get()); + const ColumnArray * col_array = checkAndGetColumn(block.getByPosition(arguments[0]).column.get()); if (col_array) is_nullable = col_array->getData().isColumnNullable(); else diff --git a/dbms/src/IO/CachedCompressedReadBuffer.h b/dbms/src/IO/CachedCompressedReadBuffer.h index 11c72a569cd..1364643d975 100644 --- a/dbms/src/IO/CachedCompressedReadBuffer.h +++ b/dbms/src/IO/CachedCompressedReadBuffer.h @@ -38,7 +38,7 @@ private: /// Passed into file_in. ReadBufferFromFileBase::ProfileCallback profile_callback; - clockid_t clock_type; + clockid_t clock_type {}; public: CachedCompressedReadBuffer( diff --git a/dbms/src/IO/CompressedWriteBuffer.cpp b/dbms/src/IO/CompressedWriteBuffer.cpp index b9a121b466b..2e77d7ae66f 100644 --- a/dbms/src/IO/CompressedWriteBuffer.cpp +++ b/dbms/src/IO/CompressedWriteBuffer.cpp @@ -45,7 +45,7 @@ void CompressedWriteBuffer::nextImpl() compressed_buffer.resize(header_size + LZ4_COMPRESSBOUND(uncompressed_size)); #pragma GCC diagnostic pop - compressed_buffer[0] = static_cast(CompressionMethodByte::LZ4); + compressed_buffer[0] = static_cast(CompressionMethodByte::LZ4); if (compression_settings.method == CompressionMethod::LZ4) compressed_size = header_size + LZ4_compress_default( @@ -76,7 +76,7 @@ void CompressedWriteBuffer::nextImpl() compressed_buffer.resize(header_size + ZSTD_compressBound(uncompressed_size)); - compressed_buffer[0] = static_cast(CompressionMethodByte::ZSTD); + compressed_buffer[0] = static_cast(CompressionMethodByte::ZSTD); size_t res = ZSTD_compress( &compressed_buffer[header_size], @@ -109,7 +109,7 @@ void CompressedWriteBuffer::nextImpl() compressed_buffer.resize(compressed_size); - compressed_buffer[0] = static_cast(CompressionMethodByte::NONE); + compressed_buffer[0] = static_cast(CompressionMethodByte::NONE); unalignedStore(&compressed_buffer[1], compressed_size_32); unalignedStore(&compressed_buffer[5], uncompressed_size_32); diff --git a/dbms/src/Interpreters/Join.cpp b/dbms/src/Interpreters/Join.cpp index 7e62751d27d..7409af75986 100644 --- a/dbms/src/Interpreters/Join.cpp +++ b/dbms/src/Interpreters/Join.cpp @@ -1098,7 +1098,7 @@ private: if (!position) position = decltype(position)( - static_cast(new typename Map::const_iterator(map.begin())), + static_cast(new typename Map::const_iterator(map.begin())), //-V572 [](void * ptr) { delete reinterpret_cast(ptr); }); auto & it = *reinterpret_cast(position.get());