fru-device: use off_t/size_t for FRU IO offsets & lengths

While the 8-bit and 16-bit types that had been used for these were
adequate for the small devices typically used for most FRU EEPROMs, some
do get within striking distance of the limits of 16-bit types, and we
might as well use the more "natural" types that are intended for these
sorts of parameters, which avoid the risk of range problems and signal
intent more clearly & explicitly.

Tested: on an ASRock Rack romed8hm3, fru-device successfully recognizes
and parses the baseboard FRU EEPROM as it did prior to this patch.

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Change-Id: I38251fec2857923356d324e01af77795186560eb
diff --git a/src/FruUtils.cpp b/src/FruUtils.cpp
index 9a7c519..70f461c 100644
--- a/src/FruUtils.cpp
+++ b/src/FruUtils.cpp
@@ -590,7 +590,7 @@
 bool findFRUHeader(int flag, int file, uint16_t address,
                    const ReadBlockFunc& readBlock, const std::string& errorHelp,
                    std::array<uint8_t, I2C_SMBUS_BLOCK_MAX>& blockData,
-                   uint16_t& baseOffset)
+                   off_t& baseOffset)
 {
     if (readBlock(flag, file, address, baseOffset, 0x8, blockData.data()) < 0)
     {
@@ -638,7 +638,7 @@
                                      const std::string& errorHelp)
 {
     std::array<uint8_t, I2C_SMBUS_BLOCK_MAX> blockData;
-    uint16_t baseOffset = 0x0;
+    off_t baseOffset = 0x0;
 
     if (!findFRUHeader(flag, file, address, readBlock, errorHelp, blockData,
                        baseOffset))
@@ -685,8 +685,7 @@
 
         areaOffset *= fruBlockSize;
 
-        if (readBlock(flag, file, address,
-                      baseOffset + static_cast<uint16_t>(areaOffset), 0x2,
+        if (readBlock(flag, file, address, baseOffset + areaOffset, 0x2,
                       blockData.data()) < 0)
         {
             std::cerr << "failed to read " << errorHelp << " base offset "
@@ -717,8 +716,7 @@
         {
             // In multi-area, the area offset points to the 0th record, each
             // record has 3 bytes of the header we care about.
-            if (readBlock(flag, file, address,
-                          baseOffset + static_cast<uint16_t>(areaOffset), 0x3,
+            if (readBlock(flag, file, address, baseOffset + areaOffset, 0x3,
                           blockData.data()) < 0)
             {
                 std::cerr << "failed to read " << errorHelp << " base offset "
@@ -750,10 +748,8 @@
         size_t requestLength =
             std::min(static_cast<size_t>(I2C_SMBUS_BLOCK_MAX), fruLength);
 
-        if (readBlock(flag, file, address,
-                      baseOffset + static_cast<uint16_t>(readOffset),
-                      static_cast<uint8_t>(requestLength),
-                      blockData.data()) < 0)
+        if (readBlock(flag, file, address, baseOffset + readOffset,
+                      requestLength, blockData.data()) < 0)
         {
             std::cerr << "failed to read " << errorHelp << " base offset "
                       << baseOffset << "\n";