Fixed bugs found by PVS-Studio#4013
Merged
alexey-milovidov merged 4 commits intomasterfrom Jan 9, 2019
Merged
Conversation
abyss7
suggested changes
Jan 9, 2019
| void registerCodecZSTD(CompressionCodecFactory & factory) | ||
| { | ||
| UInt8 method_code = static_cast<char>(CompressionMethodByte::ZSTD); | ||
| UInt8 method_code = UInt8(CompressionMethodByte::ZSTD); |
Contributor
There was a problem hiding this comment.
C-style cast doesn't look good
Member
Author
There was a problem hiding this comment.
This is not a C-style cast. It is named "constructor cast".
Member
Author
There was a problem hiding this comment.
BTW, we have a warning (with -Werror) for C-style casts. They shall not pass.
| return; | ||
|
|
||
| ThreadPool pool(std::min(getNumberOfPhysicalCPUCores(), replica_names.size())); | ||
| ThreadPool pool(std::min(size_t(getNumberOfPhysicalCPUCores()), replica_names.size())); |
Contributor
There was a problem hiding this comment.
C-style cast doesn't look good - may be std::min<size_t>(…) is better?
Member
Author
There was a problem hiding this comment.
std::min takes both arguments by references.
| return BlockInputStreams(); | ||
|
|
||
| const size_t stream_count = std::min(num_streams, num_created_consumers); | ||
| const size_t stream_count = std::min(size_t(num_streams), num_created_consumers); |
Contributor
There was a problem hiding this comment.
C-style cast doesn't look good - may be std::min<size_t>(…) is better?
| size_t current_streams = std::min(current_need_streams, remaining_streams); | ||
| remaining_streams -= current_streams; | ||
| current_streams = std::max(1, current_streams); | ||
| current_streams = std::max(size_t(1), current_streams); |
Contributor
There was a problem hiding this comment.
C-style cast doesn't look good - may be std::max<size_t>(…) is better?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For changelog. Remove if this is non-significant change.
Category (leave one):
Short description (up to few sentences):
Fixed bugs found by PVS-Studio.