diff options
author | Ed Tanous <edtanous@google.com> | 2022-05-31 18:59:27 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2022-06-01 19:10:35 +0300 |
commit | 002d39b4a7a5ed7166e2acad84e0943c3def9492 (patch) | |
tree | 4307dd5161ec9779d59308a9b933e408cc2c6ca7 /include/image_upload.hpp | |
parent | 62c416fb0d2f62e09d7f60754ff359ac2389e749 (diff) | |
download | bmcweb-002d39b4a7a5ed7166e2acad84e0943c3def9492.tar.xz |
Try to fix the lambda formatting issue
clang-tidy has a setting, LambdaBodyIndentation, which it says:
"For callback-heavy code, it may improve readability to have the
signature indented two levels and to use OuterScope."
bmcweb is very callback heavy code. Try to enable it and see if that
improves things. There are many cases where the length of a lambda call
will change, and reindent the entire lambda function. This is really
bad for code reviews, as it's difficult to see the lines changed. This
commit should resolve it. This does have the downside of reindenting a
lot of functions, which is unfortunate, but probably worth it in the
long run.
All changes except for the .clang-format file were made by the robot.
Tested: Code compiles, whitespace changes only.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ib4aa2f1391fada981febd25b67dcdb9143827f43
Diffstat (limited to 'include/image_upload.hpp')
-rw-r--r-- | include/image_upload.hpp | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/include/image_upload.hpp b/include/image_upload.hpp index aefb27e3a8..0fff1ea03f 100644 --- a/include/image_upload.hpp +++ b/include/image_upload.hpp @@ -59,32 +59,31 @@ inline void std::function<void(sdbusplus::message::message&)> callback = [asyncResp](sdbusplus::message::message& m) { - BMCWEB_LOG_DEBUG << "Match fired"; + BMCWEB_LOG_DEBUG << "Match fired"; - sdbusplus::message::object_path path; - dbus::utility::DBusInteracesMap interfaces; - m.read(path, interfaces); + sdbusplus::message::object_path path; + dbus::utility::DBusInteracesMap interfaces; + m.read(path, interfaces); - if (std::find_if(interfaces.begin(), interfaces.end(), - [](const auto& i) { - return i.first == - "xyz.openbmc_project.Software.Version"; - }) != interfaces.end()) + if (std::find_if(interfaces.begin(), interfaces.end(), + [](const auto& i) { + return i.first == "xyz.openbmc_project.Software.Version"; + }) != interfaces.end()) + { + timeout.cancel(); + std::string leaf = path.filename(); + if (leaf.empty()) { - timeout.cancel(); - std::string leaf = path.filename(); - if (leaf.empty()) - { - leaf = path.str; - } - - asyncResp->res.jsonValue["data"] = leaf; - asyncResp->res.jsonValue["message"] = "200 OK"; - asyncResp->res.jsonValue["status"] = "ok"; - BMCWEB_LOG_DEBUG << "ending response"; - fwUpdateMatcher = nullptr; + leaf = path.str; } - }; + + asyncResp->res.jsonValue["data"] = leaf; + asyncResp->res.jsonValue["message"] = "200 OK"; + asyncResp->res.jsonValue["status"] = "ok"; + BMCWEB_LOG_DEBUG << "ending response"; + fwUpdateMatcher = nullptr; + } + }; fwUpdateMatcher = std::make_unique<sdbusplus::bus::match::match>( *crow::connections::systemBus, "interface='org.freedesktop.DBus.ObjectManager',type='signal'," @@ -116,8 +115,8 @@ inline void requestRoutes(App& app) .methods(boost::beast::http::verb::post, boost::beast::http::verb::put)( [](const crow::Request& req, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { - uploadImageHandler(req, asyncResp); - }); + uploadImageHandler(req, asyncResp); + }); } } // namespace image_upload } // namespace crow |