Support large files in the complete toolset. Indexes of this
[ntk/apt.git] / cmdline / acqprogress.cc
index fd80ea1..1ccb088 100644 (file)
@@ -163,7 +163,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;
@@ -214,11 +214,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,"]");
@@ -238,7 +238,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);