Minor warning fixes.

This commit is contained in:
levlam 2021-10-18 12:57:13 +03:00
parent 0782f56408
commit f35afe23c8
11 changed files with 28 additions and 29 deletions

View File

@ -261,9 +261,8 @@ std::string TD_TL_writer::gen_constructor_parameter(int field_num, const std::st
} else if (field_type == "UInt128 " || field_type == "UInt256 " || field_type == "string " || } else if (field_type == "UInt128 " || field_type == "UInt256 " || field_type == "string " ||
(string_type == bytes_type && field_type == "bytes ")) { (string_type == bytes_type && field_type == "bytes ")) {
res += field_type + "const &"; res += field_type + "const &";
} else if (field_type.compare(0, 5, "array") == 0 || field_type == "bytes ") { } else if (field_type.compare(0, 5, "array") == 0 || field_type == "bytes " ||
res += field_type + "&&"; field_type.compare(0, 10, "object_ptr") == 0) {
} else if (field_type.compare(0, 10, "object_ptr") == 0) {
res += field_type + "&&"; res += field_type + "&&";
} else { } else {
assert(false && "unreachable"); assert(false && "unreachable");

View File

@ -78,7 +78,7 @@ bool AuthData::update_server_time_difference(double diff) {
} else { } else {
return false; return false;
} }
LOG(DEBUG) << "SERVER_TIME: " << format::as_hex(static_cast<int>(get_server_time(Time::now_cached()))); LOG(DEBUG) << "SERVER_TIME: " << format::as_hex(static_cast<int32>(get_server_time(Time::now_cached())));
return true; return true;
} }
@ -119,13 +119,13 @@ int64 AuthData::next_message_id(double now) {
bool AuthData::is_valid_outbound_msg_id(int64 id, double now) const { bool AuthData::is_valid_outbound_msg_id(int64 id, double now) const {
double server_time = get_server_time(now); double server_time = get_server_time(now);
auto id_time = static_cast<double>(id / (1ll << 32)); auto id_time = static_cast<double>(id) / static_cast<double>(1ll << 32);
return server_time - 300 / 2 < id_time && id_time < server_time + 60 / 2; return server_time - 300 / 2 < id_time && id_time < server_time + 30;
} }
bool AuthData::is_valid_inbound_msg_id(int64 id, double now) const { bool AuthData::is_valid_inbound_msg_id(int64 id, double now) const {
double server_time = get_server_time(now); double server_time = get_server_time(now);
auto id_time = static_cast<double>(id / (1ll << 32)); auto id_time = static_cast<double>(id) / static_cast<double>(1ll << 32);
return server_time - 300 < id_time && id_time < server_time + 30; return server_time - 300 < id_time && id_time < server_time + 30;
} }

View File

@ -11121,8 +11121,9 @@ void ContactsManager::on_update_user_full_common_chat_count(UserFull *user_full,
void ContactsManager::on_update_user_full_commands(UserFull *user_full, UserId user_id, void ContactsManager::on_update_user_full_commands(UserFull *user_full, UserId user_id,
vector<tl_object_ptr<telegram_api::botCommand>> &&bot_commands) { vector<tl_object_ptr<telegram_api::botCommand>> &&bot_commands) {
CHECK(user_full != nullptr); CHECK(user_full != nullptr);
auto commands = auto commands = transform(std::move(bot_commands), [](tl_object_ptr<telegram_api::botCommand> &&bot_command) {
transform(std::move(bot_commands), [](auto &&bot_command) { return BotCommand(std::move(bot_command)); }); return BotCommand(std::move(bot_command));
});
if (user_full->commands != commands) { if (user_full->commands != commands) {
user_full->commands = std::move(commands); user_full->commands = std::move(commands);
user_full->is_changed = true; user_full->is_changed = true;

View File

@ -517,7 +517,6 @@ static bool check_encrypted_secure_value(const EncryptedSecureValue &value) {
case SecureValueType::TemporaryRegistration: case SecureValueType::TemporaryRegistration:
return !has_encrypted_data && !has_plain_data && has_files && !has_front_side && !has_reverse_side && !has_selfie; return !has_encrypted_data && !has_plain_data && has_files && !has_front_side && !has_reverse_side && !has_selfie;
case SecureValueType::PhoneNumber: case SecureValueType::PhoneNumber:
return has_plain_data && !has_files && !has_front_side && !has_reverse_side && !has_selfie && !has_translations;
case SecureValueType::EmailAddress: case SecureValueType::EmailAddress:
return has_plain_data && !has_files && !has_front_side && !has_reverse_side && !has_selfie && !has_translations; return has_plain_data && !has_files && !has_front_side && !has_reverse_side && !has_selfie && !has_translations;
case SecureValueType::None: case SecureValueType::None:

View File

@ -1781,11 +1781,14 @@ class CliClient final : public Actor {
} else if (op == "rreac") { } else if (op == "rreac") {
send_request(td_api::make_object<td_api::resendRecoveryEmailAddressCode>()); send_request(td_api::make_object<td_api::resendRecoveryEmailAddressCode>());
} else if (op == "spncc") { } else if (op == "spncc") {
send_request(td_api::make_object<td_api::sendPhoneNumberVerificationCode>(args, nullptr)); string hash;
string phone_number;
get_args(args, hash, phone_number);
send_request(td_api::make_object<td_api::sendPhoneNumberConfirmationCode>(hash, phone_number, nullptr));
} else if (op == "cpncc") { } else if (op == "cpncc") {
send_request(td_api::make_object<td_api::checkPhoneNumberVerificationCode>(args)); send_request(td_api::make_object<td_api::checkPhoneNumberConfirmationCode>(args));
} else if (op == "rpncc") { } else if (op == "rpncc") {
send_request(td_api::make_object<td_api::resendPhoneNumberVerificationCode>()); send_request(td_api::make_object<td_api::resendPhoneNumberConfirmationCode>());
} else if (op == "rpr") { } else if (op == "rpr") {
send_request(td_api::make_object<td_api::requestPasswordRecovery>()); send_request(td_api::make_object<td_api::requestPasswordRecovery>());
} else if (op == "cprc") { } else if (op == "cprc") {
@ -3020,7 +3023,7 @@ class CliClient final : public Actor {
execute(td_api::make_object<td_api::getJsonValue>("\"\\u0080\"")); execute(td_api::make_object<td_api::getJsonValue>("\"\\u0080\""));
execute(td_api::make_object<td_api::getJsonValue>("\"\\uD800\"")); execute(td_api::make_object<td_api::getJsonValue>("\"\\uD800\""));
} else if (op == "gjs") { } else if (op == "gjs") {
auto test_get_json_string = [&](auto &&json_value) { auto test_get_json_string = [&](td_api::object_ptr<td_api::JsonValue> &&json_value) {
execute(td_api::make_object<td_api::getJsonString>(std::move(json_value))); execute(td_api::make_object<td_api::getJsonString>(std::move(json_value)));
}; };
@ -4477,7 +4480,7 @@ class CliClient final : public Actor {
if (slice.empty()) { if (slice.empty()) {
return EOF; return EOF;
} }
int res = slice[0]; int res = static_cast<unsigned char>(slice[0]);
stdin_.input_buffer().confirm_read(1); stdin_.input_buffer().confirm_read(1);
return res; return res;
} }

View File

@ -107,9 +107,7 @@ void FileManager::store_file(FileId file_id, StorerT &storer, int32 ttl) const {
default: default:
UNREACHABLE(); UNREACHABLE();
} }
if (has_encryption_key) { if (has_encryption_key || has_secure_key) {
store(file_view.encryption_key(), storer);
} else if (has_secure_key) {
store(file_view.encryption_key(), storer); store(file_view.encryption_key(), storer);
} }
} }
@ -225,13 +223,10 @@ FileId FileManager::parse_file(ParserT &parser) {
return FileId(); return FileId();
}(); }();
if (has_encryption_key) { if (has_encryption_key || has_secure_key) {
auto key_type = has_encryption_key ? FileEncryptionKey::Type::Secret : FileEncryptionKey::Type::Secure;
FileEncryptionKey encryption_key; FileEncryptionKey encryption_key;
encryption_key.parse(FileEncryptionKey::Type::Secret, parser); encryption_key.parse(key_type, parser);
set_encryption_key(file_id, std::move(encryption_key));
} else if (has_secure_key) {
FileEncryptionKey encryption_key;
encryption_key.parse(FileEncryptionKey::Type::Secure, parser);
set_encryption_key(file_id, std::move(encryption_key)); set_encryption_key(file_id, std::move(encryption_key));
} }

View File

@ -136,7 +136,7 @@ class LambdaPromise : public PromiseInterface<ValueT> {
, has_lambda_(true) { , has_lambda_(true) {
} }
template <class FromOkT> template <class FromOkT>
LambdaPromise(FromOkT &&ok) : LambdaPromise(std::move(ok), Ignore(), true) { LambdaPromise(FromOkT &&ok) : LambdaPromise(std::forward<FromOkT>(ok), Ignore(), true) {
} }
private: private:
@ -461,7 +461,7 @@ class SendClosure {
template <class... ArgsT> template <class... ArgsT>
auto promise_send_closure(ArgsT &&... args) { auto promise_send_closure(ArgsT &&... args) {
return [t = std::make_tuple(std::forward<ArgsT>(args)...)](auto &&res) mutable { return [t = std::make_tuple(std::forward<ArgsT>(args)...)](auto &&res) mutable {
call_tuple(SendClosure(), std::tuple_cat(std::move(t), std::make_tuple(std::move(res)))); call_tuple(SendClosure(), std::tuple_cat(std::move(t), std::make_tuple(std::forward<decltype(res)>(res))));
}; };
} }

View File

@ -96,7 +96,6 @@ long strm_ctrl(BIO *b, int cmd, long num, void *ptr) {
case BIO_CTRL_FLUSH: case BIO_CTRL_FLUSH:
return 1; return 1;
case BIO_CTRL_PUSH: case BIO_CTRL_PUSH:
return 0;
case BIO_CTRL_POP: case BIO_CTRL_POP:
return 0; return 0;
default: default:

View File

@ -37,7 +37,7 @@ class EpochBasedMemoryReclamation {
if (ebmr_) { if (ebmr_) {
retire_sync(); retire_sync();
unlock(); unlock();
ebmr_.release(); (void)ebmr_.release();
} }
} }
void lock() { void lock() {

View File

@ -106,6 +106,9 @@ class SharedPtr {
SharedPtr(const SharedPtr &other) : SharedPtr(other.raw_) { SharedPtr(const SharedPtr &other) : SharedPtr(other.raw_) {
} }
SharedPtr &operator=(const SharedPtr &other) { SharedPtr &operator=(const SharedPtr &other) {
if (this == &other) {
return *this;
}
if (other.raw_) { if (other.raw_) {
other.raw_->inc(); other.raw_->inc();
} }