Make clang-tidy changes
clang-tidy has a number of checks it recommends. These checks are
documented in the next commit, but make the code pass our coding
standard.
Tested:
Minor changes made by the robot.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I6cfaab92211af9c4c1eccd981ba9fe7b8c523457
diff --git a/src/fru_reader.cpp b/src/fru_reader.cpp
index e381e7e..61d4020 100644
--- a/src/fru_reader.cpp
+++ b/src/fru_reader.cpp
@@ -30,8 +30,8 @@
break;
}
- const uint8_t* blkData;
- size_t available;
+ const uint8_t* blkData = nullptr;
+ size_t available = 0;
size_t blk = cursor / cacheBlockSize;
size_t blkOffset = cursor % cacheBlockSize;
auto findBlk = cache.find(blk);
@@ -52,7 +52,7 @@
{
// don't leave empty blocks in the cache
cache.erase(blk);
- return done ? done : ret;
+ return done != 0U ? done : ret;
}
blkData = newData;
@@ -80,6 +80,7 @@
? 0
: std::min(available - blkOffset, remaining);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
memcpy(outbuf + done, blkData + blkOffset, toCopy);
cursor += toCopy;
done += toCopy;