summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2022-01-13 00:56:15 +0300
committerEd Tanous <ed@tanous.net>2022-01-13 01:18:16 +0300
commit0dccd040311847cbd7438b5f63207d360d5b3a34 (patch)
treea3ecebb0c67b54ea46014e21ae4a83082c95e1a1
parentebe4d91e8fece8c292395ccfd45d87a3546fd821 (diff)
downloadbmcweb-0dccd040311847cbd7438b5f63207d360d5b3a34.tar.xz
Fix 32/64 bit compile issue
It turns out std::string, std::fstream::read, and std::ifstream::tellg all use different integer types, which differ depending on 32 vs 64 bit. This is similar to the problem we already had, just now the compiler is warning us. Wrap in a static_cast to make sure it builds for all environments. Tested: Code compiles in 32 bit. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ie8fd610812fd2271e6be599dacca583747b9217f
-rw-r--r--redfish-core/lib/log_services.hpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 774bb0a272..1b84e3b9cf 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -2856,9 +2856,11 @@ inline void requestRoutesCrashdumpFile(App& app)
return;
}
ifs.seekg(0, std::ios::beg);
+ std::streamsize streamFileSize =
+ static_cast<std::streamsize>(fileSize);
size_t sFileSize = static_cast<size_t>(fileSize);
asyncResp->res.body().resize(sFileSize, '\0');
- ifs.read(asyncResp->res.body().data(), fileSize);
+ ifs.read(asyncResp->res.body().data(), streamFileSize);
// Configure this to be a file download when accessed
// from a browser