diff options
author | Ed Tanous <ed@tanous.net> | 2020-07-25 07:45:05 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2020-08-17 23:54:37 +0300 |
commit | 23a21a1cbed23ace4174664950e595df961e9e69 (patch) | |
tree | 12e7cc9d9301642fc1e48332a0e0834c54e8c8af /redfish-core/lib/certificate_service.hpp | |
parent | 52cc112d962920b035c870127784bcbd98948fad (diff) | |
download | bmcweb-23a21a1cbed23ace4174664950e595df961e9e69.tar.xz |
Enable clang warnings
This commit enables clang warnings, and fixes all warnings that were
found. Most of these fall into a couple categories:
Variable shadow issues were fixed by renaming variables
unused parameter warnings were resolved by either checking error codes
that had been ignored, or removing the name of the variable from the
scope.
Other various warnings were fixed in the best way I was able to come up
with.
Note, the redfish Node class is especially insidious, as it causes all
imlementers to have variables for parameters, regardless of whether or
not they are used. Deprecating the Node class is on my list of things
to do, as it adds extra overhead, and in general isn't a useful
abstraction. For now, I have simply fixed all the handlers.
Tested:
Added the current meta-clang meta layer into bblayers.conf, and added
TOOLCHAIN_pn-bmcweb = "clang" to my local.conf
Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: Ia75b94010359170159c703e535d1c1af182fe700
Diffstat (limited to 'redfish-core/lib/certificate_service.hpp')
-rw-r--r-- | redfish-core/lib/certificate_service.hpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp index 6ade4e5e3a..e237fd35f2 100644 --- a/redfish-core/lib/certificate_service.hpp +++ b/redfish-core/lib/certificate_service.hpp @@ -97,7 +97,7 @@ class CertificateService : public Node * @param[in] path URL * @return -1 on failure and number on success */ -long getIDFromURL(const std::string_view url) +inline long getIDFromURL(const std::string_view url) { std::size_t found = url.rfind("/"); if (found == std::string::npos) @@ -115,7 +115,7 @@ long getIDFromURL(const std::string_view url) return -1; } -std::string +inline std::string getCertificateFromReqBody(const std::shared_ptr<AsyncResp>& asyncResp, const crow::Request& req) { @@ -180,11 +180,9 @@ class CertificateFile if (std::filesystem::exists(certDirectory)) { BMCWEB_LOG_DEBUG << "Removing certificate file" << certificateFile; - try - { - std::filesystem::remove_all(certDirectory); - } - catch (const std::filesystem::filesystem_error& e) + std::error_code ec; + std::filesystem::remove_all(certDirectory, ec); + if (ec) { BMCWEB_LOG_ERROR << "Failed to remove temp directory" << certDirectory; |