summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeungha Son <seungha.son@samsung.com>2017-09-26 08:45:46 (GMT)
committerSeungha Son <seungha.son@samsung.com>2017-09-26 08:46:29 (GMT)
commit29cf664563d00e0296e9de7503236389b8849f75 (patch)
tree17d45157d44a398624e6888de44df57bf22ee3fd
parent9402be0e03b0120ed688314e77e6da2e43790433 (diff)
downloadbadge-29cf664563d00e0296e9de7503236389b8849f75.zip
badge-29cf664563d00e0296e9de7503236389b8849f75.tar.gz
badge-29cf664563d00e0296e9de7503236389b8849f75.tar.bz2
Adds lcov commentrefs/changes/16/152516/1
Signed-off-by: Seungha Son <seungha.son@samsung.com> Change-Id: I8ccaa8b4c59ff8b68630a1d812e0105cc865860a
-rw-r--r--src/badge_setting_service.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/badge_setting_service.c b/src/badge_setting_service.c
index ff22bc4..4c04884 100644
--- a/src/badge_setting_service.c
+++ b/src/badge_setting_service.c
@@ -109,8 +109,10 @@ EXPORT_API int badge_db_get_setting_by_appid(const char *appid, badge_setting_h
sql_ret = db_util_open(BADGE_DB_PATH, &db, 0);
if (sql_ret != SQLITE_OK || db == NULL) {
+ /* LCOV_EXCL_START */
ERR("Failed db util open [%s][%d]", BADGE_DB_PATH, sql_ret);
return BADGE_ERROR_FROM_DB;
+ /* LCOV_EXCL_STOP */
}
sql_query = sqlite3_mprintf("SELECT pkgname, appid, allow_to_display FROM %s " \
@@ -118,30 +120,38 @@ EXPORT_API int badge_db_get_setting_by_appid(const char *appid, badge_setting_h
"ORDER BY uid DESC;",
BADGE_SETTING_DB_TABLE, appid, 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) {
+ /* LCOV_EXCL_START */
DBG("No setting found for [%s]", appid);
ret = BADGE_ERROR_NOT_EXIST;
goto out;
+ /* LCOV_EXCL_STOP */
}
result_setting = (struct badge_setting *)malloc(sizeof(struct badge_setting));
if (result_setting == NULL) {
+ /* LCOV_EXCL_START */
ERR("Failed to alloc setting");
ret = BADGE_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
col_index = col_count;
@@ -180,8 +190,10 @@ EXPORT_API int badge_db_update_setting(char *pkgname, char *appid, int allow_to_
sql_ret = db_util_open(BADGE_DB_PATH, &db, 0);
if (sql_ret != SQLITE_OK || db == NULL) {
+ /* LCOV_EXCL_START */
ERR("db_util_open failed [%s][%d]", BADGE_DB_PATH, sql_ret);
return BADGE_ERROR_FROM_DB;
+ /* LCOV_EXCL_STOP */
}
sqlbuf = sqlite3_mprintf("UPDATE %s SET allow_to_display = %d " \
@@ -191,9 +203,11 @@ EXPORT_API int badge_db_update_setting(char *pkgname, char *appid, int allow_to_
pkgname, appid, uid);
if (!sqlbuf) {
+ /* LCOV_EXCL_START */
ERR("Failed to alloc query");
ret = BADGE_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
ret = badge_db_exec(db, sqlbuf, NULL);
@@ -226,8 +240,10 @@ EXPORT_API int badge_db_get_allow_to_display_by_appid(char *appid, int *allow_to
sql_ret = db_util_open(BADGE_DB_PATH, &db, 0);
if (sql_ret != SQLITE_OK || db == NULL) {
+ /* LCOV_EXCL_START */
ERR("Failed db util open [%s][%d]", BADGE_DB_PATH, sql_ret);
return BADGE_ERROR_FROM_DB;
+ /* LCOV_EXCL_STOP */
}
sql_query = sqlite3_mprintf("SELECT allow_to_display FROM %s WHERE appid = %Q " \
@@ -235,23 +251,29 @@ EXPORT_API int badge_db_get_allow_to_display_by_appid(char *appid, int *allow_to
BADGE_SETTING_DB_TABLE, appid, 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) {
+ /* LCOV_EXCL_START */
DBG("No setting found for [%s]", appid);
ret = BADGE_ERROR_NOT_EXIST;
goto out;
+ /* LCOV_EXCL_STOP */
}
col_index = col_count;
@@ -298,17 +320,21 @@ EXPORT_API int badge_setting_is_existed_appid(const char *appid, bool *is_existe
"appid = %Q AND uid = %d",
BADGE_SETTING_DB_TABLE, appid, uid);
if (!sqlbuf) {
+ /* LCOV_EXCL_START */
ERR("Failed to alloc query");
ret = BADGE_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
sqlret = sqlite3_prepare_v2(db, sqlbuf, -1, &stmt, NULL);
if (sqlret != SQLITE_OK) {
+ /* LCOV_EXCL_START */
ERR("sqlite3_prepare_v2 failed [%d][%s]", sqlret,
sqlite3_errmsg(db));
ret = BADGE_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
sqlret = sqlite3_step(stmt);
@@ -347,10 +373,12 @@ static bool _is_package_in_setting_table(sqlite3 *db, const char *pkgname, const
sqlite3_ret = sqlite3_prepare_v2(db, "SELECT pkgname FROM badge_setting WHERE uid = ? AND pkgname = ?", -1, &db_statement, NULL);
if (sqlite3_ret != SQLITE_OK) {
+ /* LCOV_EXCL_START */
ERR("sqlite3_prepare_v2 failed [%d][%s]", sqlite3_ret,
sqlite3_errmsg(db));
err = false;
goto out;
+ /* LCOV_EXCL_STOP */
}
sqlite3_bind_int(db_statement, field_index++, uid);
@@ -366,10 +394,12 @@ static bool _is_package_in_setting_table(sqlite3 *db, const char *pkgname, const
}
if (sqlite3_ret != SQLITE_OK && sqlite3_ret != SQLITE_ROW) {
+ /* LCOV_EXCL_START */
ERR("sqlite3_step failed [%d][%s]", sqlite3_ret,
sqlite3_errmsg(db));
err = false;
goto out;
+ /* LCOV_EXCL_STOP */
}
out:
@@ -451,29 +481,37 @@ static int package_info_callback(const pkgmgrinfo_pkginfo_h package_info, void *
pkgmgr_ret = pkgmgrinfo_appinfo_filter_create(&handle);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
ERR("pkgmgrinfo_appinfo_filter_create failed [%d]", pkgmgr_ret);
goto out;
+ /* LCOV_EXCL_STOP */
}
pkgmgr_ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_PACKAGE, pkgname);
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(handle, 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 */
}
pkgmgr_ret = pkgmgrinfo_appinfo_usr_filter_foreach_appinfo(handle, app_info_callback, info, info->uid);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
ERR("pkgmgrinfo_pkginfo_filter_foreach_appinfo failed [%d]",
pkgmgr_ret);
goto out;
+ /* LCOV_EXCL_STOP */
}
out:
@@ -503,27 +541,33 @@ EXPORT_API int badge_setting_insert_package_for_uid(const char *pkgname, uid_t u
pkgmgr_ret = pkgmgrinfo_pkginfo_filter_create(&handle);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
ERR("pkgmgrinfo_pkginfo_filter_create failed [%d]", pkgmgr_ret);
ret = BADGE_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
pkgmgr_ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_ID, pkgname);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
ERR("pkgmgrinfo_pkginfo_filter_add_string failed [%d]",
pkgmgr_ret);
ret = BADGE_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
info.db = db;
info.uid = uid;
pkgmgr_ret = pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo(handle, package_info_callback, &info, uid);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
ERR("pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo failed [%d]",
pkgmgr_ret);
ret = BADGE_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
out:
@@ -568,10 +612,12 @@ EXPORT_API int badge_setting_delete_package_for_uid(const char *pkgname, uid_t u
sqlite3_ret = sqlite3_prepare_v2(db, "DELETE FROM badge_setting WHERE uid = ? AND pkgname = ? ", -1, &db_statement, NULL);
if (sqlite3_ret != SQLITE_OK) {
+ /* LCOV_EXCL_START */
ERR("sqlite3_prepare_v2 failed [%d][%s]", sqlite3_ret,
sqlite3_errmsg(db));
ret = BADGE_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
sqlite3_bind_int(db_statement, field_index++, uid);
@@ -579,9 +625,11 @@ EXPORT_API int badge_setting_delete_package_for_uid(const char *pkgname, uid_t u
sqlite3_ret = sqlite3_step(db_statement);
if (sqlite3_ret != SQLITE_OK && sqlite3_ret != SQLITE_DONE) {
+ /* LCOV_EXCL_START */
ERR("sqlite3_step failed [%d][%s]", sqlite3_ret,
sqlite3_errmsg(db));
ret = BADGE_ERROR_FROM_DB;
+ /* LCOV_EXCL_STOP */
}
out:
@@ -619,19 +667,23 @@ EXPORT_API int badge_setting_refresh_setting_table(uid_t uid)
pkgmgr_ret = pkgmgrinfo_pkginfo_filter_create(&filter);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
ERR("pkgmgrinfo_pkginfo_filter_create failed [%d]", pkgmgr_ret);
ret = BADGE_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
info.db = db;
info.uid = uid;
pkgmgr_ret = pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo(filter, package_info_callback, &info, uid);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
ERR("pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo failed [%d]",
pkgmgr_ret);
ret = BADGE_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
out: