From b5407cd6bcbbb73efb043fa50013ab7bb5e841a9 Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 17 Mar 2019 23:43:58 +0300 Subject: [PATCH] Minor fixes. GitOrigin-RevId: 39fb006dd5d935f6dd0b400114d71391463450eb --- td/telegram/PollManager.cpp | 7 +++---- td/telegram/QueryCombiner.cpp | 1 + td/telegram/QueryCombiner.h | 3 ++- td/telegram/files/PartsManager.cpp | 5 ++--- td/telegram/net/SessionMultiProxy.cpp | 2 ++ td/telegram/net/SessionProxy.cpp | 1 + 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/td/telegram/PollManager.cpp b/td/telegram/PollManager.cpp index aafd8c1c2..e3706c217 100644 --- a/td/telegram/PollManager.cpp +++ b/td/telegram/PollManager.cpp @@ -21,7 +21,6 @@ #include "td/telegram/StateManager.h" #include "td/telegram/TdDb.h" #include "td/telegram/Td.h" -#include "td/telegram/TdParameters.h" #include "td/telegram/UpdatesManager.h" #include "td/db/binlog/BinlogEvent.h" @@ -335,7 +334,7 @@ vector PollManager::get_vote_percentage(const vector &voter_counts // just round to the nearest for (size_t i = 0; i < result.size(); i++) { result[i] = - static_cast((static_cast(voter_counts[i]) * 200 + total_voter_count) / total_voter_count / 2); + static_cast((static_cast(voter_counts[i]) * 200 + total_voter_count) / total_voter_count / 2); } return result; } @@ -344,10 +343,10 @@ vector PollManager::get_vote_percentage(const vector &voter_counts int32 percent_sum = 0; vector gap(voter_counts.size(), 0); for (size_t i = 0; i < result.size(); i++) { - auto multiplied_voter_count = static_cast(voter_counts[i]) * 100; + auto multiplied_voter_count = static_cast(voter_counts[i]) * 100; result[i] = static_cast(multiplied_voter_count / total_voter_count); CHECK(0 <= result[i] && result[i] <= 100); - gap[i] = static_cast(static_cast(result[i] + 1) * total_voter_count - multiplied_voter_count); + gap[i] = static_cast(static_cast(result[i] + 1) * total_voter_count - multiplied_voter_count); CHECK(0 <= gap[i] && gap[i] <= total_voter_count); percent_sum += result[i]; } diff --git a/td/telegram/QueryCombiner.cpp b/td/telegram/QueryCombiner.cpp index 715b6c68d..7ddcb6595 100644 --- a/td/telegram/QueryCombiner.cpp +++ b/td/telegram/QueryCombiner.cpp @@ -6,6 +6,7 @@ // #include "td/telegram/QueryCombiner.h" +#include "td/utils/logging.h" #include "td/utils/Time.h" namespace td { diff --git a/td/telegram/QueryCombiner.h b/td/telegram/QueryCombiner.h index ecfdb9f45..222b7fb7d 100644 --- a/td/telegram/QueryCombiner.h +++ b/td/telegram/QueryCombiner.h @@ -10,8 +10,9 @@ #include "td/actor/PromiseFuture.h" #include "td/utils/common.h" +#include "td/utils/Slice.h" +#include "td/utils/Status.h" -#include #include #include diff --git a/td/telegram/files/PartsManager.cpp b/td/telegram/files/PartsManager.cpp index 78b0b1c4f..d00003875 100644 --- a/td/telegram/files/PartsManager.cpp +++ b/td/telegram/files/PartsManager.cpp @@ -9,6 +9,7 @@ #include "td/utils/format.h" #include "td/utils/logging.h" #include "td/utils/misc.h" +#include "td/utils/ScopeGuard.h" #include #include @@ -225,9 +226,7 @@ bool PartsManager::is_part_in_streaming_limit(int part_i) const { return true; } - auto is_intersect_with = [&](int64 begin, int64 end) { - return std::max(begin, offset_begin) < std::min(end, offset_end); - }; + auto is_intersect_with = [&](int64 begin, int64 end) { return max(begin, offset_begin) < min(end, offset_end); }; auto streaming_begin = streaming_offset_; auto streaming_end = streaming_offset_ + streaming_limit_; diff --git a/td/telegram/net/SessionMultiProxy.cpp b/td/telegram/net/SessionMultiProxy.cpp index 590b4879b..d3a905d27 100644 --- a/td/telegram/net/SessionMultiProxy.cpp +++ b/td/telegram/net/SessionMultiProxy.cpp @@ -13,6 +13,8 @@ #include "td/utils/logging.h" #include "td/utils/Slice.h" +#include + namespace td { SessionMultiProxy::SessionMultiProxy() = default; diff --git a/td/telegram/net/SessionProxy.cpp b/td/telegram/net/SessionProxy.cpp index b97867280..862e26436 100644 --- a/td/telegram/net/SessionProxy.cpp +++ b/td/telegram/net/SessionProxy.cpp @@ -11,6 +11,7 @@ #include "td/telegram/net/DcId.h" #include "td/telegram/net/NetQueryDispatcher.h" #include "td/telegram/net/Session.h" +#include "td/telegram/UniqueId.h" #include "td/actor/PromiseFuture.h"