Fix static analysis issue
[platform/core/security/ode.git] / server / internal-encryption.cpp
index 901396a..58edac5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2015-2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *  Copyright (c) 2015-2023 Samsung Electronics Co., Ltd All Rights Reserved
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -225,7 +225,7 @@ void stopSystemdUnits()
                }
        }
 
-       for (auto unit : preprocessUnits) {
+       for (auto &unit : preprocessUnits) {
                stopUnit(unit);
        }
 
@@ -366,7 +366,7 @@ void killProcesses(std::vector<const char*> &args)
                while ((::getline(&line, &len, fp.get())) != -1) {
                        std::string log(line);
                        log.erase(std::find_if(log.rbegin(), log.rend(),
-                                               std::ptr_fun<int, int>(std::isgraph)).base(), log.end());
+                                               [](unsigned char c){ return std::isgraph(c); }).base(), log.end());
                        WARN(SINK, log);
                }
        } catch (std::exception &e) {
@@ -461,13 +461,9 @@ InternalEncryptionServer::InternalEncryptionServer(ServerContext& srv,
                }
        }
 
-       engine.reset(new INTERNAL_ENGINE(
-               source, INTERNAL_PATH,
-               ProgressBar([](unsigned v) {
-                       ::vconf_set_str(VCONFKEY_ODE_ENCRYPT_PROGRESS,
-                                                       std::to_string(v).c_str());
-               })
-       ));
+       engine.reset(new INTERNAL_ENGINE(source,
+                                        INTERNAL_PATH,
+                                        ProgressBar(VCONFKEY_ODE_ENCRYPT_PROGRESS)));
 
        try {
                dbus::Connection &systemDBus = dbus::Connection::getSystem();