Various style fixes.

GitOrigin-RevId: 056c091cfd71322a0cc8db0e3bafec7d272da7ad
This commit is contained in:
levlam 2018-08-16 01:06:53 +03:00
parent 966eb11fe1
commit 23c03a97f4
10 changed files with 22 additions and 20 deletions

View File

@ -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"

View File

@ -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<TdApiAuthorizationForm> promise,
Result<std::pair<std::map<SecureValueType, SuitableSecureValue>, TdApiAuthorizationForm>>
r_authorization_form) {
Result<std::pair<std::map<SecureValueType, SuitableSecureValue>, TdApiAuthorizationForm>> r_authorization_form) {
auto it = authorization_forms_.find(authorization_form_id);
CHECK(it != authorization_forms_.end());
CHECK(it->second.is_received == false);

View File

@ -22,6 +22,7 @@
#include <map>
#include <memory>
#include <unordered_map>
#include <utility>
namespace td {
@ -73,8 +74,7 @@ class SecureManager : public NetQueryCallback {
void on_delete_secure_value(SecureValueType type, Promise<Unit> promise, Result<Unit> result);
void on_get_passport_authorization_form(
int32 authorization_form_id, Promise<TdApiAuthorizationForm> promise,
Result<std::pair<std::map<SecureValueType, SuitableSecureValue>, TdApiAuthorizationForm>>
r_authorization_form);
Result<std::pair<std::map<SecureValueType, SuitableSecureValue>, TdApiAuthorizationForm>> r_authorization_form);
void on_result(NetQueryPtr query) override;
Container<Promise<NetQueryPtr>> container_;

View File

@ -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"

View File

@ -10,6 +10,7 @@
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include "td/utils/port/Fd.h"
namespace td {
namespace detail {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 <openssl/err.h>
#include <openssl/evp.h>
@ -20,6 +20,7 @@
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include <cstring>
#include <map>
#include <mutex>
@ -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<void *>(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<SslStreamImpl *>(BIO_get_data(b));
CHECK(stream);
auto *stream = static_cast<SslStreamImpl *>(BIO_get_data(b));
CHECK(stream != nullptr);
BIO_clear_retry_flags(b);
int res = narrow_cast<int>(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<SslStreamImpl *>(BIO_get_data(b));
CHECK(stream);
auto *stream = static_cast<SslStreamImpl *>(BIO_get_data(b));
CHECK(stream != nullptr);
BIO_clear_retry_flags(b);
return narrow_cast<int>(stream->flow_write(Slice(buf, len)));
}

View File

@ -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<detail::SslStreamImpl> impl_;
SslStream(std::unique_ptr<detail::SslStreamImpl> impl);
explicit SslStream(std::unique_ptr<detail::SslStreamImpl> impl);
};
} // namespace td

View File

@ -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 {