[Aptitude-devel] r2965 - in branches/aptitude-0.3/aptitude: . src/generic/problemresolver

Daniel Burrows dburrows@costa.debian.org
Sat, 09 Apr 2005 15:19:46 +0000


Author: dburrows
Date: Sat Apr  9 15:19:43 2005
New Revision: 2965

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/generic/problemresolver/aptitude_resolver.h
Log:
Fix the dep-iterator to not produce an empty list.  Now it aborts.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Sat Apr  9 15:19:43 2005
@@ -1,5 +1,10 @@
 2005-04-09  Daniel Burrows  <dburrows@debian.org>
 
+	* src/generic/problemresolver/aptitude_resolver.h:
+
+	  Fix the dep_iterator to iterate over all dependencies instead of
+	  none.
+
 	* src/generic/problemresolver/test.cc:
 
 	  Run dump_universe on input universes, both for diagnostics

Modified: branches/aptitude-0.3/aptitude/src/generic/problemresolver/aptitude_resolver.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/problemresolver/aptitude_resolver.h	(original)
+++ branches/aptitude-0.3/aptitude/src/generic/problemresolver/aptitude_resolver.h	Sat Apr  9 15:19:43 2005
@@ -113,6 +113,8 @@
     if(!ver.end())
       return ver.VerStr();
     else
+      // Note that this is an invalid version string for apt, so we
+      // can't clash with real versions.
       return "[UNINST]";
   }
 
@@ -512,22 +514,27 @@
     // Advance to the next valid dep (inclusive of dep).
     void normalize()
     {
-      if(dep.end())
+      while(dep.end() && !pkg.end())
 	{
-	  while(!pkg.end())
+	  while(dep.end() && !ver.end())
 	    {
-	      while(dep.end() && !ver.end())
-		{
-		  // Since dep is an end iterator, advance at least
-		  // to the next version.
-		  ++ver;
+	      // Since dep is an end iterator, advance at least
+	      // to the next version.
+	      ++ver;
 
+	      if(!ver.end())
+		dep=ver.DependsList();
+	    }
+
+	  if(dep.end())
+	    {
+	      ++pkg;
+	      if(!pkg.end())
+		{
+		  ver=pkg.VersionList();
 		  if(!ver.end())
 		    dep=ver.DependsList();
 		}
-	      ++pkg;
-	      if(!pkg.end())
-		ver=pkg.VersionList();
 	    }
 	}
     }