summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-03-25 20:49:34 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2022-03-25 20:49:34 +0000
commit32d59ad5a34000d56093ed735ef3b6793529b599 (patch)
treeee7b077ab07f14976a40ad57e347af7904229b4a
parentCTF get return str content by move (diff)
downloadlibadhocutil-32d59ad5a34000d56093ed735ef3b6793529b599.tar.bz2
libadhocutil-32d59ad5a34000d56093ed735ef3b6793529b599.tar.xz
libadhocutil-32d59ad5a34000d56093ed735ef3b6793529b599.zip
Fixup from clang-tidy-14
-rw-r--r--libadhocutil/curlHandle.cpp3
-rw-r--r--libadhocutil/curlHandle.h4
-rw-r--r--libadhocutil/curlStream.cpp3
-rw-r--r--libadhocutil/curlStream.h6
-rw-r--r--libadhocutil/handle.h4
-rw-r--r--libadhocutil/lexer-regex.cpp8
6 files changed, 13 insertions, 15 deletions
diff --git a/libadhocutil/curlHandle.cpp b/libadhocutil/curlHandle.cpp
index bcb5fa0..d7a91ae 100644
--- a/libadhocutil/curlHandle.cpp
+++ b/libadhocutil/curlHandle.cpp
@@ -13,8 +13,7 @@ namespace AdHoc::Net {
curl_global_cleanup();
}
- CurlHandle::CurlHandle(const std::string & url) :
- curl_handle(curl_easy_init()), curl_headers(nullptr), postS(nullptr), postE(nullptr)
+ CurlHandle::CurlHandle(const std::string & url) : curl_handle(curl_easy_init())
{
curl_easy_setopt(curl_handle, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl_handle, CURLOPT_FAILONERROR, 1);
diff --git a/libadhocutil/curlHandle.h b/libadhocutil/curlHandle.h
index d1c6471..dd81989 100644
--- a/libadhocutil/curlHandle.h
+++ b/libadhocutil/curlHandle.h
@@ -52,8 +52,8 @@ namespace AdHoc::Net {
void checkCurlCode(CURLcode res) const;
CURL * curl_handle;
- curl_slist * curl_headers;
- curl_httppost *postS, *postE;
+ curl_slist * curl_headers {nullptr};
+ curl_httppost *postS {nullptr}, *postE {nullptr};
/// @endcond
};
using CurlHandlePtr = std::shared_ptr<CurlHandle>;
diff --git a/libadhocutil/curlStream.cpp b/libadhocutil/curlStream.cpp
index 051bbcf..8a60f40 100644
--- a/libadhocutil/curlStream.cpp
+++ b/libadhocutil/curlStream.cpp
@@ -4,8 +4,7 @@
namespace AdHoc::Net {
- CurlStreamSource::CurlStreamSource(const std::string & url) :
- CurlHandle(url), buflen(0), buf(nullptr), res(CURLE_OK)
+ CurlStreamSource::CurlStreamSource(const std::string & url) : CurlHandle(url)
{
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, &CurlStreamSource::recvWrapper);
curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, this);
diff --git a/libadhocutil/curlStream.h b/libadhocutil/curlStream.h
index ce99a12..58e5015 100644
--- a/libadhocutil/curlStream.h
+++ b/libadhocutil/curlStream.h
@@ -37,9 +37,9 @@ namespace AdHoc::Net {
DLL_PRIVATE static size_t recvWrapper(void * data, size_t sz, size_t nm, void * css);
DLL_PRIVATE std::streamsize recv(void * data, std::streamsize datalen);
- std::streamsize buflen;
- char * buf;
- CURLcode res;
+ std::streamsize buflen {0};
+ char * buf {nullptr};
+ CURLcode res {CURLE_OK};
};
using CurlStream = boost::iostreams::stream<boost::reference_wrapper<CurlStreamSource>>;
diff --git a/libadhocutil/handle.h b/libadhocutil/handle.h
index 97770d9..c634049 100644
--- a/libadhocutil/handle.h
+++ b/libadhocutil/handle.h
@@ -9,7 +9,7 @@ namespace AdHoc {
template<typename T, typename D> class Handle {
public:
/// Constructs a Handle that owns t, to be tidied with d
- Handle(T t, D d) noexcept : inst(std::move(t)), deleter(std::move(d)), owning(true) { }
+ Handle(T t, D d) noexcept : inst(std::move(t)), deleter(std::move(d)) { }
/// Constructs a Handle that takes over ownership of h
Handle(Handle && h) noexcept : inst(std::move(h.inst)), deleter(std::move(h.deleter)), owning(h.owning)
@@ -96,7 +96,7 @@ namespace AdHoc {
private:
T inst;
D deleter;
- bool owning;
+ bool owning {true};
};
template<typename T, typename D, typename... Args>
diff --git a/libadhocutil/lexer-regex.cpp b/libadhocutil/lexer-regex.cpp
index 5f2ceaa..f0cd27c 100644
--- a/libadhocutil/lexer-regex.cpp
+++ b/libadhocutil/lexer-regex.cpp
@@ -14,7 +14,7 @@ namespace AdHoc::LexerMatchers {
class Regex : public Lexer::Pattern {
public:
Regex(const Glib::ustring & pattern, GRegexCompileFlags compile, GRegexMatchFlags match) :
- err(nullptr), regex(g_regex_new(pattern.c_str(), compile, match, &err)), info(nullptr), str(nullptr)
+ regex(g_regex_new(pattern.c_str(), compile, match, &err))
{
if (!regex) {
auto msg = std::string("Failed to create GRegex: ") + err->message;
@@ -75,10 +75,10 @@ namespace AdHoc::LexerMatchers {
}
private:
- mutable GError * err;
+ mutable GError * err {nullptr};
GRegex * regex;
- mutable GMatchInfo * info;
- mutable const gchar * str;
+ mutable GMatchInfo * info {nullptr};
+ mutable const gchar * str {nullptr};
};
Lexer::PatternPtr