From 464207c3429f3b30e2ad50377d8ddb7d43ff52aa Mon Sep 17 00:00:00 2001 From: Kyoungyong Lee Date: Tue, 26 Apr 2016 11:05:19 +0900 Subject: [PATCH] fixed savace warnings Change-Id: Ic088f9fb1ea0f285d4a22de9969681c00677560c --- pkgmgr_plugin/privileges.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pkgmgr_plugin/privileges.cpp b/pkgmgr_plugin/privileges.cpp index 41db854..5d32a6a 100755 --- a/pkgmgr_plugin/privileges.cpp +++ b/pkgmgr_plugin/privileges.cpp @@ -44,7 +44,7 @@ int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char* packageId) { LOGD("[STHAN] PKGMGR_PARSER_PLUGIN_INSTALL - START"); - int ret; + int ret = 0; // Node: xmlNodePtr curPtr = xmlFirstElementChild(xmlDocGetRootElement(docPtr)); @@ -78,7 +78,7 @@ int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char* packageId) char** ppPrivilegeList = (char**) calloc(privilegeList.size() + 1, sizeof(char*)); std::list ::iterator iter = privilegeList.begin(); - for (int i = 0; i < privilegeList.size(); ++i) + for (size_t i = 0; i < privilegeList.size(); ++i) { ppPrivilegeList[i] = (char*)calloc (strlen(iter->c_str()) + 1, sizeof(char)); if (ppPrivilegeList[i] == NULL) @@ -98,7 +98,7 @@ int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char* packageId) int monitor_policy = 1; if (user_id < 0 || packageId == NULL) - return PRIV_GUARD_ERROR_INVALID_PARAMETER; + return -EINVAL; PrivacyGuardClient *pInst = PrivacyGuardClient::getInstance(); std::list < std::string > privilege_List; @@ -108,10 +108,8 @@ int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char* packageId) LOGD("privacyList : %s", *ppPrivilegeList); privilege_List.push_back(std::string(*ppPrivilegeList++)); } - int retval = pInst->PgAddMonitorPolicy(user_id, std::string(packageId), privilege_List, monitor_policy); - + ret = pInst->PgAddMonitorPolicy(user_id, std::string(packageId), privilege_List, monitor_policy); destroy_char_list(ppPrivilegeList, privilegeList.size() + 1); - if (ret != PRIV_GUARD_ERROR_SUCCESS) { LOGD("Failed to install monitor policy: %d", ret); -- 2.7.4