Workaround GCC 12 false positive warnings.
This commit is contained in:
parent
1616513c4c
commit
18cd0dd95e
@ -145,6 +145,9 @@ function(td_set_up_compiler)
|
||||
# see http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1579
|
||||
add_cxx_compiler_flag("-Wno-redundant-move")
|
||||
endif()
|
||||
if (GCC AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.0))
|
||||
add_cxx_compiler_flag("-Wno-stringop-overflow") # some false positives
|
||||
endif()
|
||||
if (CLANG AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5))
|
||||
# https://stackoverflow.com/questions/26744556/warning-returning-a-captured-reference-from-a-lambda
|
||||
add_cxx_compiler_flag("-Wno-return-stack-address")
|
||||
|
@ -1516,7 +1516,7 @@ Status SecretChatActor::outbound_rewrite_with_empty(uint64 state_id) {
|
||||
state->message->is_external = false;
|
||||
state->message->need_notify_user = false;
|
||||
state->message->is_silent = true;
|
||||
state->message->file = log_event::EncryptedInputFile::from_input_encrypted_file(nullptr);
|
||||
state->message->file = log_event::EncryptedInputFile();
|
||||
binlog_rewrite(context_->binlog(), state->message->log_event_id(), LogEvent::HandlerType::SecretChats,
|
||||
create_storer(*state->message));
|
||||
return Status::OK();
|
||||
@ -1606,15 +1606,14 @@ void SecretChatActor::on_outbound_send_message_result(NetQueryPtr query, Promise
|
||||
auto sent = move_tl_object_as<telegram_api::messages_sentEncryptedFile>(result);
|
||||
auto file = EncryptedFile::get_encrypted_file(std::move(sent->file_));
|
||||
if (file == nullptr) {
|
||||
state->message->file = log_event::EncryptedInputFile::from_input_encrypted_file(nullptr);
|
||||
state->message->file = log_event::EncryptedInputFile();
|
||||
state->send_result_ = [this, random_id = state->message->random_id,
|
||||
message_id = MessageId(ServerMessageId(state->message->message_id)),
|
||||
date = sent->date_](Promise<> promise) {
|
||||
context_->on_send_message_ok(random_id, message_id, date, nullptr, std::move(promise));
|
||||
};
|
||||
} else {
|
||||
state->message->file = log_event::EncryptedInputFile::from_input_encrypted_file(
|
||||
make_tl_object<telegram_api::inputEncryptedFile>(file->id_, file->access_hash_));
|
||||
state->message->file = {log_event::EncryptedInputFile::Location, file->id_, file->access_hash_, 0, 0};
|
||||
state->send_result_ = [this, random_id = state->message->random_id,
|
||||
message_id = MessageId(ServerMessageId(state->message->message_id)),
|
||||
date = sent->date_, file = *file](Promise<> promise) {
|
||||
|
@ -175,31 +175,30 @@ struct EncryptedInputFile {
|
||||
}
|
||||
}
|
||||
static EncryptedInputFile from_input_encrypted_file(const tl_object_ptr<telegram_api::InputEncryptedFile> &from) {
|
||||
if (!from) {
|
||||
return EncryptedInputFile{Empty, 0, 0, 0, 0};
|
||||
if (from == nullptr) {
|
||||
return EncryptedInputFile();
|
||||
}
|
||||
return from_input_encrypted_file(*from);
|
||||
}
|
||||
static EncryptedInputFile from_input_encrypted_file(const telegram_api::InputEncryptedFile &from) {
|
||||
switch (from.get_id()) {
|
||||
switch (from->get_id()) {
|
||||
case telegram_api::inputEncryptedFileEmpty::ID:
|
||||
return EncryptedInputFile{Empty, 0, 0, 0, 0};
|
||||
case telegram_api::inputEncryptedFileUploaded::ID: {
|
||||
auto &uploaded = static_cast<const telegram_api::inputEncryptedFileUploaded &>(from);
|
||||
auto &uploaded = static_cast<const telegram_api::inputEncryptedFileUploaded &>(*from);
|
||||
return EncryptedInputFile{Uploaded, uploaded.id_, 0, uploaded.parts_, uploaded.key_fingerprint_};
|
||||
}
|
||||
case telegram_api::inputEncryptedFileBigUploaded::ID: {
|
||||
auto &uploaded = static_cast<const telegram_api::inputEncryptedFileBigUploaded &>(from);
|
||||
auto &uploaded = static_cast<const telegram_api::inputEncryptedFileBigUploaded &>(*from);
|
||||
return EncryptedInputFile{BigUploaded, uploaded.id_, 0, uploaded.parts_, uploaded.key_fingerprint_};
|
||||
}
|
||||
case telegram_api::inputEncryptedFile::ID: {
|
||||
auto &uploaded = static_cast<const telegram_api::inputEncryptedFile &>(from);
|
||||
auto &uploaded = static_cast<const telegram_api::inputEncryptedFile &>(*from);
|
||||
return EncryptedInputFile{Location, uploaded.id_, uploaded.access_hash_, 0, 0};
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return EncryptedInputFile();
|
||||
}
|
||||
}
|
||||
|
||||
tl_object_ptr<telegram_api::InputEncryptedFile> as_input_encrypted_file() const {
|
||||
switch (type) {
|
||||
case Empty:
|
||||
@ -212,6 +211,7 @@ struct EncryptedInputFile {
|
||||
return make_tl_object<telegram_api::inputEncryptedFile>(id, access_hash);
|
||||
}
|
||||
UNREACHABLE();
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user