X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/3952f883f3b60aaebe538afe3e8fb2b9f75c9262..0e279e3527ce3dc9de0e01441ad693f415e75d6a:/cmdline/acqprogress.cc

diff --git a/cmdline/acqprogress.cc b/cmdline/acqprogress.cc
index d2db949ea..3ac350aca 100644
--- a/cmdline/acqprogress.cc
+++ b/cmdline/acqprogress.cc
@@ -8,19 +8,21 @@
    ##################################################################### */
 									/*}}}*/
 // Include files							/*{{{*/
-#include "acqprogress.h"
+#include<config.h>
+
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/acquire-worker.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
 
-#include <apti18n.h>
-    
 #include <stdio.h>
 #include <signal.h>
 #include <iostream>
 #include <unistd.h>
+
+#include "acqprogress.h"
+#include <apti18n.h>
 									/*}}}*/
 
 using namespace std;
@@ -29,8 +31,9 @@ using namespace std;
 // ---------------------------------------------------------------------
 /* */
 AcqTextStatus::AcqTextStatus(unsigned int &ScreenWidth,unsigned int Quiet) :
-    ScreenWidth(ScreenWidth), Quiet(Quiet)
+    ScreenWidth(ScreenWidth), ID(0), Quiet(Quiet)
 {
+   BlankLine[0] = 0;
 }
 									/*}}}*/
 // AcqTextStatus::Start - Downloading has started			/*{{{*/
@@ -161,7 +164,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
       ScreenWidth = sizeof(Buffer)-1;
 
    // Put in the percent done
-   sprintf(S,"%ld%%",long(double((CurrentBytes + CurrentItems)*100.0)/double(TotalBytes+TotalItems)));
+   sprintf(S,"%.0f%%",((CurrentBytes + CurrentItems)*100.0)/(TotalBytes+TotalItems));
 
    bool Shown = false;
    for (pkgAcquire::Worker *I = Owner->WorkersBegin(); I != 0;
@@ -212,11 +215,11 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
       if (I->TotalSize > 0 && I->CurrentItem->Owner->Complete == false)
       {
 	 if (Mode == Short)
-	    snprintf(S,End-S," %lu%%",
-		     long(double(I->CurrentSize*100.0)/double(I->TotalSize)));
+	    snprintf(S,End-S," %.0f%%",
+		     (I->CurrentSize*100.0)/I->TotalSize);
 	 else
-	    snprintf(S,End-S,"/%sB %lu%%",SizeToStr(I->TotalSize).c_str(),
-		     long(double(I->CurrentSize*100.0)/double(I->TotalSize)));
+	    snprintf(S,End-S,"/%sB %.0f%%",SizeToStr(I->TotalSize).c_str(),
+		     (I->CurrentSize*100.0)/I->TotalSize);
       }      
       S += strlen(S);
       snprintf(S,End-S,"]");
@@ -236,7 +239,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
    if (CurrentCPS != 0)
    {      
       char Tmp[300];
-      unsigned long ETA = (unsigned long)((TotalBytes - CurrentBytes)/CurrentCPS);
+      unsigned long long ETA = (TotalBytes - CurrentBytes)/CurrentCPS;
       sprintf(Tmp," %sB/s %s",SizeToStr(CurrentCPS).c_str(),TimeToStr(ETA).c_str());
       unsigned int Len = strlen(Buffer);
       unsigned int LenT = strlen(Tmp);