[Aptitude-svn-commit] r4095 - in branches/aptitude-0.3/aptitude: . src

Daniel Burrows dburrows at costa.debian.org
Thu Sep 15 20:15:16 UTC 2005


Author: dburrows
Date: Thu Sep 15 20:15:13 2005
New Revision: 4095

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/download_list.cc
Log:
Fix a divide-by-zero.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Thu Sep 15 20:15:13 2005
@@ -1,5 +1,9 @@
 2005-09-15  Daniel Burrows  <dburrows at debian.org>
 
+	* src/download_list.cc:
+
+	  Fix a divide-by-zero.
+
 	* src/ui.cc, src/ui.h, src/view_changelog.cc:
 
 	  Add support for the new display mode of download_list.

Modified: branches/aptitude-0.3/aptitude/src/download_list.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/download_list.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/download_list.cc	Thu Sep 15 20:15:13 2005
@@ -221,10 +221,10 @@
 	  // The contribution of the active workers to the completion
 	  // status.
 	  double active_complete_fraction
-	    = ((double) active_current) / ((double) active_total);
+	    = active_total == 0 ? 0 : ((double) active_current) / ((double) active_total);
 
 	  double fraction_complete
-	    = (((double) CurrentItems) + active_workers * active_complete_fraction)
+	    = TotalItems == 0 ? 0 : (((double) CurrentItems) + active_workers * active_complete_fraction)
 	    / ((double) TotalItems);
 	  if(fraction_complete > 1)
 	    fraction_complete = 1;



More information about the Aptitude-svn-commit mailing list