From 6cbc02ed1b19d9651023a054d17125f752f6d56d Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 5 Sep 2019 18:32:45 +0300 Subject: [PATCH] Minor improvements. GitOrigin-RevId: 157e77d244b24f3c5af56539d434096f7440e2e8 --- td/telegram/SecretChatsManager.cpp | 1 + td/tl/tl_json.h | 2 +- tdactor/test/actors_main.cpp | 2 +- tdutils/td/utils/ConcurrentHashTable.h | 2 +- tdutils/td/utils/tl_parsers.h | 3 ++- tdutils/test/log.cpp | 4 ++-- test/secret.cpp | 2 +- test/tdclient.cpp | 2 +- 8 files changed, 10 insertions(+), 8 deletions(-) diff --git a/td/telegram/SecretChatsManager.cpp b/td/telegram/SecretChatsManager.cpp index 19ba726e7..9e4036827 100644 --- a/td/telegram/SecretChatsManager.cpp +++ b/td/telegram/SecretChatsManager.cpp @@ -506,6 +506,7 @@ ActorId SecretChatsManager::create_chat_actor_impl(int32 id, bo return it_flag.first->second.get(); } } + void SecretChatsManager::on_qts_ack(PtsManager::PtsId qts_ack_token) { auto old_qts = qts_manager_.db_pts(); auto new_qts = qts_manager_.finish(qts_ack_token); diff --git a/td/tl/tl_json.h b/td/tl/tl_json.h index a90634da3..1ff559a32 100644 --- a/td/tl/tl_json.h +++ b/td/tl/tl_json.h @@ -88,7 +88,7 @@ inline Status from_json(int32 &to, JsonValue &from) { inline Status from_json(bool &to, JsonValue &from) { if (from.type() != JsonValue::Type::Boolean) { - int32 x; + int32 x = 0; auto status = from_json(x, from); if (status.is_ok()) { to = x != 0; diff --git a/tdactor/test/actors_main.cpp b/tdactor/test/actors_main.cpp index 976adf441..5ba3b1987 100644 --- a/tdactor/test/actors_main.cpp +++ b/tdactor/test/actors_main.cpp @@ -486,7 +486,7 @@ class XContext : public ActorContext { class WithXContext : public Actor { public: void start_up() override { - set_context(std::make_shared()); + auto old_context = set_context(std::make_shared()); } void f(unique_ptr guard) { } diff --git a/tdutils/td/utils/ConcurrentHashTable.h b/tdutils/td/utils/ConcurrentHashTable.h index 96a16ed5d..14db1d1e3 100644 --- a/tdutils/td/utils/ConcurrentHashTable.h +++ b/tdutils/td/utils/ConcurrentHashTable.h @@ -109,7 +109,7 @@ class ConcurrentHashMap { ConcurrentHashMap(ConcurrentHashMap &&) = delete; ConcurrentHashMap &operator=(ConcurrentHashMap &&) = delete; ~ConcurrentHashMap() { - unique_ptr(hash_map_.load()); + unique_ptr(hash_map_.load()).reset(); } static std::string get_name() { diff --git a/tdutils/td/utils/tl_parsers.h b/tdutils/td/utils/tl_parsers.h index 1a6722259..e730e26ec 100644 --- a/tdutils/td/utils/tl_parsers.h +++ b/tdutils/td/utils/tl_parsers.h @@ -156,7 +156,8 @@ class TlParser { data += sizeof(int32); } else { check_len(sizeof(int32)); - auto result_len_uint64 = data[1] + (data[2] << 8) + (data[3] << 16) + (data[4] << 24) + + auto result_len_uint64 = static_cast(data[1]) + (static_cast(data[2]) << 8) + + (static_cast(data[3]) << 16) + (static_cast(data[4]) << 24) + (static_cast(data[5]) << 32) + (static_cast(data[6]) << 40) + (static_cast(data[7]) << 48); if (result_len_uint64 > std::numeric_limits::max() - 3) { diff --git a/tdutils/test/log.cpp b/tdutils/test/log.cpp index ac26b81a7..4d2762218 100644 --- a/tdutils/test/log.cpp +++ b/tdutils/test/log.cpp @@ -76,7 +76,7 @@ TEST(Log, TsLogger) { class FileLog : public td::LogInterface { public: FileLog() { - file_log_.init("tmplog", std::numeric_limits::max(), false); + file_log_.init("tmplog", std::numeric_limits::max(), false).ensure(); ts_log_.init(&file_log_); } ~FileLog() { @@ -108,7 +108,7 @@ TEST(Log, TsLogger) { class FileLog : public td::LogInterface { public: FileLog() { - file_log_.init("tmplog", std::numeric_limits::max(), false); + file_log_.init("tmplog", std::numeric_limits::max(), false).ensure(); } ~FileLog() { } diff --git a/test/secret.cpp b/test/secret.cpp index cab74359f..aa8c10750 100644 --- a/test/secret.cpp +++ b/test/secret.cpp @@ -757,7 +757,7 @@ class Master : public Actor { return get_by_id(3 - get_link_token()); } void start_up() override { - set_context(std::make_shared()); + auto old_context = set_context(std::make_shared()); alice_ = create_actor("SecretChatProxy alice", "alice", actor_shared(this, 1)); bob_ = create_actor("SecretChatProxy bob", "bob", actor_shared(this, 2)); send_closure(alice_->get_actor_unsafe()->actor_, &SecretChatActor::create_chat, 2, 0, 123, diff --git a/test/tdclient.cpp b/test/tdclient.cpp index caf8242a3..d88d4a265 100644 --- a/test/tdclient.cpp +++ b/test/tdclient.cpp @@ -142,7 +142,7 @@ class TestClient : public Actor { void start_up() override { rmrf(name_).ignore(); - set_context(std::make_shared()); + auto old_context = set_context(std::make_shared()); set_tag(name_); LOG(INFO) << "START UP!";