diff --git a/benchmark/bench_http.cpp b/benchmark/bench_http.cpp index c2755b9f0..5d4cf95c1 100644 --- a/benchmark/bench_http.cpp +++ b/benchmark/bench_http.cpp @@ -8,6 +8,7 @@ #include "td/net/HttpOutboundConnection.h" #include "td/net/HttpQuery.h" +#include "td/net/SslStream.h" #include "td/utils/buffer.h" #include "td/utils/logging.h" diff --git a/td/telegram/SecureManager.cpp b/td/telegram/SecureManager.cpp index ae7a7669b..fcd8cc07c 100644 --- a/td/telegram/SecureManager.cpp +++ b/td/telegram/SecureManager.cpp @@ -1057,8 +1057,7 @@ void SecureManager::get_passport_authorization_form(string password, UserId bot_ void SecureManager::on_get_passport_authorization_form( int32 authorization_form_id, Promise promise, - Result, TdApiAuthorizationForm>> - r_authorization_form) { + Result, TdApiAuthorizationForm>> r_authorization_form) { auto it = authorization_forms_.find(authorization_form_id); CHECK(it != authorization_forms_.end()); CHECK(it->second.is_received == false); diff --git a/td/telegram/SecureManager.h b/td/telegram/SecureManager.h index 6dbe1915e..05e30a071 100644 --- a/td/telegram/SecureManager.h +++ b/td/telegram/SecureManager.h @@ -22,6 +22,7 @@ #include #include #include +#include namespace td { @@ -73,8 +74,7 @@ class SecureManager : public NetQueryCallback { void on_delete_secure_value(SecureValueType type, Promise promise, Result result); void on_get_passport_authorization_form( int32 authorization_form_id, Promise promise, - Result, TdApiAuthorizationForm>> - r_authorization_form); + Result, TdApiAuthorizationForm>> r_authorization_form); void on_result(NetQueryPtr query) override; Container> container_; diff --git a/td/telegram/files/FileGenerateManager.cpp b/td/telegram/files/FileGenerateManager.cpp index b7f90f0b5..c78169613 100644 --- a/td/telegram/files/FileGenerateManager.cpp +++ b/td/telegram/files/FileGenerateManager.cpp @@ -7,6 +7,7 @@ #include "td/telegram/files/FileGenerateManager.h" #include "td/telegram/td_api.h" +#include "td/telegram/telegram_api.h" #include "td/telegram/files/FileId.h" #include "td/telegram/files/FileLoaderUtils.h" diff --git a/tdnet/td/net/HttpConnectionBase.cpp b/tdnet/td/net/HttpConnectionBase.cpp index 3d05a6fd4..67dc7bd2a 100644 --- a/tdnet/td/net/HttpConnectionBase.cpp +++ b/tdnet/td/net/HttpConnectionBase.cpp @@ -10,6 +10,7 @@ #include "td/utils/logging.h" #include "td/utils/misc.h" +#include "td/utils/port/Fd.h" namespace td { namespace detail { diff --git a/tdnet/td/net/HttpConnectionBase.h b/tdnet/td/net/HttpConnectionBase.h index f5a3aae99..8f836d644 100644 --- a/tdnet/td/net/HttpConnectionBase.h +++ b/tdnet/td/net/HttpConnectionBase.h @@ -14,8 +14,8 @@ #include "td/utils/buffer.h" #include "td/utils/BufferedFd.h" +#include "td/utils/ByteFlow.h" #include "td/utils/port/SocketFd.h" -#include "td/utils/Slice.h" #include "td/utils/Status.h" namespace td { diff --git a/tdnet/td/net/HttpOutboundConnection.h b/tdnet/td/net/HttpOutboundConnection.h index 28ce83fbe..c1166224c 100644 --- a/tdnet/td/net/HttpOutboundConnection.h +++ b/tdnet/td/net/HttpOutboundConnection.h @@ -10,7 +10,9 @@ #include "td/net/HttpConnectionBase.h" #include "td/net/HttpQuery.h" +#include "td/net/SslStream.h" +#include "td/utils/port/SocketFd.h" #include "td/utils/Status.h" namespace td { diff --git a/tdnet/td/net/SslStream.cpp b/tdnet/td/net/SslStream.cpp index 0fa545700..45c3f7dfc 100644 --- a/tdnet/td/net/SslStream.cpp +++ b/tdnet/td/net/SslStream.cpp @@ -7,12 +7,12 @@ #include "td/net/SslStream.h" #include "td/utils/logging.h" +#include "td/utils/misc.h" #include "td/utils/port/wstring_convert.h" #include "td/utils/StackAllocator.h" #include "td/utils/Status.h" #include "td/utils/StringBuilder.h" #include "td/utils/Time.h" -#include "td/utils/misc.h" #include #include @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -47,7 +48,7 @@ int BIO_get_new_index() { } BIO_METHOD *BIO_meth_new(int type, const char *name) { auto res = new BIO_METHOD(); - memset(res, 0, sizeof(*res)); + std::memset(res, 0, sizeof(*res)); return res; } @@ -308,7 +309,7 @@ class SslStreamImpl { #endif auto *bio = BIO_new(BIO_s_sslstream()); - BIO_set_data(bio, this); + BIO_set_data(bio, static_cast(this)); SSL_set_bio(ssl_handle, bio, bio); #if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT) @@ -370,7 +371,7 @@ class SslStreamImpl { class SslReadByteFlow : public ByteFlowBase { public: - SslReadByteFlow(SslStreamImpl *stream) : stream_(stream) { + explicit SslReadByteFlow(SslStreamImpl *stream) : stream_(stream) { } void loop() override { bool was_append = false; @@ -393,7 +394,7 @@ class SslStreamImpl { } size_t read(MutableSlice data) { - return input_->advance(std::min(data.size(), input_->size()), data); + return input_->advance(min(data.size(), input_->size()), data); } private: @@ -402,7 +403,7 @@ class SslStreamImpl { class SslWriteByteFlow : public ByteFlowBase { public: - SslWriteByteFlow(SslStreamImpl *stream) : stream_(stream) { + explicit SslWriteByteFlow(SslStreamImpl *stream) : stream_(stream) { } void loop() override { while (!input_->empty()) { @@ -477,8 +478,8 @@ class SslStreamImpl { namespace { int strm_read(BIO *b, char *buf, int len) { - auto *stream = reinterpret_cast(BIO_get_data(b)); - CHECK(stream); + auto *stream = static_cast(BIO_get_data(b)); + CHECK(stream != nullptr); BIO_clear_retry_flags(b); int res = narrow_cast(stream->flow_read(MutableSlice(buf, len))); if (res == 0) { @@ -488,8 +489,8 @@ int strm_read(BIO *b, char *buf, int len) { return res; } int strm_write(BIO *b, const char *buf, int len) { - auto *stream = reinterpret_cast(BIO_get_data(b)); - CHECK(stream); + auto *stream = static_cast(BIO_get_data(b)); + CHECK(stream != nullptr); BIO_clear_retry_flags(b); return narrow_cast(stream->flow_write(Slice(buf, len))); } diff --git a/tdnet/td/net/SslStream.h b/tdnet/td/net/SslStream.h index cf70fbb83..1801a4f71 100644 --- a/tdnet/td/net/SslStream.h +++ b/tdnet/td/net/SslStream.h @@ -6,10 +6,7 @@ // #pragma once -#include "td/utils/BufferedFd.h" #include "td/utils/ByteFlow.h" -#include "td/utils/port/Fd.h" -#include "td/utils/port/SocketFd.h" #include "td/utils/Slice.h" #include "td/utils/Status.h" @@ -43,7 +40,7 @@ class SslStream { private: std::unique_ptr impl_; - SslStream(std::unique_ptr impl); + explicit SslStream(std::unique_ptr impl); }; } // namespace td diff --git a/tdutils/td/utils/ByteFlow.h b/tdutils/td/utils/ByteFlow.h index 260f6bd3e..5b9c206cd 100644 --- a/tdutils/td/utils/ByteFlow.h +++ b/tdutils/td/utils/ByteFlow.h @@ -247,7 +247,7 @@ class ByteFlowSink : public ByteFlowInterface { class ByteFlowMoveSink : public ByteFlowInterface { public: ByteFlowMoveSink() = default; - ByteFlowMoveSink(ChainBufferWriter *output) { + explicit ByteFlowMoveSink(ChainBufferWriter *output) { set_output(output); } void set_input(ChainBufferReader *input) final {