From e3f7ecc6bdf7bbd1ae7ec10c387e15743842db90 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Thu, 10 Aug 2017 21:10:23 +0200 Subject: Fix some issues and improvements found by cppcheck --- src/gui_qt.cc | 4 ++-- src/protocols.cc | 2 -- src/ssl_openssl.cc | 2 +- src/url.hh | 1 + test/test-http.cc | 3 +++ 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/gui_qt.cc b/src/gui_qt.cc index 16102d6..76611e4 100644 --- a/src/gui_qt.cc +++ b/src/gui_qt.cc @@ -922,8 +922,8 @@ void QtGuiStatusBar::set_override(std::string const& str) { class QtGuiAbout : public virtual GuiAbout, public QtGuiWindow { public: QtGuiAbout(std::string const& title, std::string const& version, - std::vector const& authors) { - title_ = title + " " + version; + std::vector const& authors) + : title_(title + " " + version) { auto it = authors.begin(); while (it != authors.end()) { text_ += *it++; diff --git a/src/protocols.cc b/src/protocols.cc index 8d3689c..9598093 100644 --- a/src/protocols.cc +++ b/src/protocols.cc @@ -327,8 +327,6 @@ private: match.reset(); } else if (text) { cache_entry_with_lock(id, size, std::move(match), std::move(text)); - assert(!match); - assert(!text); id = 0; offset = 0; } diff --git a/src/ssl_openssl.cc b/src/ssl_openssl.cc index 14c3162..046687b 100644 --- a/src/ssl_openssl.cc +++ b/src/ssl_openssl.cc @@ -137,7 +137,7 @@ public: SSLImpl(Logger* logger, uint16_t flags) : logger_(logger), flags_(flags), bio_meth_(BIO_meth_new(99 | BIO_TYPE_SOURCE_SINK, "SSLImpl")), - ctx_(nullptr), ssl_(nullptr), + ctx_(nullptr), ssl_(nullptr), state_(HANDSHAKE), bio_(nullptr), rbuf_(nullptr), wbuf_(nullptr) { BIO_meth_set_write(bio_meth_, bio_write); BIO_meth_set_read(bio_meth_, bio_read); diff --git a/src/url.hh b/src/url.hh index 77027d2..e7af890 100644 --- a/src/url.hh +++ b/src/url.hh @@ -59,6 +59,7 @@ public: protected: Url() {} Url(Url const&) = delete; + Url& operator=(Url const&) = delete; }; #endif // URL_HH diff --git a/test/test-http.cc b/test/test-http.cc index 73f5261..90cb844 100644 --- a/test/test-http.cc +++ b/test/test-http.cc @@ -341,15 +341,18 @@ bool tokens(std::string const& in, char const* header, ...) { if (!iter->valid()) { std::cerr << "tokens:" << header << ": Expected " << token << " got " << "no more tokens" << std::endl; + va_end(tokens); return false; } if (iter->token().compare(token)) { std::cerr << "tokens:" << header << ": Expected " << token << " got " << iter->token() << std::endl; + va_end(tokens); return false; } iter->next(); } + va_end(tokens); if (iter->valid()) { std::cerr << "tokens:" << header << ": Expected no more tokens got " << iter->token() << std::endl; -- cgit v1.2.3-70-g09d2