From 461e4a5e0d30549e5b9758ce816027d92747f00d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 29 May 2010 19:02:32 +0200 Subject: [PATCH] * apt-pkg/depcache.cc: - correct "Dangerous iterator usage." pointed out by cppcheck --- apt-pkg/depcache.cc | 6 +++--- debian/changelog | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index afec7ba8..6c73b9cf 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -806,7 +806,7 @@ void pkgDepCache::Update(OpProgress *Prog) a bit we increase with a kill, but we should do something more clever… */ while(recheck.empty() == false) for (std::set::const_iterator p = recheck.begin(); - p != recheck.end(); ++p) { + p != recheck.end();) { if (Prog != 0 && Done%20 == 0) Prog->Progress(Done); PkgIterator P = PkgIterator(*Cache, Cache->PkgP + *p); @@ -814,7 +814,7 @@ void pkgDepCache::Update(OpProgress *Prog) ++killed; ++Done; } - recheck.erase(p); + recheck.erase(p++); } /* Okay, we have killed a great amount of pseudopackages - @@ -849,7 +849,7 @@ void pkgDepCache::Update(OpProgress *Prog) unsigned long const G = *g; recheck.erase(g); if (unlikely(ReInstallPseudoForGroup(G, recheck) == false)) - _error->Warning(_("Internal error, group '%s' has no installable pseudo package"), GrpIterator(*Cache, Cache->GrpP + *g).Name()); + _error->Warning(_("Internal error, group '%s' has no installable pseudo package"), GrpIterator(*Cache, Cache->GrpP + G).Name()); } } diff --git a/debian/changelog b/debian/changelog index 839c8c80..e8c1f959 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,8 +18,10 @@ apt (0.7.26~exp6) UNRELEASED; urgency=low - do not try PDiff if it is not listed in the Meta file * apt-pkg/cacheiterator.h: - let pkgCache::Iterator inherent std::iterator + * apt-pkg/depcache.cc: + - correct "Dangerous iterator usage." pointed out by cppcheck - -- David Kalnischkies Sat, 29 May 2010 15:39:07 +0200 + -- David Kalnischkies Sat, 29 May 2010 19:02:12 +0200 apt (0.7.26~exp5) experimental; urgency=low -- 2.20.1