Merge pull request #23663 from ClickHouse/fix-pvs

Fix a few PVS-Studio warnings
This commit is contained in:
Maksim Kita 2021-04-27 14:11:38 +03:00 committed by GitHub
commit 3891205f50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -24,6 +24,8 @@
#include <cassert> #include <cassert>
#include <stack> #include <stack>
#include <limits>
namespace DB namespace DB
{ {
@ -91,7 +93,7 @@ static String extractFixedPrefixFromLikePattern(const String & like_pattern)
*/ */
static String firstStringThatIsGreaterThanAllStringsWithPrefix(const String & prefix) static String firstStringThatIsGreaterThanAllStringsWithPrefix(const String & prefix)
{ {
/** Increment the last byte of the prefix by one. But if it is 255, then remove it and increase the previous one. /** Increment the last byte of the prefix by one. But if it is max (255), then remove it and increase the previous one.
* Example (for convenience, suppose that the maximum value of byte is `z`) * Example (for convenience, suppose that the maximum value of byte is `z`)
* abcx -> abcy * abcx -> abcy
* abcz -> abd * abcz -> abd
@ -101,7 +103,7 @@ static String firstStringThatIsGreaterThanAllStringsWithPrefix(const String & pr
String res = prefix; String res = prefix;
while (!res.empty() && static_cast<UInt8>(res.back()) == 255) while (!res.empty() && static_cast<UInt8>(res.back()) == std::numeric_limits<UInt8>::max())
res.pop_back(); res.pop_back();
if (res.empty()) if (res.empty())
@ -1346,7 +1348,7 @@ KeyCondition::Description KeyCondition::getDescription() const
Or, Or,
}; };
Type type; Type type{};
/// Only for Leaf /// Only for Leaf
const RPNElement * element = nullptr; const RPNElement * element = nullptr;

View File

@ -39,7 +39,6 @@ ReplicatedFetchInfo ReplicatedFetchListElement::getInfo() const
res.source_replica_port = source_replica_port; res.source_replica_port = source_replica_port;
res.interserver_scheme = interserver_scheme; res.interserver_scheme = interserver_scheme;
res.uri = uri; res.uri = uri;
res.interserver_scheme = interserver_scheme;
res.to_detached = to_detached; res.to_detached = to_detached;
res.elapsed = watch.elapsedSeconds(); res.elapsed = watch.elapsedSeconds();
res.progress = progress.load(std::memory_order_relaxed); res.progress = progress.load(std::memory_order_relaxed);