diff --git a/.gitattributes b/.gitattributes index c684829d..1aeb2b1a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -29,9 +29,6 @@ *.csproj text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent *.sln text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent *.xml text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent -*.rb text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent -*.lock text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent -*.go text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent *.config text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent sqlite/sqlite/* linguist-vendored diff --git a/td/telegram/WebPagesManager.cpp b/td/telegram/WebPagesManager.cpp index 73796fa6..6f141ccb 100644 --- a/td/telegram/WebPagesManager.cpp +++ b/td/telegram/WebPagesManager.cpp @@ -1187,7 +1187,8 @@ void WebPagesManager::on_get_web_page_instant_view(WebPage *web_page, tl_object_ if (photo.id == -2 || photo.id == 0) { LOG(ERROR) << "Receive empty photo in web page instant view for " << web_page->url; } else { - photos.emplace(photo.id, std::move(photo)); + auto photo_id = photo.id; + photos.emplace(photo_id, std::move(photo)); } } if (web_page->photo.id != -2 && web_page->photo.id != 0) { diff --git a/tdnet/CMakeLists.txt b/tdnet/CMakeLists.txt index ed15325d..cf7e8c90 100644 --- a/tdnet/CMakeLists.txt +++ b/tdnet/CMakeLists.txt @@ -51,7 +51,7 @@ target_include_directories(tdnet SYSTEM PRIVATE $ SslStream::create(CSlice host, CSlice cert_file, VerifyPeer verify_peer) { return Status::Error("Not supported in emscripten"); } + SslStream::SslStream(unique_ptr impl) : impl_(std::move(impl)) { } + ByteFlowInterface &SslStream::read_byte_flow() { UNREACHABLE(); } + ByteFlowInterface &SslStream::write_byte_flow() { UNREACHABLE(); } + size_t SslStream::flow_read(MutableSlice slice) { UNREACHABLE(); } + size_t SslStream::flow_write(Slice slice) { UNREACHABLE(); } } // namespace td + #endif diff --git a/tdnet/td/net/SslStream.h b/tdnet/td/net/SslStream.h index cbce90f3..e4432057 100644 --- a/tdnet/td/net/SslStream.h +++ b/tdnet/td/net/SslStream.h @@ -14,7 +14,7 @@ namespace td { namespace detail { class SslStreamImpl; -} +} // namespace detail class SslStream { public: diff --git a/tdutils/td/utils/ConcurrentHashTable.h b/tdutils/td/utils/ConcurrentHashTable.h index 87b07986..6f890224 100644 --- a/tdutils/td/utils/ConcurrentHashTable.h +++ b/tdutils/td/utils/ConcurrentHashTable.h @@ -238,7 +238,7 @@ class ConcurrentHashMap { TaskCreator task_creator; void do_migrate(HashMap *ptr) { - //LOG(ERROR) << "do migrate: " << ptr; + //LOG(ERROR) << "In do_migrate: " << ptr; std::unique_lock lock(migrate_mutex_); if (hash_map_.load() != ptr) { return; @@ -260,7 +260,7 @@ class ConcurrentHashMap { } void finish_migrate() { - //LOG(ERROR) << "finish_migrate"; + //LOG(ERROR) << "In finish_migrate"; hash_map_.store(migrate_to_hash_map_); hp_.retire(get_thread_id(), migrate_from_hash_map_); migrate_from_hash_map_ = nullptr; @@ -273,7 +273,7 @@ class ConcurrentHashMap { if (migrate_from_hash_map_ != nullptr) { return; } - //LOG(ERROR) << "init_migrate"; + //LOG(ERROR) << "In init_migrate"; CHECK(migrate_cnt_ == 0); migrate_generation_++; migrate_from_hash_map_ = hash_map_.exchange(nullptr); @@ -285,7 +285,7 @@ class ConcurrentHashMap { } void run_migrate() { - //LOG(ERROR) << "run_migrate"; + //LOG(ERROR) << "In run_migrate"; size_t cnt = 0; while (true) { auto task = task_creator.create(); @@ -295,7 +295,7 @@ class ConcurrentHashMap { } run_task(task); } - //LOG(ERROR) << "run_migrate " << cnt; + //LOG(ERROR) << "In run_migrate " << cnt; } void run_task(Task task) { @@ -309,7 +309,7 @@ class ConcurrentHashMap { //LOG(ERROR) << node_key << " " << node_key; auto ok = migrate_to_hash_map_->with_value( node_key, true, [&](auto &node_value) { node_value.store(old_value, std::memory_order_relaxed); }); - LOG_CHECK(ok) << "migration overflow"; + LOG_CHECK(ok) << "Migration overflow"; } } }; diff --git a/tdutils/td/utils/port/FileFd.cpp b/tdutils/td/utils/port/FileFd.cpp index 323e1e72..721fee88 100644 --- a/tdutils/td/utils/port/FileFd.cpp +++ b/tdutils/td/utils/port/FileFd.cpp @@ -197,7 +197,7 @@ Result FileFd::open(CSlice filepath, int32 flags, int32 mode) { CreateFile(w_filepath.c_str(), desired_access, share_mode, nullptr, creation_disposition, native_flags, nullptr); #else CREATEFILE2_EXTENDED_PARAMETERS extended_parameters; - memset(&extended_parameters, 0, sizeof(extended_parameters)); + std::memset(&extended_parameters, 0, sizeof(extended_parameters)); extended_parameters.dwFileFlags = native_flags; auto handle = CreateFile2(w_filepath.c_str(), desired_access, share_mode, creation_disposition, &extended_parameters); #endif diff --git a/tdutils/td/utils/port/detail/Iocp.h b/tdutils/td/utils/port/detail/Iocp.h index e9c123e4..5a08e531 100644 --- a/tdutils/td/utils/port/detail/Iocp.h +++ b/tdutils/td/utils/port/detail/Iocp.h @@ -56,7 +56,7 @@ class IocpRef { IocpRef(IocpRef &&) = default; IocpRef &operator=(IocpRef &&) = default; - IocpRef(std::weak_ptr iocp_handle); + explicit IocpRef(std::weak_ptr iocp_handle); bool post(size_t size, Iocp::Callback *callback, WSAOVERLAPPED *overlapped); diff --git a/tdutils/td/utils/port/signals.cpp b/tdutils/td/utils/port/signals.cpp index a0611477..d02dae9d 100644 --- a/tdutils/td/utils/port/signals.cpp +++ b/tdutils/td/utils/port/signals.cpp @@ -316,7 +316,7 @@ static void default_failure_signal_handler(int sig) { } Status set_default_failure_signal_handler() { - atexit(block_stdin); + std::atexit(block_stdin); TRY_STATUS(setup_signals_alt_stack()); TRY_STATUS(set_signal_handler(SignalType::Abort, default_failure_signal_handler)); TRY_STATUS(set_signal_handler(SignalType::Error, default_failure_signal_handler)); diff --git a/tdutils/td/utils/port/stacktrace.cpp b/tdutils/td/utils/port/stacktrace.cpp index 7d9dcd7a..136b0f83 100644 --- a/tdutils/td/utils/port/stacktrace.cpp +++ b/tdutils/td/utils/port/stacktrace.cpp @@ -82,7 +82,7 @@ void print_backtrace_gdb(void) { #endif dup2(2, 1); // redirect output to stderr execlp("gdb", "gdb", "--batch", "-n", "-ex", "thread", "-ex", "thread apply all bt full", name_buf, pid_buf_begin, - NULL); + nullptr); return; } else { #if TD_LINUX && defined(PR_SET_PTRACER) diff --git a/tdutils/test/ConcurrentHashMap.cpp b/tdutils/test/ConcurrentHashMap.cpp index c26fa5f9..b2018352 100644 --- a/tdutils/test/ConcurrentHashMap.cpp +++ b/tdutils/test/ConcurrentHashMap.cpp @@ -43,7 +43,7 @@ class ArrayHashMap { } struct Node { std::atomic key{KeyT{}}; - std::atomic value{}; + std::atomic value{ValueT{}}; }; static std::string get_name() { return "ArrayHashMap"; @@ -188,7 +188,7 @@ class HashMapBenchmark : public td::Benchmark { size_t threads_n = 16; int mod_; - constexpr static size_t mul_ = 7273; //1000000000 + 7; + static constexpr size_t mul_ = 7273; //1000000000 + 7; int n_; public: @@ -235,7 +235,7 @@ class HashMapBenchmark : public td::Benchmark { }; template -void bench_hash_map() { +static void bench_hash_map() { td::bench(HashMapBenchmark(16)); td::bench(HashMapBenchmark(1)); } diff --git a/tdutils/test/EpochBasedMemoryReclamation.cpp b/tdutils/test/EpochBasedMemoryReclamation.cpp index de409d97..60673b93 100644 --- a/tdutils/test/EpochBasedMemoryReclamation.cpp +++ b/tdutils/test/EpochBasedMemoryReclamation.cpp @@ -15,7 +15,7 @@ #if !TD_THREAD_UNSUPPORTED TEST(EpochBaseMemoryReclamation, stress) { struct Node { - std::atomic name_; + std::atomic name_{nullptr}; char pad[64]; }; diff --git a/tdutils/test/misc.cpp b/tdutils/test/misc.cpp index 90042b34..e1446a43 100644 --- a/tdutils/test/misc.cpp +++ b/tdutils/test/misc.cpp @@ -872,7 +872,7 @@ class ValueB { }; template