summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-11-04 21:08:55 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2015-11-05 12:21:33 +0100
commit258b9e512c4001e806c5c0966acecd3d742ec6e9 (patch)
treec8bdbb43dd9e1b5d54b90e4845065a653d585ca5 /apt-pkg
parent9fb4e6510faaa9c84b88d4cb567bf3deebf8e0b7 (diff)
apply various suggestions made by cppcheck
Reported-By: cppcheck Git-Dch: Ignore
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire-item.cc12
-rw-r--r--apt-pkg/algorithms.cc2
-rw-r--r--apt-pkg/deb/dpkgpm.cc2
-rw-r--r--apt-pkg/indexfile.h2
-rw-r--r--apt-pkg/pkgcachegen.cc1
-rw-r--r--apt-pkg/policy.cc4
6 files changed, 9 insertions, 14 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 834776404..9d1c2cc61 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -2237,14 +2237,10 @@ bool pkgAcqIndexDiffs::QueueNextDiff() /*{{{*/
// remove all patches until the next matching patch is found
// this requires the Index file to be ordered
- for(vector<DiffInfo>::iterator I = available_patches.begin();
- available_patches.empty() == false &&
- I != available_patches.end() &&
- I->result_hashes != LocalHashes;
- ++I)
- {
- available_patches.erase(I);
- }
+ available_patches.erase(available_patches.begin(),
+ std::find_if(available_patches.begin(), available_patches.end(), [&](DiffInfo const &I) {
+ return I.result_hashes == LocalHashes;
+ }));
// error checking and falling back if no patch was found
if(available_patches.empty() == true)
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index d25cbd63a..4b84b8324 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -1315,7 +1315,7 @@ void pkgProblemResolver::InstallProtect()
struct PrioComp {
pkgCache &PrioCache;
- PrioComp(pkgCache &PrioCache) : PrioCache(PrioCache) {
+ explicit PrioComp(pkgCache &PrioCache) : PrioCache(PrioCache) {
}
bool operator() (pkgCache::Version * const &A, pkgCache::Version * const &B) {
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index d253808f2..7355af9d5 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -126,7 +126,7 @@ namespace
const char *target;
public:
- MatchProcessingOp(const char *the_target)
+ explicit MatchProcessingOp(const char *the_target)
: target(the_target)
{
}
diff --git a/apt-pkg/indexfile.h b/apt-pkg/indexfile.h
index c3f01c774..79abe2f4f 100644
--- a/apt-pkg/indexfile.h
+++ b/apt-pkg/indexfile.h
@@ -168,7 +168,7 @@ public:
virtual bool Merge(pkgCacheGenerator &Gen, OpProgress* const Prog) APT_OVERRIDE;
virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const APT_OVERRIDE;
- pkgDebianIndexFile(bool const Trusted);
+ explicit pkgDebianIndexFile(bool const Trusted);
virtual ~pkgDebianIndexFile();
};
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index 69c8fd105..5c61ff2b8 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -1434,7 +1434,6 @@ static bool BuildCache(pkgCacheGenerator &Gen,
pkgSourceList const * const List,
FileIterator const Start, FileIterator const End)
{
- std::vector<pkgIndexFile *> Files;
bool mergeFailure = false;
auto const indexFileMerge = [&](pkgIndexFile * const I) {
diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc
index 4f953bd50..d442e5c90 100644
--- a/apt-pkg/policy.cc
+++ b/apt-pkg/policy.cc
@@ -235,7 +235,7 @@ pkgCache::VerIterator pkgPolicy::GetCandidateVerNew(pkgCache::PkgIterator const
int candPriority = -1;
pkgVersioningSystem *vs = Cache->VS;
- for (pkgCache::VerIterator ver = Pkg.VersionList(); ver.end() == false; ver++) {
+ for (pkgCache::VerIterator ver = Pkg.VersionList(); ver.end() == false; ++ver) {
int priority = GetPriority(ver, true);
if (priority == 0 || priority <= candPriority)
@@ -322,7 +322,7 @@ void pkgPolicy::CreatePin(pkgVersionMatch::MatchType Type,string Name,
// Find matching version(s) and copy the pin into it
pkgVersionMatch Match(P->Data,P->Type);
- for (pkgCache::VerIterator Ver = Pkg.VersionList(); Ver.end() != true; Ver++)
+ for (pkgCache::VerIterator Ver = Pkg.VersionList(); Ver.end() != true; ++Ver)
{
if (Match.VersionMatches(Ver)) {
Pin *VP = VerPins + Ver->ID;