Minor improvements.

This commit is contained in:
levlam 2021-11-10 21:09:28 +03:00
parent 5a02af8c72
commit 6238f0fc89
8 changed files with 13 additions and 11 deletions

View File

@ -3920,7 +3920,7 @@ void GroupCallManager::leave_group_call(GroupCallId group_call_id, Promise<Unit>
process_group_call_after_join_requests(input_group_call_id, "leave_group_call 1");
return promise.set_value(Unit());
}
if (group_call->need_rejoin) {
if (group_call != nullptr && group_call->need_rejoin) {
group_call->need_rejoin = false;
send_update_group_call(group_call, "leave_group_call");
if (try_clear_group_call_participants(input_group_call_id)) {

View File

@ -20,7 +20,8 @@ MessageId::MessageId(ScheduledServerMessageId server_message_id, int32 send_date
LOG(ERROR) << "Scheduled message ID " << server_message_id.get() << " is invalid";
return;
}
id = (static_cast<int64>(send_date - (1 << 30)) << 21) | (server_message_id.get() << 3) | SCHEDULED_MASK;
id = (static_cast<int64>(send_date - (1 << 30)) << 21) | (static_cast<int64>(server_message_id.get()) << 3) |
SCHEDULED_MASK;
}
bool MessageId::is_valid() const {

View File

@ -3635,7 +3635,7 @@ class EditMessageActor final : public NetActorOnce {
uint64 sequence_dispatcher_id) {
dialog_id_ = dialog_id;
if (false && input_media != nullptr) {
if (input_media != nullptr && false) {
on_error(Status::Error(400, "FILE_PART_1_MISSING"));
stop();
return;

View File

@ -677,7 +677,7 @@ Result<PasswordManager::PasswordInputSettings> PasswordManager::get_password_inp
tl_object_ptr<telegram_api::secureSecretSettings> new_secure_settings;
if (update_secure_secret) {
auto secret = have_secret ? std::move(private_state->secret.value()) : secure_storage::Secret::create_new();
auto secret = have_secret ? private_state->secret.value() : secure_storage::Secret::create_new();
auto algorithm =
make_tl_object<telegram_api::securePasswordKdfAlgoPBKDF2HMACSHA512iter100000>(create_salt(state.secure_salt));
auto encrypted_secret = secret.encrypt(

View File

@ -6257,8 +6257,8 @@ void Td::on_request(uint64 id, td_api::setChatMemberStatus &request) {
void Td::on_request(uint64 id, const td_api::banChatMember &request) {
CREATE_OK_REQUEST_PROMISE();
contacts_manager_->ban_dialog_participant(DialogId(request.chat_id_), std::move(request.member_id_),
request.banned_until_date_, request.revoke_messages_, std::move(promise));
contacts_manager_->ban_dialog_participant(DialogId(request.chat_id_), request.member_id_, request.banned_until_date_,
request.revoke_messages_, std::move(promise));
}
void Td::on_request(uint64 id, const td_api::canTransferOwnership &request) {
@ -8341,7 +8341,7 @@ td_api::object_ptr<td_api::Object> Td::do_static_request(const td_api::getLangua
request.language_pack_database_path_, request.localization_target_, request.language_pack_id_, request.key_);
}
td_api::object_ptr<td_api::Object> Td::do_static_request(const td_api::getPhoneNumberInfoSync &request) {
td_api::object_ptr<td_api::Object> Td::do_static_request(td_api::getPhoneNumberInfoSync &request) {
// don't check language_code/phone number UTF-8 correctness
return CountryInfoManager::get_phone_number_info_sync(request.language_code_,
std::move(request.phone_number_prefix_));

View File

@ -1310,7 +1310,7 @@ class Td final : public Actor {
static td_api::object_ptr<td_api::Object> do_static_request(const td_api::getFileExtension &request);
static td_api::object_ptr<td_api::Object> do_static_request(const td_api::cleanFileName &request);
static td_api::object_ptr<td_api::Object> do_static_request(const td_api::getLanguagePackString &request);
static td_api::object_ptr<td_api::Object> do_static_request(const td_api::getPhoneNumberInfoSync &request);
static td_api::object_ptr<td_api::Object> do_static_request(td_api::getPhoneNumberInfoSync &request);
static td_api::object_ptr<td_api::Object> do_static_request(const td_api::getPushReceiverId &request);
static td_api::object_ptr<td_api::Object> do_static_request(const td_api::getChatFilterDefaultIconName &request);
static td_api::object_ptr<td_api::Object> do_static_request(td_api::getJsonValue &request);

View File

@ -80,7 +80,7 @@ void NetStatsManager::get_network_stats(bool current, Promise<NetworkStats> prom
NetStatsData total_files;
for_each_stat([&](NetStatsInfo &info, size_t id, CSlice name, FileType file_type) {
auto type_stats = info.stats_by_type[net_type_i];
const auto &type_stats = info.stats_by_type[net_type_i];
auto stats = current ? type_stats.mem_stats : type_stats.mem_stats + type_stats.db_stats;
if (id == 0) {
} else if (id == 1) {
@ -96,7 +96,7 @@ void NetStatsManager::get_network_stats(bool current, Promise<NetworkStats> prom
if (id == 1) {
return;
}
auto type_stats = info.stats_by_type[net_type_i];
const auto &type_stats = info.stats_by_type[net_type_i];
auto stats = current ? type_stats.mem_stats : type_stats.mem_stats + type_stats.db_stats;
NetworkStatsEntry entry;

View File

@ -68,7 +68,7 @@ class Handshake {
CHECK(pkey_private != nullptr);
auto res = X25519_pem_from_PKEY(pkey_private, true);
EVP_PKEY_free(pkey_private);
return std::move(res);
return res;
}
static td::Result<td::SecureString> calc_shared_secret(td::Slice private_key, td::Slice other_public_key) {
@ -134,6 +134,7 @@ class Handshake {
}
return std::move(result);
}
static td::Result<td::SecureString> X25519_pem_from_PKEY(EVP_PKEY *pkey, bool is_private) {
BIO *mem_bio = BIO_new(BIO_s_mem());
SCOPE_EXIT {