Minor improvements.

GitOrigin-RevId: 157e77d244b24f3c5af56539d434096f7440e2e8
This commit is contained in:
levlam 2019-09-05 18:32:45 +03:00
parent 2fa2e966c9
commit 6cbc02ed1b
8 changed files with 10 additions and 8 deletions

View File

@ -506,6 +506,7 @@ ActorId<SecretChatActor> SecretChatsManager::create_chat_actor_impl(int32 id, bo
return it_flag.first->second.get(); return it_flag.first->second.get();
} }
} }
void SecretChatsManager::on_qts_ack(PtsManager::PtsId qts_ack_token) { void SecretChatsManager::on_qts_ack(PtsManager::PtsId qts_ack_token) {
auto old_qts = qts_manager_.db_pts(); auto old_qts = qts_manager_.db_pts();
auto new_qts = qts_manager_.finish(qts_ack_token); auto new_qts = qts_manager_.finish(qts_ack_token);

View File

@ -88,7 +88,7 @@ inline Status from_json(int32 &to, JsonValue &from) {
inline Status from_json(bool &to, JsonValue &from) { inline Status from_json(bool &to, JsonValue &from) {
if (from.type() != JsonValue::Type::Boolean) { if (from.type() != JsonValue::Type::Boolean) {
int32 x; int32 x = 0;
auto status = from_json(x, from); auto status = from_json(x, from);
if (status.is_ok()) { if (status.is_ok()) {
to = x != 0; to = x != 0;

View File

@ -486,7 +486,7 @@ class XContext : public ActorContext {
class WithXContext : public Actor { class WithXContext : public Actor {
public: public:
void start_up() override { void start_up() override {
set_context(std::make_shared<XContext>()); auto old_context = set_context(std::make_shared<XContext>());
} }
void f(unique_ptr<Guard> guard) { void f(unique_ptr<Guard> guard) {
} }

View File

@ -109,7 +109,7 @@ class ConcurrentHashMap {
ConcurrentHashMap(ConcurrentHashMap &&) = delete; ConcurrentHashMap(ConcurrentHashMap &&) = delete;
ConcurrentHashMap &operator=(ConcurrentHashMap &&) = delete; ConcurrentHashMap &operator=(ConcurrentHashMap &&) = delete;
~ConcurrentHashMap() { ~ConcurrentHashMap() {
unique_ptr<HashMap>(hash_map_.load()); unique_ptr<HashMap>(hash_map_.load()).reset();
} }
static std::string get_name() { static std::string get_name() {

View File

@ -156,7 +156,8 @@ class TlParser {
data += sizeof(int32); data += sizeof(int32);
} else { } else {
check_len(sizeof(int32)); 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<uint64>(data[1]) + (static_cast<uint64>(data[2]) << 8) +
(static_cast<uint64>(data[3]) << 16) + (static_cast<uint64>(data[4]) << 24) +
(static_cast<uint64>(data[5]) << 32) + (static_cast<uint64>(data[6]) << 40) + (static_cast<uint64>(data[5]) << 32) + (static_cast<uint64>(data[6]) << 40) +
(static_cast<uint64>(data[7]) << 48); (static_cast<uint64>(data[7]) << 48);
if (result_len_uint64 > std::numeric_limits<size_t>::max() - 3) { if (result_len_uint64 > std::numeric_limits<size_t>::max() - 3) {

View File

@ -76,7 +76,7 @@ TEST(Log, TsLogger) {
class FileLog : public td::LogInterface { class FileLog : public td::LogInterface {
public: public:
FileLog() { FileLog() {
file_log_.init("tmplog", std::numeric_limits<td::int64>::max(), false); file_log_.init("tmplog", std::numeric_limits<td::int64>::max(), false).ensure();
ts_log_.init(&file_log_); ts_log_.init(&file_log_);
} }
~FileLog() { ~FileLog() {
@ -108,7 +108,7 @@ TEST(Log, TsLogger) {
class FileLog : public td::LogInterface { class FileLog : public td::LogInterface {
public: public:
FileLog() { FileLog() {
file_log_.init("tmplog", std::numeric_limits<td::int64>::max(), false); file_log_.init("tmplog", std::numeric_limits<td::int64>::max(), false).ensure();
} }
~FileLog() { ~FileLog() {
} }

View File

@ -757,7 +757,7 @@ class Master : public Actor {
return get_by_id(3 - get_link_token()); return get_by_id(3 - get_link_token());
} }
void start_up() override { void start_up() override {
set_context(std::make_shared<Global>()); auto old_context = set_context(std::make_shared<Global>());
alice_ = create_actor<SecretChatProxy>("SecretChatProxy alice", "alice", actor_shared(this, 1)); alice_ = create_actor<SecretChatProxy>("SecretChatProxy alice", "alice", actor_shared(this, 1));
bob_ = create_actor<SecretChatProxy>("SecretChatProxy bob", "bob", actor_shared(this, 2)); bob_ = create_actor<SecretChatProxy>("SecretChatProxy bob", "bob", actor_shared(this, 2));
send_closure(alice_->get_actor_unsafe()->actor_, &SecretChatActor::create_chat, 2, 0, 123, send_closure(alice_->get_actor_unsafe()->actor_, &SecretChatActor::create_chat, 2, 0, 123,

View File

@ -142,7 +142,7 @@ class TestClient : public Actor {
void start_up() override { void start_up() override {
rmrf(name_).ignore(); rmrf(name_).ignore();
set_context(std::make_shared<td::ActorContext>()); auto old_context = set_context(std::make_shared<td::ActorContext>());
set_tag(name_); set_tag(name_);
LOG(INFO) << "START UP!"; LOG(INFO) << "START UP!";