Update LCOV comment 27/186227/2
authormk5004.lee <mk5004.lee@samsung.com>
Wed, 8 Aug 2018 07:09:24 +0000 (16:09 +0900)
committerMyungKi Lee <mk5004.lee@samsung.com>
Thu, 9 Aug 2018 01:00:39 +0000 (01:00 +0000)
Change-Id: I105f4451e20072817cc2ee4ed51c8fdc8aa6cae9
Signed-off-by: mk5004.lee <mk5004.lee@samsung.com>
src/notification_db.c
src/notification_init.c
src/notification_ipc.c
src/notification_ipc_socket.c
src/notification_noti.c
src/notification_setting.c
src/notification_setting_service.c
src/notification_viewer.c

index aed4104f3e4ea197fd4adc39e9cc0ef8bfa62fd7..134f5101b9141b79077b27a8c4421f46bc155ed2 100644 (file)
@@ -29,6 +29,7 @@
 
 static bool is_db_corrupted = false;
 
+/* LCOV_EXCL_START */
 static int __check_integrity_cb(void *pid, int argc, char **argv, char **notUsed)
 {
        char *check_str = "ok";
@@ -42,7 +43,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 = NOTIFICATION_ERROR_NONE;
@@ -76,7 +79,9 @@ out:
 
        return ret;
 }
+/* LCOV_EXCL_STOP */
 
