Clang-tidy-14 fixes
Do as the robot commands. All changes made automatically by tidy.
Tested: (Thanks Zhikui)
Downloaded and run on system. Sensors scan normally.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I752f37c9e7a95aa3be8e6980ba6e4b2b48b3395a
diff --git a/src/CPUSensorMain.cpp b/src/CPUSensorMain.cpp
index 9d5bda4..681fb9f 100644
--- a/src/CPUSensorMain.cpp
+++ b/src/CPUSensorMain.cpp
@@ -107,7 +107,7 @@
const int& cpuId)
{
std::string sensorName = label;
- if (item.compare("input") != 0)
+ if (item != "input")
{
sensorName += " " + item;
}
@@ -116,7 +116,7 @@
bool isWordEnd = true;
std::transform(sensorName.begin(), sensorName.end(), sensorName.begin(),
[&isWordEnd](int c) {
- if (std::isspace(c))
+ if (std::isspace(c) != 0)
{
isWordEnd = true;
}
@@ -396,7 +396,7 @@
}
}
- if (createdSensors.size())
+ if (static_cast<unsigned int>(!createdSensors.empty()) != 0U)
{
std::cout << "Sensor" << (createdSensors.size() == 1 ? " is" : "s are")
<< " created\n";
@@ -478,7 +478,7 @@
msg.addr = config.addr;
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
- if (!ioctl(file, PECI_IOC_PING, &msg))
+ if (ioctl(file, PECI_IOC_PING, &msg) == 0)
{
bool dimmReady = false;
for (unsigned int rank = 0; rank < rankNumMax; rank++)
@@ -491,10 +491,10 @@
msg.rx_len = 4;
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
- if (!ioctl(file, PECI_IOC_RD_PKG_CFG, &msg))
+ if (ioctl(file, PECI_IOC_RD_PKG_CFG, &msg) == 0)
{
- if (msg.pkg_config[0] || msg.pkg_config[1] ||
- msg.pkg_config[2])
+ if ((msg.pkg_config[0] != 0U) ||
+ (msg.pkg_config[1] != 0U) || (msg.pkg_config[2] != 0U))
{
dimmReady = true;
break;
@@ -554,7 +554,7 @@
}
}
- if (rescanDelaySeconds)
+ if (rescanDelaySeconds != 0U)
{
creationTimer.expires_from_now(
boost::posix_time::seconds(rescanDelaySeconds));
@@ -698,7 +698,7 @@
}
}
- if (cpuConfigs.size())
+ if (static_cast<unsigned int>(!cpuConfigs.empty()) != 0U)
{
std::cout << "CPU config" << (cpuConfigs.size() == 1 ? " is" : "s are")
<< " parsed\n";