]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Avoid "double to int" compiler warnings.
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 14 Oct 2011 22:43:20 +0000 (16:43 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Fri, 14 Oct 2011 22:43:20 +0000 (16:43 -0600)
Could also use integer arithmetic instead of 1e3 double, but it is often safer
to use doubles when it comes to formulas because significant integer rounding
errors are difficult to spot.

src/DiskIO/IpcIo/IpcIoFile.cc

index 3f6a889e5df309f7b2b24ae4b34d5699b47777a9..cb8869d13812f72c11a75eda9b448b8c07947e0f 100644 (file)
@@ -367,7 +367,7 @@ IpcIoFile::canWait() const
     if (ioRate > 0) {
         // if there are N requests pending, the new one will wait at
         // least N/max-swap-rate seconds
-        rateWait = 1e3 * queue->outSize(diskId) / ioRate;
+        rateWait = static_cast<int>(1e3 * queue->outSize(diskId) / ioRate);
         // adjust N/max-swap-rate value based on the queue "balance"
         // member, in case we have been borrowing time against future
         // I/O already