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 " ||
(string_type == bytes_type && field_type == "bytes ")) {
res += field_type + "const &";
} else if (field_type.compare(0, 5, "array") == 0 || field_type == "bytes ") {
res += field_type + "&&";
} else if (field_type.compare(0, 10, "object_ptr") == 0) {
} else if (field_type.compare(0, 5, "array") == 0 || field_type == "bytes " ||
field_type.compare(0, 10, "object_ptr") == 0) {
res += field_type + "&&";
} else {
assert(false && "unreachable");

View File

@ -78,7 +78,7 @@ bool AuthData::update_server_time_difference(double diff) {
} else {
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;
}
@ -119,13 +119,13 @@ int64 AuthData::next_message_id(double now) {
bool AuthData::is_valid_outbound_msg_id(int64 id, double now) const {
double server_time = get_server_time(now);
auto id_time = static_cast<double>(id / (1ll << 32));
return server_time - 300 / 2 < id_time && id_time < server_time + 60 / 2;
auto id_time = static_cast<double>(id) / static_cast<double>(1ll << 32);
return server_time - 300 / 2 < id_time && id_time < server_time + 30;
}
bool AuthData::is_valid_inbound_msg_id(int64 id, double now) const {
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;
}

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,
vector<tl_object_ptr<telegram_api::botCommand>> &&bot_commands) {
CHECK(user_full != nullptr);
auto commands =
transform(std::move(bot_commands), [](auto &&bot_command) { return BotCommand(std::move(bot_command)); });
auto commands = transform(std::move(bot_commands), [](tl_object_ptr<telegram_api::botCommand> &&bot_command) {
return BotCommand(std::move(bot_command));
});
if (user_full->commands != commands) {
user_full->commands = std::move(commands);
user_full->is_changed = true;

View File

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

View File

@ -1781,11 +1781,14 @@ class CliClient final : public Actor {
} else if (op == "rreac") {
send_request(td_api::make_object<td_api::resendRecoveryEmailAddressCode>());
} 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") {
send_request(td_api::make_object<td_api::checkPhoneNumberVerificationCode>(args));
send_request(td_api::make_object<td_api::checkPhoneNumberConfirmationCode>(args));
} 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") {
send_request(td_api::make_object<td_api::requestPasswordRecovery>());
} 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>("\"\\uD800\""));
} 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)));
};
@ -4477,7 +4480,7 @@ class CliClient final : public Actor {
if (slice.empty()) {
return EOF;
}
int res = slice[0];
int res = static_cast<unsigned char>(slice[0]);
stdin_.input_buffer().confirm_read(1);
return res;
}

View File

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

View File

@ -136,7 +136,7 @@ class LambdaPromise : public PromiseInterface<ValueT> {
, has_lambda_(true) {
}
template <class FromOkT>
LambdaPromise(FromOkT &&ok) : LambdaPromise(std::move(ok), Ignore(), true) {
LambdaPromise(FromOkT &&ok) : LambdaPromise(std::forward<FromOkT>(ok), Ignore(), true) {
}
private:
@ -461,7 +461,7 @@ class SendClosure {
template <class... ArgsT>
auto promise_send_closure(ArgsT &&... args) {
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:
return 1;
case BIO_CTRL_PUSH:
return 0;
case BIO_CTRL_POP:
return 0;
default:

View File

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

View File

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

View File

@ -254,7 +254,7 @@ Slice get_operating_system_version() {
}
return "Windows Server 2016";
}
if (os_version_info.dwBuildNumber >= 21900) { // build numbers between 21391 and 21999 aren't used
if (os_version_info.dwBuildNumber >= 21900) { // build numbers between 21391 and 21999 aren't used
return "Windows 11";
}
return "Windows 10";