From f29c4a9ed17caaae67c60e71a2c4ca4cfcf2ed7a Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 15 Sep 2019 06:19:46 +0300 Subject: [PATCH] Remove unneded explicit td::. GitOrigin-RevId: e3888510ce72a55072a11d105311f07b4ba42bbf --- td/mtproto/TlsInit.cpp | 2 +- td/mtproto/Transport.cpp | 2 +- td/telegram/MessagesManager.cpp | 12 ++--- td/telegram/SecureStorage.cpp | 19 ++++--- td/telegram/SecureStorage.h | 2 +- td/telegram/TdDb.cpp | 2 +- td/telegram/UpdatesManager.cpp | 2 +- td/telegram/cli.cpp | 26 ++++----- td/telegram/files/FileBitmask.cpp | 2 +- td/telegram/files/FileManager.cpp | 2 +- td/telegram/files/FileStatsWorker.cpp | 54 +++++++++---------- td/telegram/net/ConnectionCreator.cpp | 2 +- td/telegram/net/NetQuery.cpp | 6 +-- tdactor/td/actor/impl/ConcurrentScheduler.cpp | 6 +-- tdnet/td/net/HttpProxy.cpp | 2 +- tdutils/td/utils/DecTree.h | 6 +-- tdutils/td/utils/MpscLinkQueue.h | 2 +- tdutils/td/utils/Time.h | 2 +- tdutils/td/utils/port/StdStreams.cpp | 10 ++-- tdutils/td/utils/port/signals.cpp | 2 +- 20 files changed, 81 insertions(+), 82 deletions(-) diff --git a/td/mtproto/TlsInit.cpp b/td/mtproto/TlsInit.cpp index e67df404..40375b20 100644 --- a/td/mtproto/TlsInit.cpp +++ b/td/mtproto/TlsInit.cpp @@ -456,7 +456,7 @@ Status TlsInit::wait_hello_response() { std::string hash_dest(32, '\0'); hmac_sha256(password_, PSLICE() << hello_rand_ << response.as_slice(), hash_dest); if (hash_dest != response_rand) { - return td::Status::Error("Response hash mismatch"); + return Status::Error("Response hash mismatch"); } stop(); diff --git a/td/mtproto/Transport.cpp b/td/mtproto/Transport.cpp index a3e3b8a8..3f03a769 100644 --- a/td/mtproto/Transport.cpp +++ b/td/mtproto/Transport.cpp @@ -175,7 +175,7 @@ size_t do_calc_crypto_size2_basic(size_t data_size, size_t enc_size, size_t raw_ } size_t do_calc_crypto_size2_rand(size_t data_size, size_t enc_size, size_t raw_size) { - size_t rand_data_size = td::Random::secure_uint32() & 0xff; + size_t rand_data_size = Random::secure_uint32() & 0xff; size_t encrypted_size = (enc_size + data_size + rand_data_size + 12 + 15) & ~15; return raw_size + encrypted_size; } diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 83ae2059..95967404 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -6117,7 +6117,7 @@ void MessagesManager::on_update_dialog_notify_settings( return; } - const DialogNotificationSettings notification_settings = td::get_dialog_notification_settings( + const DialogNotificationSettings notification_settings = ::td::get_dialog_notification_settings( std::move(peer_notify_settings), current_settings->use_default_disable_pinned_message_notifications, current_settings->disable_pinned_message_notifications, current_settings->use_default_disable_mention_notifications, current_settings->disable_mention_notifications); @@ -6137,7 +6137,7 @@ void MessagesManager::on_update_scope_notify_settings( auto old_notification_settings = get_scope_notification_settings(scope); CHECK(old_notification_settings != nullptr); - const ScopeNotificationSettings notification_settings = td::get_scope_notification_settings( + const ScopeNotificationSettings notification_settings = ::td::get_scope_notification_settings( std::move(peer_notify_settings), old_notification_settings->disable_pinned_message_notifications, old_notification_settings->disable_mention_notifications); if (!notification_settings.is_synchronized) { @@ -27150,7 +27150,7 @@ void MessagesManager::get_payment_form(FullMessageId full_message_id, return promise.set_error(r_message_id.move_as_error()); } - td::get_payment_form(r_message_id.ok(), std::move(promise)); + ::td::get_payment_form(r_message_id.ok(), std::move(promise)); } void MessagesManager::validate_order_info(FullMessageId full_message_id, tl_object_ptr order_info, @@ -27161,7 +27161,7 @@ void MessagesManager::validate_order_info(FullMessageId full_message_id, tl_obje return promise.set_error(r_message_id.move_as_error()); } - td::validate_order_info(r_message_id.ok(), std::move(order_info), allow_save, std::move(promise)); + ::td::validate_order_info(r_message_id.ok(), std::move(order_info), allow_save, std::move(promise)); } void MessagesManager::send_payment_form(FullMessageId full_message_id, const string &order_info_id, @@ -27173,7 +27173,7 @@ void MessagesManager::send_payment_form(FullMessageId full_message_id, const str return promise.set_error(r_message_id.move_as_error()); } - td::send_payment_form(r_message_id.ok(), order_info_id, shipping_option_id, credentials, std::move(promise)); + ::td::send_payment_form(r_message_id.ok(), order_info_id, shipping_option_id, credentials, std::move(promise)); } void MessagesManager::get_payment_receipt(FullMessageId full_message_id, @@ -27190,7 +27190,7 @@ void MessagesManager::get_payment_receipt(FullMessageId full_message_id, return promise.set_error(Status::Error(5, "Wrong message identifier")); } - td::get_payment_receipt(message_id.get_server_message_id(), std::move(promise)); + ::td::get_payment_receipt(message_id.get_server_message_id(), std::move(promise)); } void MessagesManager::on_get_sponsored_dialog_id(tl_object_ptr peer, diff --git a/td/telegram/SecureStorage.cpp b/td/telegram/SecureStorage.cpp index e9a2b54c..0dd0ac37 100644 --- a/td/telegram/SecureStorage.cpp +++ b/td/telegram/SecureStorage.cpp @@ -181,7 +181,7 @@ Result Secret::create(Slice secret) { return Status::Error(PSLICE() << "Wrong checksum " << checksum); } UInt256 res; - td::as_slice(res).copy_from(secret); + ::td::as_slice(res).copy_from(secret); UInt256 secret_sha256; sha256(secret, ::td::as_slice(secret_sha256)); @@ -191,7 +191,7 @@ Result Secret::create(Slice secret) { Secret Secret::create_new() { UInt256 secret; - auto secret_slice = td::as_slice(secret); + auto secret_slice = ::td::as_slice(secret); Random::secure_bytes(secret_slice); auto checksum_diff = secret_checksum(secret_slice); uint8 new_byte = static_cast((static_cast(secret_slice.ubegin()[0]) + checksum_diff) % 255); @@ -200,8 +200,7 @@ Secret Secret::create_new() { } Slice Secret::as_slice() const { - using td::as_slice; - return as_slice(secret_); + return ::td::as_slice(secret_); } int64 Secret::get_hash() const { @@ -226,8 +225,8 @@ EncryptedSecret Secret::encrypt(Slice key, Slice salt, EnryptionAlgorithm algori }(); UInt256 res; - aes_cbc_state.encrypt(as_slice(), td::as_slice(res)); - return EncryptedSecret::create(td::as_slice(res)).move_as_ok(); + aes_cbc_state.encrypt(as_slice(), ::td::as_slice(res)); + return EncryptedSecret::create(::td::as_slice(res)).move_as_ok(); } Secret::Secret(UInt256 secret, int64 hash) : secret_(secret), hash_(hash) { @@ -238,7 +237,7 @@ Result EncryptedSecret::create(Slice encrypted_secret) { return Status::Error("Wrong encrypted secret size"); } UInt256 res; - td::as_slice(res).copy_from(encrypted_secret); + ::td::as_slice(res).copy_from(encrypted_secret); return EncryptedSecret{res}; } @@ -256,12 +255,12 @@ Result EncryptedSecret::decrypt(Slice key, Slice salt, EnryptionAlgorith }(); UInt256 res; - aes_cbc_state.decrypt(td::as_slice(encrypted_secret_), td::as_slice(res)); - return Secret::create(td::as_slice(res)); + aes_cbc_state.decrypt(::td::as_slice(encrypted_secret_), ::td::as_slice(res)); + return Secret::create(::td::as_slice(res)); } Slice EncryptedSecret::as_slice() const { - return td::as_slice(encrypted_secret_); + return ::td::as_slice(encrypted_secret_); } EncryptedSecret::EncryptedSecret(UInt256 encrypted_secret) : encrypted_secret_(encrypted_secret) { diff --git a/td/telegram/SecureStorage.h b/td/telegram/SecureStorage.h index 67506268..7e68b0d1 100644 --- a/td/telegram/SecureStorage.h +++ b/td/telegram/SecureStorage.h @@ -55,7 +55,7 @@ class ValueHash { } static Result create(Slice data); Slice as_slice() const { - return td::as_slice(hash_); + return ::td::as_slice(hash_); } private: diff --git a/td/telegram/TdDb.cpp b/td/telegram/TdDb.cpp index 00b3c4ff..b452c544 100644 --- a/td/telegram/TdDb.cpp +++ b/td/telegram/TdDb.cpp @@ -485,7 +485,7 @@ void TdDb::with_db_path(std::function callback) { } Result TdDb::get_stats() { - auto sb = td::StringBuilder({}, true); + auto sb = StringBuilder({}, true); auto &sql = sql_connection_->get(); auto run_query = [&](CSlice query, Slice desc) -> Status { TRY_RESULT(stmt, sql.get_statement(query)); diff --git a/td/telegram/UpdatesManager.cpp b/td/telegram/UpdatesManager.cpp index 572dcf64..b8a3ce1a 100644 --- a/td/telegram/UpdatesManager.cpp +++ b/td/telegram/UpdatesManager.cpp @@ -677,7 +677,7 @@ void UpdatesManager::on_get_updates(tl_object_ptr &&updat auto update = move_tl_object_as(updates_ptr); LOG(DEBUG) << "Receive " << oneline(to_string(update)); if (!is_acceptable_update(update->update_.get())) { - LOG(ERROR) << "Receive unacceptable short update: " << td::oneline(to_string(update)); + LOG(ERROR) << "Receive unacceptable short update: " << oneline(to_string(update)); return get_difference("unacceptable short update"); } short_update_date_ = update->date_; diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index bb2d2570..a4fc94d4 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -77,14 +77,14 @@ static void dump_memory_usage() { int cnt = 0; for (auto &info : v) { if (cnt++ < 50) { - LOG(WARNING) << td::format::as_size(info.size) << td::format::as_array(info.backtrace); + LOG(WARNING) << format::as_size(info.size) << format::as_array(info.backtrace); } else { other_size += info.size; } total_size += info.size; } - LOG(WARNING) << tag("other", td::format::as_size(other_size)); - LOG(WARNING) << tag("total", td::format::as_size(total_size)); + LOG(WARNING) << tag("other", format::as_size(other_size)); + LOG(WARNING) << tag("total", format::as_size(total_size)); LOG(WARNING) << tag("total traces", get_ht_size()); LOG(WARNING) << tag("fast_backtrace_success_rate", get_fast_backtrace_success_rate()); } @@ -301,7 +301,7 @@ class CliClient final : public Actor { for (auto &m : messages.messages_) { // LOG(PLAIN) << to_string(m); if (m->content_->get_id() == td_api::messageText::ID) { - LOG(PLAIN) << td::oneline(static_cast(m->content_.get())->text_->text_) << "\n"; + LOG(PLAIN) << oneline(static_cast(m->content_.get())->text_->text_) << "\n"; } last_message_id = m->id_; } @@ -3674,11 +3674,11 @@ class CliClient final : public Actor { fd.seek(size).ignore(); fd.truncate_to_current_position(size).ignore(); } else if (op == "SetVerbosity" || op == "SV") { - td::Log::set_verbosity_level(to_integer(args)); + Log::set_verbosity_level(to_integer(args)); } else if (op[0] == 'v' && op[1] == 'v') { - td::Log::set_verbosity_level(static_cast(op.size())); + Log::set_verbosity_level(static_cast(op.size())); } else if (op[0] == 'v' && ('0' <= op[1] && op[1] <= '9')) { - td::Log::set_verbosity_level(to_integer(op.substr(1))); + Log::set_verbosity_level(to_integer(op.substr(1))); } else if (op == "slse") { execute(td_api::make_object(td_api::make_object())); } else if (op == "slsd") { @@ -3884,7 +3884,7 @@ void main(int argc, char **argv) { ignore_signal(SignalType::Pipe).ensure(); set_signal_handler(SignalType::Error, fail_signal).ensure(); set_signal_handler(SignalType::Abort, fail_signal).ensure(); - td::Log::set_fatal_error_callback(on_fatal_error); + Log::set_fatal_error_callback(on_fatal_error); const char *locale_name = (std::setlocale(LC_ALL, "fr-FR") == nullptr ? "" : "fr-FR"); std::locale new_locale(locale_name); @@ -3898,8 +3898,8 @@ void main(int argc, char **argv) { CliLog cli_log; log_interface = &cli_log; - td::FileLog file_log; - td::TsLog ts_log(&file_log); + FileLog file_log; + TsLog ts_log(&file_log); int new_verbosity_level = VERBOSITY_NAME(INFO); bool use_test_dc = false; @@ -3907,7 +3907,7 @@ void main(int argc, char **argv) { bool disable_network = false; auto api_id = [](auto x) -> int32 { if (x) { - return td::to_integer(Slice(x)); + return to_integer(Slice(x)); } return 0; }(std::getenv("TD_API_ID")); @@ -3951,7 +3951,7 @@ void main(int argc, char **argv) { if (i + 1 >= argc) { return usage(); } - api_id = td::to_integer(Slice(argv[++i])); + api_id = to_integer(Slice(argv[++i])); } else if (!std::strcmp(argv[i], "--api_hash") || !std::strcmp(argv[i], "--api-hash")) { if (i + 1 >= argc) { return usage(); @@ -4005,7 +4005,7 @@ void main(int argc, char **argv) { .release(); scheduler.start(); - while (scheduler.run_main(td::Timestamp::in(100))) { + while (scheduler.run_main(Timestamp::in(100))) { } scheduler.finish(); } diff --git a/td/telegram/files/FileBitmask.cpp b/td/telegram/files/FileBitmask.cpp index cbb09248..472fa0f2 100644 --- a/td/telegram/files/FileBitmask.cpp +++ b/td/telegram/files/FileBitmask.cpp @@ -37,7 +37,7 @@ Bitmask Bitmask::compress(int k) const { std::string Bitmask::encode(int32 prefix_count) { // remove zeroes in the end to make encoding deterministic - td::Slice data(data_); + Slice data(data_); int save_i = -1; char save_c; diff --git a/td/telegram/files/FileManager.cpp b/td/telegram/files/FileManager.cpp index 62188c08..db1884ce 100644 --- a/td/telegram/files/FileManager.cpp +++ b/td/telegram/files/FileManager.cpp @@ -2620,7 +2620,7 @@ string FileManager::get_persistent_id(const FullRemoteFileLocation &location) { auto binary = serialize(location_copy); binary = zero_encode(binary); - binary.push_back(static_cast(narrow_cast(Version::Next) - 1)); + binary.push_back(static_cast(narrow_cast(Version::Next) - 1)); binary.push_back(PERSISTENT_ID_VERSION); return base64url_encode(binary); } diff --git a/td/telegram/files/FileStatsWorker.cpp b/td/telegram/files/FileStatsWorker.cpp index cbd8228c..9313ed1f 100644 --- a/td/telegram/files/FileStatsWorker.cpp +++ b/td/telegram/files/FileStatsWorker.cpp @@ -106,34 +106,34 @@ void scan_fs(CancellationToken &token, CallbackT &&callback) { continue; } auto files_dir = get_files_dir(file_type); - td::walk_path(files_dir, - [&](CSlice path, WalkPath::Type type) { - if (token) { - return WalkPath::Action::Abort; - } - if (type != WalkPath::Type::NotDir) { - return WalkPath::Action::Continue; - } - auto r_stat = stat(path); - if (r_stat.is_error()) { - LOG(WARNING) << "Stat in files gc failed: " << r_stat.error(); - return WalkPath::Action::Continue; - } - auto stat = r_stat.move_as_ok(); - if (ends_with(path, "/.nomedia") && stat.size_ == 0) { - // skip .nomedia file - return WalkPath::Action::Continue; - } + walk_path(files_dir, + [&](CSlice path, WalkPath::Type type) { + if (token) { + return WalkPath::Action::Abort; + } + if (type != WalkPath::Type::NotDir) { + return WalkPath::Action::Continue; + } + auto r_stat = stat(path); + if (r_stat.is_error()) { + LOG(WARNING) << "Stat in files gc failed: " << r_stat.error(); + return WalkPath::Action::Continue; + } + auto stat = r_stat.move_as_ok(); + if (ends_with(path, "/.nomedia") && stat.size_ == 0) { + // skip .nomedia file + return WalkPath::Action::Continue; + } - FsFileInfo info; - info.path = path.str(); - info.size = stat.size_; - info.file_type = file_type; - info.atime_nsec = stat.atime_nsec_; - info.mtime_nsec = stat.mtime_nsec_; - callback(info); - return WalkPath::Action::Continue; - }) + FsFileInfo info; + info.path = path.str(); + info.size = stat.size_; + info.file_type = file_type; + info.atime_nsec = stat.atime_nsec_; + info.mtime_nsec = stat.mtime_nsec_; + callback(info); + return WalkPath::Action::Continue; + }) .ignore(); } } diff --git a/td/telegram/net/ConnectionCreator.cpp b/td/telegram/net/ConnectionCreator.cpp index 8a7c9db2..a213f436 100644 --- a/td/telegram/net/ConnectionCreator.cpp +++ b/td/telegram/net/ConnectionCreator.cpp @@ -663,7 +663,7 @@ Result ConnectionCreator::get_transport_type(const Proxy CHECK(info.option != nullptr); string proxy_authorization; if (!proxy.user().empty() || !proxy.password().empty()) { - proxy_authorization = "|basic " + td::base64_encode(PSLICE() << proxy.user() << ':' << proxy.password()); + proxy_authorization = "|basic " + base64_encode(PSLICE() << proxy.user() << ':' << proxy.password()); } return mtproto::TransportType{ mtproto::TransportType::Http, 0, diff --git a/td/telegram/net/NetQuery.cpp b/td/telegram/net/NetQuery.cpp index 4e65464d..9692ebe1 100644 --- a/td/telegram/net/NetQuery.cpp +++ b/td/telegram/net/NetQuery.cpp @@ -77,10 +77,10 @@ void dump_pending_network_queries() { was_gap = false; } auto nq = &static_cast(*cur); - LOG(WARNING) << tag("id", nq->my_id_) << *nq << tag("total_flood", td::format::as_time(nq->total_timeout)) << " " - << tag("since start", td::format::as_time(td::Time::now_cached() - nq->start_timestamp_)) + LOG(WARNING) << tag("id", nq->my_id_) << *nq << tag("total_flood", format::as_time(nq->total_timeout)) << " " + << tag("since start", format::as_time(Time::now_cached() - nq->start_timestamp_)) << tag("state", nq->debug_str_) - << tag("since state", td::format::as_time(td::Time::now_cached() - nq->debug_timestamp_)) + << tag("since state", format::as_time(Time::now_cached() - nq->debug_timestamp_)) << tag("resend_cnt", nq->debug_resend_cnt_) << tag("fail_cnt", nq->debug_send_failed_cnt_) << tag("ack", nq->debug_ack) << tag("unknown", nq->debug_unknown); } else { diff --git a/tdactor/td/actor/impl/ConcurrentScheduler.cpp b/tdactor/td/actor/impl/ConcurrentScheduler.cpp index efeb46f5..aec2c9ec 100644 --- a/tdactor/td/actor/impl/ConcurrentScheduler.cpp +++ b/tdactor/td/actor/impl/ConcurrentScheduler.cpp @@ -80,7 +80,7 @@ void ConcurrentScheduler::start() { auto &sched = schedulers_[i]; threads_.push_back(td::thread([&]() { #if TD_PORT_WINDOWS - td::detail::Iocp::Guard iocp_guard(iocp_.get()); + detail::Iocp::Guard iocp_guard(iocp_.get()); #endif while (!is_finished()) { sched->run(Timestamp::in(10)); @@ -105,7 +105,7 @@ bool ConcurrentScheduler::run_main(Timestamp timeout) { auto &main_sched = schedulers_[0]; if (!is_finished()) { #if TD_PORT_WINDOWS - td::detail::Iocp::Guard iocp_guard(iocp_.get()); + detail::Iocp::Guard iocp_guard(iocp_.get()); #endif main_sched->run(timeout); } @@ -137,7 +137,7 @@ void ConcurrentScheduler::finish() { SCOPE_EXIT { iocp_->clear(); }; - td::detail::Iocp::Guard iocp_guard(iocp_.get()); + detail::Iocp::Guard iocp_guard(iocp_.get()); #endif #if !TD_THREAD_UNSUPPORTED && !TD_EVENTFD_UNSUPPORTED diff --git a/tdnet/td/net/HttpProxy.cpp b/tdnet/td/net/HttpProxy.cpp index 6aee2cf7..eb6dad31 100644 --- a/tdnet/td/net/HttpProxy.cpp +++ b/tdnet/td/net/HttpProxy.cpp @@ -24,7 +24,7 @@ void HttpProxy::send_connect() { string proxy_authorization; if (!username_.empty() || !password_.empty()) { auto userinfo = PSTRING() << username_ << ':' << password_; - proxy_authorization = PSTRING() << "Proxy-Authorization: basic " << td::base64_encode(userinfo) << "\r\n"; + proxy_authorization = PSTRING() << "Proxy-Authorization: basic " << base64_encode(userinfo) << "\r\n"; } fd_.output_buffer().append(PSLICE() << "CONNECT " << host << " HTTP/1.1\r\n" << "Host: " << host << "\r\n" diff --git a/tdutils/td/utils/DecTree.h b/tdutils/td/utils/DecTree.h index 467158d0..ae2ae715 100644 --- a/tdutils/td/utils/DecTree.h +++ b/tdutils/td/utils/DecTree.h @@ -180,7 +180,7 @@ class DecTree { } } void insert(KeyType key, ValueType value) { - root_ = insert_node(std::move(root_), std::move(key), std::move(value), td::Random::fast_uint32()); + root_ = insert_node(std::move(root_), std::move(key), std::move(value), Random::fast_uint32()); } void remove(const KeyType &key) { root_ = remove_node(std::move(root_), key); @@ -195,7 +195,7 @@ class DecTree { if (size() == 0) { return nullptr; } else { - return get_node_by_idx(root_, td::Random::fast_uint32() % size()); + return get_node_by_idx(root_, Random::fast_uint32() % size()); } } const ValueType *get(const KeyType &key) const { @@ -205,7 +205,7 @@ class DecTree { if (size() == 0) { return nullptr; } else { - return get_node_by_idx(root_, td::Random::fast_uint32() % size()); + return get_node_by_idx(root_, Random::fast_uint32() % size()); } } bool exists(const KeyType &key) const { diff --git a/tdutils/td/utils/MpscLinkQueue.h b/tdutils/td/utils/MpscLinkQueue.h index ec1dc64f..82565e47 100644 --- a/tdutils/td/utils/MpscLinkQueue.h +++ b/tdutils/td/utils/MpscLinkQueue.h @@ -154,7 +154,7 @@ class MpscLinkQueueUniquePtrNode { MpscLinkQueueImpl::Node *to_mpsc_link_queue_node() { return ptr_.release()->to_mpsc_link_queue_node(); } - static MpscLinkQueueUniquePtrNode from_mpsc_link_queue_node(td::MpscLinkQueueImpl::Node *node) { + static MpscLinkQueueUniquePtrNode from_mpsc_link_queue_node(MpscLinkQueueImpl::Node *node) { return MpscLinkQueueUniquePtrNode(unique_ptr(Value::from_mpsc_link_queue_node(node))); } diff --git a/tdutils/td/utils/Time.h b/tdutils/td/utils/Time.h index 110b58ff..d0382f9c 100644 --- a/tdutils/td/utils/Time.h +++ b/tdutils/td/utils/Time.h @@ -55,7 +55,7 @@ class Timestamp { return Timestamp{timeout}; } static Timestamp at_unix(double timeout) { - return Timestamp{timeout - td::Clocks::system() + Time::now()}; + return Timestamp{timeout - Clocks::system() + Time::now()}; } static Timestamp in(double timeout) { diff --git a/tdutils/td/utils/port/StdStreams.cpp b/tdutils/td/utils/port/StdStreams.cpp index ba56d9ae..799baed8 100644 --- a/tdutils/td/utils/port/StdStreams.cpp +++ b/tdutils/td/utils/port/StdStreams.cpp @@ -22,7 +22,7 @@ namespace td { template static FileFd &get_file_fd() { static FileFd result = FileFd::from_native_fd(NativeFd(id, true)); - static auto guard = td::ScopeExit() + [&] { result.move_as_native_fd().release(); }; + static auto guard = ScopeExit() + [&] { result.move_as_native_fd().release(); }; return result; } @@ -42,7 +42,7 @@ static FileFd &get_file_fd() { static auto handle = GetStdHandle(id); LOG_IF(FATAL, handle == INVALID_HANDLE_VALUE) << "Failed to GetStdHandle " << id; static FileFd result = FileFd::from_native_fd(NativeFd(handle, true)); - static auto guard = td::ScopeExit() + [&] { result.move_as_native_fd().release(); }; + static auto guard = ScopeExit() + [&] { result.move_as_native_fd().release(); }; #else static FileFd result; #endif @@ -67,7 +67,7 @@ class BufferedStdinImpl : public Iocp::Callback { #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM) BufferedStdinImpl() : info_(NativeFd(GetStdHandle(STD_INPUT_HANDLE), true)) { iocp_ref_ = Iocp::get()->get_ref(); - read_thread_ = td::thread([this] { this->read_loop(); }); + read_thread_ = thread([this] { this->read_loop(); }); } #else BufferedStdinImpl() { @@ -107,7 +107,7 @@ class BufferedStdinImpl : public Iocp::Callback { PollableFdInfo info_; ChainBufferWriter writer_; ChainBufferReader reader_ = writer_.extract_reader(); - td::thread read_thread_; + thread read_thread_; std::atomic close_flag_{false}; IocpRef iocp_ref_; std::atomic refcnt_{1}; @@ -130,7 +130,7 @@ class BufferedStdinImpl : public Iocp::Callback { } } void on_iocp(Result r_size, WSAOVERLAPPED *overlapped) override { - info_.add_flags_from_poll(td::PollFlags::Read()); + info_.add_flags_from_poll(PollFlags::Read()); dec_refcnt(); } diff --git a/tdutils/td/utils/port/signals.cpp b/tdutils/td/utils/port/signals.cpp index c63c5190..03e82393 100644 --- a/tdutils/td/utils/port/signals.cpp +++ b/tdutils/td/utils/port/signals.cpp @@ -289,7 +289,7 @@ void signal_safe_write_pointer(void *p, bool add_header) { char *ptr = end; *--ptr = '\n'; do { - *--ptr = td::format::hex_digit(addr % 16); + *--ptr = format::hex_digit(addr % 16); addr /= 16; } while (addr != 0); *--ptr = 'x';