]> git.saurik.com Git - apt.git/commitdiff
replace the last standing double's with long long
authorDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 14 Jul 2011 13:54:25 +0000 (15:54 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 14 Jul 2011 13:54:25 +0000 (15:54 +0200)
apt-pkg/acquire.cc
apt-pkg/acquire.h
cmdline/acqprogress.cc

index fff487dc86cd288387adf1f5bd93b45f56a2d43a..2064abc5031d8005b8af2dcae02819c5f4171f51 100644 (file)
@@ -799,7 +799,7 @@ bool pkgAcquireStatus::Pulse(pkgAcquire *Owner)
    }
    
    // Compute the current completion
-   unsigned long ResumeSize = 0;
+   unsigned long long ResumeSize = 0;
    for (pkgAcquire::Worker *I = Owner->WorkersBegin(); I != 0;
        I = Owner->WorkerStep(I))
       if (I->CurrentItem != 0 && I->CurrentItem->Owner->Complete == false)
@@ -838,7 +838,7 @@ bool pkgAcquireStatus::Pulse(pkgAcquire *Owner)
       else
         CurrentCPS = ((CurrentBytes - ResumeSize) - LastBytes)/Delta;
       LastBytes = CurrentBytes - ResumeSize;
-      ElapsedTime = (unsigned long)Delta;
+      ElapsedTime = (unsigned long long)Delta;
       Time = NewTime;
    }
 
@@ -849,8 +849,7 @@ bool pkgAcquireStatus::Pulse(pkgAcquire *Owner)
 
       char msg[200];
       long i = CurrentItems < TotalItems ? CurrentItems + 1 : CurrentItems;
-      unsigned long ETA =
-        (unsigned long)((TotalBytes - CurrentBytes) / CurrentCPS);
+      unsigned long long const ETA = (TotalBytes - CurrentBytes) / CurrentCPS;
 
       // only show the ETA if it makes sense
       if (ETA > 0 && ETA < 172800 /* two days */ )
@@ -906,7 +905,7 @@ void pkgAcquireStatus::Stop()
    else
       CurrentCPS = FetchedBytes/Delta;
    LastBytes = CurrentBytes;
-   ElapsedTime = (unsigned int)Delta;
+   ElapsedTime = (unsigned long long)Delta;
 }
                                                                        /*}}}*/
 // AcquireStatus::Fetched - Called when a byte set has been fetched    /*{{{*/
index 8fad9149722649a602d7d00fc042ae01417792c4..c9eaa67d1e4c8a4a5122c1cd887e2e76f405f2c2 100644 (file)
@@ -650,8 +650,6 @@ struct pkgAcquire::MethodConfig
 /** \brief A monitor object for downloads controlled by the pkgAcquire class.  {{{
  *
  *  \todo Why protected members?
- *
- *  \todo Should the double members be uint64_t?
  */
 class pkgAcquireStatus
 {
@@ -669,34 +667,34 @@ class pkgAcquireStatus
    /** \brief The number of bytes fetched as of the previous call to
     *  pkgAcquireStatus::Pulse, including local items.
     */
-   double LastBytes;
+   unsigned long long LastBytes;
 
    /** \brief The current rate of download as of the most recent call
     *  to pkgAcquireStatus::Pulse, in bytes per second.
     */
-   double CurrentCPS;
+   unsigned long long CurrentCPS;
 
    /** \brief The number of bytes fetched as of the most recent call
     *  to pkgAcquireStatus::Pulse, including local items.
     */
-   double CurrentBytes;
+   unsigned long long CurrentBytes;
 
    /** \brief The total number of bytes that need to be fetched.
     *
     *  \warning This member is inaccurate, as new items might be
     *  enqueued while the download is in progress!
     */
-   double TotalBytes;
+   unsigned long long TotalBytes;
 
    /** \brief The total number of bytes accounted for by items that
     *  were successfully fetched.
     */
-   double FetchedBytes;
+   unsigned long long FetchedBytes;
 
    /** \brief The amount of time that has elapsed since the download
     *   started.
     */
-   unsigned long ElapsedTime;
+   unsigned long long ElapsedTime;
 
    /** \brief The total number of items that need to be fetched.
     *
index ba334ce05737c7057707239a0f12dcb54dc74da9..d2db949ea05962a64421b8c8c170ccf9d79b1a57 100644 (file)
@@ -200,7 +200,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
             
       // Add the current progress
       if (Mode == Long)
-        snprintf(S,End-S," %lu",I->CurrentSize);
+        snprintf(S,End-S," %llu",I->CurrentSize);
       else
       {
         if (Mode == Medium || I->TotalSize == 0)