cleanup: Fix warnings found by cppcheck

Fix various warnings found by cppcheck.

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I4db2319f5890d7aa73c8f418f610a6cba338ce24
diff --git a/image_manager.cpp b/image_manager.cpp
index a9a5a69..922575b 100644
--- a/image_manager.cpp
+++ b/image_manager.cpp
@@ -42,7 +42,7 @@
 {
     fs::path path;
 
-    RemovablePath(const fs::path& path) : path(path)
+    explicit RemovablePath(const fs::path& path) : path(path)
     {}
     ~RemovablePath()
     {
diff --git a/image_manager.hpp b/image_manager.hpp
index 6dc80cf..acd56b6 100644
--- a/image_manager.hpp
+++ b/image_manager.hpp
@@ -24,7 +24,7 @@
      *
      * @param[in] bus - The Dbus bus object
      */
-    Manager(sdbusplus::bus::bus& bus) : bus(bus){};
+    explicit Manager(sdbusplus::bus::bus& bus) : bus(bus){};
 
     /**
      * @brief Verify and untar the tarball. Verify the manifest file.
diff --git a/image_verify.cpp b/image_verify.cpp
index d67cfac..098ad9d 100644
--- a/image_verify.cpp
+++ b/image_verify.cpp
@@ -413,7 +413,7 @@
         sigFile += SIGNATURE_FILE_EXT;
 
         // Verify the signature.
-        auto valid = verifyFile(file, sigFile, publicKeyPath, hashType);
+        valid = verifyFile(file, sigFile, publicKeyPath, hashType);
         if (valid == false)
         {
             error("Image file Signature Validation failed on {PATH}", "PATH",
diff --git a/image_verify.hpp b/image_verify.hpp
index 88762e1..8cda65c 100644
--- a/image_verify.hpp
+++ b/image_verify.hpp
@@ -49,7 +49,7 @@
      *
      *  @param[in] fd - File descriptor
      */
-    CustomFd(int fd) : fd(fd)
+    explicit CustomFd(int fd) : fd(fd)
     {}
 
     ~CustomFd()
diff --git a/item_updater.cpp b/item_updater.cpp
index fe9c808..8619c91 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -669,7 +669,7 @@
     updateUbootEnvVars(lowestPriorityVersion);
 }
 
-void ItemUpdater::freeSpace(Activation& caller)
+void ItemUpdater::freeSpace(const Activation& caller)
 {
     //  Versions with the highest priority in front
     std::priority_queue<std::pair<int, std::string>,
diff --git a/item_updater.hpp b/item_updater.hpp
index b18e4bd..794aa4d 100644
--- a/item_updater.hpp
+++ b/item_updater.hpp
@@ -152,7 +152,7 @@
      *
      * @param[in] caller - The Activation object that called this function.
      */
-    void freeSpace(Activation& caller);
+    void freeSpace(const Activation& caller);
 
     /** @brief Creates a updateable association to the
      *  "running" BMC software image
diff --git a/item_updater_helper.hpp b/item_updater_helper.hpp
index 2aeeb23..de48df4 100644
--- a/item_updater_helper.hpp
+++ b/item_updater_helper.hpp
@@ -24,7 +24,7 @@
      *
      *  @param[in] bus - sdbusplus D-Bus bus connection
      */
-    Helper(sdbusplus::bus::bus& bus) : bus(bus)
+    explicit Helper(sdbusplus::bus::bus& bus) : bus(bus)
     {
         // Empty
     }
diff --git a/usb/usb_manager.cpp b/usb/usb_manager.cpp
index 5e225ac..4a1f768 100644
--- a/usb/usb_manager.cpp
+++ b/usb/usb_manager.cpp
@@ -57,11 +57,11 @@
 {
     utils::PropertyValue value =
         "xyz.openbmc_project.Software.ApplyTime.RequestedApplyTimes.OnReset";
-    constexpr auto objectPath = "/xyz/openbmc_project/software/apply_time";
-    constexpr auto interface = "xyz.openbmc_project.Software.ApplyTime";
-    constexpr auto propertyName = "RequestedApplyTime";
     try
     {
+        constexpr auto objectPath = "/xyz/openbmc_project/software/apply_time";
+        constexpr auto interface = "xyz.openbmc_project.Software.ApplyTime";
+        constexpr auto propertyName = "RequestedApplyTime";
         utils::setProperty(bus, objectPath, interface, propertyName, value);
     }
     catch (const std::exception& e)
@@ -75,10 +75,10 @@
 {
     utils::PropertyValue value =
         "xyz.openbmc_project.Software.Activation.RequestedActivations.Active";
-    constexpr auto interface = "xyz.openbmc_project.Software.Activation";
-    constexpr auto propertyName = "RequestedActivation";
     try
     {
+        constexpr auto interface = "xyz.openbmc_project.Software.Activation";
+        constexpr auto propertyName = "RequestedActivation";
         utils::setProperty(bus, path, interface, propertyName, value);
     }
     catch (const std::exception& e)
diff --git a/utils.cpp b/utils.cpp
index 410ddc8..6763768 100644
--- a/utils.cpp
+++ b/utils.cpp
@@ -80,10 +80,11 @@
     bus.call_noreply(method);
 }
 
-void mergeFiles(std::vector<std::string>& srcFiles, std::string& dstFile)
+void mergeFiles(const std::vector<std::string>& srcFiles,
+                const std::string& dstFile)
 {
     std::ofstream outFile(dstFile, std::ios::out);
-    for (auto& file : srcFiles)
+    for (const auto& file : srcFiles)
     {
         std::ifstream inFile;
         inFile.open(file, std::ios_base::in);
diff --git a/utils.hpp b/utils.hpp
index fc8144c..1a695f4 100644
--- a/utils.hpp
+++ b/utils.hpp
@@ -56,7 +56,8 @@
  * @param[out] dstFile - destination file
  * @return
  **/
-void mergeFiles(std::vector<std::string>& srcFiles, std::string& dstFile);
+void mergeFiles(const std::vector<std::string>& srcFiles,
+                const std::string& dstFile);
 
 namespace internal
 {