Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ Checks: '*,
-readability-magic-numbers,
-cppcoreguidelines-avoid-do-while,
-llvmlibc-inline-function-decl,
-altera-struct-pack-align
-altera-struct-pack-align,
-boost-use-ranges
'
WarningsAsErrors: '*'
HeaderFilterRegex: 'src/*.hpp'
Expand Down
2 changes: 1 addition & 1 deletion cpr/cookies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const std::string Cookie::GetExpiresString() const {
#ifdef _WIN32
gmtime_s(&tm, &tt);
#else
// NOLINTNEXTLINE(misc-include-cleaner) False positive since <ctime> is included
// NOLINTNEXTLINE(misc-include-cleaner,cert-err33-c) False positive since <ctime> is included. Also ignore the ret value here.
gmtime_r(&tt, &tm);
#endif
ss << std::put_time(&tm, "%a, %d %b %Y %H:%M:%S GMT");
Expand Down
2 changes: 1 addition & 1 deletion cpr/multiperform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ std::vector<Response> MultiPerform::ReadMultiInfo(const std::function<Response(S
for (const std::pair<std::shared_ptr<Session>, HttpMethod>& pair : sessions_) {
Session& current_session = *(pair.first);
auto it = std::find_if(responses.begin(), responses.end(), [&current_session](const Response& response) { return current_session.curl_->handle == response.curl_->handle; });
const Response current_response = *it;
const Response current_response = *it; // NOLINT (performance-unnecessary-copy-initialization) False possible
// Erase response from original vector to increase future search speed
responses.erase(it);
sorted_responses.push_back(current_response);
Expand Down
3 changes: 3 additions & 0 deletions cpr/ssl_ctx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ using custom_unique_ptr = std::unique_ptr<T, deleter_from_fn<fn>>;
using x509_ptr = custom_unique_ptr<X509, X509_free>;
using bio_ptr = custom_unique_ptr<BIO, BIO_free>;

namespace {
inline std::string get_openssl_print_errors() {
std::ostringstream oss;
ERR_print_errors_cb(
Expand All @@ -66,6 +67,8 @@ inline std::string get_openssl_print_errors() {
return oss.str();
}

} // namespace

CURLcode sslctx_function_load_ca_cert_from_buffer(CURL* /*curl*/, void* sslctx, void* raw_cert_buf) {
// Check arguments
if (raw_cert_buf == nullptr || sslctx == nullptr) {
Expand Down
8 changes: 2 additions & 6 deletions cpr/threadpool.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "cpr/threadpool.h"
#include <algorithm>
#include <chrono>
#include <cstddef>
#include <ctime>
Expand All @@ -20,12 +21,7 @@ int ThreadPool::Start(size_t start_threads) {
return -1;
}
status = RUNNING;
if (start_threads < min_thread_num) {
start_threads = min_thread_num;
}
if (start_threads > max_thread_num) {
start_threads = max_thread_num;
}
start_threads = std::clamp(start_threads, min_thread_num, max_thread_num);
for (size_t i = 0; i < start_threads; ++i) {
CreateThread();
}
Expand Down
Loading