Don't save get_id() to a used-once variable before switch.
This commit is contained in:
parent
dce778442c
commit
542271a1fd
@ -3398,8 +3398,7 @@ class GetCreatedPublicChannelsQuery final : public Td::ResultHandler {
|
||||
|
||||
auto chats_ptr = result_ptr.move_as_ok();
|
||||
LOG(INFO) << "Receive result for GetCreatedPublicChannelsQuery: " << to_string(chats_ptr);
|
||||
int32 constructor_id = chats_ptr->get_id();
|
||||
switch (constructor_id) {
|
||||
switch (chats_ptr->get_id()) {
|
||||
case telegram_api::messages_chats::ID: {
|
||||
auto chats = move_tl_object_as<telegram_api::messages_chats>(chats_ptr);
|
||||
td_->contacts_manager_->on_get_created_public_channels(type_, std::move(chats->chats_));
|
||||
@ -3442,8 +3441,7 @@ class GetGroupsForDiscussionQuery final : public Td::ResultHandler {
|
||||
|
||||
auto chats_ptr = result_ptr.move_as_ok();
|
||||
LOG(INFO) << "Receive result for GetGroupsForDiscussionQuery: " << to_string(chats_ptr);
|
||||
int32 constructor_id = chats_ptr->get_id();
|
||||
switch (constructor_id) {
|
||||
switch (chats_ptr->get_id()) {
|
||||
case telegram_api::messages_chats::ID: {
|
||||
auto chats = move_tl_object_as<telegram_api::messages_chats>(chats_ptr);
|
||||
td_->contacts_manager_->on_get_dialogs_for_discussion(std::move(chats->chats_));
|
||||
@ -3622,8 +3620,7 @@ class GetChatsQuery final : public Td::ResultHandler {
|
||||
}
|
||||
|
||||
auto chats_ptr = result_ptr.move_as_ok();
|
||||
int32 constructor_id = chats_ptr->get_id();
|
||||
switch (constructor_id) {
|
||||
switch (chats_ptr->get_id()) {
|
||||
case telegram_api::messages_chats::ID: {
|
||||
auto chats = move_tl_object_as<telegram_api::messages_chats>(chats_ptr);
|
||||
td_->contacts_manager_->on_get_chats(std::move(chats->chats_), "GetChatsQuery");
|
||||
@ -3707,8 +3704,7 @@ class GetChannelsQuery final : public Td::ResultHandler {
|
||||
|
||||
// LOG(INFO) << "Receive result for GetChannelsQuery: " << to_string(result_ptr.ok());
|
||||
auto chats_ptr = result_ptr.move_as_ok();
|
||||
int32 constructor_id = chats_ptr->get_id();
|
||||
switch (constructor_id) {
|
||||
switch (chats_ptr->get_id()) {
|
||||
case telegram_api::messages_chats::ID: {
|
||||
auto chats = move_tl_object_as<telegram_api::messages_chats>(chats_ptr);
|
||||
td_->contacts_manager_->on_get_chats(std::move(chats->chats_), "GetChannelsQuery");
|
||||
|
@ -264,8 +264,7 @@ unique_ptr<DraftMessage> get_draft_message(Td *td,
|
||||
if (draft_message_ptr == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
auto constructor_id = draft_message_ptr->get_id();
|
||||
switch (constructor_id) {
|
||||
switch (draft_message_ptr->get_id()) {
|
||||
case telegram_api::draftMessageEmpty::ID:
|
||||
return nullptr;
|
||||
case telegram_api::draftMessage::ID:
|
||||
|
@ -5550,8 +5550,7 @@ unique_ptr<MessageContent> get_message_content(Td *td, FormattedText message,
|
||||
*disable_web_page_preview = false;
|
||||
}
|
||||
|
||||
int32 constructor_id = media_ptr == nullptr ? telegram_api::messageMediaEmpty::ID : media_ptr->get_id();
|
||||
switch (constructor_id) {
|
||||
switch (media_ptr == nullptr ? telegram_api::messageMediaEmpty::ID : media_ptr->get_id()) {
|
||||
case telegram_api::messageMediaEmpty::ID:
|
||||
if (message.text.empty()) {
|
||||
LOG(ERROR) << "Receive empty message text and media from " << source;
|
||||
|
@ -474,8 +474,7 @@ static Result<KeyboardButton> get_keyboard_button(tl_object_ptr<td_api::keyboard
|
||||
KeyboardButton current_button;
|
||||
current_button.text = std::move(button->text_);
|
||||
|
||||
int32 button_type_id = button->type_ == nullptr ? td_api::keyboardButtonTypeText::ID : button->type_->get_id();
|
||||
switch (button_type_id) {
|
||||
switch (button->type_ == nullptr ? td_api::keyboardButtonTypeText::ID : button->type_->get_id()) {
|
||||
case td_api::keyboardButtonTypeText::ID:
|
||||
current_button.type = KeyboardButton::Type::Text;
|
||||
break;
|
||||
@ -566,8 +565,7 @@ static Result<InlineKeyboardButton> get_inline_keyboard_button(tl_object_ptr<td_
|
||||
InlineKeyboardButton current_button;
|
||||
current_button.text = std::move(button->text_);
|
||||
|
||||
int32 button_type_id = button->type_->get_id();
|
||||
switch (button_type_id) {
|
||||
switch (button->type_->get_id()) {
|
||||
case td_api::inlineKeyboardButtonTypeUrl::ID: {
|
||||
auto button_type = move_tl_object_as<td_api::inlineKeyboardButtonTypeUrl>(button->type_);
|
||||
auto user_id = LinkManager::get_link_user_id(button_type->url_);
|
||||
|
@ -189,8 +189,7 @@ void add_story_content_dependencies(Dependencies &dependencies, const StoryConte
|
||||
unique_ptr<StoryContent> get_story_content(Td *td, tl_object_ptr<telegram_api::MessageMedia> &&media_ptr,
|
||||
DialogId owner_dialog_id) {
|
||||
CHECK(media_ptr != nullptr);
|
||||
int32 constructor_id = media_ptr->get_id();
|
||||
switch (constructor_id) {
|
||||
switch (media_ptr->get_id()) {
|
||||
case telegram_api::messageMediaPhoto::ID: {
|
||||
auto media = move_tl_object_as<telegram_api::messageMediaPhoto>(media_ptr);
|
||||
if (media->photo_ == nullptr || (media->flags_ & telegram_api::messageMediaPhoto::TTL_SECONDS_MASK) != 0 ||
|
||||
|
@ -764,8 +764,7 @@ class GetChatsToSendStoriesQuery final : public Td::ResultHandler {
|
||||
|
||||
auto chats_ptr = result_ptr.move_as_ok();
|
||||
LOG(INFO) << "Receive result for GetChatsToSendStoriesQuery: " << to_string(chats_ptr);
|
||||
int32 constructor_id = chats_ptr->get_id();
|
||||
switch (constructor_id) {
|
||||
switch (chats_ptr->get_id()) {
|
||||
case telegram_api::messages_chats::ID: {
|
||||
auto chats = move_tl_object_as<telegram_api::messages_chats>(chats_ptr);
|
||||
td_->story_manager_->on_get_dialogs_to_send_stories(std::move(chats->chats_));
|
||||
|
Loading…
Reference in New Issue
Block a user