summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2015-05-06 10:35:26 +0900
committerSung-jae Park <nicesj.park@samsung.com>2015-05-06 10:35:26 +0900
commit0126c16ae240ecfc7d8ed8903eae14565187314b (patch)
treefd5fbbec511dd3951363ec6329d2d9986f049bde
parent3d2590ee27fac055cab389a6119d9c4e53d37b39 (diff)
downloadwidget-service-0126c16ae240ecfc7d8ed8903eae14565187314b.tar.gz
widget-service-0126c16ae240ecfc7d8ed8903eae14565187314b.tar.bz2
widget-service-0126c16ae240ecfc7d8ed8903eae14565187314b.zip
Update the code for TC
While preparing TC, there is some changes in the code for making APIs work as what we expect. [model] Redwood,Kiran,B3(Wearable) [binary_type] AP [customer] Docomo/Orange/ATT/Open [issue#] N/A [problem] [cause] [solution] [team] HomeTF [request] [horizontal_expansion] Change-Id: Ie4ce43974840d84be0597284f8fc96add704c110
-rwxr-xr-xinclude/widget_service.h2
-rw-r--r--src/widget_monitor.c6
-rw-r--r--src/widget_service.c31
3 files changed, 27 insertions, 12 deletions
diff --git a/include/widget_service.h b/include/widget_service.h
index a9dca23..aa0cecc 100755
--- a/include/widget_service.h
+++ b/include/widget_service.h
@@ -385,7 +385,7 @@ extern char *widget_service_get_name(const char *widget_id, const char *lang);
* @see #widget_service_get_icon
* @see #widget_service_get_name
*/
-extern char *widget_service_get_preview_image_path(const char *widget_id, int size_type);
+extern char *widget_service_get_preview_image_path(const char *widget_id, widget_size_type_e size_type);
/**
* @brief Gets icon path of given widget package.
diff --git a/src/widget_monitor.c b/src/widget_monitor.c
index d638ae4..3695bf0 100644
--- a/src/widget_monitor.c
+++ b/src/widget_monitor.c
@@ -235,6 +235,7 @@ EAPI int widget_service_unset_lifecycle_event_cb(const char *widget_id, void **u
struct dlist *l;
struct dlist *n;
struct lifecycle_monitor_item *item;
+ int ret = WIDGET_ERROR_NOT_EXIST
dlist_foreach_safe(s_info.lifecycle_monitor_list, l, n, item) {
if (widget_id == NULL && item->widget_id == NULL) {
@@ -249,6 +250,8 @@ EAPI int widget_service_unset_lifecycle_event_cb(const char *widget_id, void **u
* Send service_unregister command to master
*/
send_monitor_command(CMD_MONITOR_UNREGISTER, widget_id);
+
+ ret = WIDGET_ERROR_NONE;
break;
} else if (widget_id && item->widget_id) {
if (!strcmp(item->widget_id, widget_id)) {
@@ -264,6 +267,7 @@ EAPI int widget_service_unset_lifecycle_event_cb(const char *widget_id, void **u
* Send service_unregister command to master
*/
send_monitor_command(CMD_MONITOR_UNREGISTER, widget_id);
+ ret = WIDGET_ERROR_NONE;
break;
}
}
@@ -274,7 +278,7 @@ EAPI int widget_service_unset_lifecycle_event_cb(const char *widget_id, void **u
s_info.lifecycle_monitor_handle = -1;
}
- return WIDGET_ERROR_NOT_EXIST;
+ return ret;
}
EAPI int widget_service_get_content_of_widget_instance(const char *widget_id, const char *widget_instance_id, bundle **b)
diff --git a/src/widget_service.c b/src/widget_service.c
index 7f72136..0070491 100644
--- a/src/widget_service.c
+++ b/src/widget_service.c
@@ -856,6 +856,10 @@ EAPI int widget_service_get_widget_list(widget_list_cb cb, void *data)
}
}
+ if (ret == 0) {
+ ret = WIDGET_ERROR_NOT_EXIST;
+ }
+
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
@@ -915,6 +919,10 @@ EAPI int widget_service_get_widget_list_by_pkgid(const char *pkgid, widget_list_
}
}
+ if (ret == 0) {
+ ret = WIDGET_ERROR_NOT_EXIST;
+ }
+
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
@@ -1085,20 +1093,24 @@ EAPI char *widget_service_get_main_app_id(const char *widgetid)
if (sqlite3_prepare_v2(handle, "SELECT appid, uiapp FROM pkgmap WHERE (pkgid = ?) or (appid = ? and prime = 1)", -1, &stmt, NULL) != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ set_last_result(WIDGET_ERROR_FAULT);
goto out;
}
if (sqlite3_bind_text(stmt, 1, widgetid, -1, SQLITE_TRANSIENT) != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ set_last_result(WIDGET_ERROR_FAULT);
goto out;
}
if (sqlite3_bind_text(stmt, 2, widgetid, -1, SQLITE_TRANSIENT) != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ set_last_result(WIDGET_ERROR_FAULT);
goto out;
}
if (sqlite3_step(stmt) != SQLITE_ROW) {
+ set_last_result(WIDGET_ERROR_NOT_EXIST);
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
goto out;
@@ -1109,6 +1121,7 @@ EAPI char *widget_service_get_main_app_id(const char *widgetid)
ErrPrint("Invalid package name (%s)\n", widgetid);
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
+ set_last_result(WIDGET_ERROR_IO_ERROR);
goto out;
}
@@ -1123,6 +1136,7 @@ EAPI char *widget_service_get_main_app_id(const char *widgetid)
ret = strdup(pkgid);
if (!ret) {
ErrPrint("Error: %d\n", errno);
+ set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
}
}
@@ -1570,7 +1584,7 @@ EAPI int widget_service_get_need_of_mouse_event(const char *pkgid, widget_size_t
goto out;
}
- ret_sqlite = sqlite3_bind_int(stmt, 2, size_type);
+ ret_sqlite = sqlite3_bind_int(stmt, 2, (int)size_type);
if (ret_sqlite != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
ret = WIDGET_ERROR_FAULT;
@@ -1698,7 +1712,7 @@ out:
return appid;
}
-EAPI char *widget_service_get_preview_image_path(const char *pkgid, int size_type)
+EAPI char *widget_service_get_preview_image_path(const char *pkgid, widget_size_type_e size_type)
{
sqlite3_stmt *stmt;
sqlite3 *handle;
@@ -1733,7 +1747,7 @@ EAPI char *widget_service_get_preview_image_path(const char *pkgid, int size_typ
goto out;
}
- ret = sqlite3_bind_int(stmt, 2, size_type);
+ ret = sqlite3_bind_int(stmt, 2, (int)size_type);
if (ret != SQLITE_OK) {
set_last_result(WIDGET_ERROR_FAULT);
ErrPrint("Error: %s, %s\n", sqlite3_errmsg(handle), pkgid);
@@ -1991,7 +2005,7 @@ EAPI int widget_service_get_supported_sizes(const char *pkgid, int *cnt, int **w
int size;
int ret;
- if (!w || !h || !cnt || !pkgid) {
+ if (!w || !h || !cnt || !pkgid || *cnt <= 0) {
return WIDGET_ERROR_INVALID_PARAMETER;
}
@@ -2024,11 +2038,8 @@ EAPI int widget_service_get_supported_sizes(const char *pkgid, int *cnt, int **w
*h = malloc(sizeof(int) * *cnt);
if (*w == NULL || *h == NULL) {
ErrPrint("Out of memory");
- if (w)
- free(w);
-
- if (h)
- free(h);
+ free(*w);
+ free(*h);
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
@@ -2043,9 +2054,9 @@ EAPI int widget_service_get_supported_sizes(const char *pkgid, int *cnt, int **w
}
*cnt = ret;
+ ret = (ret > 0) ? WIDGET_ERROR_NONE : WIDGET_ERROR_NOT_EXIST;
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
- ret = 0;
out:
close_db(handle);
return ret;