Fix g++ CEs, warnings and Internal Compiler Errors.
GitOrigin-RevId: 0d7213b04cbbe67157f93fcdcf76f11373b47470
This commit is contained in:
parent
184af85bfc
commit
50ab1fd175
@ -197,19 +197,6 @@ void PhoneNumberManager::set_phone_number(uint64 query_id, string phone_number,
|
|||||||
if (phone_number.empty()) {
|
if (phone_number.empty()) {
|
||||||
return on_query_error(query_id, Status::Error(8, "Phone number can't be empty"));
|
return on_query_error(query_id, Status::Error(8, "Phone number can't be empty"));
|
||||||
}
|
}
|
||||||
auto with_send_code = [&](auto c) {
|
|
||||||
switch (this->type_) {
|
|
||||||
case Type::ChangePhone:
|
|
||||||
return c(send_code_helper_.send_change_phone_code(phone_number, allow_flash_call, is_current_phone_number));
|
|
||||||
case Type::VerifyPhone:
|
|
||||||
return c(send_code_helper_.send_verify_phone_code(phone_number, allow_flash_call, is_current_phone_number));
|
|
||||||
case Type::ConfirmPhone:
|
|
||||||
return c(send_code_helper_.send_confirm_phone_code(phone_number, allow_flash_call, is_current_phone_number));
|
|
||||||
default:
|
|
||||||
UNREACHABLE();
|
|
||||||
return c(send_code_helper_.send_change_phone_code(phone_number, allow_flash_call, is_current_phone_number));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
auto process_send_code = [&](auto r_send_code) {
|
auto process_send_code = [&](auto r_send_code) {
|
||||||
if (r_send_code.is_error()) {
|
if (r_send_code.is_error()) {
|
||||||
@ -221,7 +208,19 @@ void PhoneNumberManager::set_phone_number(uint64 query_id, string phone_number,
|
|||||||
start_net_query(NetQueryType::SendCode, G()->net_query_creator().create(create_storer(r_send_code.move_as_ok())));
|
start_net_query(NetQueryType::SendCode, G()->net_query_creator().create(create_storer(r_send_code.move_as_ok())));
|
||||||
};
|
};
|
||||||
|
|
||||||
with_send_code(process_send_code);
|
switch (type_) {
|
||||||
|
case Type::ChangePhone:
|
||||||
|
return process_send_code(
|
||||||
|
send_code_helper_.send_change_phone_code(phone_number, allow_flash_call, is_current_phone_number));
|
||||||
|
case Type::VerifyPhone:
|
||||||
|
return process_send_code(
|
||||||
|
send_code_helper_.send_verify_phone_code(phone_number, allow_flash_call, is_current_phone_number));
|
||||||
|
case Type::ConfirmPhone:
|
||||||
|
return process_send_code(
|
||||||
|
send_code_helper_.send_confirm_phone_code(phone_number, allow_flash_call, is_current_phone_number));
|
||||||
|
default:
|
||||||
|
UNREACHABLE();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhoneNumberManager::resend_authentication_code(uint64 query_id) {
|
void PhoneNumberManager::resend_authentication_code(uint64 query_id) {
|
||||||
@ -246,29 +245,23 @@ void PhoneNumberManager::check_code(uint64 query_id, string code) {
|
|||||||
return on_query_error(query_id, Status::Error(8, "checkAuthenticationCode unexpected"));
|
return on_query_error(query_id, Status::Error(8, "checkAuthenticationCode unexpected"));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto with_api_object = [&](auto c) {
|
|
||||||
switch (type_) {
|
|
||||||
case Type::ChangePhone:
|
|
||||||
return c(telegram_api::account_changePhone(send_code_helper_.phone_number().str(),
|
|
||||||
send_code_helper_.phone_code_hash().str(), code));
|
|
||||||
case Type::ConfirmPhone:
|
|
||||||
return c(telegram_api::account_confirmPhone(send_code_helper_.phone_code_hash().str(), code));
|
|
||||||
case Type::VerifyPhone:
|
|
||||||
return c(telegram_api::account_verifyPhone(send_code_helper_.phone_number().str(),
|
|
||||||
send_code_helper_.phone_code_hash().str(), code));
|
|
||||||
default:
|
|
||||||
UNREACHABLE();
|
|
||||||
return c(telegram_api::account_changePhone(send_code_helper_.phone_number().str(),
|
|
||||||
send_code_helper_.phone_code_hash().str(), code));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
on_new_query(query_id);
|
on_new_query(query_id);
|
||||||
auto send_new_query = [&](auto q) {
|
auto send_new_query = [&](auto q) {
|
||||||
start_net_query(NetQueryType::CheckCode, G()->net_query_creator().create(create_storer(q)));
|
start_net_query(NetQueryType::CheckCode, G()->net_query_creator().create(create_storer(q)));
|
||||||
};
|
};
|
||||||
|
|
||||||
with_api_object(send_new_query);
|
switch (type_) {
|
||||||
|
case Type::ChangePhone:
|
||||||
|
return send_new_query(telegram_api::account_changePhone(send_code_helper_.phone_number().str(),
|
||||||
|
send_code_helper_.phone_code_hash().str(), code));
|
||||||
|
case Type::ConfirmPhone:
|
||||||
|
return send_new_query(telegram_api::account_confirmPhone(send_code_helper_.phone_code_hash().str(), code));
|
||||||
|
case Type::VerifyPhone:
|
||||||
|
return send_new_query(telegram_api::account_verifyPhone(send_code_helper_.phone_number().str(),
|
||||||
|
send_code_helper_.phone_code_hash().str(), code));
|
||||||
|
default:
|
||||||
|
UNREACHABLE();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhoneNumberManager::on_new_query(uint64 query_id) {
|
void PhoneNumberManager::on_new_query(uint64 query_id) {
|
||||||
@ -311,20 +304,6 @@ void PhoneNumberManager::start_net_query(NetQueryType net_query_type, NetQueryPt
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PhoneNumberManager::on_check_code_result(NetQueryPtr &result) {
|
void PhoneNumberManager::on_check_code_result(NetQueryPtr &result) {
|
||||||
auto with_result = [&](auto c) {
|
|
||||||
switch (type_) {
|
|
||||||
case Type::ChangePhone:
|
|
||||||
return c(fetch_result<telegram_api::account_changePhone>(result->ok()));
|
|
||||||
case Type::VerifyPhone:
|
|
||||||
return c(fetch_result<telegram_api::account_verifyPhone>(result->ok()));
|
|
||||||
case Type::ConfirmPhone:
|
|
||||||
return c(fetch_result<telegram_api::account_confirmPhone>(result->ok()));
|
|
||||||
default:
|
|
||||||
UNREACHABLE();
|
|
||||||
return c(fetch_result<telegram_api::account_changePhone>(result->ok()));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
auto process_result = [&](auto result) {
|
auto process_result = [&](auto result) {
|
||||||
if (result.is_error()) {
|
if (result.is_error()) {
|
||||||
return on_query_error(result.move_as_error());
|
return on_query_error(result.move_as_error());
|
||||||
@ -333,7 +312,16 @@ void PhoneNumberManager::on_check_code_result(NetQueryPtr &result) {
|
|||||||
on_query_ok();
|
on_query_ok();
|
||||||
};
|
};
|
||||||
|
|
||||||
with_result(process_result);
|
switch (type_) {
|
||||||
|
case Type::ChangePhone:
|
||||||
|
return process_result(fetch_result<telegram_api::account_changePhone>(result->ok()));
|
||||||
|
case Type::VerifyPhone:
|
||||||
|
return process_result(fetch_result<telegram_api::account_verifyPhone>(result->ok()));
|
||||||
|
case Type::ConfirmPhone:
|
||||||
|
return process_result(fetch_result<telegram_api::account_confirmPhone>(result->ok()));
|
||||||
|
default:
|
||||||
|
UNREACHABLE();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhoneNumberManager::on_send_code_result(NetQueryPtr &result) {
|
void PhoneNumberManager::on_send_code_result(NetQueryPtr &result) {
|
||||||
|
@ -4336,6 +4336,7 @@ void parse(ScopeNotificationSettings ¬ification_settings, ParserT &parser) {
|
|||||||
PARSE_FLAG(silent_send_message_ignored);
|
PARSE_FLAG(silent_send_message_ignored);
|
||||||
PARSE_FLAG(notification_settings.is_synchronized);
|
PARSE_FLAG(notification_settings.is_synchronized);
|
||||||
END_PARSE_FLAGS();
|
END_PARSE_FLAGS();
|
||||||
|
(void)silent_send_message_ignored;
|
||||||
if (is_muted) {
|
if (is_muted) {
|
||||||
parse(notification_settings.mute_until, parser);
|
parse(notification_settings.mute_until, parser);
|
||||||
}
|
}
|
||||||
|
@ -436,7 +436,7 @@ Result<std::pair<FileId, SecureFileCredentials>> decrypt_secure_file(FileManager
|
|||||||
const secure_storage::Secret &master_secret,
|
const secure_storage::Secret &master_secret,
|
||||||
const EncryptedSecureFile &secure_file) {
|
const EncryptedSecureFile &secure_file) {
|
||||||
if (!secure_file.file_id.is_valid()) {
|
if (!secure_file.file_id.is_valid()) {
|
||||||
return std::make_pair(secure_file.file_id, SecureFileCredentials{});
|
return std::make_pair(secure_file.file_id, SecureFileCredentials());
|
||||||
}
|
}
|
||||||
TRY_RESULT(hash, secure_storage::ValueHash::create(secure_file.file_hash));
|
TRY_RESULT(hash, secure_storage::ValueHash::create(secure_file.file_hash));
|
||||||
TRY_RESULT(encrypted_secret, secure_storage::EncryptedSecret::create(secure_file.encrypted_secret));
|
TRY_RESULT(encrypted_secret, secure_storage::EncryptedSecret::create(secure_file.encrypted_secret));
|
||||||
@ -520,15 +520,15 @@ EncryptedSecureFile encrypt_secure_file(FileManager *file_manager, const secure_
|
|||||||
FileId file, string &to_hash) {
|
FileId file, string &to_hash) {
|
||||||
auto file_view = file_manager->get_file_view(file);
|
auto file_view = file_manager->get_file_view(file);
|
||||||
if (file_view.empty()) {
|
if (file_view.empty()) {
|
||||||
return {};
|
return EncryptedSecureFile();
|
||||||
}
|
}
|
||||||
if (!file_view.encryption_key().is_secure()) {
|
if (!file_view.encryption_key().is_secure()) {
|
||||||
LOG(ERROR) << "File has no encryption key";
|
LOG(ERROR) << "File has no encryption key";
|
||||||
return {};
|
return EncryptedSecureFile();
|
||||||
}
|
}
|
||||||
if (!file_view.encryption_key().has_value_hash()) {
|
if (!file_view.encryption_key().has_value_hash()) {
|
||||||
LOG(ERROR) << "File has no hash";
|
LOG(ERROR) << "File has no hash";
|
||||||
return {};
|
return EncryptedSecureFile();
|
||||||
}
|
}
|
||||||
auto value_hash = file_view.encryption_key().value_hash();
|
auto value_hash = file_view.encryption_key().value_hash();
|
||||||
auto secret = file_view.encryption_key().secret();
|
auto secret = file_view.encryption_key().secret();
|
||||||
@ -641,29 +641,29 @@ JsonScope &operator+(JsonValueScope &scope, const SecureValueCredentials &creden
|
|||||||
Slice secure_value_type_as_slice(SecureValueType type) {
|
Slice secure_value_type_as_slice(SecureValueType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case SecureValueType::PersonalDetails:
|
case SecureValueType::PersonalDetails:
|
||||||
return "personal_details";
|
return Slice("personal_details");
|
||||||
case SecureValueType::Passport:
|
case SecureValueType::Passport:
|
||||||
return "passport";
|
return Slice("passport");
|
||||||
case SecureValueType::DriverLicense:
|
case SecureValueType::DriverLicense:
|
||||||
return "driver_license";
|
return Slice("driver_license");
|
||||||
case SecureValueType::IdentityCard:
|
case SecureValueType::IdentityCard:
|
||||||
return "identity_card";
|
return Slice("identity_card");
|
||||||
case SecureValueType::Address:
|
case SecureValueType::Address:
|
||||||
return "address";
|
return Slice("address");
|
||||||
case SecureValueType::UtilityBill:
|
case SecureValueType::UtilityBill:
|
||||||
return "utility_bill";
|
return Slice("utility_bill");
|
||||||
case SecureValueType::BankStatement:
|
case SecureValueType::BankStatement:
|
||||||
return "bank_statement";
|
return Slice("bank_statement");
|
||||||
case SecureValueType::RentalAgreement:
|
case SecureValueType::RentalAgreement:
|
||||||
return "rental_agreement";
|
return Slice("rental_agreement");
|
||||||
case SecureValueType::PhoneNumber:
|
case SecureValueType::PhoneNumber:
|
||||||
return "phone";
|
return Slice("phone");
|
||||||
case SecureValueType::EmailAddress:
|
case SecureValueType::EmailAddress:
|
||||||
return "email";
|
return Slice("email");
|
||||||
default:
|
default:
|
||||||
case SecureValueType::None:
|
case SecureValueType::None:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
return "none";
|
return Slice("none");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user