]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/acquire.cc
Fixed segfault in re-install/upgrade condition
[apt.git] / apt-pkg / acquire.cc
index 80624f9d3341bbc209123b8ca9b94cecc10490ff..07e4fab599ce82712a5fa3199bbf6fbe2e0e800e 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: acquire.cc,v 1.29 1999/03/16 00:43:55 jgg Exp $
+// $Id: acquire.cc,v 1.32 1999/04/07 06:02:56 jgg Exp $
 /* ######################################################################
 
    Acquire - File Acquiration
@@ -25,6 +25,7 @@
 
 #include <dirent.h>
 #include <sys/time.h>
+#include <errno.h>
                                                                        /*}}}*/
 
 // Acquire::pkgAcquire - Constructor                                   /*{{{*/
@@ -419,6 +420,18 @@ unsigned long pkgAcquire::FetchNeeded()
    return Total;
 }
                                                                        /*}}}*/
+// Acquire::PartialPresent - Number of partial bytes we already have   /*{{{*/
+// ---------------------------------------------------------------------
+/* This is the number of bytes that is not local */
+unsigned long pkgAcquire::PartialPresent()
+{
+   unsigned long Total = 0;
+   for (pkgAcquire::Item **I = ItemsBegin(); I != ItemsEnd(); I++)
+      if ((*I)->Local == false)
+        Total += (*I)->PartialSize;
+   return Total;
+}
+                                                                       /*}}}*/
 // pkgAcquire::UriBegin - Start iterator for the uri list              /*{{{*/
 // ---------------------------------------------------------------------
 /* */
@@ -697,8 +710,6 @@ void pkgAcquireStatus::Pulse(pkgAcquire *Owner)
       TotalBytes = 1;
    if (Unknown == Count)
       TotalBytes = Unknown;
-   else
-      TotalBytes += TotalBytes/(Count - Unknown)*Unknown;
    
    // Compute the CPS
    struct timeval NewTime;