clang-tidy: Enable bugprone-narrowing-conversions
Modified code to address issues flagged by this check.
Tested: Build and unit tests passed successfully.
Change-Id: Idd5e3701725a833324535d29f0bfffb3ba180e88
Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com>
diff --git a/dump_offload.cpp b/dump_offload.cpp
index 4958b0c..edf1bff 100644
--- a/dump_offload.cpp
+++ b/dump_offload.cpp
@@ -37,7 +37,7 @@
void writeOnUnixSocket(const int socket, const char* buf,
const uint64_t blockSize)
{
- int numOfBytesWrote = 0;
+ ssize_t numOfBytesWrote = 0;
for (uint64_t i = 0; i < blockSize; i = i + numOfBytesWrote)
{
@@ -199,7 +199,7 @@
// allocate memory to contain file data
std::unique_ptr<char[]> buffer(new char[size]);
// get file data
- pbuf->sgetn(buffer.get(), size);
+ pbuf->sgetn(buffer.get(), static_cast<std::streamsize>(size));
infile.close();
writeOnUnixSocket(socketFD(), buffer.get(), size);