From d5445065e639fa673b86933062650d671eb419a2 Mon Sep 17 00:00:00 2001 From: AYMEN <53928879+AYMENJD@users.noreply.github.com> Date: Thu, 5 Dec 2024 15:41:30 +0300 Subject: [PATCH] Minor improvements. (#3169) --- CMake/GetGitRevisionDescription.cmake | 2 +- CMake/iOS.cmake | 2 +- benchmark/check_tls.cpp | 2 +- example/web/tdweb/src/worker.js | 2 +- memprof/memprof.cpp | 2 +- td/mtproto/SessionConnection.cpp | 2 +- td/telegram/AuthManager.h | 2 +- td/telegram/BusinessConnectedBot.cpp | 2 +- td/telegram/GroupCallManager.cpp | 2 +- td/telegram/GroupCallParticipant.cpp | 2 +- td/telegram/MessageEntity.cpp | 2 +- td/telegram/MessagesManager.cpp | 12 ++++++------ td/telegram/MessagesManager.h | 2 +- td/telegram/NotificationSettingsManager.cpp | 2 +- td/telegram/SecretChatActor.cpp | 2 +- td/telegram/SecretChatActor.h | 2 +- td/telegram/Td.cpp | 2 +- td/telegram/files/FileDownloader.cpp | 4 ++-- td/telegram/files/FileManager.cpp | 4 ++-- tdactor/td/actor/impl/Event.h | 2 +- tdutils/td/utils/HazardPointers.h | 2 +- tdutils/td/utils/MpmcWaiter.h | 2 +- tdutils/td/utils/port/thread_local.cpp | 2 +- 23 files changed, 30 insertions(+), 30 deletions(-) diff --git a/CMake/GetGitRevisionDescription.cmake b/CMake/GetGitRevisionDescription.cmake index 724d07821674..746c29d583cd 100644 --- a/CMake/GetGitRevisionDescription.cmake +++ b/CMake/GetGitRevisionDescription.cmake @@ -35,7 +35,7 @@ get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) # function returns an empty string via _git_dir_var. # # Example: Given a path C:/bla/foo/bar and assuming C:/bla/.git exists and -# neither foo nor bar contain a file/directory .git. This wil return +# neither foo nor bar contain a file/directory .git. This will return # C:/bla/.git # function(_git_find_closest_git_dir _start_dir _git_dir_var) diff --git a/CMake/iOS.cmake b/CMake/iOS.cmake index 4ef76bd0f6d6..0bdbe7505ae6 100644 --- a/CMake/iOS.cmake +++ b/CMake/iOS.cmake @@ -154,7 +154,7 @@ endif() set (CMAKE_SHARED_LINKER_FLAGS_INIT "-fapplication-extension") set (CMAKE_C_FLAGS_INIT "${XCODE_IOS_PLATFORM_VERSION_FLAGS}") -# Hidden visibilty is required for cxx on iOS +# Hidden visibility is required for cxx on iOS set (CMAKE_CXX_FLAGS_INIT "${XCODE_IOS_PLATFORM_VERSION_FLAGS} -fvisibility-inlines-hidden") set (CMAKE_C_LINK_FLAGS "${XCODE_IOS_PLATFORM_VERSION_FLAGS} -fapplication-extension -Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}") diff --git a/benchmark/check_tls.cpp b/benchmark/check_tls.cpp index 9586df076e4a..af3e08fb7e18 100644 --- a/benchmark/check_tls.cpp +++ b/benchmark/check_tls.cpp @@ -199,7 +199,7 @@ td::Result test_tls(const td::string &url) { if (random_id == "\xcf\x21\xad\x74\xe5\x9a\x61\x11\xbe\x1d\x8c\x02\x1e\x65\xb8\x91\xc2\xa2\x11\x16\x7a\xbb\x8c\x5e\x07" "\x9e\x09\xe2\xc8\xa8\x33\x9c") { - return td::Status::Error("TLS 1.3 servers returning HelloRetryRequest are not supprted"); + return td::Status::Error("TLS 1.3 servers returning HelloRetryRequest are not supported"); } if (result[43] == '\x00') { return td::Status::Error("TLS <= 1.2: empty session_id"); diff --git a/example/web/tdweb/src/worker.js b/example/web/tdweb/src/worker.js index 82be9bfe83f1..ef4bc98ee882 100644 --- a/example/web/tdweb/src/worker.js +++ b/example/web/tdweb/src/worker.js @@ -884,7 +884,7 @@ class TdClient { } async close(last_update) { - // close db and cancell all timers + // close db and cancel all timers this.isClosing = true; if (this.isStarted) { log.debug('close worker: start'); diff --git a/memprof/memprof.cpp b/memprof/memprof.cpp index e6564e66ad2f..c14914bc68e8 100644 --- a/memprof/memprof.cpp +++ b/memprof/memprof.cpp @@ -285,7 +285,7 @@ void *realloc(void *ptr, std::size_t size) { return new_ptr; } -void *memalign(std::size_t aligment, std::size_t size) { +void *memalign(std::size_t alignment, std::size_t size) { my_assert(false && "Memalign is unsupported"); return nullptr; } diff --git a/td/mtproto/SessionConnection.cpp b/td/mtproto/SessionConnection.cpp index 05b1556a588e..252c9ae523ba 100644 --- a/td/mtproto/SessionConnection.cpp +++ b/td/mtproto/SessionConnection.cpp @@ -117,7 +117,7 @@ namespace mtproto { * BadMsgNotification; * * error codes: - * 16: msg_id is too low. -- lite resend. It will be automatially packed in a container. I hope. + * 16: msg_id is too low. -- lite resend. It will be automatically packed in a container. I hope. * 17: msg_id is too high. -- fail connection. * 18: msg_id % 4 != 0. -- Error and fail connection. * 19: container msg_id is the same as msg_id of a previously received message. MUST NEVER HAPPENS. Error and fail diff --git a/td/telegram/AuthManager.h b/td/telegram/AuthManager.h index 4c2ff21e627d..d48ff740e2ba 100644 --- a/td/telegram/AuthManager.h +++ b/td/telegram/AuthManager.h @@ -129,7 +129,7 @@ class AuthManager final : public NetActor { ActorShared<> parent_; // STATE - // from contructor + // from constructor int32 api_id_; string api_hash_; diff --git a/td/telegram/BusinessConnectedBot.cpp b/td/telegram/BusinessConnectedBot.cpp index eabdf3c3d920..56fe7d293401 100644 --- a/td/telegram/BusinessConnectedBot.cpp +++ b/td/telegram/BusinessConnectedBot.cpp @@ -39,7 +39,7 @@ bool operator==(const BusinessConnectedBot &lhs, const BusinessConnectedBot &rhs } StringBuilder &operator<<(StringBuilder &string_builder, const BusinessConnectedBot &connected_bot) { - return string_builder << "coneected bot " << connected_bot.user_id_ << ' ' << connected_bot.recipients_ << ' ' + return string_builder << "connected bot " << connected_bot.user_id_ << ' ' << connected_bot.recipients_ << ' ' << (connected_bot.can_reply_ ? " that can reply" : " read-only"); } diff --git a/td/telegram/GroupCallManager.cpp b/td/telegram/GroupCallManager.cpp index e2164fe7687b..eea33b85f506 100644 --- a/td/telegram/GroupCallManager.cpp +++ b/td/telegram/GroupCallManager.cpp @@ -4376,7 +4376,7 @@ InputGroupCallId GroupCallManager::update_group_call(const tl_object_ptris_active) { // never update ended calls } else if (!call.is_active) { - // always update to an ended call, droping also is_joined, is_speaking and other local flags + // always update to an ended call, dropping also is_joined, is_speaking and other local flags fail_promises(group_call->after_join, Status::Error(400, "Group call ended")); *group_call = std::move(call); need_update = true; diff --git a/td/telegram/GroupCallParticipant.cpp b/td/telegram/GroupCallParticipant.cpp index 2ecfcece3282..d72474d109b5 100644 --- a/td/telegram/GroupCallParticipant.cpp +++ b/td/telegram/GroupCallParticipant.cpp @@ -72,7 +72,7 @@ GroupCallParticipant::GroupCallParticipant(const tl_object_ptr &participant) { - // updates about new and left participants must be applyed as versioned, even they don't increase version + // updates about new and left participants must be applied as versioned, even they don't increase version return participant->just_joined_ || participant->left_ || participant->versioned_; } diff --git a/td/telegram/MessageEntity.cpp b/td/telegram/MessageEntity.cpp index 90cc1f061b18..17558b455d43 100644 --- a/td/telegram/MessageEntity.cpp +++ b/td/telegram/MessageEntity.cpp @@ -4235,7 +4235,7 @@ static std::pair remove_invalid_entities(const string &text, vect return {last_non_whitespace_pos, last_non_whitespace_utf16_offset}; } -// enitities must contain only splittable entities +// entities must contain only splittable entities static void split_entities(vector &entities, const vector &other_entities) { check_is_sorted(entities); check_is_sorted(other_entities); diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 7218e3b33df0..a97d5b317e83 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -6009,7 +6009,7 @@ void MessagesManager::skip_old_pending_pts_update(tl_object_ptrpts; - if (new_pts <= old_pts) { // very old or unuseful update + if (new_pts <= old_pts) { // very old or useless update if (update->get_id() == telegram_api::updateNewChannelMessage::ID) { auto update_new_channel_message = static_cast(update.get()); auto message_id = MessageId::get_message_id(update_new_channel_message->message_, false); @@ -9640,7 +9640,7 @@ void MessagesManager::on_get_scheduled_server_messages(DialogId dialog_id, uint3 d->scheduled_messages_sync_generation = generation; if (is_not_modified) { - LOG(INFO) << "Scheduled messages are mot modified in " << dialog_id; + LOG(INFO) << "Scheduled messages are not modified in " << dialog_id; return; } @@ -10700,7 +10700,7 @@ void MessagesManager::delete_dialog_messages_by_sender(DialogId dialog_id, Dialo } channel_status = td_->chat_manager_->get_channel_permissions(channel_id); if (!channel_status.can_delete_messages()) { - return promise.set_error(Status::Error(400, "Need delete messages administator right in the supergroup chat")); + return promise.set_error(Status::Error(400, "Need delete messages administrator right in the supergroup chat")); } channel_id = dialog_id.get_channel_id(); break; @@ -26464,7 +26464,7 @@ void MessagesManager::register_message_reply(DialogId dialog_id, const Message * } void MessagesManager::reregister_message_reply(DialogId dialog_id, const Message *m) { - // reply itself wan't changed, so there is nothing to reregister + // reply itself wasn't changed, so there is nothing to reregister if (!can_register_message_reply(m)) { return; } @@ -32784,7 +32784,7 @@ MessagesManager::Message *MessagesManager::on_get_message_from_database(Dialog * // data in the database is always outdated, so return a message from the memory if (dialog_id.get_type() == DialogType::SecretChat) { CHECK(!is_scheduled); - // just in case restore random_id to message_id corespondence + // just in case restore random_id to message_id correspondence // can be needed if there was newer unloaded message with the same random_id add_random_id_to_message_id_correspondence(d, old_message->random_id, old_message->message_id); } diff --git a/td/telegram/MessagesManager.h b/td/telegram/MessagesManager.h index 72f76728e050..d4d86007a54b 100644 --- a/td/telegram/MessagesManager.h +++ b/td/telegram/MessagesManager.h @@ -1665,7 +1665,7 @@ class MessagesManager final : public Actor { static constexpr int32 AUTH_NOTIFICATION_ID_CACHE_TIME = 7 * 86400; static constexpr size_t MAX_SAVED_AUTH_NOTIFICATION_IDS = 100; - static constexpr int32 MAX_RESEND_DELAY = 86400; // seconds, some resonable limit + static constexpr int32 MAX_RESEND_DELAY = 86400; // seconds, some reasonable limit static constexpr int32 SCHEDULE_WHEN_ONLINE_DATE = 2147483646; diff --git a/td/telegram/NotificationSettingsManager.cpp b/td/telegram/NotificationSettingsManager.cpp index fbc74943c377..eb6a73a7781a 100644 --- a/td/telegram/NotificationSettingsManager.cpp +++ b/td/telegram/NotificationSettingsManager.cpp @@ -1358,7 +1358,7 @@ void NotificationSettingsManager::load_saved_ringtones(Promise &&promise) on_saved_ringtones_updated(true); } - // the promis must not be set synchronously + // the promise must not be set synchronously send_closure_later(actor_id(this), &NotificationSettingsManager::on_load_saved_ringtones, std::move(promise)); reload_saved_ringtones(Auto()); } else { diff --git a/td/telegram/SecretChatActor.cpp b/td/telegram/SecretChatActor.cpp index dd6ecfd44664..7f2ce8347c80 100644 --- a/td/telegram/SecretChatActor.cpp +++ b/td/telegram/SecretChatActor.cpp @@ -1310,7 +1310,7 @@ Status SecretChatActor::do_inbound_message_decrypted(unique_ptrmessage_id; TRY_STATUS(on_inbound_action(*action, message->message_id)); } else { - LOG(ERROR) << "INGORE MESSAGE: " << to_string(message->decrypted_message_layer); + LOG(ERROR) << "IGNORE MESSAGE: " << to_string(message->decrypted_message_layer); save_message_finish.set_value(Unit()); } diff --git a/td/telegram/SecretChatActor.h b/td/telegram/SecretChatActor.h index 2136e36542ea..a7d9d7ab1628 100644 --- a/td/telegram/SecretChatActor.h +++ b/td/telegram/SecretChatActor.h @@ -476,7 +476,7 @@ class SecretChatActor final : public NetQueryCallback { // We may accept some other change during that time, and there goes our problem // The reason for the change may already be invalid. So we should somehow recheck change, that // is already written to binlog, and apply it only if necessary. - // This is completly flawed. + // This is completely flawed. // (A-start_save_to_binlog ----> B-start_save_to_binlog+change_memory ----> A-finish_save_to_binlog+surprise) // // Instead, I suggest general solution that is already used with SeqNoState and QTS diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index a313ce691728..b3e6884240fd 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -834,7 +834,7 @@ void Td::init(Parameters parameters, Result r_opened_datab // we need to process td_api::getOption along with td_api::setOption for consistency // we need to process td_api::setOption before managers and MTProto header are created, - // because their initialiation may be affected by the options + // because their initialization may be affected by the options complete_pending_preauthentication_requests([](int32 id) { switch (id) { case td_api::getOption::ID: diff --git a/td/telegram/files/FileDownloader.cpp b/td/telegram/files/FileDownloader.cpp index 7dcd1f0c203c..796e6f04ea96 100644 --- a/td/telegram/files/FileDownloader.cpp +++ b/td/telegram/files/FileDownloader.cpp @@ -103,7 +103,7 @@ Result FileDownloader::should_restart_part(Part part, const NetQueryPtr &n case QueryType::ReuploadCDN: { TRY_RESULT(file_hashes, fetch_result(net_query->ok())); add_hash_info(file_hashes); - LOG(DEBUG) << "Part " << part.id << " was reuplaoded to CDN"; + LOG(DEBUG) << "Part " << part.id << " was reuploaded to CDN"; return true; } case QueryType::CDN: { @@ -111,7 +111,7 @@ Result FileDownloader::should_restart_part(Part part, const NetQueryPtr &n TRY_RESULT(file_base, fetch_result(net_query->ok())); CHECK(file_base->get_id() == telegram_api::upload_cdnFileReuploadNeeded::ID); auto file = move_tl_object_as(file_base); - LOG(DEBUG) << "Part " << part.id << " must be reuplaoded to " << oneline(to_string(file)); + LOG(DEBUG) << "Part " << part.id << " must be reuploaded to " << oneline(to_string(file)); cdn_part_reupload_token_[part.id] = file->request_token_.as_slice().str(); return true; } diff --git a/td/telegram/files/FileManager.cpp b/td/telegram/files/FileManager.cpp index a37fc0bb8d9e..aa7a9cc06152 100644 --- a/td/telegram/files/FileManager.cpp +++ b/td/telegram/files/FileManager.cpp @@ -2097,7 +2097,7 @@ static int merge_choose_generate_location(const unique_ptrconversion_ >= y->conversion_ ? 0 - : 1; // the bigger conversion, the bigger mtime or at least more stable choise + : 1; // the bigger conversion, the bigger mtime or at least more stable choice } return 2; } @@ -3320,7 +3320,7 @@ void FileManager::run_download(FileNodePtr node, bool force_update_priority) { node->download_id_ = query_id; node->is_download_started_ = false; LOG(INFO) << "Run download of file " << file_id << " of size " << node->size_ << " from " - << node->remote_.full.value() << " with suggested name " << node->suggested_path() << " and encyption key " + << node->remote_.full.value() << " with suggested name " << node->suggested_path() << " and encryption key " << node->encryption_key_; auto download_offset = node->download_offset_; auto download_limit = node->get_download_limit(); diff --git a/tdactor/td/actor/impl/Event.h b/tdactor/td/actor/impl/Event.h index ceec14f5325f..044635af230e 100644 --- a/tdactor/td/actor/impl/Event.h +++ b/tdactor/td/actor/impl/Event.h @@ -22,7 +22,7 @@ class Actor; // Small structure (up to 16 bytes) used to send events between actors. // // There are some predefined types of events: -// NoType -- unitialized event +// NoType -- uninitialized event // Start -- start actor // Stop -- stop actor // Yield -- wake up actor diff --git a/tdutils/td/utils/HazardPointers.h b/tdutils/td/utils/HazardPointers.h index 79715caa4592..e38e48bd5658 100644 --- a/tdutils/td/utils/HazardPointers.h +++ b/tdutils/td/utils/HazardPointers.h @@ -78,7 +78,7 @@ class HazardPointers { } } - // old inteface + // old interface T *protect(size_t thread_id, size_t pos, std::atomic &ptr) { return do_protect(get_hazard_ptr(thread_id, pos), ptr); } diff --git a/tdutils/td/utils/MpmcWaiter.h b/tdutils/td/utils/MpmcWaiter.h index 2ec315cff4ef..ee1d8d064544 100644 --- a/tdutils/td/utils/MpmcWaiter.h +++ b/tdutils/td/utils/MpmcWaiter.h @@ -281,7 +281,7 @@ class MpmcSleepyWaiter { auto view = StateView(state_.load()); //LOG(ERROR) << view.parked_count; if (view.searching_count > 0 || view.parked_count == 0) { - VLOG(waiter) << "Ingore notify: " << view.searching_count << ' ' << view.parked_count; + VLOG(waiter) << "Ignore notify: " << view.searching_count << ' ' << view.parked_count; return; } diff --git a/tdutils/td/utils/port/thread_local.cpp b/tdutils/td/utils/port/thread_local.cpp index c5d8ee9eee62..1199b835e45e 100644 --- a/tdutils/td/utils/port/thread_local.cpp +++ b/tdutils/td/utils/port/thread_local.cpp @@ -23,7 +23,7 @@ void add_thread_local_destructor(unique_ptr destructor) { } // namespace detail void clear_thread_locals() { - // ensure that no destructors were added during destructors invokation + // ensure that no destructors were added during destructors invocation auto to_delete = detail::thread_local_destructors; detail::thread_local_destructors = nullptr; delete to_delete;