Fix some warnings
-werror on the newest version of GCC finds even more stuff than was
found before. Fix all of them.
Tested: No functional change. In theory these cases can't occur unless
a dbus interface is broken.
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Change-Id: Id11e29e4851075b511e69cbc006aa8d7e1e229f0
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index 775e6e1..749e899 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -533,7 +533,6 @@
jIt++;
}
const int64_t *intValue = j->get_ptr<const int64_t *>();
- const uint64_t *uintValue = j->get_ptr<const uint64_t *>();
const std::string *stringValue = j->get_ptr<const std::string *>();
const double *doubleValue = j->get_ptr<const double *>();
const bool *b = j->get_ptr<const bool *>();
@@ -542,20 +541,31 @@
// Do some basic type conversions that make sense. uint can be
// converted to int. int and uint can be converted to double
- if (uintValue != nullptr && intValue == nullptr)
+ if (intValue == nullptr)
{
- v = static_cast<int64_t>(*uintValue);
- intValue = &v;
+ const uint64_t *uintValue = j->get_ptr<const uint64_t *>();
+ if (uintValue != nullptr)
+ {
+ v = static_cast<int64_t>(*uintValue);
+ intValue = &v;
+ }
}
- if (uintValue != nullptr && doubleValue == nullptr)
+ if (doubleValue == nullptr)
{
- d = static_cast<double>(*uintValue);
- doubleValue = &d;
+ const uint64_t *uintValue = j->get_ptr<const uint64_t *>();
+ if (uintValue != nullptr)
+ {
+ d = static_cast<double>(*uintValue);
+ doubleValue = &d;
+ }
}
- if (intValue != nullptr && doubleValue == nullptr)
+ if (doubleValue == nullptr)
{
- d = static_cast<double>(*intValue);
- doubleValue = &d;
+ if (intValue != nullptr)
+ {
+ d = static_cast<double>(*intValue);
+ doubleValue = &d;
+ }
}
if (argCode == "s")
@@ -663,6 +673,7 @@
}
else if (argCode == "y")
{
+ const uint64_t *uintValue = j->get_ptr<const uint64_t *>();
if (uintValue == nullptr)
{
return -1;
@@ -677,6 +688,7 @@
}
else if (argCode == "q")
{
+ const uint64_t *uintValue = j->get_ptr<const uint64_t *>();
if (uintValue == nullptr)
{
return -1;
@@ -691,6 +703,7 @@
}
else if (argCode == "u")
{
+ const uint64_t *uintValue = j->get_ptr<const uint64_t *>();
if (uintValue == nullptr)
{
return -1;
@@ -705,6 +718,7 @@
}
else if (argCode == "t")
{
+ const uint64_t *uintValue = j->get_ptr<const uint64_t *>();
if (uintValue == nullptr)
{
return -1;