summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2017-12-13 23:54:38 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2017-12-13 23:54:38 +0100
commit99813a2eaa7c0cce1d7d8c811827733ed66458de (patch)
tree61fe422eeca8c5bd5cb2de6060f11e71343d4602 /apt-pkg/acquire.cc
parentd30b30ad1e1ce434df84e15e2573c43ac152f9e3 (diff)
parent0b5e329a8ba2461ccb7017d3adfc972f9dccd830 (diff)
Merge branch 'feature/happy-gcc'
Fixing various real and imagined bugs reported by gcc warnings
Diffstat (limited to 'apt-pkg/acquire.cc')
-rw-r--r--apt-pkg/acquire.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc
index 408cf6df5..f6e323d30 100644
--- a/apt-pkg/acquire.cc
+++ b/apt-pkg/acquire.cc
@@ -31,6 +31,7 @@
#include <sstream>
#include <string>
#include <vector>
+#include <cmath>
#include <dirent.h>
#include <errno.h>
@@ -437,7 +438,7 @@ string pkgAcquire::QueueName(string Uri,MethodConfig const *&Config)
clog << "Found " << Instances << " instances of " << U.Access << endl;
}
- if (Instances >= (unsigned int)_config->FindI("Acquire::QueueHost::Limit",10))
+ if (Instances >= static_cast<decltype(Instances)>(_config->FindI("Acquire::QueueHost::Limit",10)))
return U.Access;
return FullQueueName;
@@ -1074,7 +1075,7 @@ bool pkgAcquire::Queue::Cycle()
// Look for a queable item
QItem *I = Items;
int ActivePriority = 0;
- while (PipeDepth < (signed)MaxPipeDepth)
+ while (PipeDepth < static_cast<decltype(PipeDepth)>(MaxPipeDepth))
{
for (; I != 0; I = I->Next) {
if (I->Owner->Status == pkgAcquire::Item::StatFetching)
@@ -1285,7 +1286,7 @@ bool pkgAcquireStatus::Pulse(pkgAcquire *Owner)
else
CurrentCPS = ((CurrentBytes - ResumeSize) - LastBytes)/Delta;
LastBytes = CurrentBytes - ResumeSize;
- ElapsedTime = (unsigned long long)Delta;
+ ElapsedTime = std::llround(Delta);
Time = NewTime;
}
@@ -1295,8 +1296,8 @@ bool pkgAcquireStatus::Pulse(pkgAcquire *Owner)
Percent = 0;
else
// use both files and bytes because bytes can be unreliable
- Percent = (0.8 * (CurrentBytes/float(TotalBytes)*100.0) +
- 0.2 * (CurrentItems/float(TotalItems)*100.0));
+ Percent = (0.8 * (CurrentBytes/double(TotalBytes)*100.0) +
+ 0.2 * (CurrentItems/double(TotalItems)*100.0));
// debug
if (_config->FindB("Debug::acquire::progress", false) == true)
@@ -1380,7 +1381,7 @@ void pkgAcquireStatus::Stop()
else
CurrentCPS = FetchedBytes/Delta;
LastBytes = CurrentBytes;
- ElapsedTime = (unsigned long long)Delta;
+ ElapsedTime = std::llround(Delta);
}
/*}}}*/
// AcquireStatus::Fetched - Called when a byte set has been fetched /*{{{*/