Skip to content

Commit fe12554

Browse files
committed
Clang-Tidy updates
1 parent 2eb8144 commit fe12554

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

cpr/cookies.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const std::string Cookie::GetExpiresString() const {
3434
#ifdef _WIN32
3535
gmtime_s(&tm, &tt);
3636
#else
37-
// NOLINTNEXTLINE(misc-include-cleaner) False positive since <ctime> is included
37+
// NOLINTNEXTLINE(misc-include-cleaner,cert-err33-c) False positive since <ctime> is included. Also ignore the ret value here.
3838
gmtime_r(&tt, &tm);
3939
#endif
4040
ss << std::put_time(&tm, "%a, %d %b %Y %H:%M:%S GMT");

cpr/multiperform.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ std::vector<Response> MultiPerform::ReadMultiInfo(const std::function<Response(S
162162
for (const std::pair<std::shared_ptr<Session>, HttpMethod>& pair : sessions_) {
163163
Session& current_session = *(pair.first);
164164
auto it = std::find_if(responses.begin(), responses.end(), [&current_session](const Response& response) { return current_session.curl_->handle == response.curl_->handle; });
165-
const Response current_response = *it;
165+
const Response& current_response = *it;
166166
// Erase response from original vector to increase future search speed
167167
responses.erase(it);
168168
sorted_responses.push_back(current_response);

cpr/ssl_ctx.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ using custom_unique_ptr = std::unique_ptr<T, deleter_from_fn<fn>>;
5454
using x509_ptr = custom_unique_ptr<X509, X509_free>;
5555
using bio_ptr = custom_unique_ptr<BIO, BIO_free>;
5656

57+
namespace {
5758
inline std::string get_openssl_print_errors() {
5859
std::ostringstream oss;
5960
ERR_print_errors_cb(
@@ -66,6 +67,8 @@ inline std::string get_openssl_print_errors() {
6667
return oss.str();
6768
}
6869

70+
} // namespace
71+
6972
CURLcode sslctx_function_load_ca_cert_from_buffer(CURL* /*curl*/, void* sslctx, void* raw_cert_buf) {
7073
// Check arguments
7174
if (raw_cert_buf == nullptr || sslctx == nullptr) {

cpr/threadpool.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "cpr/threadpool.h"
2+
#include <algorithm>
23
#include <chrono>
34
#include <cstddef>
45
#include <ctime>
@@ -20,12 +21,7 @@ int ThreadPool::Start(size_t start_threads) {
2021
return -1;
2122
}
2223
status = RUNNING;
23-
if (start_threads < min_thread_num) {
24-
start_threads = min_thread_num;
25-
}
26-
if (start_threads > max_thread_num) {
27-
start_threads = max_thread_num;
28-
}
24+
start_threads = std::clamp(start_threads, min_thread_num, max_thread_num);
2925
for (size_t i = 0; i < start_threads; ++i) {
3026
CreateThread();
3127
}

0 commit comments

Comments
 (0)