1
0
mirror of synced 2025-04-28 09:25:05 +03:00

Code cleanup. (Removed unnecessary .c_str() calls)

This commit is contained in:
yhirose 2023-10-23 16:43:12 -04:00
parent 20a7f088ce
commit e2813d9d4d

View File

@ -3326,7 +3326,7 @@ find_content_type(const std::string &path,
auto ext = file_extension(path); auto ext = file_extension(path);
auto it = user_data.find(ext); auto it = user_data.find(ext);
if (it != user_data.end()) { return it->second.c_str(); } if (it != user_data.end()) { return it->second; }
using udl::operator""_t; using udl::operator""_t;
@ -6082,7 +6082,7 @@ inline bool Server::handle_file_request(const Request &req, Response &res,
if (detail::is_file(path)) { if (detail::is_file(path)) {
for (const auto &kv : entry.headers) { for (const auto &kv : entry.headers) {
res.set_header(kv.first.c_str(), kv.second); res.set_header(kv.first, kv.second);
} }
auto mm = std::make_shared<detail::mmap>(path.c_str()); auto mm = std::make_shared<detail::mmap>(path.c_str());
@ -6992,7 +6992,7 @@ inline bool ClientImpl::redirect(Request &req, Response &res, Error &error) {
} else { } else {
if (next_scheme == "https") { if (next_scheme == "https") {
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT #ifdef CPPHTTPLIB_OPENSSL_SUPPORT
SSLClient cli(next_host.c_str(), next_port); SSLClient cli(next_host, next_port);
cli.copy_settings(*this); cli.copy_settings(*this);
if (ca_cert_store_) { cli.set_ca_cert_store(ca_cert_store_); } if (ca_cert_store_) { cli.set_ca_cert_store(ca_cert_store_); }
return detail::redirect(cli, req, res, path, location, error); return detail::redirect(cli, req, res, path, location, error);
@ -7000,7 +7000,7 @@ inline bool ClientImpl::redirect(Request &req, Response &res, Error &error) {
return false; return false;
#endif #endif
} else { } else {
ClientImpl cli(next_host.c_str(), next_port); ClientImpl cli(next_host, next_port);
cli.copy_settings(*this); cli.copy_settings(*this);
return detail::redirect(cli, req, res, path, location, error); return detail::redirect(cli, req, res, path, location, error);
} }
@ -7478,7 +7478,7 @@ inline Result ClientImpl::Get(const std::string &path, const Params &params,
if (params.empty()) { return Get(path, headers); } if (params.empty()) { return Get(path, headers); }
std::string path_with_query = append_query_params(path, params); std::string path_with_query = append_query_params(path, params);
return Get(path_with_query.c_str(), headers, progress); return Get(path_with_query, headers, progress);
} }
inline Result ClientImpl::Get(const std::string &path, const Params &params, inline Result ClientImpl::Get(const std::string &path, const Params &params,
@ -7498,7 +7498,7 @@ inline Result ClientImpl::Get(const std::string &path, const Params &params,
} }
std::string path_with_query = append_query_params(path, params); std::string path_with_query = append_query_params(path, params);
return Get(path_with_query.c_str(), headers, response_handler, return Get(path_with_query, headers, response_handler,
content_receiver, progress); content_receiver, progress);
} }
@ -7601,7 +7601,7 @@ inline Result ClientImpl::Post(const std::string &path, const Headers &headers,
const auto &content_type = const auto &content_type =
detail::serialize_multipart_formdata_get_content_type(boundary); detail::serialize_multipart_formdata_get_content_type(boundary);
const auto &body = detail::serialize_multipart_formdata(items, boundary); const auto &body = detail::serialize_multipart_formdata(items, boundary);
return Post(path, headers, body, content_type.c_str()); return Post(path, headers, body, content_type);
} }
inline Result ClientImpl::Post(const std::string &path, const Headers &headers, inline Result ClientImpl::Post(const std::string &path, const Headers &headers,
@ -7614,7 +7614,7 @@ inline Result ClientImpl::Post(const std::string &path, const Headers &headers,
const auto &content_type = const auto &content_type =
detail::serialize_multipart_formdata_get_content_type(boundary); detail::serialize_multipart_formdata_get_content_type(boundary);
const auto &body = detail::serialize_multipart_formdata(items, boundary); const auto &body = detail::serialize_multipart_formdata(items, boundary);
return Post(path, headers, body, content_type.c_str()); return Post(path, headers, body, content_type);
} }
inline Result inline Result