summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormk5004.lee <mk5004.lee@samsung.com>2018-08-08 08:12:06 (GMT)
committermk5004.lee <mk5004.lee@samsung.com>2018-08-08 08:27:49 (GMT)
commit23dd329a0ebb6c95f55c5cfb1a6dac62167417d9 (patch)
tree8f125d81bbf35cb7406bfe40519f1105073da7d6
parent57625b6ff1f2734e93c05ee2dd3a736daec74b49 (diff)
downloadbadge-23dd329a0ebb6c95f55c5cfb1a6dac62167417d9.zip
badge-23dd329a0ebb6c95f55c5cfb1a6dac62167417d9.tar.gz
badge-23dd329a0ebb6c95f55c5cfb1a6dac62167417d9.tar.bz2
Update LCOV commentrefs/changes/39/186239/2
Change-Id: I594c701342e52ed783073de42863a5787604bd4c Signed-off-by: mk5004.lee <mk5004.lee@samsung.com>
-rwxr-xr-xsrc/badge_db.c13
-rwxr-xr-xsrc/badge_internal.c15
-rwxr-xr-xsrc/badge_ipc.c3
-rwxr-xr-xsrc/badge_setting_service.c28
4 files changed, 38 insertions, 21 deletions
diff --git a/src/badge_db.c b/src/badge_db.c
index a96ba4c..ec5f7a4 100755
--- a/src/badge_db.c
+++ b/src/badge_db.c
@@ -54,6 +54,7 @@ CREATE TABLE IF NOT EXISTS badge_setting ( \
static bool is_db_corrupted = false;
+/* LCOV_EXCL_START */
static int __check_integrity_cb(void *pid, int argc, char **argv, char **notUsed)
{
if (strcmp(argv[0], "ok") != 0) {
@@ -65,7 +66,9 @@ static int __check_integrity_cb(void *pid, int argc, char **argv, char **notUsed
INFO("db integrity result : %s" , argv[0]);
return 0;
}
+/* LCOV_EXCL_STOP */
+/* LCOV_EXCL_START */
static int __recover_corrupted_db(sqlite3 *db)
{
int ret = BADGE_ERROR_NONE;
@@ -99,9 +102,10 @@ out:
return ret;
}
+/* LCOV_EXCL_STOP */
-EXPORT_API
-int badge_db_init()
+/* LCOV_EXCL_START */
+EXPORT_API int badge_db_init()
{
int ret = BADGE_ERROR_NONE;
int sql_ret;
@@ -140,6 +144,7 @@ out:
return ret;
}
+/* LCOV_EXCL_STOP */
EXPORT_API
int badge_db_is_existing(const char *pkgname, bool *existing, uid_t uid)
@@ -240,9 +245,11 @@ int badge_db_exec(sqlite3 *db, const char *query, int *num_changes)
ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
if (ret != SQLITE_OK) {
+ /* LCOV_EXCL_START */
ERR("sqlite3_prepare_v2 failed [%d][%s]", ret,
sqlite3_errmsg(db));
return BADGE_ERROR_FROM_DB;
+ /* LCOV_EXCL_STOP */
}
if (stmt != NULL) {
@@ -253,10 +260,12 @@ int badge_db_exec(sqlite3 *db, const char *query, int *num_changes)
sqlite3_finalize(stmt);
} else {
+ /* LCOV_EXCL_START */
ERR("sqlite3_step failed [%d][%s]", ret,
sqlite3_errmsg(db));
sqlite3_finalize(stmt);
return BADGE_ERROR_FROM_DB;
+ /* LCOV_EXCL_STOP */
}
} else {
return BADGE_ERROR_FROM_DB;
diff --git a/src/badge_internal.c b/src/badge_internal.c
index 4f6f50b..1360133 100755
--- a/src/badge_internal.c
+++ b/src/badge_internal.c
@@ -134,7 +134,6 @@ static int _badge_check_data_inserted(const char *pkgname,
sqlbuf = sqlite3_mprintf("SELECT count(*) FROM %q WHERE " \
"pkgname = %Q AND uid = %d",
BADGE_TABLE_NAME, pkgname, uid);
-
if (!sqlbuf) {
/* LCOV_EXCL_START */
ERR("Failed to alloc query");
@@ -190,7 +189,6 @@ static int _badge_check_option_inserted(const char *pkgname,
sqlbuf = sqlite3_mprintf("SELECT count(*) FROM %q WHERE " \
"pkgname = %Q AND uid = %d",
BADGE_OPTION_TABLE_NAME, pkgname, uid);
-
if (!sqlbuf) {
/* LCOV_EXCL_START */
ERR("Failed to alloc query");
@@ -683,10 +681,11 @@ static int _badge_remove_by_appid(const char *appid, uid_t uid, sqlite3 *db)
ret = badge_db_exec(db, sqlbuf, NULL);
if (ret != BADGE_ERROR_NONE) {
- ERR("Failed to remove badge[%s], err[%d]",
- appid, ret);
+ /* LCOV_EXCL_START */
+ ERR("Failed to remove badge[%s], err[%d]", appid, ret);
result = ret;
goto return_close_db;
+ /* LCOV_EXCL_STOP */
}
/* treating option table */
@@ -784,17 +783,21 @@ int _badge_remove_by_pkgname(const char *pkgname, uid_t uid)
BADGE_SETTING_DB_TABLE, pkgname, uid,
tzplatform_getuid(TZ_SYS_GLOBALAPP_USER));
if (!sql_query) {
+ /* LCOV_EXCL_START */
ERR("Failed to alloc query");
ret = BADGE_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
sql_ret = sqlite3_get_table(db, sql_query, &query_result, &row_count, &col_count, NULL);
if (sql_ret != SQLITE_OK && sql_ret != -1) {
+ /* LCOV_EXCL_START */
ERR("sqlite3_get_table failed [%d][%s]", sql_ret,
sqlite3_errmsg(db));
ret = BADGE_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
if (!row_count) {
@@ -1187,8 +1190,10 @@ static struct _badge_cb_data *__malloc_badge_cb_data(badge_change_cb callback, v
struct _badge_cb_data *bd = NULL;
bd = (struct _badge_cb_data *)malloc(sizeof(struct _badge_cb_data));
if (bd == NULL) {
+ /* LCOV_EXCL_START */
ERR("Failed malloc badge_cb_data");
return NULL;
+ /* LCOV_EXCL_STOP */
}
bd->callback = callback;
@@ -1227,10 +1232,12 @@ badge_h *_badge_new(const char *pkgname, const char *writable_pkgs,
badge = (badge_h *)malloc(sizeof(struct _badge_h));
if (!badge) {
+ /* LCOV_EXCL_START */
ERR("Failed to alloc handle");
if (err)
*err = BADGE_ERROR_OUT_OF_MEMORY;
return NULL;
+ /* LCOV_EXCL_STOP */
}
badge->pkgname = strdup(pkgname);
diff --git a/src/badge_ipc.c b/src/badge_ipc.c
index 55eb317..cd9d193 100755
--- a/src/badge_ipc.c
+++ b/src/badge_ipc.c
@@ -110,7 +110,6 @@ int badge_ipc_add_deferred_task(
task_list *list_new;
list_new = (task_list *) malloc(sizeof(task_list));
-
if (list_new == NULL)
return BADGE_ERROR_OUT_OF_MEMORY;
@@ -795,9 +794,11 @@ int badge_ipc_request_get_setting_by_appid(badge_setting_h *setting, const char
result_setting = (struct badge_setting *)malloc(sizeof(struct badge_setting));
if (result_setting == NULL) {
+ /* LCOV_EXCL_START */
ERR("Failed memory allocation.");
g_object_unref(reply);
return BADGE_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
badge_ipc_make_setting_from_gvariant(result_setting, setting_body);
*setting = result_setting;
diff --git a/src/badge_setting_service.c b/src/badge_setting_service.c
index 177a900..587f80e 100755
--- a/src/badge_setting_service.c
+++ b/src/badge_setting_service.c
@@ -454,10 +454,12 @@ EXPORT_API int badge_setting_is_existed_appid(const char *appid, bool *is_existe
sqlret = db_util_open(BADGE_DB_PATH, &db, 0);
if (sqlret != SQLITE_OK || !db) {
+ /* LCOV_EXCL_START */
ERR("Failed to db_util_open [%d]", sqlret);
if (sqlret == SQLITE_PERM)
return BADGE_ERROR_PERMISSION_DENIED;
return BADGE_ERROR_FROM_DB;
+ /* LCOV_EXCL_STOP */
}
sqlbuf = sqlite3_mprintf("SELECT count(*) FROM %q WHERE " \
@@ -750,9 +752,11 @@ EXPORT_API int badge_setting_delete_package_for_uid(const char *pkgname, uid_t u
sql_ret = sqlite3_open_v2(BADGE_DB_PATH, &db, SQLITE_OPEN_READWRITE, NULL);
if (ret != SQLITE_OK || db == NULL) {
+ /* LCOV_EXCL_START */
ERR("db_util_open failed [%s][%d]", BADGE_DB_PATH, sql_ret);
ret = BADGE_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
is_package_in_setting_table = _is_package_in_setting_table(db, pkgname, NULL, uid);
@@ -764,18 +768,22 @@ EXPORT_API int badge_setting_delete_package_for_uid(const char *pkgname, uid_t u
sqlite3_exec(db, "BEGIN immediate;", NULL, NULL, NULL);
query = sqlite3_mprintf("DELETE FROM badge_setting "
- "WHERE uid = %d AND pkgname = %Q ",
- uid, pkgname);
+ "WHERE uid = %d AND pkgname = %Q ",
+ uid, pkgname);
if (query == NULL) {
+ /* LCOV_EXCL_START */
ERR("Out of memory");
ret = BADGE_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
ret = badge_db_exec(db, query, NULL);
if (ret != BADGE_ERROR_NONE) {
+ /* LCOV_EXCL_START */
ERR("DB Error");
goto out;
+ /* LCOV_EXCL_STOP */
}
out:
@@ -794,6 +802,7 @@ out:
return ret;
}
+/* LCOV_EXCL_START */
EXPORT_API int badge_setting_refresh_setting_table(uid_t uid)
{
int ret = BADGE_ERROR_NONE;
@@ -813,31 +822,25 @@ EXPORT_API int badge_setting_refresh_setting_table(uid_t uid)
pkgmgr_ret = pkgmgrinfo_appinfo_filter_create(&filter);
if (pkgmgr_ret != PMINFO_R_OK) {
- /* LCOV_EXCL_START */
ERR("pkgmgrinfo_appinfo_filter_create failed [%d]", pkgmgr_ret);
ret = BADGE_ERROR_FROM_DB;
goto out;
- /* LCOV_EXCL_STOP */
}
pkgmgr_ret = pkgmgrinfo_appinfo_filter_add_string(filter,
PMINFO_APPINFO_PROP_PRIVILEGE, BADGE_PRIVILEGE);
if (pkgmgr_ret != PMINFO_R_OK) {
- /* LCOV_EXCL_START */
ERR("pkgmgrinfo_appinfo_filter_add_string failed [%d]",
pkgmgr_ret);
goto out;
- /* LCOV_EXCL_STOP */
}
pkgmgr_ret = pkgmgrinfo_appinfo_filter_add_bool(filter,
PMINFO_APPINFO_PROP_APP_NODISPLAY, false);
if (pkgmgr_ret != PMINFO_R_OK) {
- /* LCOV_EXCL_START */
ERR("pkgmgrinfo_appinfo_filter_add_bool failed [%d]",
pkgmgr_ret);
goto out;
- /* LCOV_EXCL_STOP */
}
info.db = db;
@@ -845,12 +848,10 @@ EXPORT_API int badge_setting_refresh_setting_table(uid_t uid)
pkgmgr_ret = pkgmgrinfo_appinfo_usr_filter_foreach_appinfo(filter,
app_info_callback, &info, uid);
if (pkgmgr_ret != PMINFO_R_OK) {
- /* LCOV_EXCL_START */
ERR("pkgmgrinfo_appinfo_usr_filter_foreach_appinfo failed [%d]",
pkgmgr_ret);
ret = BADGE_ERROR_FROM_DB;
goto out;
- /* LCOV_EXCL_STOP */
}
out:
@@ -867,7 +868,9 @@ out:
return ret;
}
+/* LCOV_EXCL_STOP */
+/* LCOV_EXCL_START */
EXPORT_API int badge_setting_arrange_tables(uid_t uid)
{
int ret = BADGE_ERROR_NONE;
@@ -887,11 +890,9 @@ EXPORT_API int badge_setting_arrange_tables(uid_t uid)
"(SELECT pkgname FROM %Q) AND uid = %d",
BADGE_TABLE_NAME, BADGE_SETTING_DB_TABLE, uid);
if (sqlbuf == NULL) {
- /* LCOV_EXCL_START */
ERR("Failed to alloc query");
ret = BADGE_ERROR_OUT_OF_MEMORY;
goto out;
- /* LCOV_EXCL_STOP */
}
ret = badge_db_exec(db, sqlbuf, NULL);
@@ -908,11 +909,9 @@ EXPORT_API int badge_setting_arrange_tables(uid_t uid)
BADGE_OPTION_TABLE_NAME, BADGE_SETTING_DB_TABLE,
uid);
if (sqlbuf == NULL) {
- /* LCOV_EXCL_START */
ERR("Failed to alloc query");
ret = BADGE_ERROR_OUT_OF_MEMORY;
goto out;
- /* LCOV_EXCL_STOP */
}
ret = badge_db_exec(db, sqlbuf, NULL);
@@ -929,3 +928,4 @@ out:
return ret;
}
+/* LCOV_EXCL_STOP */