diff options
author | David Kalnischkies <david@kalnischkies.de> | 2016-01-25 22:13:52 +0100 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2016-01-26 15:32:15 +0100 |
commit | 2651f1c071927b7fc440ec7a638ecad7ccf04a2e (patch) | |
tree | c2b4f94c949590c4689c1509b490b4c9d4cc9bc7 | |
parent | 3b0e76ec9c9386e428944f621b970d691884b84a (diff) |
act on various suggestions from cppcheck
Reported-By: cppcheck
Git-Dch: Ignore
-rw-r--r-- | apt-pkg/acquire-method.cc | 5 | ||||
-rw-r--r-- | apt-pkg/acquire-worker.cc | 21 | ||||
-rw-r--r-- | apt-pkg/indexcopy.cc | 4 | ||||
-rw-r--r-- | methods/rred.cc | 4 | ||||
-rw-r--r-- | methods/server.cc | 3 |
5 files changed, 16 insertions, 21 deletions
diff --git a/apt-pkg/acquire-method.cc b/apt-pkg/acquire-method.cc index 991e6780a..d0eb01bbc 100644 --- a/apt-pkg/acquire-method.cc +++ b/apt-pkg/acquire-method.cc @@ -480,7 +480,10 @@ void pkgAcqMethod::Dequeue() { /*{{{*/ /*}}}*/ pkgAcqMethod::~pkgAcqMethod() {} -pkgAcqMethod::FetchItem::FetchItem() : d(NULL) {} +pkgAcqMethod::FetchItem::FetchItem() : + Next(nullptr), DestFileFd(-1), LastModified(0), IndexFile(false), + FailIgnore(false), MaximumSize(0), d(nullptr) +{} pkgAcqMethod::FetchItem::~FetchItem() {} pkgAcqMethod::FetchResult::~FetchResult() {} diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc index c2ee8cda3..37804c67a 100644 --- a/apt-pkg/acquire-worker.cc +++ b/apt-pkg/acquire-worker.cc @@ -42,29 +42,16 @@ using namespace std; // Worker::Worker - Constructor for Queue startup /*{{{*/ -// --------------------------------------------------------------------- -/* */ -pkgAcquire::Worker::Worker(Queue *Q,MethodConfig *Cnf, - pkgAcquireStatus *log) : d(NULL), Log(log) +pkgAcquire::Worker::Worker(Queue *Q, MethodConfig *Cnf, pkgAcquireStatus *log) : + d(NULL), OwnerQ(Q), Log(log), Config(Cnf), Access(Cnf->Access), + CurrentItem(nullptr), CurrentSize(0), TotalSize(0) { - OwnerQ = Q; - Config = Cnf; - Access = Cnf->Access; - CurrentItem = 0; - TotalSize = 0; - CurrentSize = 0; - Construct(); } /*}}}*/ // Worker::Worker - Constructor for method config startup /*{{{*/ -// --------------------------------------------------------------------- -/* */ -pkgAcquire::Worker::Worker(MethodConfig *Cnf) : d(NULL), OwnerQ(NULL), Config(Cnf), - Access(Cnf->Access), CurrentItem(NULL), - CurrentSize(0), TotalSize(0) +pkgAcquire::Worker::Worker(MethodConfig *Cnf) : Worker(nullptr, Cnf, nullptr) { - Construct(); } /*}}}*/ // Worker::Construct - Constructor helper /*{{{*/ diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc index c54b365dc..4aade6e8a 100644 --- a/apt-pkg/indexcopy.cc +++ b/apt-pkg/indexcopy.cc @@ -771,14 +771,14 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name, /*{{{*/ } /*}}}*/ -IndexCopy::IndexCopy() : d(NULL) {} +IndexCopy::IndexCopy() : d(nullptr), Section(nullptr) {} APT_CONST IndexCopy::~IndexCopy() {} PackageCopy::PackageCopy() : IndexCopy(), d(NULL) {} APT_CONST PackageCopy::~PackageCopy() {} SourceCopy::SourceCopy() : IndexCopy(), d(NULL) {} APT_CONST SourceCopy::~SourceCopy() {} -TranslationsCopy::TranslationsCopy() : d(NULL) {} +TranslationsCopy::TranslationsCopy() : d(nullptr), Section(nullptr) {} APT_CONST TranslationsCopy::~TranslationsCopy() {} SigVerify::SigVerify() : d(NULL) {} APT_CONST SigVerify::~SigVerify() {} 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<struct Change>::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(); } |