refactor: fix readability-redundant-string-cstr warnings found by clang-tidy-16 (#4529)

This commit is contained in:
Charles Kerr
2023-01-03 21:43:54 -06:00
committed by GitHub
parent dc968892ec
commit ee0877c99d
2 changed files with 2 additions and 5 deletions

View File

@@ -474,7 +474,7 @@ tr_device_info tr_device_info_create(std::string_view path)
out.path = path; out.path = path;
#ifndef _WIN32 #ifndef _WIN32
out.device = getblkdev(out.path); out.device = getblkdev(out.path);
auto const* const fstype = getfstype(out.path.c_str()); auto const* const fstype = getfstype(out.path);
out.fstype = fstype != nullptr ? fstype : ""; out.fstype = fstype != nullptr ? fstype : "";
#endif #endif
return out; return out;

View File

@@ -382,10 +382,7 @@ static bool isHostnameAllowed(tr_rpc_server const* server, evhttp_request const*
} }
auto const& src = server->host_whitelist_; auto const& src = server->host_whitelist_;
return std::any_of( return std::any_of(std::begin(src), std::end(src), [&hostname](auto const& str) { return tr_wildmat(hostname, str); });
std::begin(src),
std::end(src),
[&hostname](auto const& str) { return tr_wildmat(hostname.c_str(), str.c_str()); });
} }
static bool test_session_id(tr_rpc_server const* server, evhttp_request const* req) static bool test_session_id(tr_rpc_server const* server, evhttp_request const* req)