From ad8f0c4146cb8ce77357c6f0174ff3b5508ee1da Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 16 Jan 2023 12:59:43 +0300 Subject: [PATCH] Improve some spelling. --- td/generate/scheme/td_api.tl | 4 ++-- td/generate/tl_writer_c.h | 1 - td/telegram/BackgroundManager.h | 2 +- td/telegram/Client.h | 2 +- td/telegram/ContactsManager.h | 2 +- td/telegram/MessageDb.cpp | 2 +- td/telegram/MessagesManager.cpp | 2 +- td/telegram/MessagesManager.h | 2 +- td/telegram/StickersManager.cpp | 2 +- td/telegram/StickersManager.h | 5 +++-- tdactor/td/actor/impl/ActorInfo.h | 4 ++-- tdutils/td/utils/Container.h | 2 +- tdutils/td/utils/logging.cpp | 2 +- tdutils/td/utils/port/UdpSocketFd.cpp | 6 +++--- tdutils/test/heap.cpp | 13 +++++++++---- 15 files changed, 28 insertions(+), 23 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 3980ebfdc..03b635316 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -1433,7 +1433,7 @@ replyMarkupInlineKeyboard rows:vector> = ReplyMarku //@class LoginUrlInfo @description Contains information about an inline button of type inlineKeyboardButtonTypeLoginUrl -//@description An HTTP url needs to be open @url The URL to open @skip_confirm True, if there is no need to show an ordinary open URL confirm +//@description An HTTP URL needs to be open @url The URL to open @skip_confirm True, if there is no need to show an ordinary open URL confirm loginUrlInfoOpen url:string skip_confirm:Bool = LoginUrlInfo; //@description An authorization confirmation dialog needs to be shown to the user @@ -2978,7 +2978,7 @@ groupCallStream channel_id:int32 scale:int32 time_offset:int53 = GroupCallStream //@description Represents a list of group call streams @streams A list of group call streams groupCallStreams streams:vector = GroupCallStreams; -//@description Represents an RTMP url @url The URL @stream_key Stream key +//@description Represents an RTMP URL @url The URL @stream_key Stream key rtmpUrl url:string stream_key:string = RtmpUrl; diff --git a/td/generate/tl_writer_c.h b/td/generate/tl_writer_c.h index 4311cf5e1..41bb38b5d 100644 --- a/td/generate/tl_writer_c.h +++ b/td/generate/tl_writer_c.h @@ -1019,7 +1019,6 @@ class TlWriterCCommon final : public tl::TL_writer { if (is_proxy || is_header_ != 1) { return ""; } - // return "#define CODE_" + class_name + " " + int_to_string(id) + "\n"; return ""; } diff --git a/td/telegram/BackgroundManager.h b/td/telegram/BackgroundManager.h index f623d4f91..f7d711214 100644 --- a/td/telegram/BackgroundManager.h +++ b/td/telegram/BackgroundManager.h @@ -160,7 +160,7 @@ class BackgroundManager final : public Actor { FlatHashMap, BackgroundIdHash> backgrounds_; FlatHashMap, BackgroundIdHash> - background_id_to_file_source_id_; // id -> [access_hash, file_source_id] + background_id_to_file_source_id_; // background_id -> [access_hash, file_source_id] FlatHashMap name_to_background_id_; diff --git a/td/telegram/Client.h b/td/telegram/Client.h index 86ec2b205..2f2165ebf 100644 --- a/td/telegram/Client.h +++ b/td/telegram/Client.h @@ -199,7 +199,7 @@ class ClientManager final { * if (response.id == 0) { * // process response.object as an incoming update of type td_api::Update * } else { - * // process response.object as an answer to a sent request with id response.id + * // process response.object as an answer to a sent request with identifier response.id * } * } * \endcode diff --git a/td/telegram/ContactsManager.h b/td/telegram/ContactsManager.h index fd2daca22..18c1dd36e 100644 --- a/td/telegram/ContactsManager.h +++ b/td/telegram/ContactsManager.h @@ -725,7 +725,7 @@ class ContactsManager final : public Actor { FlatHashSet photo_ids; - FlatHashMap online_member_dialogs; // id -> time + FlatHashMap online_member_dialogs; // dialog_id -> time static constexpr uint32 CACHE_VERSION = 4; uint32 cache_version = 0; diff --git a/td/telegram/MessageDb.cpp b/td/telegram/MessageDb.cpp index f1e53bb9a..7b11fcc91 100644 --- a/td/telegram/MessageDb.cpp +++ b/td/telegram/MessageDb.cpp @@ -565,7 +565,7 @@ class MessageDbImpl final : public MessageDbSyncInterface { prev_found_message_id = message_id; } - // left_message_id is always an id of suitable message, let's return it + // left_message_id is always an identifier of suitable message, let's return it return get_message({dialog_id, MessageId(left_message_id)}); } } diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index a1e740229..586c522b8 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -25826,7 +25826,7 @@ MessageId MessagesManager::get_persistent_message_id(const Dialog *d, MessageId return MessageId(); } if (message_id.is_yet_unsent()) { - // it is possible that user tries to do something with an already sent message by its temporary id + // it is possible that user tries to do something with an already sent message by its temporary identifier // we need to use real message in this case and transparently replace message_id auto it = d->yet_unsent_message_id_to_persistent_message_id.find(message_id); if (it != d->yet_unsent_message_id_to_persistent_message_id.end()) { diff --git a/td/telegram/MessagesManager.h b/td/telegram/MessagesManager.h index 99807e730..cc094862b 100644 --- a/td/telegram/MessagesManager.h +++ b/td/telegram/MessagesManager.h @@ -1599,7 +1599,7 @@ class MessagesManager final : public Actor { protected: MessagesIteratorBase() = default; - // points iterator to message with greatest id which is less or equal than message_id + // points iterator to message with greatest identifier which is less or equal than message_id MessagesIteratorBase(const Message *root, MessageId message_id) { size_t last_right_pos = 0; while (root != nullptr) { diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp index cff6562a0..c404e1bb3 100644 --- a/td/telegram/StickersManager.cpp +++ b/td/telegram/StickersManager.cpp @@ -3174,7 +3174,7 @@ StickerSetId StickersManager::on_get_input_sticker_set(FileId sticker_file_id, })); } // always return empty StickerSetId, because we can't trust the set_id provided by the peer in the secret chat - // the real sticker set id will be set in on_get_sticker if and only if the sticker is really from the set + // the real sticker set identifier will be set in on_get_sticker if and only if the sticker is really from the set return StickerSetId(); } case telegram_api::inputStickerSetAnimatedEmoji::ID: diff --git a/td/telegram/StickersManager.h b/td/telegram/StickersManager.h index 908bd543a..160dcaaee 100644 --- a/td/telegram/StickersManager.h +++ b/td/telegram/StickersManager.h @@ -967,8 +967,9 @@ class StickersManager final : public Actor { bool is_inited_ = false; - WaitFreeHashMap, FileIdHash> stickers_; // file_id -> Sticker - WaitFreeHashMap, StickerSetIdHash> sticker_sets_; // id -> StickerSet + WaitFreeHashMap, FileIdHash> stickers_; // file_id -> Sticker + WaitFreeHashMap, StickerSetIdHash> + sticker_sets_; // sticker_set_id -> StickerSet WaitFreeHashMap short_name_to_sticker_set_id_; vector installed_sticker_set_ids_[MAX_STICKER_TYPE]; diff --git a/tdactor/td/actor/impl/ActorInfo.h b/tdactor/td/actor/impl/ActorInfo.h index f734f4c0b..0bb85e728 100644 --- a/tdactor/td/actor/impl/ActorInfo.h +++ b/tdactor/td/actor/impl/ActorInfo.h @@ -69,8 +69,8 @@ inline void ActorInfo::clear() { CHECK(!actor_); CHECK(!is_running()); CHECK(!is_migrating()); - // NB: must be in non migrating state - // store invalid scheduler id. + // NB: must be in non-migrating state + // store invalid scheduler identifier sched_id_.store((1 << 30) - 1, std::memory_order_relaxed); VLOG(actor) << "Clear context " << context_.get() << " for " << get_name(); context_.reset(); diff --git a/tdutils/td/utils/Container.h b/tdutils/td/utils/Container.h index a3d62c7c4..5f1e0920e 100644 --- a/tdutils/td/utils/Container.h +++ b/tdutils/td/utils/Container.h @@ -155,7 +155,7 @@ class Container { void release(int32 id) { inc_generation(id); slots_[id].data = DataT(); - if (slots_[id].generation & ~TYPE_MASK) { // generation overflow. Can't use this id anymore + if (slots_[id].generation & ~TYPE_MASK) { // generation overflow. Can't use this identifier anymore empty_slots_.push_back(id); } } diff --git a/tdutils/td/utils/logging.cpp b/tdutils/td/utils/logging.cpp index a59589b26..cf73f5dfb 100644 --- a/tdutils/td/utils/logging.cpp +++ b/tdutils/td/utils/logging.cpp @@ -80,7 +80,7 @@ Logger::Logger(LogInterface &log, const LogOptions &options, int log_level, Slic } sb_ << ']'; - // thread id + // thread identifier auto thread_id = get_thread_id(); sb_ << "[t"; if (static_cast(thread_id) < 10) { diff --git a/tdutils/td/utils/port/UdpSocketFd.cpp b/tdutils/td/utils/port/UdpSocketFd.cpp index 3c94e7021..e5db2c2fb 100644 --- a/tdutils/td/utils/port/UdpSocketFd.cpp +++ b/tdutils/td/utils/port/UdpSocketFd.cpp @@ -600,12 +600,12 @@ class UdpSocketFdImpl { case EBADF: // impossible case ENOTSOCK: // impossible - case EPIPE: // impossible for udp - case ECONNRESET: // impossible for udp + case EPIPE: // impossible for UDP + case ECONNRESET: // impossible for UDP case EDESTADDRREQ: // we checked that address is valid case ENOTCONN: // we checked that address is valid case EINTR: // we already skipped all EINTR - case EISCONN: // impossible for udp socket + case EISCONN: // impossible for UDP socket case EOPNOTSUPP: case ENOTDIR: case EFAULT: diff --git a/tdutils/test/heap.cpp b/tdutils/test/heap.cpp index bc317152d..43072fb97 100644 --- a/tdutils/test/heap.cpp +++ b/tdutils/test/heap.cpp @@ -46,10 +46,12 @@ class CheckedHeap { nodes[i].value = i; } } + static void xx(int key, const td::HeapNode *heap_node) { const Node *node = static_cast(heap_node); std::fprintf(stderr, "(%d;%d)", node->key, node->value); } + void check() const { for (auto p : set_heap) { std::fprintf(stderr, "(%d;%d)", p.first, p.second); @@ -59,13 +61,16 @@ class CheckedHeap { std::fprintf(stderr, "\n"); kheap.check(); } + int random_id() const { CHECK(!empty()); return ids[td::Random::fast(0, static_cast(ids.size() - 1))]; } + std::size_t size() const { return ids.size(); } + bool empty() const { return ids.empty(); } @@ -77,8 +82,8 @@ class CheckedHeap { ASSERT_EQ(res, kheap.top_key()); return res; } + int insert(int key) { - // std::fprintf(stderr, "insert %d\n", key); int id; if (free_ids.empty()) { UNREACHABLE(); @@ -96,15 +101,15 @@ class CheckedHeap { set_heap.emplace(key, id); return id; } + void fix_key(int new_key, int id) { - // std::fprintf(stderr, "fix key %d %d (old_key = %d)\n", new_key, id, nodes[id].key); set_heap.erase(std::make_pair(nodes[id].key, id)); nodes[id].key = new_key; kheap.fix(new_key, &nodes[id]); set_heap.emplace(new_key, id); } + void erase(int id) { - // std::fprintf(stderr, "erase %d\n", id); int pos = rev_ids[id]; CHECK(pos != -1); ids[pos] = ids.back(); @@ -116,8 +121,8 @@ class CheckedHeap { kheap.erase(&nodes[id]); set_heap.erase(std::make_pair(nodes[id].key, id)); } + void pop() { - // std::fprintf(stderr, "pop\n"); CHECK(!empty()); Node *node = static_cast(kheap.pop()); int id = node->value;