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 <stack>
#include <limits>
namespace DB
{
@ -91,7 +93,7 @@ static String extractFixedPrefixFromLikePattern(const String & like_pattern)
*/
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`)
* abcx -> abcy
* abcz -> abd
@ -101,7 +103,7 @@ static String firstStringThatIsGreaterThanAllStringsWithPrefix(const String & pr
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();
if (res.empty())
@ -1346,7 +1348,7 @@ KeyCondition::Description KeyCondition::getDescription() const
Or,
};
Type type;
Type type{};
/// Only for Leaf
const RPNElement * element = nullptr;

View File

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