From 0009fc7f35998596dbb0e631d0075f19245bdbe6 Mon Sep 17 00:00:00 2001 From: "j-h.choi" Date: Thu, 10 Oct 2019 14:40:43 +0900 Subject: [PATCH] Code cleanup --- NativeLauncher/installer-plugin/prefer_nuget_cache_plugin.cc | 10 +++++----- NativeLauncher/tool/dotnettool.cc | 11 ----------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/NativeLauncher/installer-plugin/prefer_nuget_cache_plugin.cc b/NativeLauncher/installer-plugin/prefer_nuget_cache_plugin.cc index 9e6c06b..8d15f6b 100644 --- a/NativeLauncher/installer-plugin/prefer_nuget_cache_plugin.cc +++ b/NativeLauncher/installer-plugin/prefer_nuget_cache_plugin.cc @@ -328,12 +328,12 @@ static int sqliteCb(void *count, int argc, char **argv, char **colName) { return 0; } -int updateTacDB(const char *pkgId) +int updateTacDB(sqlite3 *sqlite) { for (auto& unp : updateTac) { int count = -1; std::string sql = "SELECT COUNT(NUGET) FROM TAC WHERE NUGET = '" + unp + "';"; - int ret = sqlite3_exec(tac_db, sql.c_str(), sqliteCb, &count, NULL); + int ret = sqlite3_exec(sqlite, sql.c_str(), sqliteCb, &count, NULL); if (ret != SQLITE_OK) { _ERR("Sqlite select error"); return -1; @@ -389,7 +389,7 @@ extern "C" int PKGMGR_MDPARSER_PLUGIN_UPGRADE(const char *pkgId, const char *app if (tacDB.empty()) { std::string sql = "DELETE FROM TAC WHERE PKGID = '" + std::string(pkgId) + "';"; dbDelete(tac_db, TAC_APP_LIST_DB, sql); - if (updateTacDB(pkgId) < 0) { + if (updateTacDB(tac_db) < 0) { return -1; } } else { @@ -517,7 +517,7 @@ extern "C" int PKGMGR_MDPARSER_PLUGIN_UPGRADE(const char *pkgId, const char *app dbDelete(tac_db, TAC_APP_LIST_DB, sql); } } - if (updateTacDB(pkgId) < 0) { + if (updateTacDB(tac_db) < 0) { return -1; } } @@ -542,7 +542,7 @@ extern "C" int PKGMGR_MDPARSER_PLUGIN_UNINSTALL(const char *pkgId, const char *a sql = "DELETE FROM TAC WHERE PKGID = '" + std::string(pkgId) + "';"; dbDelete(tac_db, TAC_APP_LIST_DB, sql); - if (updateTacDB(pkgId) < 0) { + if (updateTacDB(tac_db) < 0) { return -1; } return 0; diff --git a/NativeLauncher/tool/dotnettool.cc b/NativeLauncher/tool/dotnettool.cc index 3699372..8f842d0 100644 --- a/NativeLauncher/tool/dotnettool.cc +++ b/NativeLauncher/tool/dotnettool.cc @@ -14,26 +14,15 @@ * limitations under the License. */ -#include "log.h" #include "utils.h" -#include "db_manager.h" #include "ni_common.h" #include "tac_common.h" #include #include #include -#include #include -#include -#include - -#ifdef LOG_TAG -#undef LOG_TAG -#endif -#define LOG_TAG "DOTNET_INSTALLER_PLUGIN" - std::vector getCmdArgs(char** begin, char** end) { std::vector list; -- 2.7.4