Add debug.

GitOrigin-RevId: e6efea5f211c8926b986fc40eed6ae1401322c38
This commit is contained in:
levlam 2018-04-13 21:20:20 +03:00
parent ce7c410a5a
commit 82820bf842
5 changed files with 15 additions and 13 deletions

View File

@ -188,8 +188,7 @@ class SecretChatActor : public NetQueryCallback {
storer.store_int(ttl);
storer.store_int(my_layer);
//for future usage
BEGIN_STORE_FLAGS();
END_STORE_FLAGS();
storer.store_int(0);
}
template <class ParserT>
@ -201,8 +200,8 @@ class SecretChatActor : public NetQueryCallback {
his_layer &= ~HAS_FLAGS;
my_layer = parser.fetch_int();
// for future usage
BEGIN_PARSE_FLAGS();
END_PARSE_FLAGS();
int32 flags = parser.fetch_int();
CHECK(flags == 0);
}
}

View File

@ -59,7 +59,8 @@ FileId StickersManager::parse_sticker(bool in_sticker_set, T &parser) {
PARSE_FLAG(has_sticker_set_access_hash);
PARSE_FLAG(in_sticker_set_stored);
END_PARSE_FLAGS();
CHECK(in_sticker_set_stored == in_sticker_set) << in_sticker_set << " " << in_sticker_set_stored;
CHECK(in_sticker_set_stored == in_sticker_set)
<< in_sticker_set << " " << in_sticker_set_stored << " " << parser.version();
if (!in_sticker_set) {
parse(sticker->set_id, parser);
if (has_sticker_set_access_hash) {

View File

@ -1222,7 +1222,7 @@ class FileData {
PARSE_FLAG(has_owner_dialog_id);
PARSE_FLAG(has_expected_size);
PARSE_FLAG(encryption_key_is_secure);
END_PARSE_FLAGS();
// END_PARSE_FLAGS();
if (has_owner_dialog_id) {
parse(owner_dialog_id_, parser);

View File

@ -72,8 +72,8 @@ struct AesCtrEncryptionEvent {
template <class StorerT>
void store(StorerT &storer) const {
using td::store;
BEGIN_STORE_FLAGS();
END_STORE_FLAGS();
int32 flags = 0;
store(flags, storer);
store(key_salt_, storer);
store(iv_, storer);
store(key_hash_, storer);
@ -81,8 +81,9 @@ struct AesCtrEncryptionEvent {
template <class ParserT>
void parse(ParserT &&parser) {
using td::parse;
BEGIN_PARSE_FLAGS();
END_PARSE_FLAGS();
int32 flags;
parse(flags, parser);
CHECK(flags == 0);
parse(key_salt_, parser);
parse(iv_, parser);
parse(key_hash_, parser);

View File

@ -39,9 +39,10 @@
flag = ((flags_parse >> bit_offset_parse) & 1) != 0; \
bit_offset_parse++
#define END_PARSE_FLAGS() \
CHECK(bit_offset_parse < 31); \
CHECK((flags_parse & ~((1 << bit_offset_parse) - 1)) == 0) << flags_parse << " " << bit_offset_parse;
#define END_PARSE_FLAGS() \
CHECK(bit_offset_parse < 31); \
CHECK((flags_parse & ~((1 << bit_offset_parse) - 1)) == 0) \
<< flags_parse << " " << bit_offset_parse << " " << parser.version();
namespace td {
template <class StorerT>