fix different signedness comparison
../ipmbbridged.cpp:368:12: warning: comparison of integer expressions of different signedness: ‘int’ and ‘const size_t’ {aka ‘const long unsigned int’} [-Wsign-compare]
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I12bff463c9422f050a572f0936ca5488a461c807
diff --git a/ipmbbridged.cpp b/ipmbbridged.cpp
index 678c750..5b22a7a 100644
--- a/ipmbbridged.cpp
+++ b/ipmbbridged.cpp
@@ -354,7 +354,13 @@
IPMB_HEADER* ipmbFrame = &(ipmbPkt->hdr);
lseek(ipmbi2cSlaveFd, 0, SEEK_SET);
- int r = read(ipmbi2cSlaveFd, buffer.data(), ipmbMaxFrameLength);
+ ssize_t r = read(ipmbi2cSlaveFd, buffer.data(), ipmbMaxFrameLength);
+
+ // Handle error cases.
+ if (r < 0)
+ {
+ goto end;
+ }
/* Substract first byte len size from total frame length */
r--;
diff --git a/ipmbbridged.hpp b/ipmbbridged.hpp
index 08c68e8..d7a75a7 100644
--- a/ipmbbridged.hpp
+++ b/ipmbbridged.hpp
@@ -73,8 +73,8 @@
constexpr size_t ipmbPktLenSize = 1;
constexpr size_t ipmbChecksumSize = 1;
constexpr size_t ipmbChecksum2StartOffset = 3;
-constexpr size_t ipmbMinFrameLength = 7;
-constexpr size_t ipmbMaxFrameLength =
+constexpr ssize_t ipmbMinFrameLength = 7;
+constexpr ssize_t ipmbMaxFrameLength =
ipmbPktLenSize + ipmbConnectionHeaderLength + ipmbResponseDataHeaderLength +
ipmbChecksumSize + ipmbMaxDataSize;