Skip to content

Commit

Permalink
Minor improvements. (#3169)
Browse files Browse the repository at this point in the history
  • Loading branch information
AYMENJD authored Dec 5, 2024
1 parent d0f077f commit d544506
Show file tree
Hide file tree
Showing 23 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion CMake/GetGitRevisionDescription.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion CMake/iOS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
2 changes: 1 addition & 1 deletion benchmark/check_tls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ td::Result<TlsInfo> 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");
Expand Down
2 changes: 1 addition & 1 deletion example/web/tdweb/src/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion memprof/memprof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion td/mtproto/SessionConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion td/telegram/AuthManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class AuthManager final : public NetActor {
ActorShared<> parent_;

// STATE
// from contructor
// from constructor
int32 api_id_;
string api_hash_;

Expand Down
2 changes: 1 addition & 1 deletion td/telegram/BusinessConnectedBot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down
2 changes: 1 addition & 1 deletion td/telegram/GroupCallManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4376,7 +4376,7 @@ InputGroupCallId GroupCallManager::update_group_call(const tl_object_ptr<telegra
if (!group_call->is_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;
Expand Down
2 changes: 1 addition & 1 deletion td/telegram/GroupCallParticipant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ GroupCallParticipant::GroupCallParticipant(const tl_object_ptr<telegram_api::gro
}

bool GroupCallParticipant::is_versioned_update(const tl_object_ptr<telegram_api::groupCallParticipant> &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_;
}

Expand Down
2 changes: 1 addition & 1 deletion td/telegram/MessageEntity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4235,7 +4235,7 @@ static std::pair<size_t, int32> 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<MessageEntity> &entities, const vector<MessageEntity> &other_entities) {
check_is_sorted(entities);
check_is_sorted(other_entities);
Expand Down
12 changes: 6 additions & 6 deletions td/telegram/MessagesManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6009,7 +6009,7 @@ void MessagesManager::skip_old_pending_pts_update(tl_object_ptr<telegram_api::Up
return;
}

// very old or unuseful update
// very old or useless update
LOG_IF(WARNING, new_pts == old_pts && pts_count == 0 && !is_allowed_useless_update(update))
<< "Receive useless update " << oneline(to_string(update)) << " from " << source;
}
Expand Down Expand Up @@ -7154,7 +7154,7 @@ void MessagesManager::add_pending_channel_update(DialogId dialog_id, tl_object_p
}
} else {
int32 old_pts = d->pts;
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<telegram_api::updateNewChannelMessage *>(update.get());
auto message_id = MessageId::get_message_id(update_new_channel_message->message_, false);
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion td/telegram/MessagesManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion td/telegram/NotificationSettingsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,7 @@ void NotificationSettingsManager::load_saved_ringtones(Promise<Unit> &&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 {
Expand Down
2 changes: 1 addition & 1 deletion td/telegram/SecretChatActor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,7 @@ Status SecretChatActor::do_inbound_message_decrypted(unique_ptr<log_event::Inbou
state.message_id = message->message_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());
}

Expand Down
2 changes: 1 addition & 1 deletion td/telegram/SecretChatActor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion td/telegram/Td.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ void Td::init(Parameters parameters, Result<TdDb::OpenedDatabase> 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:
Expand Down
4 changes: 2 additions & 2 deletions td/telegram/files/FileDownloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ Result<bool> FileDownloader::should_restart_part(Part part, const NetQueryPtr &n
case QueryType::ReuploadCDN: {
TRY_RESULT(file_hashes, fetch_result<telegram_api::upload_reuploadCdnFile>(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: {
if (net_query->ok_tl_constructor() == telegram_api::upload_cdnFileReuploadNeeded::ID) {
TRY_RESULT(file_base, fetch_result<telegram_api::upload_getCdnFile>(net_query->ok()));
CHECK(file_base->get_id() == telegram_api::upload_cdnFileReuploadNeeded::ID);
auto file = move_tl_object_as<telegram_api::upload_cdnFileReuploadNeeded>(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;
}
Expand Down
4 changes: 2 additions & 2 deletions td/telegram/files/FileManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2097,7 +2097,7 @@ static int merge_choose_generate_location(const unique_ptr<FullGenerateFileLocat
}
return x->conversion_ >= 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;
}
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion tdactor/td/actor/impl/Event.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tdutils/td/utils/HazardPointers.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class HazardPointers {
}
}

// old inteface
// old interface
T *protect(size_t thread_id, size_t pos, std::atomic<T *> &ptr) {
return do_protect(get_hazard_ptr(thread_id, pos), ptr);
}
Expand Down
2 changes: 1 addition & 1 deletion tdutils/td/utils/MpmcWaiter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion tdutils/td/utils/port/thread_local.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void add_thread_local_destructor(unique_ptr<Destructor> 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;
Expand Down

0 comments on commit d544506

Please sign in to comment.