Преглед на файлове

* apt-pkg/depcache.cc:
- correct "Dangerous iterator usage." pointed out by cppcheck

David Kalnischkies преди 16 години
родител
ревизия
461e4a5e0d
променени са 2 файла, в които са добавени 6 реда и са изтрити 4 реда
  1. 3 3
      apt-pkg/depcache.cc
  2. 3 1
      debian/changelog

+ 3 - 3
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<unsigned long>::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());
       }
    }
 

+ 3 - 1
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 <kalnischkies@gmail.com>  Sat, 29 May 2010 15:39:07 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com>  Sat, 29 May 2010 19:02:12 +0200
 
 apt (0.7.26~exp5) experimental; urgency=low