Add static_assert that flag in STORE_FLAG/PARSE_FLAG is bool.
This commit is contained in:
parent
17d38edc19
commit
a59e6b8ffe
@ -5468,7 +5468,7 @@ void MessagesManager::Dialog::store(StorerT &storer) const {
|
|||||||
STORE_FLAG(need_drop_default_send_message_as_dialog_id);
|
STORE_FLAG(need_drop_default_send_message_as_dialog_id);
|
||||||
STORE_FLAG(has_available_reactions);
|
STORE_FLAG(has_available_reactions);
|
||||||
STORE_FLAG(is_available_reactions_inited);
|
STORE_FLAG(is_available_reactions_inited);
|
||||||
STORE_FLAG(available_reactions_generation);
|
STORE_FLAG(has_available_reactions_generation);
|
||||||
END_STORE_FLAGS();
|
END_STORE_FLAGS();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23700,7 +23700,7 @@ unique_ptr<MessagesManager::Message> MessagesManager::parse_message(Dialog *d, M
|
|||||||
LOG(ERROR) << "Fix available_reactions_generation in " << dialog_id << " from "
|
LOG(ERROR) << "Fix available_reactions_generation in " << dialog_id << " from "
|
||||||
<< d->available_reactions_generation << " to " << m->available_reactions_generation;
|
<< d->available_reactions_generation << " to " << m->available_reactions_generation;
|
||||||
hide_dialog_message_reactions(d);
|
hide_dialog_message_reactions(d);
|
||||||
set_dialog_available_reactions_generation(d, m->available_reactions_generation);
|
set_dialog_available_reactions_generation(d, m->available_reactions_generation + 1);
|
||||||
on_dialog_updated(dialog_id, "parse_message");
|
on_dialog_updated(dialog_id, "parse_message");
|
||||||
break;
|
break;
|
||||||
case DialogType::User:
|
case DialogType::User:
|
||||||
|
@ -26,8 +26,9 @@
|
|||||||
::td::uint32 flags_store = 0; \
|
::td::uint32 flags_store = 0; \
|
||||||
::td::uint32 bit_offset_store = 0
|
::td::uint32 bit_offset_store = 0
|
||||||
|
|
||||||
#define STORE_FLAG(flag) \
|
#define STORE_FLAG(flag) \
|
||||||
flags_store |= (flag) << bit_offset_store; \
|
static_assert(std::is_same<decltype(flag), bool>::value, "flag must be bool"); \
|
||||||
|
flags_store |= (flag) << bit_offset_store; \
|
||||||
bit_offset_store++
|
bit_offset_store++
|
||||||
|
|
||||||
#define END_STORE_FLAGS() \
|
#define END_STORE_FLAGS() \
|
||||||
@ -42,8 +43,9 @@
|
|||||||
::td::uint32 bit_offset_parse = 0; \
|
::td::uint32 bit_offset_parse = 0; \
|
||||||
::td::parse(flags_parse, parser)
|
::td::parse(flags_parse, parser)
|
||||||
|
|
||||||
#define PARSE_FLAG(flag) \
|
#define PARSE_FLAG(flag) \
|
||||||
flag = ((flags_parse >> bit_offset_parse) & 1) != 0; \
|
static_assert(std::is_same<decltype(flag), bool>::value, "flag must be bool"); \
|
||||||
|
flag = ((flags_parse >> bit_offset_parse) & 1) != 0; \
|
||||||
bit_offset_parse++
|
bit_offset_parse++
|
||||||
|
|
||||||
#define END_PARSE_FLAGS() \
|
#define END_PARSE_FLAGS() \
|
||||||
|
Loading…
Reference in New Issue
Block a user