diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2011-07-14 15:54:25 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2011-07-14 15:54:25 +0200 |
commit | dbbc549457825d5b6507fdd62bcf323ed3a3fb2a (patch) | |
tree | 9a92155f1066bf4ad177537a90279b3f85a2ed04 | |
parent | d4cfaed3d822b207f24ce11768ee14682a0c8f6b (diff) |
replace the last standing double's with long long
-rw-r--r-- | apt-pkg/acquire.cc | 9 | ||||
-rw-r--r-- | apt-pkg/acquire.h | 14 | ||||
-rw-r--r-- | cmdline/acqprogress.cc | 2 |
3 files changed, 11 insertions, 14 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index fff487dc8..2064abc50 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -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 /*{{{*/ diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h index 8fad91497..c9eaa67d1 100644 --- a/apt-pkg/acquire.h +++ b/apt-pkg/acquire.h @@ -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. * diff --git a/cmdline/acqprogress.cc b/cmdline/acqprogress.cc index ba334ce05..d2db949ea 100644 --- a/cmdline/acqprogress.cc +++ b/cmdline/acqprogress.cc @@ -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) |