Unused definitions removal in API
authorKarol Pawlowski <k.pawlowski@samsung.com>
Mon, 8 Apr 2013 09:58:59 +0000 (11:58 +0200)
committerGerrit Code Review <gerrit2@kim11>
Tue, 9 Apr 2013 07:55:27 +0000 (16:55 +0900)
[Issue#] LINUXWRT-160
[Bug] N/A
[Cause] N/A
[Solution] Remove them
[Verification] Build wrt-installer repository
- Install/uninstall any widget
- run wrt-installer -p

Change-Id: Ifa74161549090dc7ef14ea5103dd29472d96e372

src/configuration_parser/widget_parser.cpp
src/wrt-installer/wrt_installer_api.cpp
src/wrt-installer/wrt_installer_api.h

index 50c8137..39b139c 100644 (file)
@@ -2354,7 +2354,8 @@ class AccountParser : public ElementParser
         ElementParser(),
         m_data(data),
         m_account(data.accountProvider),
-        m_properNamespace(false)
+        m_properNamespace(false),
+        m_multiSupport(false)
     {}
 
   private:
index 671ab98..d6d34d8 100644 (file)
@@ -67,9 +67,6 @@ inline InstallMode::Type translateInstallMode(
     Assert(true && "wrong argument is inputed");
 }
 
-const char PLUGIN_INSTALL_SEMAPHORE[] = "/.wrt_plugin_install_lock";
-static int wrt_count_plugin;
-
 static std::string cutOffFileName(const std::string& path)
 {
     size_t found = path.find_last_of("/");
@@ -93,81 +90,13 @@ static bool checkPath(const std::string& path)
 static bool checkPaths()
 {
     bool if_ok = true;
-    if_ok &= (checkPath(cutOffFileName(
-                            GlobalConfig::GetWrtDatabaseFilePath())));
-    if (!if_ok) {
-        LogError(
-            "Path <" << GlobalConfig::GetWrtDatabaseFilePath() <<
-            "> does not exist.");
-    }
 
+    if_ok &= (checkPath(cutOffFileName(GlobalConfig::GetWrtDatabaseFilePath())));
     if_ok &= (checkPath(GlobalConfig::GetDevicePluginPath()));
-    if (!if_ok) {
-        LogError(
-            "Path <" << GlobalConfig::GetDevicePluginPath() <<
-            "> does not exist.");
-    }
-
     if_ok &= (checkPath(GlobalConfig::GetUserInstalledWidgetPath()));
-    if (!if_ok) {
-        LogError(
-            "Path <" << GlobalConfig::GetUserInstalledWidgetPath() <<
-            "> does not exist.");
-    }
-
     if_ok &= (checkPath(GlobalConfig::GetUserPreloadedWidgetPath()));
-    if (!if_ok) {
-        LogError(
-            "Path <" << GlobalConfig::GetUserPreloadedWidgetPath() <<
-            "> does not exist.");
-    }
-    return if_ok;
-}
 
-void plugin_install_status_cb(WrtErrStatus status,
-                              void* userparam)
-{
-    Assert(userparam);
-
-    wrt_plugin_data *plugin_data = static_cast<wrt_plugin_data*>(userparam);
-
-    if (--wrt_count_plugin < 1) {
-        LogDebug("All plugins installation completed");
-
-        LogDebug("Call SetAllinstallpluginsCallback");
-        plugin_data->plugin_installed_cb(plugin_data->user_data);
-    }
-
-    if (status == WRT_SUCCESS) {
-        LogInfo(
-            "plugin installation is successful: " <<
-            plugin_data->plugin_path);
-        return;
-    }
-
-    LogError("Fail to install plugin : " << plugin_data->plugin_path);
-
-    switch (status) {
-    case WRT_INSTALLER_ERROR_PLUGIN_INSTALLATION_FAILED:
-        LogError("Failed : Plugin install path is wrong");
-        break;
-    case WRT_INSTALLER_ERROR_UNKNOWN:
-        LogError("Failed : Unkown Error");
-        break;
-    default:
-        break;
-    }
-}
-
-void plugin_install_progress_cb(float percent,
-                                const char* description,
-                                void* userdata)
-{
-    char *plugin_path = static_cast<char*>(userdata);
-
-    LogInfo("Install plugin : " << plugin_path <<
-            ", Progress : " << percent <<
-            ", Description : " << description);
+    return if_ok;
 }
 
 EXPORT_API void wrt_installer_init(void *userdata,
@@ -346,130 +275,6 @@ EXPORT_API void wrt_install_plugin(
     UNHANDLED_EXCEPTION_HANDLER_END
 }
 
-EXPORT_API void wrt_install_all_plugins(
-    WrtAllPluginInstalledCallback installed_cb,
-    void *user_param)
-{
-    UNHANDLED_EXCEPTION_HANDLER_BEGIN
-    {
-        std::string installRequest =
-            std::string(GlobalConfig::GetPluginInstallInitializerName());
-
-        LogDebug("Install new plugins");
-
-        Try {
-            DPL::Semaphore lock(PLUGIN_INSTALL_SEMAPHORE);
-        }
-        Catch(DPL::Semaphore::Exception::Base){
-            LogError("Failed to create installation lock");
-            return;
-        }
-
-        struct stat tmp;
-
-        if (-1 == stat(installRequest.c_str(), &tmp) ||
-            !S_ISREG(tmp.st_mode))
-        {
-            if (ENOENT == errno) {
-                LogDebug("Plugin installation not required");
-
-                LogDebug("Call SetAllinstallPluginCallback");
-                installed_cb(user_param);
-
-                DPL::Semaphore::Remove(PLUGIN_INSTALL_SEMAPHORE);
-                return;
-            }
-            LogWarning("Opening installation request file failed");
-        }
-
-        std::string PLUGIN_PATH =
-            std::string(GlobalConfig::GetDevicePluginPath());
-
-        DIR *dir;
-        dir = opendir(PLUGIN_PATH.c_str());
-        if (!dir) {
-            DPL::Semaphore::Remove(PLUGIN_INSTALL_SEMAPHORE);
-            return;
-        }
-
-        LogInfo("Plugin DIRECTORY IS" << PLUGIN_PATH);
-        struct dirent libdir;
-        struct dirent *result;
-        int return_code;
-
-        errno = 0;
-
-        std::list<std::string> pluginsPaths;
-
-        for (return_code = readdir_r(dir, &libdir, &result);
-                    result != NULL && return_code == 0;
-                    return_code = readdir_r(dir, &libdir, &result))
-        {
-            if (strcmp(libdir.d_name, ".") == 0 ||
-                strcmp(libdir.d_name, "..") == 0)
-            {
-                continue;
-            }
-
-            std::string path = PLUGIN_PATH;
-            path += "/";
-            path += libdir.d_name;
-
-            struct stat tmp;
-
-            if (stat(path.c_str(), &tmp) == -1) {
-                LogError("Failed to open file" << path);
-                continue;
-            }
-
-            if (!S_ISDIR(tmp.st_mode)) {
-                LogError("Not a directory" << path);
-                continue;
-            }
-
-            pluginsPaths.push_back(path);
-        }
-
-        wrt_count_plugin = pluginsPaths.size();
-
-        FOREACH(it, pluginsPaths) {
-            wrt_plugin_data *plugin_data = new wrt_plugin_data;
-
-            plugin_data->plugin_installed_cb = installed_cb;
-            plugin_data->plugin_path = const_cast<char*>(it->c_str());
-            plugin_data->user_data = user_param;
-
-            wrt_install_plugin(
-                it->c_str(), static_cast<void*>(plugin_data),
-                plugin_install_status_cb,
-                plugin_install_progress_cb);
-        }
-
-        if (return_code != 0 || errno != 0) {
-            LogError("readdir_r() failed with " << DPL::GetErrnoString());
-        }
-
-        errno = 0;
-        if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
-            LogError("Failed to close dir: " << PLUGIN_PATH << " with error: "
-                                             << DPL::GetErrnoString());
-        }
-
-        if (0 != unlink(installRequest.c_str())) {
-            LogError("Failed to remove file initializing plugin "
-                     "installation");
-        }
-
-        Try {
-            DPL::Semaphore::Remove(PLUGIN_INSTALL_SEMAPHORE);
-        }
-        Catch(DPL::Semaphore::Exception::Base){
-            LogInfo("Failed to remove installation lock");
-        }
-    }
-    UNHANDLED_EXCEPTION_HANDLER_END
-}
-
 #ifdef __cplusplus
 }
 #endif
index f5f726d..584e529 100644 (file)
@@ -44,14 +44,6 @@ typedef void (*WrtInstallerStatusCallback)(std::string tizenId,
 typedef void (*WrtProgressCallback)(float percent,
                                     const char *description,
                                     void *data);
-typedef void (*WrtAllPluginInstalledCallback)(void *userdata);
-
-typedef struct
-{
-    WrtAllPluginInstalledCallback plugin_installed_cb;
-    char *plugin_path;
-    void *user_data;
-} wrt_plugin_data;
 
 enum WrtInstallMode
 {
@@ -86,8 +78,6 @@ void wrt_install_plugin(const char *pluginDirectory,
                         void *userData,
                         WrtPluginInstallerStatusCallback statusCallback,
                         WrtProgressCallback progressCallback);
-void wrt_install_all_plugins(WrtAllPluginInstalledCallback installed_cb,
-                             void *user_param);
 
 #ifdef __cplusplus
 }