Skip to content

Commit ed129f0

Browse files
committed
Fixed C++11 warnings and code format
1 parent eab5ea0 commit ed129f0

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

httplib.h

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5252,7 +5252,7 @@ inline Server &Server::set_error_handler(HandlerWithResponse handler) {
52525252
}
52535253

52545254
inline Server &Server::set_error_handler(Handler handler) {
5255-
error_handler_ = [handler = std::move(handler)](const Request &req, Response &res) {
5255+
error_handler_ = [handler](const Request &req, Response &res) {
52565256
handler(req, res);
52575257
return HandlerResponse::Handled;
52585258
};
@@ -7579,9 +7579,7 @@ inline void ClientImpl::set_proxy_digest_auth(const std::string &username,
75797579
proxy_digest_auth_username_ = username;
75807580
proxy_digest_auth_password_ = password;
75817581
}
7582-
#endif
75837582

7584-
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
75857583
inline void ClientImpl::set_ca_cert_path(const std::string &ca_cert_file_path,
75867584
const std::string &ca_cert_dir_path) {
75877585
ca_cert_file_path_ = ca_cert_file_path;
@@ -7596,7 +7594,7 @@ inline void ClientImpl::set_ca_cert_store(X509_STORE *ca_cert_store) {
75967594

75977595
inline X509_STORE *ClientImpl::create_ca_cert_store(const char *ca_cert,
75987596
std::size_t size) {
7599-
auto mem = BIO_new_mem_buf(ca_cert, size);
7597+
auto mem = BIO_new_mem_buf(ca_cert, static_cast<int>(size));
76007598
if (!mem) return nullptr;
76017599

76027600
auto inf = PEM_X509_INFO_read_bio(mem, nullptr, nullptr, nullptr);
@@ -7607,24 +7605,20 @@ inline X509_STORE *ClientImpl::create_ca_cert_store(const char *ca_cert,
76077605

76087606
auto cts = X509_STORE_new();
76097607
if (cts) {
7610-
for (int first = 0, last = sk_X509_INFO_num(inf); first < last; ++first) {
7608+
for (auto first = 0, last = sk_X509_INFO_num(inf); first < last; ++first) {
76117609
auto itmp = sk_X509_INFO_value(inf, first);
7612-
if (!itmp) continue;
7613-
7614-
if (itmp->x509) X509_STORE_add_cert(cts, itmp->x509);
7610+
if (!itmp) { continue; }
76157611

7616-
if (itmp->crl) X509_STORE_add_crl(cts, itmp->crl);
7612+
if (itmp->x509) { X509_STORE_add_cert(cts, itmp->x509); }
7613+
if (itmp->crl) { X509_STORE_add_crl(cts, itmp->crl); }
76177614
}
76187615
}
76197616

76207617
sk_X509_INFO_pop_free(inf, X509_INFO_free);
76217618
BIO_free_all(mem);
7622-
76237619
return cts;
76247620
}
7625-
#endif
76267621

7627-
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
76287622
inline void ClientImpl::enable_server_certificate_verification(bool enabled) {
76297623
server_certificate_verification_ = enabled;
76307624
}

0 commit comments

Comments
 (0)