diff options
| author | Ed Tanous <ed.tanous@intel.com> | 2019-10-11 13:05:49 -0700 |
|---|---|---|
| committer | Ed Tanous <ed.tanous@intel.com> | 2019-10-11 13:05:49 -0700 |
| commit | 66664f25734f59618f53f7f8416e3894ecb4db37 (patch) | |
| tree | 5b7c4411d0e4961bc9b6d79182d186af66b134db /include | |
| parent | a6f9392101c6adb9f4ad57d349c392b2396c2cb1 (diff) | |
| download | bmcweb-66664f25734f59618f53f7f8416e3894ecb4db37.tar.gz bmcweb-66664f25734f59618f53f7f8416e3894ecb4db37.zip | |
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
Diffstat (limited to 'include')
| -rw-r--r-- | include/openbmc_dbus_rest.hpp | 34 |
1 files changed, 24 insertions, 10 deletions
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 @@ int convertJsonToDbus(sd_bus_message *m, const std::string &arg_type, 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 @@ int convertJsonToDbus(sd_bus_message *m, const std::string &arg_type, // 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 @@ int convertJsonToDbus(sd_bus_message *m, const std::string &arg_type, } else if (argCode == "y") { + const uint64_t *uintValue = j->get_ptr<const uint64_t *>(); if (uintValue == nullptr) { return -1; @@ -677,6 +688,7 @@ int convertJsonToDbus(sd_bus_message *m, const std::string &arg_type, } else if (argCode == "q") { + const uint64_t *uintValue = j->get_ptr<const uint64_t *>(); if (uintValue == nullptr) { return -1; @@ -691,6 +703,7 @@ int convertJsonToDbus(sd_bus_message *m, const std::string &arg_type, } else if (argCode == "u") { + const uint64_t *uintValue = j->get_ptr<const uint64_t *>(); if (uintValue == nullptr) { return -1; @@ -705,6 +718,7 @@ int convertJsonToDbus(sd_bus_message *m, const std::string &arg_type, } else if (argCode == "t") { + const uint64_t *uintValue = j->get_ptr<const uint64_t *>(); if (uintValue == nullptr) { return -1; |

