From 4f8cfce082f400ca204d993dea125ccd0090d9a4 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 1 Dec 2021 20:54:56 +0300 Subject: [PATCH] Fix g++4.9 compilation errors. --- td/telegram/FileReferenceManager.cpp | 10 +++++----- td/telegram/FileReferenceManager.h | 10 +++++++--- td/telegram/MessagesDb.h | 4 ++-- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/td/telegram/FileReferenceManager.cpp b/td/telegram/FileReferenceManager.cpp index 90c931d50..cea3a1911 100644 --- a/td/telegram/FileReferenceManager.cpp +++ b/td/telegram/FileReferenceManager.cpp @@ -173,8 +173,8 @@ void FileReferenceManager::merge(NodeId to_node_id, NodeId from_node_id) { auto &from = from_it->second; VLOG(file_references) << "Merge " << to.file_source_ids.size() << " and " << from.file_source_ids.size() << " sources of files " << to_node_id << " and " << from_node_id; - CHECK(!to.query || to.query->proxy.empty()); - CHECK(!from.query || from.query->proxy.empty()); + CHECK(!to.query || to.query->proxy.is_empty()); + CHECK(!from.query || from.query->proxy.is_empty()); if (to.query || from.query) { if (!to.query) { to.query = make_unique(); @@ -183,7 +183,7 @@ void FileReferenceManager::merge(NodeId to_node_id, NodeId from_node_id) { if (from.query) { combine(to.query->promises, std::move(from.query->promises)); to.query->active_queries += from.query->active_queries; - from.query->proxy = {to_node_id, to.query->generation}; + from.query->proxy = Destination(to_node_id, to.query->generation); } } to.file_source_ids.merge(std::move(from.file_source_ids)); @@ -225,7 +225,7 @@ void FileReferenceManager::run_node(NodeId node_id) { return; } auto file_source_id = node.file_source_ids.next(); - send_query({node_id, node.query->generation}, file_source_id); + send_query(Destination(node_id, node.query->generation), file_source_id); } void FileReferenceManager::send_query(Destination dest, FileSourceId file_source_id) { @@ -325,7 +325,7 @@ FileReferenceManager::Destination FileReferenceManager::on_query_result(Destinat query->active_queries--; CHECK(query->active_queries >= 0); - if (!query->proxy.empty()) { + if (!query->proxy.is_empty()) { query->active_queries -= sub; CHECK(query->active_queries >= 0); auto new_proxy = on_query_result(query->proxy, file_source_id, std::move(status), query->active_queries); diff --git a/td/telegram/FileReferenceManager.h b/td/telegram/FileReferenceManager.h index f9129cac3..cadaba933 100644 --- a/td/telegram/FileReferenceManager.h +++ b/td/telegram/FileReferenceManager.h @@ -76,11 +76,15 @@ class FileReferenceManager final : public Actor { private: struct Destination { - bool empty() const { - return node_id.empty(); - } NodeId node_id; int64 generation{0}; + + Destination() = default; + Destination(NodeId node_id, int64 generation) : node_id(node_id), generation(generation) { + } + bool is_empty() const { + return node_id.empty(); + } }; struct Query { std::vector> promises; diff --git a/td/telegram/MessagesDb.h b/td/telegram/MessagesDb.h index f2017db93..af3ffff17 100644 --- a/td/telegram/MessagesDb.h +++ b/td/telegram/MessagesDb.h @@ -66,8 +66,8 @@ struct MessagesDbGetDialogSparseMessagePositionsQuery { }; struct MessagesDbMessagePosition { - int32 position{0}; - int32 date{0}; + int32 position; + int32 date; MessageId message_id; };