From 2651f1c071927b7fc440ec7a638ecad7ccf04a2e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 25 Jan 2016 22:13:52 +0100 Subject: act on various suggestions from cppcheck Reported-By: cppcheck Git-Dch: Ignore --- methods/rred.cc | 4 ++++ methods/server.cc | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'methods') diff --git a/methods/rred.cc b/methods/rred.cc index 85ec30bd5..e568c75b2 100644 --- a/methods/rred.cc +++ b/methods/rred.cc @@ -491,7 +491,11 @@ class Patch { for (ch = filechanges.rbegin(); ch != filechanges.rend(); ++ch) { std::list::reverse_iterator mg_i, mg_e = ch; while (ch->del_cnt == 0 && ch->offset == 0) + { ++ch; + if (unlikely(ch == filechanges.rend())) + return; + } line -= ch->del_cnt; std::string buf; if (ch->add_cnt > 0) { diff --git a/methods/server.cc b/methods/server.cc index 6340390d4..322b8d94c 100644 --- a/methods/server.cc +++ b/methods/server.cc @@ -246,7 +246,8 @@ bool ServerState::HeaderLine(string Line) } /*}}}*/ // ServerState::ServerState - Constructor /*{{{*/ -ServerState::ServerState(URI Srv, ServerMethod *Owner) : ServerName(Srv), TimeOut(120), Owner(Owner) +ServerState::ServerState(URI Srv, ServerMethod *Owner) : + DownloadSize(0), ServerName(Srv), TimeOut(120), Owner(Owner) { Reset(); } -- cgit v1.2.3