Skip to content

Commit d122ff3

Browse files
committed
Code formatting
1 parent 14c6d52 commit d122ff3

File tree

1 file changed

+36
-52
lines changed

1 file changed

+36
-52
lines changed

httplib.h

Lines changed: 36 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ using socket_t = int;
200200
#include <mutex>
201201
#include <random>
202202
#include <regex>
203+
#include <set>
203204
#include <sstream>
204205
#include <string>
205206
#include <sys/stat.h>
206207
#include <thread>
207-
#include <set>
208208

209209
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
210210
#include <openssl/err.h>
@@ -257,7 +257,7 @@ namespace detail {
257257

258258
template <class T, class... Args>
259259
typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
260-
make_unique(Args &&... args) {
260+
make_unique(Args &&...args) {
261261
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
262262
}
263263

@@ -487,7 +487,7 @@ class Stream {
487487
virtual socket_t socket() const = 0;
488488

489489
template <typename... Args>
490-
ssize_t write_format(const char *fmt, const Args &... args);
490+
ssize_t write_format(const char *fmt, const Args &...args);
491491
ssize_t write(const char *ptr);
492492
ssize_t write(const std::string &s);
493493
};
@@ -976,7 +976,8 @@ class ClientImpl {
976976

977977
void set_connection_timeout(time_t sec, time_t usec = 0);
978978
template <class Rep, class Period>
979-
void set_connection_timeout(const std::chrono::duration<Rep, Period> &duration);
979+
void
980+
set_connection_timeout(const std::chrono::duration<Rep, Period> &duration);
980981

981982
void set_read_timeout(time_t sec, time_t usec = 0);
982983
template <class Rep, class Period>
@@ -1286,7 +1287,8 @@ class Client {
12861287

12871288
void set_connection_timeout(time_t sec, time_t usec = 0);
12881289
template <class Rep, class Period>
1289-
void set_connection_timeout(const std::chrono::duration<Rep, Period> &duration);
1290+
void
1291+
set_connection_timeout(const std::chrono::duration<Rep, Period> &duration);
12901292

12911293
void set_read_timeout(time_t sec, time_t usec = 0);
12921294
template <class Rep, class Period>
@@ -3200,9 +3202,7 @@ inline void parse_query_text(const std::string &s, Params &params) {
32003202
std::set<std::string> cache;
32013203
split(s.data(), s.data() + s.size(), '&', [&](const char *b, const char *e) {
32023204
std::string kv(b, e);
3203-
if (cache.find(kv) != cache.end()) {
3204-
return;
3205-
}
3205+
if (cache.find(kv) != cache.end()) { return; }
32063206
cache.insert(kv);
32073207

32083208
std::string key;
@@ -3744,9 +3744,9 @@ inline std::pair<std::string, std::string> make_digest_authentication_header(
37443744

37453745
string response;
37463746
{
3747-
auto H = algo == "SHA-256"
3748-
? detail::SHA_256
3749-
: algo == "SHA-512" ? detail::SHA_512 : detail::MD5;
3747+
auto H = algo == "SHA-256" ? detail::SHA_256
3748+
: algo == "SHA-512" ? detail::SHA_512
3749+
: detail::MD5;
37503750

37513751
auto A1 = username + ":" + auth.at("realm") + ":" + password;
37523752

@@ -4058,7 +4058,7 @@ inline ssize_t Stream::write(const std::string &s) {
40584058
}
40594059

40604060
template <typename... Args>
4061-
inline ssize_t Stream::write_format(const char *fmt, const Args &... args) {
4061+
inline ssize_t Stream::write_format(const char *fmt, const Args &...args) {
40624062
const auto bufsiz = 2048;
40634063
std::array<char, bufsiz> buf;
40644064

@@ -4333,13 +4333,11 @@ inline Server &
43334333
Server::set_file_extension_and_mimetype_mapping(const char *ext,
43344334
const char *mime) {
43354335
file_extension_and_mimetype_map_[ext] = mime;
4336-
43374336
return *this;
43384337
}
43394338

43404339
inline Server &Server::set_file_request_handler(Handler handler) {
43414340
file_request_handler_ = std::move(handler);
4342-
43434341
return *this;
43444342
}
43454343

@@ -4373,7 +4371,6 @@ inline Server &Server::set_post_routing_handler(Handler handler) {
43734371

43744372
inline Server &Server::set_logger(Logger logger) {
43754373
logger_ = std::move(logger);
4376-
43774374
return *this;
43784375
}
43794376

@@ -4386,79 +4383,68 @@ Server::set_expect_100_continue_handler(Expect100ContinueHandler handler) {
43864383

43874384
inline Server &Server::set_tcp_nodelay(bool on) {
43884385
tcp_nodelay_ = on;
4389-
43904386
return *this;
43914387
}
43924388

43934389
inline Server &Server::set_socket_options(SocketOptions socket_options) {
43944390
socket_options_ = std::move(socket_options);
4395-
43964391
return *this;
43974392
}
43984393

43994394
inline Server &Server::set_keep_alive_max_count(size_t count) {
44004395
keep_alive_max_count_ = count;
4401-
44024396
return *this;
44034397
}
44044398

44054399
inline Server &Server::set_keep_alive_timeout(time_t sec) {
44064400
keep_alive_timeout_sec_ = sec;
4407-
44084401
return *this;
44094402
}
44104403

44114404
inline Server &Server::set_read_timeout(time_t sec, time_t usec) {
44124405
read_timeout_sec_ = sec;
44134406
read_timeout_usec_ = usec;
4414-
44154407
return *this;
44164408
}
44174409

44184410
template <class Rep, class Period>
4419-
inline Server &Server::set_read_timeout(
4420-
const std::chrono::duration<Rep, Period> &duration) {
4421-
detail::duration_to_sec_and_usec(duration, [&](time_t sec, time_t usec) {
4422-
set_read_timeout(sec, usec);
4423-
});
4411+
inline Server &
4412+
Server::set_read_timeout(const std::chrono::duration<Rep, Period> &duration) {
4413+
detail::duration_to_sec_and_usec(
4414+
duration, [&](time_t sec, time_t usec) { set_read_timeout(sec, usec); });
44244415
return *this;
44254416
}
44264417

44274418
inline Server &Server::set_write_timeout(time_t sec, time_t usec) {
44284419
write_timeout_sec_ = sec;
44294420
write_timeout_usec_ = usec;
4430-
44314421
return *this;
44324422
}
44334423

44344424
template <class Rep, class Period>
4435-
inline Server &Server::set_write_timeout(
4436-
const std::chrono::duration<Rep, Period> &duration) {
4437-
detail::duration_to_sec_and_usec(duration, [&](time_t sec, time_t usec) {
4438-
set_write_timeout(sec, usec);
4439-
});
4425+
inline Server &
4426+
Server::set_write_timeout(const std::chrono::duration<Rep, Period> &duration) {
4427+
detail::duration_to_sec_and_usec(
4428+
duration, [&](time_t sec, time_t usec) { set_write_timeout(sec, usec); });
44404429
return *this;
44414430
}
44424431

44434432
inline Server &Server::set_idle_interval(time_t sec, time_t usec) {
44444433
idle_interval_sec_ = sec;
44454434
idle_interval_usec_ = usec;
4446-
44474435
return *this;
44484436
}
44494437

44504438
template <class Rep, class Period>
4451-
inline Server &Server::set_idle_interval(
4452-
const std::chrono::duration<Rep, Period> &duration) {
4453-
detail::duration_to_sec_and_usec(duration, [&](time_t sec, time_t usec) {
4454-
set_idle_interval(sec, usec);
4455-
});
4439+
inline Server &
4440+
Server::set_idle_interval(const std::chrono::duration<Rep, Period> &duration) {
4441+
detail::duration_to_sec_and_usec(
4442+
duration, [&](time_t sec, time_t usec) { set_idle_interval(sec, usec); });
44564443
return *this;
44574444
}
44584445

44594446
inline Server &Server::set_payload_max_length(size_t length) {
44604447
payload_max_length_ = length;
4461-
44624448
return *this;
44634449
}
44644450

@@ -6339,7 +6325,7 @@ inline void ClientImpl::set_connection_timeout(time_t sec, time_t usec) {
63396325

63406326
template <class Rep, class Period>
63416327
inline void ClientImpl::set_connection_timeout(
6342-
const std::chrono::duration<Rep, Period> &duration) {
6328+
const std::chrono::duration<Rep, Period> &duration) {
63436329
detail::duration_to_sec_and_usec(duration, [&](time_t sec, time_t usec) {
63446330
set_connection_timeout(sec, usec);
63456331
});
@@ -6352,10 +6338,9 @@ inline void ClientImpl::set_read_timeout(time_t sec, time_t usec) {
63526338

63536339
template <class Rep, class Period>
63546340
inline void ClientImpl::set_read_timeout(
6355-
const std::chrono::duration<Rep, Period> &duration) {
6356-
detail::duration_to_sec_and_usec(duration, [&](time_t sec, time_t usec) {
6357-
set_read_timeout(sec, usec);
6358-
});
6341+
const std::chrono::duration<Rep, Period> &duration) {
6342+
detail::duration_to_sec_and_usec(
6343+
duration, [&](time_t sec, time_t usec) { set_read_timeout(sec, usec); });
63596344
}
63606345

63616346
inline void ClientImpl::set_write_timeout(time_t sec, time_t usec) {
@@ -6365,10 +6350,9 @@ inline void ClientImpl::set_write_timeout(time_t sec, time_t usec) {
63656350

63666351
template <class Rep, class Period>
63676352
inline void ClientImpl::set_write_timeout(
6368-
const std::chrono::duration<Rep, Period> &duration) {
6369-
detail::duration_to_sec_and_usec(duration, [&](time_t sec, time_t usec) {
6370-
set_write_timeout(sec, usec);
6371-
});
6353+
const std::chrono::duration<Rep, Period> &duration) {
6354+
detail::duration_to_sec_and_usec(
6355+
duration, [&](time_t sec, time_t usec) { set_write_timeout(sec, usec); });
63726356
}
63736357

63746358
inline void ClientImpl::set_basic_auth(const char *username,
@@ -7471,7 +7455,7 @@ inline void Client::set_connection_timeout(time_t sec, time_t usec) {
74717455

74727456
template <class Rep, class Period>
74737457
inline void Client::set_connection_timeout(
7474-
const std::chrono::duration<Rep, Period> &duration) {
7458+
const std::chrono::duration<Rep, Period> &duration) {
74757459
cli_->set_connection_timeout(duration);
74767460
}
74777461

@@ -7480,8 +7464,8 @@ inline void Client::set_read_timeout(time_t sec, time_t usec) {
74807464
}
74817465

74827466
template <class Rep, class Period>
7483-
inline void Client::set_read_timeout(
7484-
const std::chrono::duration<Rep, Period> &duration) {
7467+
inline void
7468+
Client::set_read_timeout(const std::chrono::duration<Rep, Period> &duration) {
74857469
cli_->set_read_timeout(duration);
74867470
}
74877471

@@ -7490,8 +7474,8 @@ inline void Client::set_write_timeout(time_t sec, time_t usec) {
74907474
}
74917475

74927476
template <class Rep, class Period>
7493-
inline void Client::set_write_timeout(
7494-
const std::chrono::duration<Rep, Period> &duration) {
7477+
inline void
7478+
Client::set_write_timeout(const std::chrono::duration<Rep, Period> &duration) {
74957479
cli_->set_write_timeout(duration);
74967480
}
74977481

0 commit comments

Comments
 (0)