summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYunchan Cho <yunchan.cho@samsung.com>2013-04-23 13:54:02 +0900
committerYunchan Cho <yunchan.cho@samsung.com>2013-04-23 15:12:39 +0900
commit443e0e73cb5d9741176ec25d9ba915aed38ab0b4 (patch)
tree122b51f611104a3018775159bf2638886bc49d54
parentda0432cf85f1e0d56996f62740a20aa970baf19e (diff)
downloadweb-provider-443e0e73cb5d9741176ec25d9ba915aed38ab0b4.tar.gz
web-provider-443e0e73cb5d9741176ec25d9ba915aed38ab0b4.tar.bz2
web-provider-443e0e73cb5d9741176ec25d9ba915aed38ab0b4.zip
Change-Id: I457f855ac4e73c645c8715f0c520201a5be1ada8
-rw-r--r--packaging/livebox.web-provider.spec2
-rw-r--r--src/API/web_provider_plugin_info.cpp9
-rwxr-xr-xsrc/Daemon/BoxDaemonImpl.cpp90
-rw-r--r--src/Daemon/BoxDaemonUtil.cpp9
-rw-r--r--src/Plugin/BoxPluginConnector.cpp1
5 files changed, 58 insertions, 53 deletions
diff --git a/packaging/livebox.web-provider.spec b/packaging/livebox.web-provider.spec
index 2311f94..47d9101 100644
--- a/packaging/livebox.web-provider.spec
+++ b/packaging/livebox.web-provider.spec
@@ -1,6 +1,6 @@
Name: livebox.web-provider
Summary: web framework for livebox
-Version: 1.10
+Version: 1.11
Release: 1
Group: main/app
License: Flora License, Version 1.0
diff --git a/src/API/web_provider_plugin_info.cpp b/src/API/web_provider_plugin_info.cpp
index 4d101b8..fced9c9 100644
--- a/src/API/web_provider_plugin_info.cpp
+++ b/src/API/web_provider_plugin_info.cpp
@@ -59,7 +59,10 @@ static const std::string jsonFileExtension(".json");
web_provider_plugin_info** web_provider_plugin_get_installed_list(int* count)
{
- std::unique_ptr<DIR, int(*)(DIR*)> dir (opendir(installedPluginDirPath.c_str()), closedir);
+ LogD("enter");
+
+ // open directory of web provider plugin
+ DIR* dir = opendir(installedPluginDirPath.c_str());
if (!dir) {
LogD("failed to open directory for web livebox plugins");
*count = 0;
@@ -71,7 +74,7 @@ web_provider_plugin_info** web_provider_plugin_get_installed_list(int* count)
struct dirent* entry;
struct stat configStat;
std::string configPath;
- while ((entry = readdir(dir.get()))) {
+ while (entry = readdir(dir)) {
if (!strcmp(entry->d_name, ".") ||
!strcmp(entry->d_name, "..")) {
continue;
@@ -91,6 +94,8 @@ web_provider_plugin_info** web_provider_plugin_get_installed_list(int* count)
LogD("config file: %s", configPath.c_str());
configList.push_back(configPath);
}
+ // close directory of web provider plugin
+ closedir(dir);
if (configList.size() == 0) {
*count = 0;
diff --git a/src/Daemon/BoxDaemonImpl.cpp b/src/Daemon/BoxDaemonImpl.cpp
index 1d38bfc..c129269 100755
--- a/src/Daemon/BoxDaemonImpl.cpp
+++ b/src/Daemon/BoxDaemonImpl.cpp
@@ -147,10 +147,10 @@ int BoxDaemonImpl::boxCreateCallback(
LogD("update period: %d", info->period);
LogD("--------------------------------------------");
- return ecore_job_add(
- requestBoxJobCallback,
- new JobInfo(REQUEST_CMD_ADD_BOX, info, This))
- ? 0 : -1;
+ JobInfo* jobInfo = new JobInfo(REQUEST_CMD_ADD_BOX, info, This);
+ Ecore_Job* ret = ecore_job_add(requestBoxJobCallback, jobInfo);
+
+ return ret ? 0 : -1;
}
int BoxDaemonImpl::boxReCreateCallback(ProviderEventArgPtr arg, void* data)
@@ -189,10 +189,10 @@ int BoxDaemonImpl::boxReCreateCallback(ProviderEventArgPtr arg, void* data)
LogD("update period: %f", info->period);
LogD("--------------------------------------------");
- return ecore_job_add(
- requestBoxJobCallback,
- new JobInfo(REQUEST_CMD_ADD_BOX, info, This))
- ? 0 : -1;
+ JobInfo* jobInfo = new JobInfo(REQUEST_CMD_ADD_BOX, info, This);
+ Ecore_Job* ret = ecore_job_add(requestBoxJobCallback, jobInfo);
+
+ return ret ? 0 : -1;
}
int BoxDaemonImpl::boxDestroyCallback(ProviderEventArgPtr arg, void* data)
@@ -210,10 +210,10 @@ int BoxDaemonImpl::boxDestroyCallback(ProviderEventArgPtr arg, void* data)
LogD("InstanceId: %s", info->instanceId.c_str());
LogD("--------------------------------------------");
- return ecore_job_add(
- requestBoxJobCallback,
- new JobInfo(REQUEST_CMD_REMOVE_BOX, info, This))
- ? 0 : -1;
+ JobInfo* jobInfo = new JobInfo(REQUEST_CMD_REMOVE_BOX, info, This);
+ Ecore_Job* ret = ecore_job_add(requestBoxJobCallback, jobInfo);
+
+ return ret ? 0 : -1;
}
int BoxDaemonImpl::pdCreateCallback(ProviderEventArgPtr arg, void* data)
@@ -243,10 +243,10 @@ int BoxDaemonImpl::pdCreateCallback(ProviderEventArgPtr arg, void* data)
LogD("y: %f", info->pdY);
LogD("--------------------------------------------");
- return ecore_job_add(
- requestBoxJobCallback,
- new JobInfo(REQUEST_CMD_OPEN_PD, info, This))
- ? 0 : -1;
+ JobInfo* jobInfo = new JobInfo(REQUEST_CMD_OPEN_PD, info, This);
+ Ecore_Job* ret = ecore_job_add(requestBoxJobCallback, jobInfo);
+
+ return ret ? 0 : -1;
}
int BoxDaemonImpl::pdDestroyCallback(ProviderEventArgPtr arg, void* data)
@@ -264,10 +264,10 @@ int BoxDaemonImpl::pdDestroyCallback(ProviderEventArgPtr arg, void* data)
LogD("InstanceId: %s", info->instanceId.c_str());
LogD("--------------------------------------------");
- return ecore_job_add(
- requestBoxJobCallback,
- new JobInfo(REQUEST_CMD_CLOSE_PD, info, This))
- ? 0 : -1;
+ JobInfo* jobInfo = new JobInfo(REQUEST_CMD_CLOSE_PD, info, This);
+ Ecore_Job* ret = ecore_job_add(requestBoxJobCallback, jobInfo);
+
+ return ret ? 0 : -1;
}
int BoxDaemonImpl::clickedCallback(ProviderEventArgPtr arg, void* data)
@@ -313,10 +313,10 @@ int BoxDaemonImpl::resizeCallback(ProviderEventArgPtr arg, void* data)
LogD("height: %d", info->boxHeight);
LogD("--------------------------------------------");
- return ecore_job_add(
- requestBoxJobCallback,
- new JobInfo(REQUEST_CMD_RESIZE_BOX, info, This))
- ? 0 : -1;
+ JobInfo* jobInfo = new JobInfo(REQUEST_CMD_RESIZE_BOX, info, This);
+ Ecore_Job* ret = ecore_job_add(requestBoxJobCallback, jobInfo);
+
+ return ret ? 0 : -1;
}
int BoxDaemonImpl::boxPauseCallback(ProviderEventArgPtr arg, void* data)
@@ -335,10 +335,10 @@ int BoxDaemonImpl::boxPauseCallback(ProviderEventArgPtr arg, void* data)
LogD("InstanceId: %s", info->instanceId.c_str());
LogD("--------------------------------------------");
- return ecore_job_add(
- requestBoxJobCallback,
- new JobInfo(REQUEST_CMD_PAUSE_BOX, info, This))
- ? 0 : -1;
+ JobInfo* jobInfo = new JobInfo(REQUEST_CMD_PAUSE_BOX, info, This);
+ Ecore_Job* ret = ecore_job_add(requestBoxJobCallback, jobInfo);
+
+ return ret ? 0 : -1;
}
int BoxDaemonImpl::boxResumeCallback(ProviderEventArgPtr arg, void* data)
@@ -357,10 +357,10 @@ int BoxDaemonImpl::boxResumeCallback(ProviderEventArgPtr arg, void* data)
LogD("InstanceId: %s", info->instanceId.c_str());
LogD("--------------------------------------------");
- return ecore_job_add(
- requestBoxJobCallback,
- new JobInfo(REQUEST_CMD_RESUME_BOX, info, This))
- ? 0 : -1;
+ JobInfo* jobInfo = new JobInfo(REQUEST_CMD_RESUME_BOX, info, This);
+ Ecore_Job* ret = ecore_job_add(requestBoxJobCallback, jobInfo);
+
+ return ret ? 0 : -1;
}
int BoxDaemonImpl::pauseCallback(ProviderEventArgPtr arg, void* data)
@@ -373,10 +373,10 @@ int BoxDaemonImpl::pauseCallback(ProviderEventArgPtr arg, void* data)
LogD("web-provider is paused");
LogD("--------------------------------------------");
- return ecore_job_add(
- requestBoxJobCallback,
- new JobInfo(REQUEST_CMD_PAUSE_ALL, BoxInfoPtr(), This))
- ? 0 : -1;
+ JobInfo* jobInfo = new JobInfo(REQUEST_CMD_PAUSE_ALL, BoxInfoPtr(), This);
+ Ecore_Job* ret = ecore_job_add(requestBoxJobCallback, jobInfo);
+
+ return ret ? 0 : -1;
}
int BoxDaemonImpl::resumeCallback(ProviderEventArgPtr arg, void* data)
@@ -389,10 +389,10 @@ int BoxDaemonImpl::resumeCallback(ProviderEventArgPtr arg, void* data)
LogD("web-provider is resumed");
LogD("--------------------------------------------");
- return ecore_job_add(
- requestBoxJobCallback,
- new JobInfo(REQUEST_CMD_RESUME_ALL, BoxInfoPtr(), This))
- ? 0 : -1;
+ JobInfo* jobInfo = new JobInfo(REQUEST_CMD_RESUME_ALL, BoxInfoPtr(), This);
+ Ecore_Job* ret = ecore_job_add(requestBoxJobCallback, jobInfo);
+
+ return ret ? 0 : -1;
}
int BoxDaemonImpl::updateContentCallback(ProviderEventArgPtr arg, void* data)
@@ -418,10 +418,10 @@ int BoxDaemonImpl::changePeriodCallback(ProviderEventArgPtr arg, void* data)
LogD("period: %f", info->period);
LogD("--------------------------------------------");
- return ecore_job_add(
- requestBoxJobCallback,
- new JobInfo(REQUEST_CMD_CHANGE_PERIOD, info, This))
- ? 0 : -1;
+ JobInfo* jobInfo = new JobInfo(REQUEST_CMD_CHANGE_PERIOD, info, This);
+ Ecore_Job* ret = ecore_job_add(requestBoxJobCallback, jobInfo);
+
+ return ret ? 0 : -1;
}
void BoxDaemonImpl::setProviderCallbacks(ProviderCallbacks& callbacks)
@@ -518,4 +518,6 @@ void BoxDaemonImpl::requestBoxJobCallback(void* data)
// request box job!
jobInfo->daemonImpl->m_pluginConnector->requestCommand(
jobInfo->cmdType, jobInfo->boxInfo);
+
+ delete jobInfo;
}
diff --git a/src/Daemon/BoxDaemonUtil.cpp b/src/Daemon/BoxDaemonUtil.cpp
index 04f5580..b69e858 100644
--- a/src/Daemon/BoxDaemonUtil.cpp
+++ b/src/Daemon/BoxDaemonUtil.cpp
@@ -18,6 +18,7 @@
* @author Yunchan Cho (yunchan.cho@samsung.com)
*/
#include <string>
+#include <memory>
#include <app_service.h>
#include <Core/Util/Log.h>
#include <API/web_provider_livebox_info.h>
@@ -30,7 +31,7 @@ bool BoxDaemonUtil::launchApplication(std::string& boxId, std::string& instanceI
{
LogD("enter");
- const char* appId = web_provider_livebox_get_app_id(boxId.c_str());
+ std::shared_ptr<const char> appId(web_provider_livebox_get_app_id(boxId.c_str()));
if (!appId) {
LogD("no appid of %s", boxId.c_str());
return false;
@@ -45,11 +46,10 @@ bool BoxDaemonUtil::launchApplication(std::string& boxId, std::string& instanceI
return false;
}
- ret = service_set_package(handle, appId);
+ ret = service_set_package(handle, appId.get());
if (ret != SERVICE_ERROR_NONE) {
LogD("failed to set package");
service_destroy(handle);
- delete[] appId;
return false;
}
@@ -60,12 +60,11 @@ bool BoxDaemonUtil::launchApplication(std::string& boxId, std::string& instanceI
if (ret != SERVICE_ERROR_NONE) {
LogD("failed to launch package");
service_destroy(handle);
- delete[] appId;
return false;
}
service_destroy(handle);
LogD("success to launch app of %s", boxId.c_str());
- delete[] appId;
+
return true;
}
diff --git a/src/Plugin/BoxPluginConnector.cpp b/src/Plugin/BoxPluginConnector.cpp
index 859178d..05d0b84 100644
--- a/src/Plugin/BoxPluginConnector.cpp
+++ b/src/Plugin/BoxPluginConnector.cpp
@@ -48,7 +48,6 @@ bool BoxPluginConnector::initialize()
if (count <= 0) {
LogD("There is no available livebox plugins");
- web_provider_plugin_release_installed_list(pluginList, count);
return false;
}