Clean up
Turn on werror and wall. Also return emtpy on
MATCH_ONE to discourage template usage.
Change-Id: I1b987d901d251c61b846ee88a3b95df36d59d439
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/FruDevice.cpp b/src/FruDevice.cpp
index 9d0beff..3c42515 100644
--- a/src/FruDevice.cpp
+++ b/src/FruDevice.cpp
@@ -136,8 +136,8 @@
{
continue;
}
- auto [_, inserted] = foundOffsets.insert(blockData[ii]);
- if (!inserted)
+ auto inserted = foundOffsets.insert(blockData[ii]);
+ if (!inserted.second)
{
return false;
}
@@ -210,7 +210,7 @@
device.insert(device.end(), block_data.begin(),
block_data.begin() + 8);
- for (int jj = 1; jj <= FRU_AREAS.size(); jj++)
+ for (size_t jj = 1; jj <= FRU_AREAS.size(); jj++)
{
auto area_offset = device[jj];
if (area_offset != 0)
@@ -392,8 +392,6 @@
"VERSION", "SERIAL_NUMBER", "ASSET_TAG",
"FRU_VERSION_ID", "INFO_AM1", "INFO_AM2"};
- size_t sum = 0;
-
if (fruBytes.size() <= 8)
{
return false;
@@ -404,7 +402,7 @@
const std::vector<const char*>* fieldData;
- for (auto& area : FRU_AREAS)
+ for (const std::string& area : FRU_AREAS)
{
fruAreaOffsetField++;
if (fruAreaOffsetField >= fruBytes.end())
@@ -495,7 +493,7 @@
.base(),
value.end());
- result[std::string(area) + "_" + field] = std::move(value);
+ result[area + "_" + field] = std::move(value);
fruBytesIter += length;
if (fruBytesIter >= fruBytes.end())
@@ -872,8 +870,8 @@
eventHandler);
int fd = inotify_init();
- int wd = inotify_add_watch(fd, I2C_DEV_LOCATION,
- IN_CREATE | IN_MOVED_TO | IN_DELETE);
+ inotify_add_watch(fd, I2C_DEV_LOCATION,
+ IN_CREATE | IN_MOVED_TO | IN_DELETE);
std::array<char, 4096> readBuffer;
std::string pendingBuffer;
// monitor for new i2c devices