Remove usages of boost::starts/ends_with
Per the coding standard, now that C++ supports std::string::starts_with
and std::string::ends_with, we should be using them over the boost
alternatives. This commit goes through and updates all usages.
Arguably some of these are incorrect, and instances of common error 13,
but because this is mostly a mechanical it intentionally doesn't try to
handle it.
Tested: Unit tests pass.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ic4c6e5d0da90f7442693199dc691a47d2240fa4f
diff --git a/http/http_connection.hpp b/http/http_connection.hpp
index d20fd25..feea815 100644
--- a/http/http_connection.hpp
+++ b/http/http_connection.hpp
@@ -7,7 +7,6 @@
#include "logging.hpp"
#include "utility.hpp"
-#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/ip/tcp.hpp>
diff --git a/http/websocket.hpp b/http/websocket.hpp
index 3aa8554..ecaa1d2 100644
--- a/http/websocket.hpp
+++ b/http/websocket.hpp
@@ -2,7 +2,6 @@
#include "http_request.hpp"
#include <async_resp.hpp>
-#include <boost/algorithm/string/predicate.hpp>
#include <boost/asio/buffer.hpp>
#include <boost/beast/websocket.hpp>
diff --git a/include/authentication.hpp b/include/authentication.hpp
index 8d59be4..ac2a7d1 100644
--- a/include/authentication.hpp
+++ b/include/authentication.hpp
@@ -3,7 +3,6 @@
#include "webroutes.hpp"
#include <app.hpp>
-#include <boost/algorithm/string/predicate.hpp>
#include <boost/container/flat_set.hpp>
#include <common.hpp>
#include <forward_unauthorized.hpp>
@@ -42,7 +41,7 @@
{
BMCWEB_LOG_DEBUG << "[AuthMiddleware] Basic authentication";
- if (!boost::starts_with(authHeader, "Basic "))
+ if (!authHeader.starts_with("Basic "))
{
return nullptr;
}
@@ -97,7 +96,7 @@
performTokenAuth(std::string_view authHeader)
{
BMCWEB_LOG_DEBUG << "[AuthMiddleware] Token authentication";
- if (!boost::starts_with(authHeader, "Token "))
+ if (!authHeader.starts_with("Token "))
{
return nullptr;
}
diff --git a/include/http_utility.hpp b/include/http_utility.hpp
index 3970992..c150943 100644
--- a/include/http_utility.hpp
+++ b/include/http_utility.hpp
@@ -1,7 +1,8 @@
#pragma once
#include "http_request.hpp"
-#include <boost/algorithm/string.hpp>
+#include <boost/algorithm/string/classification.hpp>
+#include <boost/algorithm/string/split.hpp>
namespace http_helpers
{
diff --git a/include/ibm/locks.hpp b/include/ibm/locks.hpp
index 2c6668c..5df3daa 100644
--- a/include/ibm/locks.hpp
+++ b/include/ibm/locks.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include <boost/algorithm/string.hpp>
+#include <boost/algorithm/string/predicate.hpp>
#include <boost/container/flat_map.hpp>
#include <boost/endian/conversion.hpp>
#include <include/ibm/utils.hpp>
@@ -9,6 +9,7 @@
#include <filesystem>
#include <fstream>
+#include <variant>
namespace crow
{
diff --git a/include/ibm/management_console_rest.hpp b/include/ibm/management_console_rest.hpp
index 8d50c9f..0d8e287 100644
--- a/include/ibm/management_console_rest.hpp
+++ b/include/ibm/management_console_rest.hpp
@@ -2,7 +2,7 @@
#include <app.hpp>
#include <async_resp.hpp>
-#include <boost/algorithm/string.hpp>
+#include <boost/algorithm/string/predicate.hpp>
#include <boost/container/flat_set.hpp>
#include <error_messages.hpp>
#include <event_service_manager.hpp>
diff --git a/include/login_routes.hpp b/include/login_routes.hpp
index fde4b8f..fd1c357 100644
--- a/include/login_routes.hpp
+++ b/include/login_routes.hpp
@@ -34,7 +34,7 @@
// within it are not destroyed before we can use them
nlohmann::json loginCredentials;
// Check if auth was provided by a payload
- if (boost::starts_with(contentType, "application/json"))
+ if (contentType.starts_with("application/json"))
{
loginCredentials = nlohmann::json::parse(req.body, nullptr, false);
if (loginCredentials.is_discarded())
@@ -116,7 +116,7 @@
}
}
}
- else if (boost::starts_with(contentType, "multipart/form-data"))
+ else if (contentType.starts_with("multipart/form-data"))
{
looksLikePhosphorRest = true;
MultipartParser parser;
diff --git a/include/multipart_parser.hpp b/include/multipart_parser.hpp
index 9d801da..2fe3679 100644
--- a/include/multipart_parser.hpp
+++ b/include/multipart_parser.hpp
@@ -1,6 +1,5 @@
#pragma once
-#include <boost/algorithm/string/predicate.hpp>
#include <boost/beast/http/fields.hpp>
#include <http_request.hpp>
@@ -58,8 +57,7 @@
std::string_view contentType = req.getHeaderValue("content-type");
const std::string boundaryFormat = "multipart/form-data; boundary=";
- if (!boost::starts_with(req.getHeaderValue("content-type"),
- boundaryFormat))
+ if (!contentType.starts_with(boundaryFormat))
{
return ParserError::ERROR_BOUNDARY_FORMAT;
}
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index d0bc29c..cf07f76 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -17,7 +17,9 @@
#include <app.hpp>
#include <async_resp.hpp>
-#include <boost/algorithm/string.hpp>
+#include <boost/algorithm/string/classification.hpp>
+#include <boost/algorithm/string/predicate.hpp>
+#include <boost/algorithm/string/split.hpp>
#include <boost/container/flat_set.hpp>
#include <dbus_singleton.hpp>
#include <dbus_utility.hpp>
@@ -207,7 +209,7 @@
{
for (const auto& interface : interfaces)
{
- if (!boost::starts_with(interface, "org.freedesktop.DBus"))
+ if (!interface.starts_with("org.freedesktop.DBus"))
{
getPropertiesForEnumerate(path, service, interface,
asyncResp);
@@ -244,7 +246,6 @@
InProgressEnumerateData(InProgressEnumerateData&&) = delete;
InProgressEnumerateData& operator=(const InProgressEnumerateData&) = delete;
InProgressEnumerateData& operator=(InProgressEnumerateData&&) = delete;
-
const std::string objectPath;
std::shared_ptr<dbus::utility::MapperGetSubTreeResponse> subtree;
std::shared_ptr<bmcweb::AsyncResp> asyncResp;
@@ -275,7 +276,7 @@
for (const auto& objectPath : objects)
{
- if (boost::starts_with(objectPath.first.str, objectName))
+ if (objectPath.first.str.starts_with(objectName))
{
BMCWEB_LOG_DEBUG << "Reading object " << objectPath.first.str;
nlohmann::json& objectJson = dataJson[objectPath.first.str];
@@ -775,7 +776,7 @@
}
sd_bus_message_append_basic(m, argCode[0], doubleValue);
}
- else if (boost::starts_with(argCode, "a"))
+ else if (argCode.starts_with("a"))
{
std::string containedType = argCode.substr(1);
r = sd_bus_message_open_container(m, SD_BUS_TYPE_ARRAY,
@@ -795,7 +796,7 @@
}
sd_bus_message_close_container(m);
}
- else if (boost::starts_with(argCode, "v"))
+ else if (argCode.starts_with("v"))
{
std::string containedType = argCode.substr(1);
BMCWEB_LOG_DEBUG << "variant type: " << argCode
@@ -819,8 +820,7 @@
return r;
}
}
- else if (boost::starts_with(argCode, "(") &&
- boost::ends_with(argCode, ")"))
+ else if (argCode.starts_with("(") && argCode.ends_with(")"))
{
std::string containedType = argCode.substr(1, argCode.size() - 1);
r = sd_bus_message_open_container(m, SD_BUS_TYPE_STRUCT,
@@ -846,8 +846,7 @@
}
r = sd_bus_message_close_container(m);
}
- else if (boost::starts_with(argCode, "{") &&
- boost::ends_with(argCode, "}"))
+ else if (argCode.starts_with("{") && argCode.ends_with("}"))
{
std::string containedType = argCode.substr(1, argCode.size() - 1);
r = sd_bus_message_open_container(m, SD_BUS_TYPE_DICT_ENTRY,
@@ -1000,8 +999,7 @@
return r;
}
- bool dict = boost::starts_with(containedType, "{") &&
- boost::ends_with(containedType, "}");
+ bool dict = containedType.starts_with("{") && containedType.ends_with("}");
if (dict)
{
@@ -1243,7 +1241,7 @@
return r;
}
}
- else if (boost::starts_with(typeCode, "a"))
+ else if (typeCode.starts_with("a"))
{
r = readArrayFromMessage(typeCode, m, *thisElement);
if (r < 0)
@@ -1251,8 +1249,7 @@
return r;
}
}
- else if (boost::starts_with(typeCode, "(") &&
- boost::ends_with(typeCode, ")"))
+ else if (typeCode.starts_with("(") && typeCode.ends_with(")"))
{
r = readStructFromMessage(typeCode, m, *thisElement);
if (r < 0)
@@ -1260,7 +1257,7 @@
return r;
}
}
- else if (boost::starts_with(typeCode, "v"))
+ else if (typeCode.starts_with("v"))
{
r = readVariantFromMessage(m, *thisElement);
if (r < 0)
@@ -2028,13 +2025,13 @@
}
else if (req.method() == boost::beast::http::verb::get)
{
- if (boost::ends_with(objectPath, "/enumerate"))
+ if (objectPath.ends_with("/enumerate"))
{
objectPath.erase(objectPath.end() - sizeof("enumerate"),
objectPath.end());
handleEnumerate(asyncResp, objectPath);
}
- else if (boost::ends_with(objectPath, "/list"))
+ else if (objectPath.ends_with("/list"))
{
objectPath.erase(objectPath.end() - sizeof("list"),
objectPath.end());
@@ -2043,7 +2040,7 @@
else
{
// Trim any trailing "/" at the end
- if (boost::ends_with(objectPath, "/"))
+ if (objectPath.ends_with("/"))
{
objectPath.pop_back();
handleList(asyncResp, objectPath, 1);
diff --git a/include/webassets.hpp b/include/webassets.hpp
index 6353a42..3d25296 100644
--- a/include/webassets.hpp
+++ b/include/webassets.hpp
@@ -79,7 +79,7 @@
if (std::filesystem::is_directory(dir))
{
// don't recurse into hidden directories or symlinks
- if (boost::starts_with(dir.path().filename().string(), ".") ||
+ if (dir.path().filename().string().starts_with(".") ||
std::filesystem::is_symlink(dir))
{
dirIter.disable_recursion_pending();
@@ -99,7 +99,7 @@
contentEncoding = "gzip";
}
- if (boost::starts_with(webpath.filename().string(), "index."))
+ if (webpath.filename().string().starts_with("index."))
{
webpath = webpath.parent_path();
if (webpath.string().empty() || webpath.string().back() != '/')
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
index aa7f0eb..0bce29f 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -22,6 +22,8 @@
#include <sys/inotify.h>
+#include <boost/algorithm/string/classification.hpp>
+#include <boost/algorithm/string/split.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/container/flat_map.hpp>
#include <dbus_utility.hpp>
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index a4ecbf0..c2c873d 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -318,15 +318,14 @@
std::string objectPath;
std::string service;
- if (boost::starts_with(
- certURI,
+ if (certURI.starts_with(
"/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates"))
{
objectPath = certs::httpsObjectPath;
service = certs::httpsServiceName;
}
- else if (boost::starts_with(
- certURI, "/redfish/v1/AccountService/LDAP/Certificates"))
+ else if (certURI.starts_with(
+ "/redfish/v1/AccountService/LDAP/Certificates"))
{
objectPath = certs::ldapObjectPath;
service = certs::ldapServiceName;
@@ -358,8 +357,7 @@
}
// validate KeyUsage supporting only 1 type based on URL
- if (boost::starts_with(
- certURI,
+ if (certURI.starts_with(
"/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates"))
{
if (optKeyUsage->empty())
@@ -382,8 +380,8 @@
return;
}
}
- else if (boost::starts_with(
- certURI, "/redfish/v1/AccountService/LDAP/Certificates"))
+ else if (certURI.starts_with(
+ "/redfish/v1/AccountService/LDAP/Certificates"))
{
if (optKeyUsage->empty())
{
@@ -799,8 +797,7 @@
std::string objectPath;
std::string name;
std::string service;
- if (boost::starts_with(
- certURI,
+ if (certURI.starts_with(
"/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/"))
{
objectPath =
@@ -808,16 +805,15 @@
name = "HTTPS certificate";
service = certs::httpsServiceName;
}
- else if (boost::starts_with(
- certURI, "/redfish/v1/AccountService/LDAP/Certificates/"))
+ else if (certURI.starts_with(
+ "/redfish/v1/AccountService/LDAP/Certificates/"))
{
objectPath =
std::string(certs::ldapObjectPath) + "/" + std::to_string(id);
name = "LDAP certificate";
service = certs::ldapServiceName;
}
- else if (boost::starts_with(
- certURI,
+ else if (certURI.starts_with(
"/redfish/v1/Managers/bmc/Truststore/Certificates/"))
{
objectPath = std::string(certs::authorityObjectPath) + "/" +
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index be4ce7e..5ccc25f 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -16,6 +16,8 @@
#pragma once
#include <app.hpp>
+#include <boost/algorithm/string/classification.hpp>
+#include <boost/algorithm/string/split.hpp>
#include <boost/container/flat_set.hpp>
#include <dbus_singleton.hpp>
#include <dbus_utility.hpp>
@@ -430,7 +432,7 @@
for (const auto& objpath : dbusData)
{
// Check if proper pattern for object path appears
- if (boost::starts_with(objpath.first.str, ipv6PathStart))
+ if (objpath.first.str.starts_with(ipv6PathStart))
{
for (const auto& interface : objpath.second)
{
@@ -508,7 +510,7 @@
for (const auto& objpath : dbusData)
{
// Check if proper pattern for object path appears
- if (boost::starts_with(objpath.first.str, ipv4PathStart))
+ if (objpath.first.str.starts_with(ipv4PathStart))
{
for (const auto& interface : objpath.second)
{
@@ -569,7 +571,7 @@
}
// Check if given address is local, or global
ipv4Address.linktype =
- boost::starts_with(ipv4Address.address, "169.254.")
+ ipv4Address.address.starts_with("169.254.")
? LinkType::Local
: LinkType::Global;
}
@@ -1815,7 +1817,7 @@
inline bool verifyNames(const std::string& parent, const std::string& iface)
{
- return boost::starts_with(iface, parent + "_");
+ return iface.starts_with(parent + "_");
}
inline void requestEthernetInterfacesRoutes(App& app)
@@ -2272,7 +2274,7 @@
for (const std::string& ifaceItem : ifaceList)
{
- if (boost::starts_with(ifaceItem, rootInterfaceName + "_"))
+ if (ifaceItem.starts_with(rootInterfaceName + "_"))
{
std::string path =
"/redfish/v1/Managers/bmc/EthernetInterfaces/";
diff --git a/redfish-core/lib/health.hpp b/redfish-core/lib/health.hpp
index cf84c93..2f0f156 100644
--- a/redfish-core/lib/health.hpp
+++ b/redfish-core/lib/health.hpp
@@ -18,7 +18,6 @@
#include "async_resp.hpp"
#include <app.hpp>
-#include <boost/algorithm/string/predicate.hpp>
#include <dbus_singleton.hpp>
#include <dbus_utility.hpp>
#include <nlohmann/json.hpp>
@@ -73,7 +72,7 @@
if (selfPath)
{
if (boost::equals(path.str, *selfPath) ||
- boost::starts_with(path.str, *selfPath + "/"))
+ path.str.starts_with(*selfPath + "/"))
{
isSelf = true;
}
@@ -89,7 +88,7 @@
for (const std::string& child : inventory)
{
- if (boost::starts_with(path.str, child))
+ if (path.str.starts_with(child))
{
isChild = true;
break;
@@ -138,15 +137,15 @@
}
}
- if (boost::starts_with(path.str, globalInventoryPath) &&
- boost::ends_with(path.str, "critical"))
+ if (path.str.starts_with(globalInventoryPath) &&
+ path.str.ends_with("critical"))
{
health = "Critical";
rollup = "Critical";
return;
}
- if (boost::starts_with(path.str, globalInventoryPath) &&
- boost::ends_with(path.str, "warning"))
+ if (path.str.starts_with(globalInventoryPath) &&
+ path.str.ends_with("warning"))
{
health = "Warning";
if (rollup != "Critical")
@@ -154,7 +153,7 @@
rollup = "Warning";
}
}
- else if (boost::ends_with(path.str, "critical"))
+ else if (path.str.ends_with("critical"))
{
rollup = "Critical";
if (isSelf)
@@ -163,7 +162,7 @@
return;
}
}
- else if (boost::ends_with(path.str, "warning"))
+ else if (path.str.ends_with("warning"))
{
if (rollup != "Critical")
{
@@ -224,8 +223,8 @@
self->statuses = resp;
for (auto it = self->statuses.begin(); it != self->statuses.end();)
{
- if (boost::ends_with(it->first.str, "critical") ||
- boost::ends_with(it->first.str, "warning"))
+ if (it->first.str.ends_with("critical") ||
+ it->first.str.ends_with("warning"))
{
it++;
continue;
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index ffae14d..fc5754b 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -27,6 +27,7 @@
#include <unistd.h>
#include <app.hpp>
+#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/beast/http.hpp>
@@ -312,7 +313,7 @@
{
// If we find a redfish log file, save the path
std::string filename = dirEnt.path().filename();
- if (boost::starts_with(filename, redfishLogFilename))
+ if (filename.starts_with(redfishLogFilename))
{
redfishLogFiles.emplace_back(redfishLogDir / filename);
}
@@ -1774,7 +1775,7 @@
std::string filename = it.path().filename();
// Prefix of each log files is "log". Find the file and save the
// path
- if (boost::starts_with(filename, "log"))
+ if (filename.starts_with("log"))
{
hostLoggerFiles.emplace_back(it.path());
}
diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp
index c4a2ef4..3c10130 100644
--- a/redfish-core/lib/memory.hpp
+++ b/redfish-core/lib/memory.hpp
@@ -18,7 +18,6 @@
#include "health.hpp"
#include <app.hpp>
-#include <boost/algorithm/string.hpp>
#include <dbus_utility.hpp>
#include <nlohmann/json.hpp>
#include <query.hpp>
@@ -383,7 +382,7 @@
for (const char* v : values)
{
- if (boost::ends_with(*value, v))
+ if (value->ends_with(v))
{
aResp->res.jsonValue[jsonPtr]["OperatingMemoryModes"].push_back(
v);
@@ -405,7 +404,7 @@
for (const char* v : values)
{
- if (boost::ends_with(*value, v))
+ if (value->ends_with(v))
{
aResp->res.jsonValue[jsonPtr]["MemoryMedia"].push_back(v);
break;
@@ -554,7 +553,7 @@
for (const char* v : values)
{
- if (boost::ends_with(*value, v))
+ if (value->ends_with(v))
{
aResp->res.jsonValue[jsonPtr]["ErrorCorrection"] = v;
break;
@@ -578,7 +577,7 @@
for (const char* v : values)
{
- if (boost::ends_with(*value, v))
+ if (value->ends_with(v))
{
aResp->res.jsonValue[jsonPtr]["BaseModuleType"] = v;
break;
@@ -642,7 +641,7 @@
{
aResp->res.jsonValue[jsonPtr]["MemoryType"] = "DRAM";
}
- else if (boost::ends_with(*value, "Logical"))
+ else if (value->ends_with("Logical"))
{
aResp->res.jsonValue[jsonPtr]["MemoryType"] = "IntelOptane";
}
diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp
index a8cfb68..a7f8a41 100644
--- a/redfish-core/lib/processor.hpp
+++ b/redfish-core/lib/processor.hpp
@@ -230,7 +230,7 @@
{
getCpuDataByInterface(aResp, object.second);
}
- else if (boost::starts_with(object.first.str, corePath))
+ else if (object.first.str.starts_with(corePath))
{
for (const auto& interface : object.second)
{
@@ -700,7 +700,7 @@
for (const auto& [objectPath, serviceMap] : subtree)
{
// Ignore any objects which don't end with our desired cpu name
- if (!boost::ends_with(objectPath, processorId))
+ if (!objectPath.ends_with(processorId))
{
continue;
}
@@ -1014,7 +1014,7 @@
std::string expectedPrefix("/redfish/v1/Systems/system/Processors/");
expectedPrefix += processorId;
expectedPrefix += "/OperatingConfigs/";
- if (!boost::starts_with(appliedConfigUri, expectedPrefix) ||
+ if (!appliedConfigUri.starts_with(expectedPrefix) ||
expectedPrefix.size() == appliedConfigUri.size())
{
messages::propertyValueIncorrect(
@@ -1078,7 +1078,7 @@
for (const std::string& object : objects)
{
- if (!boost::ends_with(object, cpuName))
+ if (!object.ends_with(cpuName))
{
continue;
}
@@ -1138,8 +1138,7 @@
for (const auto& [objectPath, serviceMap] : subtree)
{
// Ignore any configs without matching cpuX/configY
- if (!boost::ends_with(objectPath, expectedEnding) ||
- serviceMap.empty())
+ if (!objectPath.ends_with(expectedEnding) || serviceMap.empty())
{
continue;
}
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 6e72fea..04b5190 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -16,7 +16,7 @@
#pragma once
#include <app.hpp>
-#include <boost/algorithm/string/predicate.hpp>
+#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/range/algorithm/replace_copy_if.hpp>
#include <dbus_singleton.hpp>
@@ -463,7 +463,7 @@
{
for (const std::string& sensor : *allSensors)
{
- if (boost::starts_with(sensor, type))
+ if (sensor.starts_with(type))
{
activeSensors->emplace(sensor);
}
@@ -1232,11 +1232,11 @@
std::string health;
- if (boost::ends_with(*status, "Full"))
+ if (status->ends_with("Full"))
{
health = "OK";
}
- else if (boost::ends_with(*status, "Degraded"))
+ else if (status->ends_with("Degraded"))
{
health = "Warning";
}
@@ -1982,15 +1982,15 @@
if (inventoryItem != nullptr)
{
// Store LED state in InventoryItem
- if (boost::ends_with(state, "On"))
+ if (state.ends_with("On"))
{
inventoryItem->ledState = LedState::ON;
}
- else if (boost::ends_with(state, "Blink"))
+ else if (state.ends_with("Blink"))
{
inventoryItem->ledState = LedState::BLINK;
}
- else if (boost::ends_with(state, "Off"))
+ else if (state.ends_with("Off"))
{
inventoryItem->ledState = LedState::OFF;
}
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index c9fb4a1..1beef2e 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -158,8 +158,8 @@
return !task::completed;
}
- if (boost::ends_with(*state, "Invalid") ||
- boost::ends_with(*state, "Failed"))
+ if (state->ends_with("Invalid") ||
+ state->ends_with("Failed"))
{
taskData->state = "Exception";
taskData->status = "Warning";
@@ -168,7 +168,7 @@
return task::completed;
}
- if (boost::ends_with(*state, "Staged"))
+ if (state->ends_with("Staged"))
{
taskData->state = "Stopping";
taskData->messages.emplace_back(
@@ -183,7 +183,7 @@
return !task::completed;
}
- if (boost::ends_with(*state, "Active"))
+ if (state->ends_with("Active"))
{
taskData->messages.emplace_back(
messages::taskCompletedOK(index));
@@ -924,7 +924,7 @@
std::string, std::vector<std::string>>>>&
obj : subtree)
{
- if (!boost::ends_with(obj.first, *swId))
+ if (!obj.first.ends_with(*swId))
{
continue;
}