sdbusplus: remove deprecated variant_ns
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Id44aa42872ecddf18bf75db92369681942dfbc5c
diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp
index cdb0a02..338cb17 100644
--- a/src/oemcommands.cpp
+++ b/src/oemcommands.cpp
@@ -54,7 +54,6 @@
uint8_t *);
int sendMeCmd(uint8_t, uint8_t, std::vector<uint8_t> &, std::vector<uint8_t> &);
-namespace variant_ns = sdbusplus::message::variant_ns;
nlohmann::json oemData __attribute__((init_priority(101)));
enum class LanParam : uint8_t
@@ -187,7 +186,7 @@
bus, ipObjectInfo.second, ipObjectInfo.first,
ipmi::network::IP_INTERFACE);
- ipaddress = variant_ns::get<std::string>(properties["Address"]);
+ ipaddress = std::get<std::string>(properties["Address"]);
std::strcpy(data, ipaddress.c_str());
}
@@ -204,7 +203,7 @@
bus, ipObjectInfo.second, ipObjectInfo.first,
ipmi::network::IP_INTERFACE);
- ipaddress = variant_ns::get<std::string>(properties["Address"]);
+ ipaddress = std::get<std::string>(properties["Address"]);
std::strcpy(data, ipaddress.c_str());
}
@@ -221,7 +220,7 @@
bus, macObjectInfo.second, macObjectInfo.first,
ipmi::network::MAC_INTERFACE, "MACAddress");
- macAddress = variant_ns::get<std::string>(variant);
+ macAddress = std::get<std::string>(variant);
sscanf(macAddress.c_str(), ipmi::network::MAC_ADDRESS_FORMAT,
(data), (data + 1), (data + 2), (data + 3), (data + 4),
@@ -268,8 +267,7 @@
try
{
Value variant = property->second;
- std::string &result =
- sdbusplus::message::variant_ns::get<std::string>(variant);
+ std::string &result = std::get<std::string>(variant);
if (result.size() > maxFRUStringLength)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
@@ -279,7 +277,7 @@
data = result;
return 0;
}
- catch (sdbusplus::message::variant_ns::bad_variant_access &e)
+ catch (std::bad_variant_access &e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(e.what());
return -1;
diff --git a/src/storagecommands.cpp b/src/storagecommands.cpp
index 3c11372..4dd6b72 100644
--- a/src/storagecommands.cpp
+++ b/src/storagecommands.cpp
@@ -38,7 +38,6 @@
constexpr static const size_t maxFruSdrNameSize = 16;
static constexpr int sensorMapUpdatePeriod = 2;
using SensorMap = std::map<std::string, std::map<std::string, DbusVariant>>;
-namespace variant_ns = sdbusplus::message::variant_ns;
using ManagedObjectSensor =
std::map<sdbusplus::message::object_path,
@@ -216,10 +215,8 @@
continue;
}
- uint8_t fruBus =
- sdbusplus::message::variant_ns::get<uint32_t>(busFind->second);
- uint8_t fruAddr =
- sdbusplus::message::variant_ns::get<uint32_t>(addrFind->second);
+ uint8_t fruBus = std::get<uint32_t>(busFind->second);
+ uint8_t fruAddr = std::get<uint32_t>(addrFind->second);
uint8_t fruHash = 0;
// Need to revise this strategy for dev id
@@ -481,13 +478,11 @@
{
return false;
}
- if (sdbusplus::message::variant_ns::get<uint32_t>(
- findBus->second) != bus)
+ if (std::get<uint32_t>(findBus->second) != bus)
{
return false;
}
- if (sdbusplus::message::variant_ns::get<uint32_t>(
- findAddress->second) != address)
+ if (std::get<uint32_t>(findAddress->second) != address)
{
return false;
}
@@ -502,13 +497,11 @@
auto findBoardName = fruData->find("PRODUCT_PRODUCT_NAME");
if (findProductName != fruData->end())
{
- name = sdbusplus::message::variant_ns::get<std::string>(
- findProductName->second);
+ name = std::get<std::string>(findProductName->second);
}
else if (findBoardName != fruData->end())
{
- name = sdbusplus::message::variant_ns::get<std::string>(
- findBoardName->second);
+ name = std::get<std::string>(findBoardName->second);
}
else
{
@@ -715,12 +708,12 @@
double min = -127;
if (maxObject != sensorObject->second.end())
{
- max = variant_ns::visit(VariantToDoubleVisitor(), maxObject->second);
+ max = std::visit(VariantToDoubleVisitor(), maxObject->second);
}
if (minObject != sensorObject->second.end())
{
- min = variant_ns::visit(VariantToDoubleVisitor(), minObject->second);
+ min = std::visit(VariantToDoubleVisitor(), minObject->second);
}
int16_t mValue;