summaryrefslogtreecommitdiffstats
path: root/redfish-core/include/utils
diff options
context:
space:
mode:
authorEd Tanous <ed.tanous@intel.com>2019-07-09 16:24:22 -0700
committerEd Tanous <ed.tanous@intel.com>2019-10-10 23:25:26 +0000
commit271584ab78b4c1926f766aa26ddfde7da329059f (patch)
tree08001912ea542de88b9c31f5d53f195dedd56988 /redfish-core/include/utils
parent70ee8cbd4f3ec5b3e3c18967de221a9f3a70cd38 (diff)
downloadbmcweb-271584ab78b4c1926f766aa26ddfde7da329059f.tar.gz
bmcweb-271584ab78b4c1926f766aa26ddfde7da329059f.zip
Fix a bunch of warnings
using the list of warnings from here: https://github.com/lefticus/cppbestpractices/blob/e73393f25a85f83fed7399d8b65cb117d00b2231/02-Use_the_Tools_Available.md#L100 Seems like a good place to start, and would improve things a bit type-wise. This patchset attempts to correct all the issues in one shot. Tested: It builds. Will test various subsystems that have been touched Signed-off-by: Ed Tanous <ed.tanous@intel.com> Change-Id: I588c26440e5a97f718a0f0ea74cc84107d53aa1e
Diffstat (limited to 'redfish-core/include/utils')
-rw-r--r--redfish-core/include/utils/json_utils.hpp8
-rw-r--r--redfish-core/include/utils/systemd_utils.hpp6
2 files changed, 11 insertions, 3 deletions
diff --git a/redfish-core/include/utils/json_utils.hpp b/redfish-core/include/utils/json_utils.hpp
index c36ad3c..cf3227a 100644
--- a/redfish-core/include/utils/json_utils.hpp
+++ b/redfish-core/include/utils/json_utils.hpp
@@ -139,6 +139,10 @@ bool unpackValue(nlohmann::json& jsonValue, const std::string& key,
else if constexpr (std::is_signed_v<Type>)
{
int64_t* jsonPtr = jsonValue.get_ptr<int64_t*>();
+ if (jsonPtr == nullptr)
+ {
+ return false;
+ }
if (!checkRange<Type>(*jsonPtr, key, jsonValue, res))
{
return false;
@@ -150,6 +154,10 @@ bool unpackValue(nlohmann::json& jsonValue, const std::string& key,
!std::is_same_v<bool, Type>))
{
uint64_t* jsonPtr = jsonValue.get_ptr<uint64_t*>();
+ if (jsonPtr == nullptr)
+ {
+ return false;
+ }
if (!checkRange<Type>(*jsonPtr, key, jsonValue, res))
{
return false;
diff --git a/redfish-core/include/utils/systemd_utils.hpp b/redfish-core/include/utils/systemd_utils.hpp
index 1c34fca..da1b4e2 100644
--- a/redfish-core/include/utils/systemd_utils.hpp
+++ b/redfish-core/include/utils/systemd_utils.hpp
@@ -33,9 +33,9 @@ const std::string getUuid()
{
std::string ret;
// This ID needs to match the one in ipmid
- sd_id128_t appId = SD_ID128_MAKE(e0, e1, 73, 76, 64, 61, 47, da, a5, 0c, d0,
- cc, 64, 12, 45, 78);
- sd_id128_t machineId = SD_ID128_NULL;
+ sd_id128_t appId{{0Xe0, 0Xe1, 0X73, 0X76, 0X64, 0X61, 0X47, 0Xda, 0Xa5,
+ 0X0c, 0Xd0, 0Xcc, 0X64, 0X12, 0X45, 0X78}};
+ sd_id128_t machineId{};
if (sd_id128_get_machine_app_specific(appId, &machineId) == 0)
{
OpenPOWER on IntegriCloud