Move over to upstream c++ style
This patchset moves bmcweb over to the upstream style naming
conventions for variables, classes, and functions, as well as imposes
the latest clang-format file.
This changeset was mostly built automatically by the included
.clang-tidy file, which has the ability to autoformat and auto rename
variables. At some point in the future I would like to see this in
greater use, but for now, we will impose it on bmcweb, and see how it
goes.
Tested: Code still compiles, and appears to run, although other issues
are possible and likely.
Change-Id: If422a2e36df924e897736b3feffa89f411d9dac1
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
diff --git a/include/image_upload.hpp b/include/image_upload.hpp
index 2a95967..df5c1ae 100644
--- a/include/image_upload.hpp
+++ b/include/image_upload.hpp
@@ -14,17 +14,17 @@
std::unique_ptr<sdbusplus::bus::match::match> fwUpdateMatcher;
-inline void uploadImageHandler(const crow::request& req, crow::response& res,
+inline void uploadImageHandler(const crow::Request& req, crow::Response& res,
const std::string& filename) {
// Only allow one FW update at a time
if (fwUpdateMatcher != nullptr) {
- res.add_header("Retry-After", "30");
+ res.addHeader("Retry-After", "30");
res.result(boost::beast::http::status::service_unavailable);
res.end();
return;
}
// Make this const static so it survives outside this method
- static boost::asio::deadline_timer timeout(*req.io_service,
+ static boost::asio::deadline_timer timeout(*req.ioService,
boost::posix_time::seconds(5));
timeout.expires_from_now(boost::posix_time::seconds(5));
@@ -35,10 +35,10 @@
// expected, we were canceled before the timer completed.
return;
}
- CROW_LOG_ERROR << "Timed out waiting for log event";
+ BMCWEB_LOG_ERROR << "Timed out waiting for log event";
if (ec) {
- CROW_LOG_ERROR << "Async_wait failed " << ec;
+ BMCWEB_LOG_ERROR << "Async_wait failed " << ec;
return;
}
@@ -48,11 +48,11 @@
std::function<void(sdbusplus::message::message&)> callback =
[&res](sdbusplus::message::message& m) {
- CROW_LOG_DEBUG << "Match fired";
+ BMCWEB_LOG_DEBUG << "Match fired";
boost::system::error_code ec;
timeout.cancel(ec);
if (ec) {
- CROW_LOG_ERROR << "error canceling timer " << ec;
+ BMCWEB_LOG_ERROR << "error canceling timer " << ec;
}
std::string versionInfo;
m.read(versionInfo); // Read in the object path that was just created
@@ -61,15 +61,15 @@
if (index != std::string::npos) {
versionInfo.erase(0, index);
}
- res.json_value = {{"data", std::move(versionInfo)},
- {"message", "200 OK"},
- {"status", "ok"}};
- CROW_LOG_DEBUG << "ending response";
+ res.jsonValue = {{"data", std::move(versionInfo)},
+ {"message", "200 OK"},
+ {"status", "ok"}};
+ BMCWEB_LOG_DEBUG << "ending response";
res.end();
fwUpdateMatcher = nullptr;
};
fwUpdateMatcher = std::make_unique<sdbusplus::bus::match::match>(
- *crow::connections::system_bus,
+ *crow::connections::systemBus,
"interface='org.freedesktop.DBus.ObjectManager',type='signal',"
"member='InterfacesAdded',path='/xyz/openbmc_project/logging'",
callback);
@@ -77,7 +77,7 @@
std::string filepath(
"/tmp/images/" +
boost::uuids::to_string(boost::uuids::random_generator()()));
- CROW_LOG_DEBUG << "Writing file to " << filepath;
+ BMCWEB_LOG_DEBUG << "Writing file to " << filepath;
std::ofstream out(filepath, std::ofstream::out | std::ofstream::binary |
std::ofstream::trunc);
out << req.body;
@@ -86,16 +86,16 @@
template <typename... Middlewares>
void requestRoutes(Crow<Middlewares...>& app) {
- CROW_ROUTE(app, "/upload/image/<str>")
+ BMCWEB_ROUTE(app, "/upload/image/<str>")
.methods("POST"_method,
- "PUT"_method)([](const crow::request& req, crow::response& res,
+ "PUT"_method)([](const crow::Request& req, crow::Response& res,
const std::string& filename) {
uploadImageHandler(req, res, filename);
});
- CROW_ROUTE(app, "/upload/image")
+ BMCWEB_ROUTE(app, "/upload/image")
.methods("POST"_method,
- "PUT"_method)([](const crow::request& req, crow::response& res) {
+ "PUT"_method)([](const crow::Request& req, crow::Response& res) {
uploadImageHandler(req, res, "");
});
}