summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
authorRegina Pfeifer <regina@mailbox.org>2018-11-20 08:13:58 (GMT)
committerBrad King <brad.king@kitware.com>2018-11-21 12:47:40 (GMT)
commitce2570b2071360c0b4bb4cd3c62ed8cccab26513 (patch)
tree22f46c9c76bcf9e37f29c8e9eeb5dcf460fb48c1 /Source/cmFileCommand.cxx
parent4e0c75b78f5745d1369867f25a46ab7d158b4469 (diff)
downloadCMake-ce2570b2071360c0b4bb4cd3c62ed8cccab26513.zip
CMake-ce2570b2071360c0b4bb4cd3c62ed8cccab26513.tar.gz
CMake-ce2570b2071360c0b4bb4cd3c62ed8cccab26513.tar.bz2
clang-tidy: Enable checks from bugprone set
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 3012b0a..fa2a3e1 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -10,6 +10,7 @@
#include <algorithm>
#include <assert.h>
+#include <cmath>
#include <ctype.h>
#include <memory> // IWYU pragma: keep
#include <sstream>
@@ -2602,10 +2603,10 @@ public:
bool UpdatePercentage(double value, double total, std::string& status)
{
- int OldPercentage = this->CurrentPercentage;
+ long OldPercentage = this->CurrentPercentage;
if (total > 0.0) {
- this->CurrentPercentage = static_cast<int>(value / total * 100.0 + 0.5);
+ this->CurrentPercentage = std::lround(value / total * 100.0);
if (this->CurrentPercentage > 100) {
// Avoid extra progress reports for unexpected data beyond total.
this->CurrentPercentage = 100;
@@ -2627,7 +2628,7 @@ public:
cmFileCommand* GetFileCommand() { return this->FileCommand; }
private:
- int CurrentPercentage;
+ long CurrentPercentage;
cmFileCommand* FileCommand;
std::string Text;
};