diff --git a/benchmark/check_proxy.cpp b/benchmark/check_proxy.cpp index 5f54e850d..686f43d15 100644 --- a/benchmark/check_proxy.cpp +++ b/benchmark/check_proxy.cpp @@ -5,6 +5,7 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #include "td/telegram/Client.h" +#include "td/telegram/td_api.h" #include "td/utils/common.h" #include "td/utils/logging.h" diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 8fecaf881..114d6ea8d 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -1633,7 +1633,7 @@ callStateError error:error = CallState; //@class CallProblem @description Describes a type of a problem that happened during a call -//@description The user heard his own voice +//@description The user heard their own voice callProblemEcho = CallProblem; //@description The user heard background noice diff --git a/td/mtproto/crypto.h b/td/mtproto/crypto.h index 00e82d0b0..042b029b6 100644 --- a/td/mtproto/crypto.h +++ b/td/mtproto/crypto.h @@ -10,7 +10,6 @@ #include "td/utils/common.h" #include "td/utils/Slice.h" #include "td/utils/Status.h" -#include "td/utils/UInt.h" #include diff --git a/td/telegram/ClientJson.cpp b/td/telegram/ClientJson.cpp index 33e541e2b..02b7dd733 100644 --- a/td/telegram/ClientJson.cpp +++ b/td/telegram/ClientJson.cpp @@ -12,11 +12,9 @@ #include "td/tl/tl_json.h" #include "td/utils/common.h" -#include "td/utils/format.h" #include "td/utils/JsonBuilder.h" #include "td/utils/logging.h" #include "td/utils/port/thread_local.h" -#include "td/utils/Status.h" #include diff --git a/td/telegram/FileReferenceManager.h b/td/telegram/FileReferenceManager.h index 53f0e26a9..6a1e7416f 100644 --- a/td/telegram/FileReferenceManager.h +++ b/td/telegram/FileReferenceManager.h @@ -19,6 +19,7 @@ #include "td/telegram/SetWithPosition.h" #include "td/telegram/UserId.h" +#include "td/utils/common.h" #include "td/utils/logging.h" #include "td/utils/Slice.h" #include "td/utils/Status.h" diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index d9cd7ef08..8c91d6723 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -69,6 +69,7 @@ #include "td/utils/misc.h" #include "td/utils/PathView.h" #include "td/utils/tl_helpers.h" +#include "td/utils/utf8.h" #include #include diff --git a/td/telegram/SecureStorage.cpp b/td/telegram/SecureStorage.cpp index cc6a8be6d..18c04de02 100644 --- a/td/telegram/SecureStorage.cpp +++ b/td/telegram/SecureStorage.cpp @@ -11,6 +11,7 @@ #include "td/utils/logging.h" #include "td/utils/misc.h" #include "td/utils/Random.h" +#include "td/utils/SharedSlice.h" namespace td { namespace secure_storage { diff --git a/td/telegram/SendCodeHelper.cpp b/td/telegram/SendCodeHelper.cpp index 7bd1557c3..92d9b10c1 100644 --- a/td/telegram/SendCodeHelper.cpp +++ b/td/telegram/SendCodeHelper.cpp @@ -6,8 +6,6 @@ // #include "td/telegram/SendCodeHelper.h" -#include "td/utils/utf8.h" - namespace td { void SendCodeHelper::on_sent_code(telegram_api::object_ptr sent_code) { diff --git a/td/telegram/StorageManager.cpp b/td/telegram/StorageManager.cpp index fd0976e6d..3840e3a73 100644 --- a/td/telegram/StorageManager.cpp +++ b/td/telegram/StorageManager.cpp @@ -263,20 +263,22 @@ void StorageManager::hangup_shared() { } void StorageManager::close_stats_worker() { - for (auto &promise : pending_storage_stats_) { + auto promises = std::move(pending_storage_stats_); + pending_storage_stats_.clear(); + for (auto &promise : promises) { promise.set_error(Status::Error(500, "Request aborted")); } - pending_storage_stats_.clear(); stats_generation_++; stats_worker_.reset(); stats_cancellation_token_source_.cancel(); } void StorageManager::close_gc_worker() { - for (auto &promise : pending_run_gc_) { + auto promises = std::move(pending_run_gc_); + pending_run_gc_.clear(); + for (auto &promise : promises) { promise.set_error(Status::Error(500, "Request aborted")); } - pending_run_gc_.clear(); gc_generation_++; gc_worker_.reset(); gc_cancellation_token_source_.cancel(); diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index b870ebc51..1067d9f2f 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -61,6 +61,7 @@ #include "td/telegram/Payments.h" #include "td/telegram/PhoneNumberManager.h" #include "td/telegram/Photo.h" +#include "td/telegram/PhotoSizeSource.h" #include "td/telegram/PollManager.h" #include "td/telegram/PrivacyManager.h" #include "td/telegram/RequestActor.h" diff --git a/td/telegram/files/FileDownloader.cpp b/td/telegram/files/FileDownloader.cpp index dd9d84496..574d1d255 100644 --- a/td/telegram/files/FileDownloader.cpp +++ b/td/telegram/files/FileDownloader.cpp @@ -27,7 +27,6 @@ #include "td/utils/port/path.h" #include "td/utils/port/Stat.h" #include "td/utils/ScopeGuard.h" -#include "td/utils/Slice.h" #include "td/utils/UInt.h" #include diff --git a/td/telegram/files/FileManager.h b/td/telegram/files/FileManager.h index be8fa3044..277e1ef29 100644 --- a/td/telegram/files/FileManager.h +++ b/td/telegram/files/FileManager.h @@ -20,6 +20,7 @@ #include "td/telegram/files/FileStats.h" #include "td/telegram/files/FileType.h" #include "td/telegram/Location.h" +#include "td/telegram/PhotoSizeSource.h" #include "td/actor/actor.h" #include "td/actor/PromiseFuture.h" diff --git a/td/telegram/logevent/LogEventHelper.h b/td/telegram/logevent/LogEventHelper.h index 4e0adc9e6..f286f7b69 100644 --- a/td/telegram/logevent/LogEventHelper.h +++ b/td/telegram/logevent/LogEventHelper.h @@ -15,6 +15,8 @@ #include "td/utils/common.h" #include "td/utils/Status.h" +#include "td/utils/Time.h" +#include "td/utils/tl_helpers.h" namespace td { diff --git a/tdactor/test/actors_main.cpp b/tdactor/test/actors_main.cpp index 269c8555c..976adf441 100644 --- a/tdactor/test/actors_main.cpp +++ b/tdactor/test/actors_main.cpp @@ -12,9 +12,11 @@ #include "td/utils/common.h" #include "td/utils/logging.h" #include "td/utils/Random.h" +#include "td/utils/ScopeGuard.h" #include #include +#include #include using namespace td; @@ -493,7 +495,7 @@ class WithXContext : public Actor { } }; -void check_context() { +static void check_context() { auto ptr = static_cast(Scheduler::context()); CHECK(ptr); ptr->validate(); diff --git a/tdutils/td/utils/SharedSlice.h b/tdutils/td/utils/SharedSlice.h index 67e806e81..0b140fd72 100644 --- a/tdutils/td/utils/SharedSlice.h +++ b/tdutils/td/utils/SharedSlice.h @@ -6,10 +6,13 @@ // #pragma once +#include "td/utils/common.h" #include "td/utils/Slice.h" #include #include +#include +#include namespace td { @@ -134,7 +137,7 @@ class UnsafeSharedSlice { return reinterpret_cast(ptr_.get()); } - struct Destructor { + struct SharedSliceDestructor { void operator()(char *ptr) { auto header = reinterpret_cast(ptr); if (header->dec()) { @@ -146,7 +149,7 @@ class UnsafeSharedSlice { } }; - std::unique_ptr ptr_; + std::unique_ptr ptr_; }; } // namespace detail diff --git a/tdutils/td/utils/ThreadLocalStorage.h b/tdutils/td/utils/ThreadLocalStorage.h index 9f3933d1d..fa092a5b5 100644 --- a/tdutils/td/utils/ThreadLocalStorage.h +++ b/tdutils/td/utils/ThreadLocalStorage.h @@ -6,6 +6,7 @@ // #pragma once +#include "td/utils/common.h" #include "td/utils/port/thread_local.h" #include @@ -16,19 +17,19 @@ namespace td { template class ThreadLocalStorage { public: - T& get() { + T &get() { return thread_local_node().value; } template - void for_each(F&& f) { + void for_each(F &&f) { int32 n = max_thread_id_.load(); for (int32 i = 0; i < n; i++) { f(nodes_[i].value); } } template - void for_each(F&& f) const { + void for_each(F &&f) const { int32 n = max_thread_id_.load(); for (int32 i = 0; i < n; i++) { f(nodes_[i].value); @@ -44,7 +45,7 @@ class ThreadLocalStorage { std::atomic max_thread_id_{MAX_THREAD_ID}; std::array nodes_; - Node& thread_local_node() { + Node &thread_local_node() { auto thread_id = get_thread_id(); CHECK(0 <= thread_id && static_cast(thread_id) < nodes_.size()); return nodes_[thread_id]; diff --git a/tdutils/td/utils/ThreadSafeCounter.h b/tdutils/td/utils/ThreadSafeCounter.h index 7df693988..e9e22f06b 100644 --- a/tdutils/td/utils/ThreadSafeCounter.h +++ b/tdutils/td/utils/ThreadSafeCounter.h @@ -6,10 +6,13 @@ // #pragma once +#include "td/utils/common.h" +#include "td/utils/Slice.h" #include "td/utils/StringBuilder.h" #include "td/utils/ThreadLocalStorage.h" #include +#include #include namespace td { diff --git a/tdutils/td/utils/TsFileLog.cpp b/tdutils/td/utils/TsFileLog.cpp index d5cf7e1c1..b8ff11f69 100644 --- a/tdutils/td/utils/TsFileLog.cpp +++ b/tdutils/td/utils/TsFileLog.cpp @@ -6,9 +6,14 @@ // #include "td/utils/TsFileLog.h" +#include "td/utils/common.h" +#include "td/utils/FileLog.h" #include "td/utils/logging.h" +#include "td/utils/port/thread_local.h" +#include "td/utils/Slice.h" #include +#include namespace td { diff --git a/tdutils/td/utils/TsFileLog.h b/tdutils/td/utils/TsFileLog.h index bc0e2f4b9..54f0ebe36 100644 --- a/tdutils/td/utils/TsFileLog.h +++ b/tdutils/td/utils/TsFileLog.h @@ -7,7 +7,6 @@ #pragma once #include "td/utils/common.h" -#include "td/utils/FileLog.h" #include "td/utils/logging.h" #include "td/utils/Status.h" diff --git a/tdutils/td/utils/UInt.h b/tdutils/td/utils/UInt.h index 60160df31..df66e2808 100644 --- a/tdutils/td/utils/UInt.h +++ b/tdutils/td/utils/UInt.h @@ -9,8 +9,6 @@ #include "td/utils/common.h" #include "td/utils/Slice.h" -#include - namespace td { template @@ -57,8 +55,8 @@ bool operator!=(const UInt &a, const UInt &b) { } template -td::UInt operator^(const UInt &a, const UInt &b) { - td::UInt res; +UInt operator^(const UInt &a, const UInt &b) { + UInt res; for (size_t i = 0; i < size / 8; i++) { res.raw[i] = static_cast(a.raw[i] ^ b.raw[i]); } diff --git a/tdutils/td/utils/base64.cpp b/tdutils/td/utils/base64.cpp index b52a10d82..12ca5fcd3 100644 --- a/tdutils/td/utils/base64.cpp +++ b/tdutils/td/utils/base64.cpp @@ -7,7 +7,6 @@ #include "td/utils/base64.h" #include "td/utils/common.h" -#include "td/utils/format.h" #include "td/utils/Slice.h" #include "td/utils/Status.h" diff --git a/tdutils/test/SharedSlice.cpp b/tdutils/test/SharedSlice.cpp index d7678373f..e303eda71 100644 --- a/tdutils/test/SharedSlice.cpp +++ b/tdutils/test/SharedSlice.cpp @@ -4,6 +4,8 @@ // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // +#include "td/utils/common.h" +#include "td/utils/port/thread.h" #include "td/utils/SharedSlice.h" #include "td/utils/tests.h" diff --git a/tdutils/test/log.cpp b/tdutils/test/log.cpp index 2836761a7..ac26b81a7 100644 --- a/tdutils/test/log.cpp +++ b/tdutils/test/log.cpp @@ -6,11 +6,17 @@ // #include "td/utils/benchmark.h" #include "td/utils/FileLog.h" +#include "td/utils/format.h" #include "td/utils/logging.h" #include "td/utils/port/path.h" +#include "td/utils/port/thread.h" +#include "td/utils/Slice.h" #include "td/utils/tests.h" #include "td/utils/TsFileLog.h" +#include +#include + // Thread safe logging with tests // // LOG uses thread local LogInterface @@ -60,7 +66,7 @@ class LogBenchmark : public td::Benchmark { }; template -void bench_log(std::string name, int threads_n, F &&f) { +static void bench_log(std::string name, int threads_n, F &&f) { bench(LogBenchmark(std::move(name), threads_n, std::move(f))); }; diff --git a/tdutils/test/port.cpp b/tdutils/test/port.cpp index f467daa97..a051ab8c2 100644 --- a/tdutils/test/port.cpp +++ b/tdutils/test/port.cpp @@ -16,6 +16,8 @@ #include "td/utils/Slice.h" #include "td/utils/tests.h" +#include + using namespace td; TEST(Port, files) {