+/* LCOV_EXCL_START */
 EXPORT_API int notification_db_init()
 {
        int ret = NOTIFICATION_ERROR_NONE;
@@ -87,20 +92,16 @@ EXPORT_API int notification_db_init()
        sql_ret = sqlite3_open_v2(DBPATH, &db,
                        SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE, NULL);
        if (sql_ret != SQLITE_OK) {
-               /* LCOV_EXCL_START */
                ERR("Failed to open db[%d]", ret);
                ret = NOTIFICATION_ERROR_FROM_DB;
                goto out;
-               /* LCOV_EXCL_STOP */
        }
 
        sql_ret = sqlite3_exec(db, CREATE_NOTIFICATION_TABLE, NULL, NULL, &errmsg);
        if (sql_ret != SQLITE_OK) {
-               /* LCOV_EXCL_START */
                ERR("Failed to exec sqlite[%d][%s]", ret, errmsg);
                ret = NOTIFICATION_ERROR_FROM_DB;
                goto out;
-               /* LCOV_EXCL_STOP */
        }
 
        sql_ret = sqlite3_exec(db, "PRAGMA integrity_check",
@@ -120,6 +121,7 @@ out:
 
        return ret;
 }
+/* LCOV_EXCL_STOP */
 
 sqlite3 *notification_db_open()
 {
index 2696c41f3f1fdbe408dfd211356b5b87b62a8389..a97cdd1f8972318d7ff5f10eca88a4818a9665e4 100644 (file)
@@ -40,6 +40,7 @@
 #define _E(fmt, arg...) fprintf(stderr, "[NOTIFICATION_INIT][E][%s,%d] "fmt"\n", \
                __FUNCTION__, __LINE__, ##arg);
 
+/* LCOV_EXCL_START */
 static int _is_authorized()
 {
        /* pkg_init db should be called by as root privilege. */
@@ -50,7 +51,9 @@ static int _is_authorized()
        else
                return 0;
 }
+/* LCOV_EXCL_STOP */
 
+/* LCOV_EXCL_START */
 int main(int argc, char *argv[])
 {
        int ret;
@@ -78,3 +81,4 @@ int main(int argc, char *argv[])
 
        return ret;
 }
+/* LCOV_EXCL_STOP */
index 14fe889f5fa04c0e15587c2d04e7f92f247d9d03..a7c4f7560c44fbcbae64392b2146760d1913bc82 100644 (file)
@@ -567,9 +567,11 @@ static void _send_event(GVariant *parameters)
        g_variant_unref(coupled_body);
        g_variant_unref(body);
        if (ret != NOTIFICATION_ERROR_NONE) {
+               /* LCOV_EXCL_START */
                ERR("Failed to make notification handle from gvariant");
                notification_free(noti);
                return;
+               /* LCOV_EXCL_STOP */
        }
 
        notification_call_event_handler_cb(noti, event_type);
@@ -740,10 +742,12 @@ static int _send_sync_noti_with_fd(int fd, GVariant *body, GDBusMessage **reply,
        fd_list = g_unix_fd_list_new();
        g_unix_fd_list_append(fd_list, fd, &g_err);
        if (g_err != NULL) {
+               /* LCOV_EXCL_START */
                ERR("g_unix_fd_list_append [%s]", g_err->message);
                g_object_unref(fd_list);
                g_error_free(g_err);
                return NOTIFICATION_ERROR_IO_ERROR;
+               /* LCOV_EXCL_STOP */
        }
 
        msg = __get_new_msg(body, cmd);
index cc1ce4a415665d0cb6d5c504c5efda74b4f74143..54090ac9d94352d4ba587aff4aac00f8af1c8412 100644 (file)
@@ -86,6 +86,7 @@ EXPORT_API int notification_ipc_socket_write(int fd, const char *buffer, unsigne
                errno = 0;
                nb = write(fd, buffer, left);
                if (nb == -1) {
+                       /* LCOV_EXCL_START */
                        if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) {
                                ERR("continue..");
                                retry_cnt++;
@@ -94,6 +95,7 @@ EXPORT_API int notification_ipc_socket_write(int fd, const char *buffer, unsigne
                        }
                        ERR("error fd [%d] errno [%d]", fd, errno);
                        return NOTIFICATION_ERROR_IO_ERROR;
+                       /* LCOV_EXCL_STOP */
                }
 
                left -= nb;
@@ -115,15 +117,19 @@ EXPORT_API int notification_ipc_socket_write_string(int fd, const char *buffer,
 
        ret = notification_ipc_socket_write(fd, (char *)&string_len, sizeof(string_len));
        if (ret != NOTIFICATION_ERROR_NONE) {
+               /* LCOV_EXCL_START */
                ERR("write string_len fail");
                return ret;
+               /* LCOV_EXCL_STOP */
        }
 
        if (string_len > 0) {
                ret = notification_ipc_socket_write(fd, buffer, string_len);
                if (ret != NOTIFICATION_ERROR_NONE) {
+                       /* LCOV_EXCL_START */
                        ERR("write string fail");
                        return ret;
+                       /* LCOV_EXCL_STOP */
                }
        }
 
index 2465f0192fb1fadde10701484bf06169aa7887b1..43efcd322ea41397c1e8f71331c97c6572a20cb1 100644 (file)
@@ -1603,9 +1603,11 @@ EXPORT_API int notification_noti_get_all_count(notification_type_e type, int *co
 
        db = notification_db_open();
        if (db == NULL) {
+               /* LCOV_EXCL_START */
                ret = get_last_result();
                ERR("Failed to open db [%d]", ret);
                return ret;
+               /* LCOV_EXCL_STOP */
        }
 
        if (type != NOTIFICATION_TYPE_NONE)
@@ -1617,17 +1619,21 @@ EXPORT_API int notification_noti_get_all_count(notification_type_e type, int *co
                                NOTIFICATION_DB_TABLE, uid);
 
        if (sql_buf == NULL) {
+               /* LCOV_EXCL_START */
                ret = NOTIFICATION_ERROR_FROM_DB;
                ERR("OOM - sqlite3_mprintf");
                goto out;
+               /* LCOV_EXCL_STOP */
        }
 
        sql_ret = sqlite3_prepare_v2(db, sql_buf, -1, &stmt, NULL);
        if (sql_ret != SQLITE_OK) {
+               /* LCOV_EXCL_START */
                ret = NOTIFICATION_ERROR_FROM_DB;
                ERR("SQLITE3 Error - sqlite3_prepare_v2 [%d][%s]",
                                sql_ret, sqlite3_errmsg(db));
                goto out;
+               /* LCOV_EXCL_STOP */
        }
 
        sql_ret = sqlite3_step(stmt);
@@ -2054,6 +2060,7 @@ err:
        return ret;
 }
 
+/* LCOV_EXCL_START */
 EXPORT_API void notification_noti_init_data(void)
 {
        int ret;
@@ -2081,6 +2088,7 @@ EXPORT_API void notification_noti_init_data(void)
        sqlite3_free(query);
        notification_db_close(&db);
 }
+/* LCOV_EXCL_STOP */
 
 EXPORT_API int notification_noti_check_limit(notification_h noti, uid_t uid, GList **list)
 {
index 8d024380f510d808612121e4fce4cf28814be22e..f53aa719afffbdf3c3a7e132421cc4214e79b606 100644 (file)
@@ -107,8 +107,10 @@ EXPORT_API int notification_setting_get_package_name(notification_setting_h sett
        }
 
        if (setting->package_name == NULL) {
+               /* LCOV_EXCL_START */
                ERR("setting->package_name is null");
                return NOTIFICATION_ERROR_NOT_EXIST_ID;
+               /* LCOV_EXCL_STOP */
        }
 
        *value = SAFE_STRDUP(setting->package_name);
@@ -124,8 +126,10 @@ EXPORT_API int notification_setting_get_appid(notification_setting_h setting, ch
        }
 
        if (setting->app_id == NULL) {
+               /* LCOV_EXCL_START */
                ERR("setting->app_id is null");
                return NOTIFICATION_ERROR_NOT_EXIST_ID;
+               /* LCOV_EXCL_STOP */
        }
 
        *app_id = SAFE_STRDUP(setting->app_id);
@@ -524,6 +528,7 @@ out:
        return err;
 }
 
+/* LCOV_EXCL_START */
 EXPORT_API int notification_setting_refresh_setting_table(uid_t uid)
 {
        int err = NOTIFICATION_ERROR_NONE;
@@ -540,21 +545,17 @@ EXPORT_API int notification_setting_refresh_setting_table(uid_t uid)
 
        pkgmgr_ret = pkgmgrinfo_appinfo_filter_create(&filter);
        if (pkgmgr_ret != PMINFO_R_OK) {
-               /* LCOV_EXCL_START */
                ERR("Failed to create appinfo_filter[%d]", pkgmgr_ret);
                err = NOTIFICATION_ERROR_FROM_DB;
                goto out;
-               /* LCOV_EXCL_STOP */
        }
 
        pkgmgr_ret = pkgmgrinfo_appinfo_filter_add_string(filter,
                        PMINFO_APPINFO_PROP_PRIVILEGE, NOTIFICATION_PRIVILEGE);
        if (pkgmgr_ret != PMINFO_R_OK) {
-               /* LCOV_EXCL_START */
                ERR("Failed to add string to appinfo_filter[%d]", pkgmgr_ret);
                err = NOTIFICATION_ERROR_FROM_DB;
                goto out;
-               /* LCOV_EXCL_STOP */
        }
 
        info.db = db;
@@ -562,11 +563,9 @@ EXPORT_API int notification_setting_refresh_setting_table(uid_t uid)
        pkgmgr_ret = pkgmgrinfo_appinfo_usr_filter_foreach_appinfo(filter,
                        _foreach_app_info_callback, &info, uid);
        if (pkgmgr_ret != PMINFO_R_OK) {
-               /* LCOV_EXCL_START */
                ERR("Failed to foreach appinfo[%d]", pkgmgr_ret);
                err = NOTIFICATION_ERROR_FROM_DB;
                goto out;
-               /* LCOV_EXCL_STOP */
        }
 
 out:
@@ -578,6 +577,7 @@ out:
 
        return err;
 }
+/* LCOV_EXCL_STOP */
 
 EXPORT_API int notification_setting_insert_package_for_uid(const char *package_name, uid_t uid)
 {
@@ -924,8 +924,10 @@ EXPORT_API int notification_register_system_setting_dnd_changed_cb_for_uid(dnd_c
                return NOTIFICATION_ERROR_INVALID_PARAMETER;
 
        if (notification_ipc_monitor_init(uid) != NOTIFICATION_ERROR_NONE) {
+               /* LCOV_EXCL_START */
                ERR("Failed to init monitor");
                return NOTIFICATION_ERROR_IO_ERROR;
+               /* LCOV_EXCL_STOP */
        }
 
        if (_noti_dnd_cb_hash == NULL)
@@ -1009,6 +1011,7 @@ EXPORT_API int notification_unregister_system_setting_dnd_changed_cb(dnd_changed
        return notification_unregister_system_setting_dnd_changed_cb_for_uid(callback, getuid());
 }
 
+/* LCOV_EXCL_START */
 static bool _is_uid_in_system_setting_table(sqlite3 *db, uid_t uid)
 {
        sqlite3_stmt *stmt = NULL;
@@ -1019,20 +1022,16 @@ static bool _is_uid_in_system_setting_table(sqlite3 *db, uid_t uid)
        query = sqlite3_mprintf("SELECT uid FROM %s WHERE uid = %d",
                                NOTIFICATION_SYSTEM_SETTING_DB_TABLE, uid);
        if (query == NULL) {
-               /* LCOV_EXCL_START */
                ERR("Failed to alloc query");
                return NOTIFICATION_ERROR_OUT_OF_MEMORY;
-               /* LCOV_EXCL_STOP */
        }
 
        sql_ret = sqlite3_prepare_v2(db, query, -1, &stmt, NULL);
        if (sql_ret != SQLITE_OK) {
-               /* LCOV_EXCL_START */
                ERR("sqlite3_prepare_v2 failed [%d][%s]", sql_ret,
                                sqlite3_errmsg(db));
                err = false;
                goto out;
-               /* LCOV_EXCL_STOP */
        }
 
        sql_ret = sqlite3_step(stmt);
@@ -1057,7 +1056,9 @@ out:
 
        return err;
 }
+/* LCOV_EXCL_STOP */
 
+/* LCOV_EXCL_START */
 EXPORT_API int notification_system_setting_init_system_setting_table(uid_t uid)
 {
        sqlite3 *db = NULL;
@@ -1069,7 +1070,7 @@ EXPORT_API int notification_system_setting_init_system_setting_table(uid_t uid)
 
        db = notification_db_open();
        if (db == NULL)
-               return get_last_result(); /* LCOV_EXCL_LINE */
+               return get_last_result();
 
        if (_is_uid_in_system_setting_table(db, uid) == true) {
                INFO("Setting table is already initialized.");
@@ -1082,11 +1083,9 @@ EXPORT_API int notification_system_setting_init_system_setting_table(uid_t uid)
                                        NOTIFICATION_SYSTEM_SETTING_DB_TABLE,
                                        uid);
        if (query_system_setting == NULL) {
-               /* LCOV_EXCL_START */
                ERR("fail to alloc query");
                ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
                goto out;
-               /* LCOV_EXCL_STOP */
        }
 
        ret = notification_db_exec(db, query_system_setting, NULL);
@@ -1099,11 +1098,9 @@ EXPORT_API int notification_system_setting_init_system_setting_table(uid_t uid)
                                        NOTIFICATION_DND_ALLOW_EXCEPTION,
                                        uid);
        if (query_dnd_allow_exception == NULL) {
-               /* LCOV_EXCL_START */
                ERR("Failed to alloc query");
                ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
                goto out;
-               /* LCOV_EXCL_STOP */
        }
 
        ret = notification_db_exec(db, query_dnd_allow_exception, NULL);
@@ -1124,3 +1121,4 @@ out:
 
        return ret;
 }
+/* LCOV_EXCL_STOP */
index 8fb26cfeb36cebc15cf18c437cf9312ff8908b14..c748c363f50c51a1dae0a943f72d61a317b2df74 100644 (file)
@@ -297,7 +297,7 @@ int noti_system_setting_load_system_setting(notification_system_setting_h *syste
                        NOTIFICATION_SYSTEM_SETTING_DB_TABLE, uid);
        if (query == NULL) {
                /* LCOV_EXCL_START */
-               ERR("Failed to alloc query"); /* LCOV_EXCL_LINE */
+               ERR("Failed to alloc query");
                ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
                goto out;
                /* LCOV_EXCL_STOP */
@@ -306,7 +306,7 @@ int noti_system_setting_load_system_setting(notification_system_setting_h *syste
        sql_ret = sqlite3_get_table(db, query, &query_result, &row_count, &column_count, NULL);
        if (sql_ret != SQLITE_OK && sql_ret != -1) {
                /* LCOV_EXCL_START */
-               ERR("Failed to get db table [%d][%s]", sql_ret, query); /* LCOV_EXCL_LINE */
+               ERR("Failed to get db table [%d][%s]", sql_ret, query);
                ret = NOTIFICATION_ERROR_FROM_DB;
                goto out;
                /* LCOV_EXCL_STOP */
@@ -317,7 +317,7 @@ int noti_system_setting_load_system_setting(notification_system_setting_h *syste
        result_system_setting = (struct notification_system_setting *)malloc(sizeof(struct notification_system_setting));
        if (result_system_setting == NULL) {
                /* LCOV_EXCL_START */
-               ERR("Failed to alloc memory"); /* LCOV_EXCL_LINE */
+               ERR("Failed to alloc memory");
                ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
                goto out;
                /* LCOV_EXCL_STOP */
@@ -325,7 +325,8 @@ int noti_system_setting_load_system_setting(notification_system_setting_h *syste
 
        /* no system setting record. allow everyting */
        if (!row_count) {
-               DBG("No setting found"); /* LCOV_EXCL_LINE */
+               /* LCOV_EXCL_START */
+               DBG("No setting found");
                result_system_setting->do_not_disturb = 0;
                result_system_setting->visibility_class = 0;
                result_system_setting->dnd_schedule_enabled = 0;
@@ -336,6 +337,7 @@ int noti_system_setting_load_system_setting(notification_system_setting_h *syste
                result_system_setting->dnd_end_min = 0;
                result_system_setting->lock_screen_content_level = 0;
                result_system_setting->dnd_allow_exceptions = NULL;
+               /* LCOV_EXCL_STOP */
        } else {
                /* LCOV_EXCL_START */
                col_index = column_count;
@@ -478,11 +480,9 @@ int notification_setting_db_update_do_not_disturb(int do_not_disturb, uid_t uid)
                                NOTIFICATION_SYSTEM_SETTING_DB_TABLE,
                                do_not_disturb, uid);
        if (query == NULL) {
-               /* LCOV_EXCL_START */
-               ERR("Failed to alloc query"); /* LCOV_EXCL_LINE */
+               ERR("Failed to alloc query");
                ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
                goto out;
-               /* LCOV_EXCL_STOP */
        }
 
        ret = notification_db_exec(db, query, NULL);
@@ -498,6 +498,7 @@ out:
 }
 /* LCOV_EXCL_STOP */
 
+/* LCOV_EXCL_START */
 EXPORT_API
 int notification_system_setting_get_dnd_schedule_enabled_uid(uid_t **uids, int *count)
 {
@@ -519,19 +520,15 @@ int notification_system_setting_get_dnd_schedule_enabled_uid(uid_t **uids, int *
                                "WHERE dnd_schedule_enabled = 1",
                                NOTIFICATION_SYSTEM_SETTING_DB_TABLE);
        if (query == NULL) {
-               /* LCOV_EXCL_START */
                ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
                goto out;
-               /* LCOV_EXCL_STOP */
        }
 
        ret = sqlite3_get_table(db, query, &query_result, &row_count, &column_count, NULL);
        if (ret != SQLITE_OK && ret != -1) {
-               /* LCOV_EXCL_START */
-               ERR("Failed to get DB table [%d][%s]", ret, query);     /* LCOV_EXCL_LINE */
+               ERR("Failed to get DB table [%d][%s]", ret, query);
                ret = NOTIFICATION_ERROR_FROM_DB;
                goto out;
-               /* LCOV_EXCL_STOP */
        }
 
        if (row_count == 0) {
@@ -541,11 +538,9 @@ int notification_system_setting_get_dnd_schedule_enabled_uid(uid_t **uids, int *
        }
 
        if (!(result_uids = (uid_t *)malloc(sizeof(int) * row_count))) {
-               /* LCOV_EXCL_START */
                ERR("Failed to alloc memory");
                ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
                goto out;
-               /* LCOV_EXCL_STOP */
        }
 
        column_index = column_count;
@@ -567,6 +562,7 @@ out:
 
        return ret;
 }
+/* LCOV_EXCL_STOP */
 
 EXPORT_API
 int notification_get_dnd_and_allow_to_notify(const char *app_id,
index 5b841e1c18d2832a2ecd67031f4f50d8fa38166d..6200d6b6087bb20d9caaee15bca4c6a99de81d31 100644 (file)
@@ -26,6 +26,7 @@
 #include <notification_debug.h>
 #include <notification_viewer.h>
 
+/* LCOV_EXCL_START */
 EXPORT_API int notification_get_default_viewer(const char *path, char **default_viewer)
 {
        char *viewer = NULL;
@@ -36,7 +37,6 @@ EXPORT_API int notification_get_default_viewer(const char *path, char **default_
                return -1;
        }
 
-       /* LCOV_EXCL_START */
        dict = iniparser_load(path);
        if (!dict) {
                ERR("can't load file");
@@ -50,8 +50,8 @@ EXPORT_API int notification_get_default_viewer(const char *path, char **default_
        iniparser_freedict(dict);
 
        return 0;
-       /* LCOV_EXCL_STOP */
 }
+/* LCOV_EXCL_STOP */
 
 /* LCOV_EXCL_START */
 EXPORT_API int notification_launch_default_viewer(const char *default_viewer,