summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@yahoo.com>2017-08-10 21:10:23 +0200
committerJoel Klinghed <the_jk@yahoo.com>2017-08-10 21:12:52 +0200
commite3f7ecc6bdf7bbd1ae7ec10c387e15743842db90 (patch)
treebbe2e05ec16f4214e02dd9e0904af97998955c63
parent725cb48b8909588b41c86c680e40b0a7df13e384 (diff)
Fix some issues and improvements found by cppcheck
-rw-r--r--src/gui_qt.cc4
-rw-r--r--src/protocols.cc2
-rw-r--r--src/ssl_openssl.cc2
-rw-r--r--src/url.hh1
-rw-r--r--test/test-http.cc3
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<std::string> const& authors) {
- title_ = title + " " + version;
+ std::vector<std::string> 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;