Revert "bmcweb: Fix a bunch of warnings"
This reverts commit 6ea007a2faec52ad62680015d2a3f00371a1e351.
Reason for revert: Reports of bmcweb seg faults.
Change-Id: I408f1bb29c2f8e427a6621cdaac8c31b847ebf06
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index b07d6b1..61cbd9e 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -46,8 +46,8 @@
size_t length = 0;
int ret = 0;
// Get the metadata from the requested field of the journal entry
- ret = sd_journal_get_data(journal, field.data(),
- reinterpret_cast<const void **>(&data), &length);
+ ret = sd_journal_get_data(journal, field.data(), (const void **)&data,
+ &length);
if (ret < 0)
{
return ret;
@@ -70,7 +70,7 @@
{
return ret;
}
- contents = static_cast<int>(strtol(metadata.data(), nullptr, base));
+ contents = strtol(metadata.data(), nullptr, base);
return ret;
}
@@ -215,12 +215,12 @@
{
index = std::stoul(std::string(indexStr), &pos);
}
- catch (std::invalid_argument &)
+ catch (std::invalid_argument)
{
messages::resourceMissingAtURI(res, entryID);
return false;
}
- catch (std::out_of_range &)
+ catch (std::out_of_range)
{
messages::resourceMissingAtURI(res, entryID);
return false;
@@ -237,12 +237,12 @@
{
timestamp = std::stoull(std::string(tsStr), &pos);
}
- catch (std::invalid_argument &)
+ catch (std::invalid_argument)
{
messages::resourceMissingAtURI(res, entryID);
return false;
}
- catch (std::out_of_range &)
+ catch (std::out_of_range)
{
messages::resourceMissingAtURI(res, entryID);
return false;
@@ -382,8 +382,8 @@
{
continue;
}
- unsigned long argNum = std::strtoul(field.data(), nullptr, 10);
- if (argNum == 0 || argNum > std::numeric_limits<size_t>::max())
+ int argNum = std::strtoul(field.data(), nullptr, 10);
+ if (argNum == 0)
{
continue;
}
@@ -392,7 +392,7 @@
// Make sure we have enough space in messageArgs
if (argNum > messageArgs.size())
{
- messageArgs.resize(static_cast<size_t>(argNum));
+ messageArgs.resize(argNum);
}
messageArgs[argNum - 1] = std::string(field);
}
@@ -482,7 +482,7 @@
std::unique_ptr<sd_journal, decltype(&sd_journal_close)> journal(
journalTmp, sd_journal_close);
journalTmp = nullptr;
- long entryCount = 0;
+ uint64_t entryCount = 0;
SD_JOURNAL_FOREACH(journal.get())
{
// Look for only journal entries that contain a REDFISH_MESSAGE_ID
@@ -803,7 +803,7 @@
std::unique_ptr<sd_journal, decltype(&sd_journal_close)> journal(
journalTmp, sd_journal_close);
journalTmp = nullptr;
- long entryCount = 0;
+ uint64_t entryCount = 0;
SD_JOURNAL_FOREACH(journal.get())
{
entryCount++;
@@ -1094,7 +1094,7 @@
messages::internalError(asyncResp->res);
return;
}
- const int logId = std::atoi(params[0].c_str());
+ const uint8_t logId = std::atoi(params[0].c_str());
auto getStoredLogCallback = [asyncResp, logId](
const boost::system::error_code ec,
const std::variant<std::string> &resp) {