From 258b9e512c4001e806c5c0966acecd3d742ec6e9 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 4 Nov 2015 21:08:55 +0100 Subject: apply various suggestions made by cppcheck Reported-By: cppcheck Git-Dch: Ignore --- apt-private/acqprogress.cc | 3 +-- apt-private/private-cachefile.h | 2 +- apt-private/private-cacheset.cc | 6 ++---- apt-private/private-cacheset.h | 2 +- apt-private/private-install.cc | 2 +- apt-private/private-list.cc | 2 +- apt-private/private-show.cc | 2 +- 7 files changed, 8 insertions(+), 11 deletions(-) (limited to 'apt-private') diff --git a/apt-private/acqprogress.cc b/apt-private/acqprogress.cc index dcc538a39..a33d51c71 100644 --- a/apt-private/acqprogress.cc +++ b/apt-private/acqprogress.cc @@ -176,8 +176,6 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) if (Quiet > 0) return true; - enum {Long = 0,Medium,Short} Mode = Medium; - std::string Line; { std::stringstream S; @@ -203,6 +201,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) if (I->CurrentItem->Owner->ActiveSubprocess.empty() == false) S << " " << I->CurrentItem->Owner->ActiveSubprocess; + enum {Long = 0,Medium,Short} Mode = Medium; // Add the current progress if (Mode == Long) S << " " << I->CurrentSize; diff --git a/apt-private/private-cachefile.h b/apt-private/private-cachefile.h index 51703b0ad..27642e025 100644 --- a/apt-private/private-cachefile.h +++ b/apt-private/private-cachefile.h @@ -46,7 +46,7 @@ class SortedPackageUniverse : public APT::PackageUniverse void LazyInit() const; public: - SortedPackageUniverse(CacheFile &Cache); + explicit SortedPackageUniverse(CacheFile &Cache); class const_iterator : public APT::Container_iterator_base::const_iterator, pkgCache::PkgIterator> { diff --git a/apt-private/private-cacheset.cc b/apt-private/private-cacheset.cc index 439b844d5..981766cdf 100644 --- a/apt-private/private-cacheset.cc +++ b/apt-private/private-cacheset.cc @@ -179,8 +179,8 @@ CacheSetHelperVirtuals::CacheSetHelperVirtuals(bool const ShowErrors, GlobalErro /*}}}*/ // CacheSetHelperAPTGet - responsible for message telling from the CacheSets/*{{{*/ -CacheSetHelperAPTGet::CacheSetHelperAPTGet(std::ostream &out) : - APT::CacheSetHelper{true}, out(out) +CacheSetHelperAPTGet::CacheSetHelperAPTGet(std::ostream &pout) : + APT::CacheSetHelper{true}, out(pout) { explicitlyNamed = true; } @@ -245,8 +245,6 @@ bool CacheSetHelperAPTGet::showVirtualPackageErrors(pkgCacheFile &Cache) "This may mean that the package is missing, has been obsoleted, or\n" "is only available from another source\n"),Pkg.FullName(true).c_str()); - std::string List; - std::string VersionsList; std::vector Seen(Cache.GetPkgCache()->Head().PackageCount, false); APT::PackageList pkglist; for (pkgCache::DepIterator Dep = Pkg.RevDependsList(); diff --git a/apt-private/private-cacheset.h b/apt-private/private-cacheset.h index 2b452ab7d..4cbc4efa1 100644 --- a/apt-private/private-cacheset.h +++ b/apt-private/private-cacheset.h @@ -89,7 +89,7 @@ class APT_PUBLIC CacheSetHelperAPTGet : public APT::CacheSetHelper { public: std::list > selectedByRelease; - CacheSetHelperAPTGet(std::ostream &out); + explicit CacheSetHelperAPTGet(std::ostream &out); virtual void showTaskSelection(pkgCache::PkgIterator const &Pkg, std::string const &pattern) APT_OVERRIDE; virtual void showFnmatchSelection(pkgCache::PkgIterator const &Pkg, std::string const &pattern) APT_OVERRIDE; diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index 52572ed80..74a2424c5 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -666,7 +666,7 @@ struct PkgIsExtraInstalled { pkgCacheFile * const Cache; APT::VersionSet const * const verset; PkgIsExtraInstalled(pkgCacheFile * const Cache, APT::VersionSet const * const Container) : Cache(Cache), verset(Container) {} - bool operator() (pkgCache::PkgIterator const Pkg) + bool operator() (pkgCache::PkgIterator const &Pkg) { if ((*Cache)[Pkg].Install() == false) return false; diff --git a/apt-private/private-list.cc b/apt-private/private-list.cc index c4d5e8bc3..a948c7d9f 100644 --- a/apt-private/private-list.cc +++ b/apt-private/private-list.cc @@ -41,7 +41,7 @@ struct PackageSortAlphabetic /*{{{*/ class PackageNameMatcher : public Matcher { public: - PackageNameMatcher(const char **patterns) + explicit PackageNameMatcher(const char **patterns) { for(int i=0; patterns[i] != NULL; ++i) { diff --git a/apt-private/private-show.cc b/apt-private/private-show.cc index aaa4268c6..34214d955 100644 --- a/apt-private/private-show.cc +++ b/apt-private/private-show.cc @@ -396,7 +396,7 @@ bool Policy(CommandLine &CmdL) continue; } // New code - for (pkgCache::VerIterator V = I.VersionList(); !V.end(); V++) { + for (pkgCache::VerIterator V = I.VersionList(); !V.end(); ++V) { auto Prio = Plcy->GetPriority(V, false); if (Prio == 0) continue; -- cgit v1.2.3