From ee28a37906e2c285233a8aa315775ee226115eb7 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 12 Oct 2022 15:59:58 +0300 Subject: [PATCH] Minor improvements. --- td/telegram/CallManager.h | 1 + td/telegram/DownloadManager.cpp | 1 + td/telegram/EmojiStatus.cpp | 3 +++ td/telegram/InputInvoice.cpp | 4 ++++ td/telegram/InputInvoice.h | 1 + td/telegram/MessageExtendedMedia.cpp | 3 +++ td/telegram/MessageExtendedMedia.h | 4 ++++ td/telegram/MessageExtendedMedia.hpp | 1 + td/telegram/MessageReaction.cpp | 2 ++ td/telegram/MessagesDb.cpp | 1 + td/telegram/NotificationManager.h | 1 + td/telegram/OrderInfo.h | 1 + td/telegram/Payments.cpp | 3 +++ td/telegram/Premium.cpp | 2 ++ td/telegram/SentEmailCode.cpp | 2 ++ td/telegram/SponsoredMessageManager.cpp | 1 + td/telegram/StickersManager.h | 2 ++ td/telegram/Support.cpp | 2 ++ td/telegram/Td.cpp | 2 ++ td/telegram/ThemeManager.cpp | 1 + td/telegram/WebPagesManager.h | 1 + td/telegram/files/FileData.hpp | 1 + td/telegram/files/FileDb.h | 4 ++-- td/telegram/files/FileDownloader.cpp | 8 ++++---- td/telegram/files/FileDownloader.h | 6 +++--- td/telegram/files/FileLoaderUtils.cpp | 1 + td/telegram/files/FileManager.cpp | 2 -- td/telegram/files/FileManager.h | 1 + tdactor/td/actor/ConcurrentScheduler.cpp | 2 +- tdactor/td/actor/ConcurrentScheduler.h | 2 +- tddb/td/db/TsSeqKeyValue.h | 2 +- tdnet/td/net/HttpChunkedByteFlow.cpp | 6 +++--- tdnet/td/net/HttpChunkedByteFlow.h | 2 +- tdutils/td/utils/GzipByteFlow.cpp | 2 +- tdutils/td/utils/GzipByteFlow.h | 2 +- tdutils/td/utils/HazardPointers.h | 8 ++++---- tdutils/td/utils/SharedObjectPool.h | 4 ++-- tdutils/td/utils/crypto.cpp | 1 + test/link.cpp | 1 + test/secret.cpp | 2 ++ 40 files changed, 70 insertions(+), 26 deletions(-) diff --git a/td/telegram/CallManager.h b/td/telegram/CallManager.h index 3d0f82a84..10d3076be 100644 --- a/td/telegram/CallManager.h +++ b/td/telegram/CallManager.h @@ -10,6 +10,7 @@ #include "td/telegram/CallId.h" #include "td/telegram/td_api.h" #include "td/telegram/telegram_api.h" +#include "td/telegram/UserId.h" #include "td/actor/actor.h" diff --git a/td/telegram/DownloadManager.cpp b/td/telegram/DownloadManager.cpp index 1c4628a2b..864f1838e 100644 --- a/td/telegram/DownloadManager.cpp +++ b/td/telegram/DownloadManager.cpp @@ -24,6 +24,7 @@ #include "td/utils/misc.h" #include "td/utils/Slice.h" #include "td/utils/SliceBuilder.h" +#include "td/utils/Status.h" #include "td/utils/tl_helpers.h" #include diff --git a/td/telegram/EmojiStatus.cpp b/td/telegram/EmojiStatus.cpp index b99da6357..22a8869ff 100644 --- a/td/telegram/EmojiStatus.cpp +++ b/td/telegram/EmojiStatus.cpp @@ -14,8 +14,11 @@ #include "td/utils/algorithm.h" #include "td/utils/buffer.h" +#include "td/utils/logging.h" #include "td/utils/Status.h" +#include + namespace td { struct EmojiStatuses { diff --git a/td/telegram/InputInvoice.cpp b/td/telegram/InputInvoice.cpp index 31d7ee243..f10fb4e31 100644 --- a/td/telegram/InputInvoice.cpp +++ b/td/telegram/InputInvoice.cpp @@ -6,12 +6,16 @@ // #include "td/telegram/InputInvoice.h" +#include "td/telegram/Dimensions.h" #include "td/telegram/files/FileManager.h" +#include "td/telegram/files/FileType.h" #include "td/telegram/misc.h" #include "td/telegram/PhotoSize.h" +#include "td/telegram/ServerMessageId.h" #include "td/telegram/Td.h" #include "td/utils/algorithm.h" +#include "td/utils/buffer.h" #include "td/utils/common.h" #include "td/utils/HttpUrl.h" #include "td/utils/logging.h" diff --git a/td/telegram/InputInvoice.h b/td/telegram/InputInvoice.h index c779e9054..c5f7d0abc 100644 --- a/td/telegram/InputInvoice.h +++ b/td/telegram/InputInvoice.h @@ -6,6 +6,7 @@ // #pragma once +#include "td/telegram/DialogId.h" #include "td/telegram/files/FileId.h" #include "td/telegram/LabeledPricePart.h" #include "td/telegram/MessageExtendedMedia.h" diff --git a/td/telegram/MessageExtendedMedia.cpp b/td/telegram/MessageExtendedMedia.cpp index 84c8108a3..660912a60 100644 --- a/td/telegram/MessageExtendedMedia.cpp +++ b/td/telegram/MessageExtendedMedia.cpp @@ -9,10 +9,13 @@ #include "td/telegram/Document.h" #include "td/telegram/DocumentsManager.h" #include "td/telegram/MessageContent.h" +#include "td/telegram/MessageContentType.h" +#include "td/telegram/PhotoSize.h" #include "td/telegram/Td.h" #include "td/telegram/VideosManager.h" #include "td/utils/algorithm.h" +#include "td/utils/logging.h" namespace td { diff --git a/td/telegram/MessageExtendedMedia.h b/td/telegram/MessageExtendedMedia.h index cbc080bc2..ec90452eb 100644 --- a/td/telegram/MessageExtendedMedia.h +++ b/td/telegram/MessageExtendedMedia.h @@ -6,12 +6,16 @@ // #pragma once +#include "td/telegram/DialogId.h" #include "td/telegram/Dimensions.h" #include "td/telegram/files/FileId.h" #include "td/telegram/MessageEntity.h" #include "td/telegram/Photo.h" +#include "td/telegram/td_api.h" +#include "td/telegram/telegram_api.h" #include "td/utils/common.h" +#include "td/utils/Status.h" namespace td { diff --git a/td/telegram/MessageExtendedMedia.hpp b/td/telegram/MessageExtendedMedia.hpp index ce1eb47d2..72c35dc69 100644 --- a/td/telegram/MessageExtendedMedia.hpp +++ b/td/telegram/MessageExtendedMedia.hpp @@ -11,6 +11,7 @@ #include "td/telegram/Td.h" #include "td/telegram/VideosManager.h" +#include "td/utils/logging.h" #include "td/utils/tl_helpers.h" namespace td { diff --git a/td/telegram/MessageReaction.cpp b/td/telegram/MessageReaction.cpp index bed3741f1..94d795ac7 100644 --- a/td/telegram/MessageReaction.cpp +++ b/td/telegram/MessageReaction.cpp @@ -30,6 +30,8 @@ #include "td/utils/emoji.h" #include "td/utils/FlatHashSet.h" #include "td/utils/logging.h" +#include "td/utils/Slice.h" +#include "td/utils/SliceBuilder.h" #include "td/utils/Status.h" #include "td/utils/utf8.h" diff --git a/td/telegram/MessagesDb.cpp b/td/telegram/MessagesDb.cpp index e079426b3..f8738fcec 100644 --- a/td/telegram/MessagesDb.cpp +++ b/td/telegram/MessagesDb.cpp @@ -7,6 +7,7 @@ #include "td/telegram/MessagesDb.h" #include "td/telegram/logevent/LogEvent.h" +#include "td/telegram/UserId.h" #include "td/telegram/Version.h" #include "td/db/SqliteConnectionSafe.h" diff --git a/td/telegram/NotificationManager.h b/td/telegram/NotificationManager.h index ff307928e..02bdab043 100644 --- a/td/telegram/NotificationManager.h +++ b/td/telegram/NotificationManager.h @@ -19,6 +19,7 @@ #include "td/telegram/NotificationType.h" #include "td/telegram/Photo.h" #include "td/telegram/td_api.h" +#include "td/telegram/UserId.h" #include "td/actor/actor.h" #include "td/actor/MultiTimeout.h" diff --git a/td/telegram/OrderInfo.h b/td/telegram/OrderInfo.h index 0026b1e50..8f840fad9 100644 --- a/td/telegram/OrderInfo.h +++ b/td/telegram/OrderInfo.h @@ -10,6 +10,7 @@ #include "td/telegram/telegram_api.h" #include "td/utils/common.h" +#include "td/utils/Slice.h" #include "td/utils/Status.h" #include "td/utils/StringBuilder.h" diff --git a/td/telegram/Payments.cpp b/td/telegram/Payments.cpp index 1933ae97d..69e9fce24 100644 --- a/td/telegram/Payments.cpp +++ b/td/telegram/Payments.cpp @@ -12,14 +12,17 @@ #include "td/telegram/Global.h" #include "td/telegram/InputInvoice.h" #include "td/telegram/MessageEntity.h" +#include "td/telegram/MessageId.h" #include "td/telegram/MessagesManager.h" #include "td/telegram/misc.h" #include "td/telegram/PasswordManager.h" +#include "td/telegram/Photo.h" #include "td/telegram/ServerMessageId.h" #include "td/telegram/Td.h" #include "td/telegram/telegram_api.h" #include "td/telegram/ThemeManager.h" #include "td/telegram/UpdatesManager.h" +#include "td/telegram/UserId.h" #include "td/utils/algorithm.h" #include "td/utils/buffer.h" diff --git a/td/telegram/Premium.cpp b/td/telegram/Premium.cpp index 4c5c5d716..243cf88d7 100644 --- a/td/telegram/Premium.cpp +++ b/td/telegram/Premium.cpp @@ -15,9 +15,11 @@ #include "td/telegram/Global.h" #include "td/telegram/MessageEntity.h" #include "td/telegram/misc.h" +#include "td/telegram/PremiumGiftOption.h" #include "td/telegram/Td.h" #include "td/telegram/telegram_api.h" #include "td/telegram/UpdatesManager.h" +#include "td/telegram/UserId.h" #include "td/utils/algorithm.h" #include "td/utils/buffer.h" diff --git a/td/telegram/SentEmailCode.cpp b/td/telegram/SentEmailCode.cpp index 04a0e883a..8e3abd303 100644 --- a/td/telegram/SentEmailCode.cpp +++ b/td/telegram/SentEmailCode.cpp @@ -6,6 +6,8 @@ // #include "td/telegram/SentEmailCode.h" +#include "td/utils/logging.h" + namespace td { SentEmailCode::SentEmailCode(telegram_api::object_ptr &&email_code) diff --git a/td/telegram/SponsoredMessageManager.cpp b/td/telegram/SponsoredMessageManager.cpp index 3a1caa343..57b8f3815 100644 --- a/td/telegram/SponsoredMessageManager.cpp +++ b/td/telegram/SponsoredMessageManager.cpp @@ -18,6 +18,7 @@ #include "td/telegram/ServerMessageId.h" #include "td/telegram/Td.h" #include "td/telegram/telegram_api.h" +#include "td/telegram/UserId.h" #include "td/utils/algorithm.h" #include "td/utils/buffer.h" diff --git a/td/telegram/StickersManager.h b/td/telegram/StickersManager.h index f52abb5ee..c9e77e4b3 100644 --- a/td/telegram/StickersManager.h +++ b/td/telegram/StickersManager.h @@ -21,6 +21,7 @@ #include "td/telegram/StickerType.h" #include "td/telegram/td_api.h" #include "td/telegram/telegram_api.h" +#include "td/telegram/UserId.h" #include "td/actor/actor.h" #include "td/actor/MultiPromise.h" @@ -37,6 +38,7 @@ #include "td/utils/WaitFreeHashMap.h" #include "td/utils/WaitFreeHashSet.h" +#include #include #include #include diff --git a/td/telegram/Support.cpp b/td/telegram/Support.cpp index 0d7bc580c..31dea54d2 100644 --- a/td/telegram/Support.cpp +++ b/td/telegram/Support.cpp @@ -7,9 +7,11 @@ #include "td/telegram/Support.h" #include "td/telegram/ContactsManager.h" +#include "td/telegram/DialogId.h" #include "td/telegram/Global.h" #include "td/telegram/MessageEntity.h" #include "td/telegram/Td.h" +#include "td/telegram/telegram_api.h" #include "td/utils/buffer.h" #include "td/utils/Status.h" diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index f318788bd..bb0dbbcf3 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -42,6 +42,7 @@ #include "td/telegram/DocumentsManager.h" #include "td/telegram/DownloadManager.h" #include "td/telegram/DownloadManagerCallback.h" +#include "td/telegram/EmailVerification.h" #include "td/telegram/EmojiStatus.h" #include "td/telegram/FileReferenceManager.h" #include "td/telegram/files/FileGcParameters.h" @@ -121,6 +122,7 @@ #include "td/telegram/TopDialogCategory.h" #include "td/telegram/TopDialogManager.h" #include "td/telegram/UpdatesManager.h" +#include "td/telegram/UserId.h" #include "td/telegram/Version.h" #include "td/telegram/VideoNotesManager.h" #include "td/telegram/VideosManager.h" diff --git a/td/telegram/ThemeManager.cpp b/td/telegram/ThemeManager.cpp index d7aa86317..89ceb3df1 100644 --- a/td/telegram/ThemeManager.cpp +++ b/td/telegram/ThemeManager.cpp @@ -10,6 +10,7 @@ #include "td/telegram/BackgroundManager.h" #include "td/telegram/BackgroundType.hpp" #include "td/telegram/Global.h" +#include "td/telegram/logevent/LogEvent.h" #include "td/telegram/net/NetQueryCreator.h" #include "td/telegram/Td.h" #include "td/telegram/TdDb.h" diff --git a/td/telegram/WebPagesManager.h b/td/telegram/WebPagesManager.h index 5c2d29687..84282d542 100644 --- a/td/telegram/WebPagesManager.h +++ b/td/telegram/WebPagesManager.h @@ -22,6 +22,7 @@ #include "td/utils/FlatHashMap.h" #include "td/utils/FlatHashSet.h" #include "td/utils/Promise.h" +#include "td/utils/Slice.h" #include "td/utils/Status.h" #include "td/utils/WaitFreeHashMap.h" diff --git a/td/telegram/files/FileData.hpp b/td/telegram/files/FileData.hpp index 2c64d3451..5c64fbf90 100644 --- a/td/telegram/files/FileData.hpp +++ b/td/telegram/files/FileData.hpp @@ -17,6 +17,7 @@ #include "td/telegram/Td.h" #include "td/telegram/Version.h" +#include "td/utils/algorithm.h" #include "td/utils/common.h" #include "td/utils/misc.h" #include "td/utils/tl_helpers.h" diff --git a/td/telegram/files/FileDb.h b/td/telegram/files/FileDb.h index de1bf67cb..76813daba 100644 --- a/td/telegram/files/FileDb.h +++ b/td/telegram/files/FileDb.h @@ -38,10 +38,10 @@ class FileDbInterface { FileDbInterface &operator=(const FileDbInterface &) = delete; virtual ~FileDbInterface() = default; - // non thread safe + // non-thread-safe virtual FileDbId create_pmc_id() = 0; - // thread safe + // thread-safe virtual void close(Promise<> promise) = 0; template diff --git a/td/telegram/files/FileDownloader.cpp b/td/telegram/files/FileDownloader.cpp index 967e6dc3e..433c5717b 100644 --- a/td/telegram/files/FileDownloader.cpp +++ b/td/telegram/files/FileDownloader.cpp @@ -33,8 +33,8 @@ namespace td { FileDownloader::FileDownloader(const FullRemoteFileLocation &remote, const LocalFileLocation &local, int64 size, - string name, const FileEncryptionKey &encryption_key, bool is_small, bool search_file, - int64 offset, int64 limit, unique_ptr callback) + string name, const FileEncryptionKey &encryption_key, bool is_small, + bool need_search_file, int64 offset, int64 limit, unique_ptr callback) : remote_(remote) , local_(local) , size_(size) @@ -42,7 +42,7 @@ FileDownloader::FileDownloader(const FullRemoteFileLocation &remote, const Local , encryption_key_(encryption_key) , callback_(std::move(callback)) , is_small_(is_small) - , search_file_(search_file) + , need_search_file_(need_search_file) , offset_(offset) , limit_(limit) { if (encryption_key.is_secret()) { @@ -87,7 +87,7 @@ Result FileDownloader::init() { CHECK((part_size & (part_size - 1)) == 0); } } - if (search_file_ && fd_.empty() && size_ > 0 && encryption_key_.empty() && !remote_.is_web()) { + if (need_search_file_ && fd_.empty() && size_ > 0 && encryption_key_.empty() && !remote_.is_web()) { [&] { TRY_RESULT(path, search_file(remote_.file_type_, name_, size_)); TRY_RESULT(fd, FileFd::open(path, FileFd::Read)); diff --git a/td/telegram/files/FileDownloader.h b/td/telegram/files/FileDownloader.h index 84bd5af28..6d0ef2ada 100644 --- a/td/telegram/files/FileDownloader.h +++ b/td/telegram/files/FileDownloader.h @@ -33,8 +33,8 @@ class FileDownloader final : public FileLoader { }; FileDownloader(const FullRemoteFileLocation &remote, const LocalFileLocation &local, int64 size, string name, - const FileEncryptionKey &encryption_key, bool is_small, bool search_file, int64 offset, int64 limit, - unique_ptr callback); + const FileEncryptionKey &encryption_key, bool is_small, bool need_search_file, int64 offset, + int64 limit, unique_ptr callback); // Should just implement all parent pure virtual methods. // Must not call any of them... @@ -55,7 +55,7 @@ class FileDownloader final : public FileLoader { int32 next_part_ = 0; bool next_part_stop_ = false; bool is_small_; - bool search_file_{false}; + bool need_search_file_{false}; int64 offset_; int64 limit_; diff --git a/td/telegram/files/FileLoaderUtils.cpp b/td/telegram/files/FileLoaderUtils.cpp index c45d4f529..64cd1cf07 100644 --- a/td/telegram/files/FileLoaderUtils.cpp +++ b/td/telegram/files/FileLoaderUtils.cpp @@ -21,6 +21,7 @@ #include "td/utils/Random.h" #include "td/utils/SliceBuilder.h" #include "td/utils/StringBuilder.h" +#include "td/utils/utf8.h" #include diff --git a/td/telegram/files/FileManager.cpp b/td/telegram/files/FileManager.cpp index 0b00ea6ed..42060e766 100644 --- a/td/telegram/files/FileManager.cpp +++ b/td/telegram/files/FileManager.cpp @@ -32,7 +32,6 @@ #include "td/utils/logging.h" #include "td/utils/misc.h" #include "td/utils/PathView.h" -#include "td/utils/port/path.h" #include "td/utils/port/Stat.h" #include "td/utils/ScopeGuard.h" #include "td/utils/SliceBuilder.h" @@ -40,7 +39,6 @@ #include "td/utils/Time.h" #include "td/utils/tl_helpers.h" #include "td/utils/tl_parsers.h" -#include "td/utils/utf8.h" #include #include diff --git a/td/telegram/files/FileManager.h b/td/telegram/files/FileManager.h index 3e3465cda..358b6cfc2 100644 --- a/td/telegram/files/FileManager.h +++ b/td/telegram/files/FileManager.h @@ -11,6 +11,7 @@ #include "td/telegram/files/FileEncryptionKey.h" #include "td/telegram/files/FileGenerateManager.h" #include "td/telegram/files/FileId.h" +#include "td/telegram/files/FileLoaderUtils.h" #include "td/telegram/files/FileLoadManager.h" #include "td/telegram/files/FileLocation.h" #include "td/telegram/files/FileSourceId.h" diff --git a/tdactor/td/actor/ConcurrentScheduler.cpp b/tdactor/td/actor/ConcurrentScheduler.cpp index 108e07e68..ef8b802d3 100644 --- a/tdactor/td/actor/ConcurrentScheduler.cpp +++ b/tdactor/td/actor/ConcurrentScheduler.cpp @@ -70,7 +70,7 @@ void ConcurrentScheduler::test_one_thread_run() { } while (!is_finished_.load(std::memory_order_relaxed)); } -thread::id ConcurrentScheduler::get_thread_id(int32 sched_id) { +thread::id ConcurrentScheduler::get_scheduler_thread_id(int32 sched_id) { auto thread_pos = static_cast(sched_id - 1); CHECK(thread_pos < threads_.size()); return threads_[thread_pos].get_id(); diff --git a/tdactor/td/actor/ConcurrentScheduler.h b/tdactor/td/actor/ConcurrentScheduler.h index 29574d246..8766db733 100644 --- a/tdactor/td/actor/ConcurrentScheduler.h +++ b/tdactor/td/actor/ConcurrentScheduler.h @@ -50,7 +50,7 @@ class ConcurrentScheduler final : private Scheduler::Callback { return is_finished_.load(std::memory_order_relaxed); } - thread::id get_thread_id(int32 sched_id); + thread::id get_scheduler_thread_id(int32 sched_id); void start(); diff --git a/tddb/td/db/TsSeqKeyValue.h b/tddb/td/db/TsSeqKeyValue.h index dca0b03b4..3153a0766 100644 --- a/tddb/td/db/TsSeqKeyValue.h +++ b/tddb/td/db/TsSeqKeyValue.h @@ -68,7 +68,7 @@ class TsSeqKeyValue { return kv_.get_all(); } - // not thread safe method + // non-thread-safe method SeqKeyValue &inner() { return kv_; } diff --git a/tdnet/td/net/HttpChunkedByteFlow.cpp b/tdnet/td/net/HttpChunkedByteFlow.cpp index 95fb850b9..259e1fafb 100644 --- a/tdnet/td/net/HttpChunkedByteFlow.cpp +++ b/tdnet/td/net/HttpChunkedByteFlow.cpp @@ -51,13 +51,13 @@ bool HttpChunkedByteFlow::loop() { return false; } total_size_ += ready; - uncommited_size_ += ready; + uncommitted_size_ += ready; output_.append(input_->cut_head(ready)); result = true; len_ -= ready; - if (uncommited_size_ >= MIN_UPDATE_SIZE) { - uncommited_size_ = 0; + if (uncommitted_size_ >= MIN_UPDATE_SIZE) { + uncommitted_size_ = 0; } if (len_ == 0) { diff --git a/tdnet/td/net/HttpChunkedByteFlow.h b/tdnet/td/net/HttpChunkedByteFlow.h index 4e00fb80c..8e248ebb7 100644 --- a/tdnet/td/net/HttpChunkedByteFlow.h +++ b/tdnet/td/net/HttpChunkedByteFlow.h @@ -25,7 +25,7 @@ class HttpChunkedByteFlow final : public ByteFlowBase { size_t len_ = 0; size_t save_len_ = 0; size_t total_size_ = 0; - size_t uncommited_size_ = 0; + size_t uncommitted_size_ = 0; }; } // namespace td diff --git a/tdutils/td/utils/GzipByteFlow.cpp b/tdutils/td/utils/GzipByteFlow.cpp index bd3e43fee..d321b68cc 100644 --- a/tdutils/td/utils/GzipByteFlow.cpp +++ b/tdutils/td/utils/GzipByteFlow.cpp @@ -35,7 +35,7 @@ bool GzipByteFlow::loop() { auto r_state = gzip_.run(); auto output_size = gzip_.flush_output(); if (output_size) { - uncommited_size_ += output_size; + uncommitted_size_ += output_size; total_output_size_ += output_size; if (total_output_size_ > max_output_size_) { finish(Status::Error("Max output size limit exceeded")); diff --git a/tdutils/td/utils/GzipByteFlow.h b/tdutils/td/utils/GzipByteFlow.h index 5e7ab3333..94a3a3ea5 100644 --- a/tdutils/td/utils/GzipByteFlow.h +++ b/tdutils/td/utils/GzipByteFlow.h @@ -38,7 +38,7 @@ class GzipByteFlow final : public ByteFlowBase { private: Gzip gzip_; - size_t uncommited_size_ = 0; + size_t uncommitted_size_ = 0; size_t total_output_size_ = 0; size_t max_output_size_ = std::numeric_limits::max(); }; diff --git a/tdutils/td/utils/HazardPointers.h b/tdutils/td/utils/HazardPointers.h index ca4227869..3ed41a0c9 100644 --- a/tdutils/td/utils/HazardPointers.h +++ b/tdutils/td/utils/HazardPointers.h @@ -88,8 +88,8 @@ class HazardPointers { size_t to_delete_size_unsafe() const { size_t res = 0; - for (auto &thread : threads_) { - res += thread.to_delete_.size(); + for (auto &thread_data : threads_) { + res += thread_data.to_delete_.size(); } return res; } @@ -122,8 +122,8 @@ class HazardPointers { } bool is_protected(T *ptr) { - for (auto &thread : threads_) { - for (auto &hazard_ptr : thread.hazard_) { + for (auto &thread_data : threads_) { + for (auto &hazard_ptr : thread_data.hazard_) { if (hazard_ptr.load() == ptr) { return true; } diff --git a/tdutils/td/utils/SharedObjectPool.h b/tdutils/td/utils/SharedObjectPool.h index 850c14aa2..6a7dcc825 100644 --- a/tdutils/td/utils/SharedObjectPool.h +++ b/tdutils/td/utils/SharedObjectPool.h @@ -214,7 +214,7 @@ class SharedObjectPool { return free_queue_reader_.calc_size(); } - //non thread safe + // non-thread-safe template void for_each(F &&f) { for (auto &raw : allocated_) { @@ -255,7 +255,7 @@ class SharedObjectPool { Raw *get() const { return raw_; } - explicit operator bool() noexcept { + explicit operator bool() const noexcept { return raw_ != nullptr; } diff --git a/tdutils/td/utils/crypto.cpp b/tdutils/td/utils/crypto.cpp index cca3215f4..4fcda63e4 100644 --- a/tdutils/td/utils/crypto.cpp +++ b/tdutils/td/utils/crypto.cpp @@ -10,6 +10,7 @@ #include "td/utils/BigNum.h" #include "td/utils/bits.h" #include "td/utils/common.h" +#include "td/utils/Destructor.h" #include "td/utils/logging.h" #include "td/utils/misc.h" #include "td/utils/port/RwMutex.h" diff --git a/test/link.cpp b/test/link.cpp index 3e2f6dafd..32ff40077 100644 --- a/test/link.cpp +++ b/test/link.cpp @@ -10,6 +10,7 @@ #include "td/telegram/td_api.h" #include "td/utils/common.h" +#include "td/utils/logging.h" #include "td/utils/misc.h" #include "td/utils/tests.h" diff --git a/test/secret.cpp b/test/secret.cpp index 6e8e5d477..2c79b7e2d 100644 --- a/test/secret.cpp +++ b/test/secret.cpp @@ -7,11 +7,13 @@ #include "td/telegram/EncryptedFile.h" #include "td/telegram/FolderId.h" #include "td/telegram/Global.h" +#include "td/telegram/logevent/LogEvent.h" #include "td/telegram/MessageId.h" #include "td/telegram/secret_api.h" #include "td/telegram/SecretChatActor.h" #include "td/telegram/SecretChatId.h" #include "td/telegram/telegram_api.h" +#include "td/telegram/UserId.h" #include "td/db/binlog/BinlogInterface.h" #include "td/db/binlog/detail/BinlogEventsProcessor.h"