From: seungha.son Date: Thu, 16 Jun 2016 00:19:36 +0000 (+0900) Subject: Exclude line and function from coverage measurement X-Git-Tag: submit/tizen/20160616.235341^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=20a571e3edcc25eb8caf8262b1594a356209fc03;p=platform%2Fcore%2Fapi%2Fnotification.git Exclude line and function from coverage measurement - Deprecated API - Can't check error line Signed-off-by: seungha.son Change-Id: I8432fdfcdfaf2c8e0fa331fdb51a1eefbd27f665 --- diff --git a/src/notification.c b/src/notification.c index a7237acf..2e4f99af 100755 --- a/src/notification.c +++ b/src/notification.c @@ -1856,11 +1856,13 @@ EXPORT_API int notification_get_tag(notification_h noti, const char **tag) return NOTIFICATION_ERROR_NONE; } +/* LCOV_EXCL_START */ void notification_call_posted_toast_cb(const char *message) { if (posted_toast_message_cb != NULL) posted_toast_message_cb((void *)message); } +/* LCOV_EXCL_STOP */ EXPORT_API int notification_set_ongoing_flag(notification_h noti, bool ongoing_flag) { diff --git a/src/notification_db.c b/src/notification_db.c index fa55162b..da915eb4 100755 --- a/src/notification_db.c +++ b/src/notification_db.c @@ -141,7 +141,7 @@ EXPORT_API int notification_db_init() char *query = NULL; const char *db_path = tzplatform_getenv(TZ_SYS_DB); if (db_path == NULL) { - NOTIFICATION_ERR("fail to get db_path"); + NOTIFICATION_ERR("fail to get db_path"); /* LCOV_EXCL_LINE */ return NOTIFICATION_ERROR_OUT_OF_MEMORY; } snprintf(defname, sizeof(defname), "%s/%s", db_path, NOTIFICATION_DB_NAME); @@ -149,9 +149,11 @@ EXPORT_API int notification_db_init() NOTIFICATION_DBG("db path : %s", defname); r = sqlite3_open_v2(defname, &db, SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE, NULL); if (r) { + /* LCOV_EXCL_START */ db_util_close(db); NOTIFICATION_ERR("fail to open notification db %d", r); return NOTIFICATION_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } query = sqlite3_mprintf(CREATE_NOTIFICATION_TABLE, tzplatform_getuid(TZ_SYS_DEFAULT_USER)); NOTIFICATION_DBG("@@@ query : %s", query); @@ -160,10 +162,12 @@ EXPORT_API int notification_db_init() if (query) sqlite3_free(query); if (r != SQLITE_OK) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("query error(%d)(%s)", r, errmsg); sqlite3_free(errmsg); db_util_close(db); return NOTIFICATION_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } db_util_close(db); @@ -177,12 +181,14 @@ sqlite3 *notification_db_open(const char *dbfile) ret = db_util_open(dbfile, &db, 0); if (ret != SQLITE_OK) { + /* LCOV_EXCL_START */ if (ret == SQLITE_PERM) set_last_result(NOTIFICATION_ERROR_PERMISSION_DENIED); else set_last_result(NOTIFICATION_ERROR_FROM_DB); return NULL; + /* LCOV_EXCL_STOP */ } return db; @@ -197,8 +203,10 @@ int notification_db_close(sqlite3 **db) ret = db_util_close(*db); if (ret != SQLITE_OK) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("DB close error(%d)", ret); return NOTIFICATION_ERROR_FROM_DB; + /* LCOV_EXCL_STOP */ } *db = NULL; @@ -219,9 +227,11 @@ int notification_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 */ NOTIFICATION_ERR("DB err(%d) : %s", ret, sqlite3_errmsg(db)); return NOTIFICATION_ERROR_FROM_DB; + /* LCOV_EXCL_STOP */ } if (stmt != NULL) { @@ -232,10 +242,12 @@ int notification_db_exec(sqlite3 *db, const char *query, int *num_changes) sqlite3_finalize(stmt); } else { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("DB err(%d) : %s", ret, sqlite3_errmsg(db)); sqlite3_finalize(stmt); return NOTIFICATION_ERROR_FROM_DB; + /* LCOV_EXCL_STOP */ } } else { return NOTIFICATION_ERROR_FROM_DB; diff --git a/src/notification_internal.c b/src/notification_internal.c index 502db5e1..36835c3d 100755 --- a/src/notification_internal.c +++ b/src/notification_internal.c @@ -971,11 +971,13 @@ notification_h notification_load_for_uid(char *pkgname, } /* LCOV_EXCL_STOP */ +/* LCOV_EXCL_START */ EXPORT_API notification_h notification_load(char *pkgname, int priv_id) { return notification_load_for_uid(pkgname, priv_id, getuid()); } +/* LCOV_EXCL_STOP */ /* LCOV_EXCL_START */ EXPORT_API notification_h notification_new(notification_type_e type, @@ -1228,10 +1230,12 @@ EXPORT_API int notification_unregister_detailed_changed_cb( return NOTIFICATION_ERROR_INVALID_PARAMETER; } +/* LCOV_EXCL_START */ EXPORT_API int notification_is_service_ready(void) { return notification_ipc_is_master_ready(); } +/* LCOV_EXCL_STOP */ EXPORT_API int notification_set_uid(notification_h noti, uid_t uid) @@ -1343,18 +1347,22 @@ EXPORT_API notification_h notification_load_by_tag_for_uid(const char *tag, uid_ caller_pkgname = notification_get_pkgname_by_pid(); if (!caller_pkgname) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("Failed to get a package name"); set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY); return NULL; + /* LCOV_EXCL_STOP */ } noti = (notification_h)calloc(1, sizeof(struct _notification)); if (noti == NULL) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("Failed to alloc a new notification"); set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY); free(caller_pkgname); return NULL; + /* LCOV_EXCL_STOP */ } ret = notification_ipc_request_load_noti_by_tag(noti, caller_pkgname, (char *)tag, uid); diff --git a/src/notification_ipc.c b/src/notification_ipc.c index 75656281..3f5abb46 100755 --- a/src/notification_ipc.c +++ b/src/notification_ipc.c @@ -126,6 +126,7 @@ static int _dbus_init() return ret; } +/* LCOV_EXCL_START */ int notification_ipc_is_master_ready(void) { GVariant *result; @@ -178,6 +179,7 @@ int notification_ipc_is_master_ready(void) return is_master_started; } +/* LCOV_EXCL_STOP */ /* TODO: dbus activation isn't enough ? */ /* @@ -257,6 +259,7 @@ int notification_ipc_del_deffered_task( return NOTIFICATION_ERROR_INVALID_PARAMETER; } +/* LCOV_EXCL_START */ static void _do_deffered_task(void) { task_list *list_do; @@ -281,6 +284,7 @@ static void _do_deffered_task(void) list_do = list_temp; } } +/* LCOV_EXCL_STOP */ /*! * functions to create operation list @@ -344,6 +348,7 @@ static inline bundle *_create_bundle_from_bundle_raw(bundle_raw *string) return bundle_decode(string, strlen((char *)string)); } +/* LCOV_EXCL_START */ static void _add_noti_notify(GVariant *parameters) { notification_h noti; @@ -374,7 +379,9 @@ static void _add_noti_notify(GVariant *parameters) } notification_free(noti); } +/* LCOV_EXCL_STOP */ +/* LCOV_EXCL_START */ static void _update_noti_notify(GVariant *parameters) { notification_h noti; @@ -397,7 +404,9 @@ static void _update_noti_notify(GVariant *parameters) } notification_free(noti); } +/* LCOV_EXCL_STOP */ +/* LCOV_EXCL_START */ static void _refresh_noti_notify(GVariant *parameters) { notification_op *noti_op = _ipc_create_op(NOTIFICATION_OP_REFRESH, 1, NULL, 0, NULL); @@ -407,7 +416,9 @@ static void _refresh_noti_notify(GVariant *parameters) free(noti_op); } } +/* LCOV_EXCL_STOP */ +/* LCOV_EXCL_START */ static void _delete_single_notify(GVariant *parameters) { int num_deleted; @@ -423,7 +434,9 @@ static void _delete_single_notify(GVariant *parameters) free(noti_op); } } +/* LCOV_EXCL_STOP */ +/* LCOV_EXCL_START */ static void _delete_multiple_notify(GVariant *parameters) { int buf[100] = {0,}; @@ -448,7 +461,9 @@ static void _delete_multiple_notify(GVariant *parameters) notification_call_changed_cb(noti_op, idx); free(noti_op); } +/* LCOV_EXCL_STOP */ +/* LCOV_EXCL_START */ static void _handle_noti_notify(GDBusConnection *connection, const gchar *sender_name, const gchar *object_path, @@ -470,6 +485,7 @@ static void _handle_noti_notify(GDBusConnection *connection, else if (g_strcmp0(signal_name, "refresh_noti_notify") == 0) _refresh_noti_notify(parameters); } +/* LCOV_EXCL_STOP */ static int _dbus_signal_init() @@ -491,8 +507,10 @@ static int _dbus_signal_init() NOTIFICATION_DBG("subscribe id : %d", id); if (id == 0) { + /* LCOV_EXCL_START */ ret = NOTIFICATION_ERROR_IO_ERROR; NOTIFICATION_ERR("Failed to _register_noti_dbus_interface"); + /* LCOV_EXCL_STOP */ } else { monitor_id = id; ret = NOTIFICATION_ERROR_NONE; @@ -513,10 +531,12 @@ static int _send_sync_noti(GVariant *body, GDBusMessage **reply, char *cmd) PROVIDER_NOTI_INTERFACE_NAME, cmd); if (!msg) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("Can't allocate new method call"); if (body) g_variant_unref(body); return NOTIFICATION_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } if (body != NULL) @@ -534,6 +554,7 @@ static int _send_sync_noti(GVariant *body, GDBusMessage **reply, char *cmd) g_object_unref(msg); if (!*reply) { + /* LCOV_EXCL_START */ ret = NOTIFICATION_ERROR_SERVICE_NOT_READY; if (err != NULL) { NOTIFICATION_ERR("No reply. cmd = %s, error = %s", cmd, err->message); @@ -542,6 +563,7 @@ static int _send_sync_noti(GVariant *body, GDBusMessage **reply, char *cmd) g_error_free(err); } return ret; + /* LCOV_EXCL_STOP */ } if (g_dbus_message_to_gerror(*reply, &err)) { @@ -581,13 +603,16 @@ static void _send_message_with_reply_async_cb(GDBusConnection *connection, &err); if (!reply) { + /* LCOV_EXCL_START */ if (err != NULL) { NOTIFICATION_ERR("No reply. error = %s", err->message); g_error_free(err); } result = NOTIFICATION_ERROR_SERVICE_NOT_READY; + /* LCOV_EXCL_STOP */ } else if (g_dbus_message_to_gerror(reply, &err)) { + /* LCOV_EXCL_START */ if (err->code == G_DBUS_ERROR_ACCESS_DENIED) result = NOTIFICATION_ERROR_PERMISSION_DENIED; else @@ -595,6 +620,7 @@ static void _send_message_with_reply_async_cb(GDBusConnection *connection, NOTIFICATION_ERR("_send_async_noti error %s", err->message); g_error_free(err); + /* LCOV_EXCL_STOP */ } NOTIFICATION_DBG("_send_async_noti done !![%d]", result); @@ -626,8 +652,10 @@ static int _send_async_noti(GVariant *body, result_cb_item *cb_item, char *cmd) PROVIDER_NOTI_INTERFACE_NAME, cmd); if (!msg) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("Can't allocate new method call"); return NOTIFICATION_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } if (body != NULL) @@ -670,8 +698,10 @@ int notification_ipc_request_insert(notification_h noti, int *priv_id) _print_noti(noti); body = notification_ipc_make_gvariant_from_noti(noti, false); if (body == NULL) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("cannot make gvariant"); return NOTIFICATION_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } result = _send_sync_noti(body, &reply, "add_noti"); @@ -703,14 +733,18 @@ int notification_ipc_request_update(notification_h noti) result = _dbus_init(); if (result != NOTIFICATION_ERROR_NONE) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("Can't init dbus %d", result); return result; + /* LCOV_EXCL_STOP */ } body = notification_ipc_make_gvariant_from_noti(noti, false); if (body == NULL) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("cannot make gvariant"); return NOTIFICATION_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } result = _send_sync_noti(body, &reply, "update_noti"); @@ -735,8 +769,10 @@ int notification_ipc_request_update_async(notification_h noti, result = _dbus_init(); if (result != NOTIFICATION_ERROR_NONE) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("Can't init dbus %d", result); return result; + /* LCOV_EXCL_STOP */ } cb_item = calloc(1, sizeof(result_cb_item)); @@ -748,17 +784,21 @@ int notification_ipc_request_update_async(notification_h noti, body = notification_ipc_make_gvariant_from_noti(noti, false); if (body == NULL) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("cannot make gvariant"); free(cb_item); return NOTIFICATION_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } result = _send_async_noti(body, cb_item, "update_noti"); NOTIFICATION_DBG("notification_ipc_request_update_async done [result: %d]", result); if (result != NOTIFICATION_ERROR_NONE) { + /* LCOV_EXCL_START */ free(cb_item); cb_item = NULL; + /* LCOV_EXCL_STOP */ } g_variant_unref(body); @@ -886,6 +926,7 @@ int notification_ipc_request_load_noti_by_tag(notification_h noti, const char *p return result; } +/* LCOV_EXCL_START */ int notification_ipc_request_load_noti_by_priv_id(notification_h noti, const char *pkgname, int priv_id, uid_t uid) { int result; @@ -921,7 +962,9 @@ int notification_ipc_request_load_noti_by_priv_id(notification_h noti, const cha NOTIFICATION_DBG("notification_ipc_request_load_noti_by_priv_id done [result: %d]", result); return result; } +/* LCOV_EXCL_STOP */ +/* LCOV_EXCL_START */ int notification_ipc_request_get_count(notification_type_e type, const char *pkgname, int group_id, int priv_id, int *count, uid_t uid) { @@ -957,6 +1000,7 @@ int notification_ipc_request_get_count(notification_type_e type, NOTIFICATION_DBG("notification_ipc_request_get_count done [result: %d]", result); return result; } +/* LCOV_EXCL_STOP */ int notification_ipc_request_load_noti_grouping_list(notification_type_e type, int count, notification_list_h *list, uid_t uid) @@ -1735,6 +1779,7 @@ static int _ipc_monitor_register(uid_t uid) return _send_service_register(uid); } +/* LCOV_EXCL_START */ static void _on_name_appeared(GDBusConnection *connection, const gchar *name, const gchar *name_owner, @@ -1748,7 +1793,9 @@ static void _on_name_appeared(GDBusConnection *connection, /* TODO: dbus activation isn't enough ? */ _do_deffered_task(); } +/* LCOV_EXCL_STOP */ +/* LCOV_EXCL_START */ static void _on_name_vanished(GDBusConnection *connection, const gchar *name, gpointer user_data) @@ -1757,6 +1804,7 @@ static void _on_name_vanished(GDBusConnection *connection, NOTIFICATION_DBG("name vanished [%d] : %s", uid, name); is_master_started = 0; } +/* LCOV_EXCL_STOP */ int notification_ipc_monitor_init(uid_t uid) { @@ -1764,20 +1812,26 @@ int notification_ipc_monitor_init(uid_t uid) ret = _dbus_init(); if (ret != NOTIFICATION_ERROR_NONE) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("Can't init dbus %d", ret); return ret; + /* LCOV_EXCL_STOP */ } ret = _dbus_signal_init(); if (ret != NOTIFICATION_ERROR_NONE) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("Can't signal_init %d", ret); return ret; + /* LCOV_EXCL_STOP */ } ret = _ipc_monitor_register(uid); if (ret != NOTIFICATION_ERROR_NONE) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("Can't init ipc_monitor_register %d", ret); return ret; + /* LCOV_EXCL_STOP */ } if (provider_monitor_id == 0) { @@ -1792,10 +1846,12 @@ int notification_ipc_monitor_init(uid_t uid) NULL); if (provider_monitor_id == 0) { + /* LCOV_EXCL_START */ g_dbus_connection_signal_unsubscribe(_gdbus_conn, monitor_id); monitor_id = 0; NOTIFICATION_ERR("watch on name fail"); return NOTIFICATION_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } } diff --git a/src/notification_list.c b/src/notification_list.c index 51101361..3e0be520 100755 --- a/src/notification_list.c +++ b/src/notification_list.c @@ -39,8 +39,10 @@ notification_list_h _notification_list_create(void) list = (notification_list_h) malloc(sizeof(struct _notification_list)); if (list == NULL) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("NO MEMORY"); return NULL; + /* LCOV_EXCL_STOP */ } list->prev = NULL; @@ -154,9 +156,11 @@ EXPORT_API notification_list_h notification_list_append(notification_list_h list new_list = _notification_list_create(); if (new_list == NULL) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("NO MEMORY"); set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY); return NULL; + /* LCOV_EXCL_STOP */ } cur_list->next = new_list; @@ -166,9 +170,11 @@ EXPORT_API notification_list_h notification_list_append(notification_list_h list } else { cur_list = _notification_list_create(); if (cur_list == NULL) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("NO MEMORY"); set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY); return NULL; + /* LCOV_EXCL_STOP */ } new_list = cur_list; diff --git a/src/notification_noti.c b/src/notification_noti.c index 177d3552..6cc1b37f 100755 --- a/src/notification_noti.c +++ b/src/notification_noti.c @@ -968,6 +968,7 @@ err: return ret; } +/* LCOV_EXCL_START */ EXPORT_API int notification_noti_get_by_priv_id(notification_h noti, char *pkgname, int priv_id, uid_t uid) { int ret = 0; @@ -1038,6 +1039,7 @@ err: return ret; } +/* LCOV_EXCL_STOP */ EXPORT_API int notification_noti_get_by_tag(notification_h noti, char *pkgname, char* tag, uid_t uid) { @@ -1351,6 +1353,7 @@ err: return ret; } +/* LCOV_EXCL_START */ EXPORT_API int notification_noti_delete_by_priv_id(const char *pkgname, int priv_id) { sqlite3 *db = NULL; @@ -1380,6 +1383,7 @@ EXPORT_API int notification_noti_delete_by_priv_id(const char *pkgname, int priv return ret; } +/* LCOV_EXCL_STOP */ EXPORT_API int notification_noti_delete_by_priv_id_get_changes(const char *pkgname, int priv_id, int *num_changes, uid_t uid) { @@ -1416,6 +1420,7 @@ EXPORT_API int notification_noti_delete_by_priv_id_get_changes(const char *pkgna } /* todo refactoring */ +/* LCOV_EXCL_START */ EXPORT_API int notification_noti_get_count(notification_type_e type, const char *pkgname, int group_id, int priv_id, @@ -1532,6 +1537,7 @@ err: return ret; } +/* LCOV_EXCL_STOP */ EXPORT_API int notification_noti_get_grouping_list(notification_type_e type, int count, diff --git a/src/notification_ongoing.c b/src/notification_ongoing.c index 9bd60e20..74a105e1 100755 --- a/src/notification_ongoing.c +++ b/src/notification_ongoing.c @@ -58,8 +58,10 @@ static void __notification_ongoing_update_callback(GDBusConnection *connection, info = calloc(1, sizeof(struct ongoing_info_s)); if (info == NULL) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("Out of memory"); return; + /* LCOV_EXCL_STOP */ } if (g_strcmp0(signal_name, MEMBER_PROGRESS) == 0) { @@ -75,9 +77,11 @@ static void __notification_ongoing_update_callback(GDBusConnection *connection, } if (pkgname == NULL) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("pkgname is null"); free(info); return; + /* LCOV_EXCL_STOP */ } info->pkgname = pkgname; @@ -102,9 +106,11 @@ static int __send_ongoing_update_signal(const char *signal_name, GVariant *param conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err); if (conn == NULL) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("g_bus_get_sync() failed: %s", err->message); ret = NOTIFICATION_ERROR_FROM_DBUS; goto end; + /* LCOV_EXCL_STOP */ } if (g_dbus_connection_emit_signal(conn, @@ -114,17 +120,21 @@ static int __send_ongoing_update_signal(const char *signal_name, GVariant *param signal_name, param, &err) == FALSE) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("g_dbus_connection_emit_signal() failed: %s", err->message); ret = NOTIFICATION_ERROR_FROM_DBUS; goto end; + /* LCOV_EXCL_STOP */ } if (g_dbus_connection_flush_sync(conn, NULL, &err) == FALSE) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("g_dbus_connection_flush_sync() failed: %s", err->message); ret = NOTIFICATION_ERROR_FROM_DBUS; goto end; + /* LCOV_EXCL_STOP */ } @@ -151,10 +161,12 @@ int notification_ongoing_update_cb_set(notification_ongoing_update_cb callback, if (od.conn == NULL) { od.conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error); if (od.conn == NULL) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("Failed to connect to the D-BUS Daemon: %s", error->message); g_error_free(error); return NOTIFICATION_ERROR_FROM_DBUS; + /* LCOV_EXCL_STOP */ } } @@ -170,9 +182,11 @@ int notification_ongoing_update_cb_set(notification_ongoing_update_cb callback, NULL, NULL); if (od.subscribe_id == 0) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("g_dbus_connection_signal_subscribe() failed"); g_object_unref(od.conn); return NOTIFICATION_ERROR_FROM_DBUS; + /* LCOV_EXCL_STOP */ } } @@ -211,9 +225,11 @@ int notification_ongoing_update_progress(const char *caller_pkgname, ret = __send_ongoing_update_signal(MEMBER_PROGRESS, param); if (ret != NOTIFICATION_ERROR_NONE) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("notification_ongoing_update_progress failed %d", ret); return ret; + /* LCOV_EXCL_STOP */ } return NOTIFICATION_ERROR_NONE; @@ -229,9 +245,11 @@ int notification_ongoing_update_size(const char *caller_pkgname, ret = __send_ongoing_update_signal(MEMBER_SIZE, param); if (ret != NOTIFICATION_ERROR_NONE) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("notification_ongoing_update_size failed %d", ret); return ret; + /* LCOV_EXCL_STOP */ } return NOTIFICATION_ERROR_NONE; @@ -247,9 +265,11 @@ int notification_ongoing_update_content(const char *caller_pkgname, ret = __send_ongoing_update_signal(MEMBER_CONTENT, param); if (ret != NOTIFICATION_ERROR_NONE) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("notification_ongoing_update_content failed %d", ret); return ret; + /* LCOV_EXCL_STOP */ } return NOTIFICATION_ERROR_NONE; } diff --git a/src/notification_setting.c b/src/notification_setting.c index fc438481..cf8daae0 100755 --- a/src/notification_setting.c +++ b/src/notification_setting.c @@ -67,11 +67,14 @@ EXPORT_API int notification_setting_get_setting_by_package_name_for_uid(const ch return ret; } +/* LCOV_EXCL_START */ EXPORT_API int notification_setting_get_setting_by_package_name(const char *package_name, notification_setting_h *setting) { return notification_setting_get_setting_by_package_name_for_uid(package_name, setting, getuid()); } +/* LCOV_EXCL_STOP */ +/* LCOV_EXCL_START */ EXPORT_API int notification_setting_get_setting(notification_setting_h *setting) { int ret; @@ -88,6 +91,7 @@ EXPORT_API int notification_setting_get_setting(notification_setting_h *setting) return ret; } +/* LCOV_EXCL_STOP */ EXPORT_API int notification_setting_get_package_name(notification_setting_h setting, char **value) { @@ -552,6 +556,7 @@ out: return err; } +/* LCOV_EXCL_START */ bool privilege_info_cb(const char *privilege_name, void *user_data) { bool *found = user_data; @@ -563,6 +568,7 @@ bool privilege_info_cb(const char *privilege_name, void *user_data) return true; } +/* LCOV_EXCL_STOP */ EXPORT_API int notification_setting_insert_package_for_uid(const char *package_id, uid_t uid) { @@ -726,7 +732,6 @@ EXPORT_API int notification_setting_db_update_system_setting(int do_not_disturb, } sqlite3_exec(db, "BEGIN immediate;", NULL, NULL, NULL); - sqlret = sqlite3_prepare_v2(db, "INSERT OR REPLACE INTO notification_system_setting (uid, do_not_disturb, visibility_class) values(?, ?, ?);", -1, &db_statement, NULL); if (sqlret != SQLITE_OK) { diff --git a/src/notification_setting_service.c b/src/notification_setting_service.c index c72ba2da..86f873a1 100644 --- a/src/notification_setting_service.c +++ b/src/notification_setting_service.c @@ -36,8 +36,10 @@ static int _get_table_field_data_int(char **table, int *buf, int index) { if ((table == NULL) || (buf == NULL) || (index < 0)) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("table[%p], buf[%p], index[%d]", table, buf, index); return false; + /* LCOV_EXCL_STOP */ } if (table[index] != NULL) { @@ -45,8 +47,10 @@ static int _get_table_field_data_int(char **table, int *buf, int index) return true; } + /* LCOV_EXCL_START */ *buf = 0; return false; + /* LCOV_EXCL_STOP */ } static int _get_table_field_data_string(char **table, char **buf, int ucs2, int index) @@ -54,26 +58,28 @@ static int _get_table_field_data_string(char **table, char **buf, int ucs2, int int ret = false; if ((table == NULL) || (buf == NULL) || (index < 0)) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("table[%p], buf[%p], index[%d]", table, buf, index); return false; + /* LCOV_EXCL_STOP */ } char *pTemp = table[index]; int sLen = 0; if (pTemp == NULL) { - *buf = NULL; + *buf = NULL; /* LCOV_EXCL_LINE */ } else { sLen = strlen(pTemp); if (sLen) { *buf = (char *) malloc(sLen + 1); if (*buf == NULL) { - NOTIFICATION_ERR("malloc is failed"); + NOTIFICATION_ERR("malloc is failed"); /* LCOV_EXCL_LINE */ goto out; } memset(*buf, 0, sLen + 1); strncpy(*buf, pTemp, sLen); } else { - *buf = NULL; + *buf = NULL; /* LCOV_EXCL_LINE */ } } @@ -97,7 +103,7 @@ EXPORT_API int noti_setting_service_get_setting_by_package_name(const char *pack notification_setting_h result_setting_array = NULL; if (package_name == NULL || setting == NULL) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); + NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); /* LCOV_EXCL_LINE */ err = NOTIFICATION_ERROR_INVALID_PARAMETER; goto out; } @@ -105,7 +111,7 @@ EXPORT_API int noti_setting_service_get_setting_by_package_name(const char *pack sql_return = db_util_open(DBPATH, &local_db_handle, 0); if (sql_return != SQLITE_OK || local_db_handle == NULL) { - NOTIFICATION_ERR("db_util_open failed [%d]", sql_return); + NOTIFICATION_ERR("db_util_open failed [%d]", sql_return); /* LCOV_EXCL_LINE */ err = NOTIFICATION_ERROR_FROM_DB; goto out; } @@ -115,7 +121,7 @@ EXPORT_API int noti_setting_service_get_setting_by_package_name(const char *pack "WHERE package_name = %Q AND uid = %d", NOTIFICATION_SETTING_DB_TABLE, package_name, uid); if (!sql_query) { - NOTIFICATION_ERR("fail to alloc query"); + NOTIFICATION_ERR("fail to alloc query"); /* LCOV_EXCL_LINE */ err = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto out; } @@ -123,13 +129,13 @@ EXPORT_API int noti_setting_service_get_setting_by_package_name(const char *pack sql_return = sqlite3_get_table(local_db_handle, sql_query, &query_result, &row_count, &column_count, NULL); if (sql_return != SQLITE_OK && sql_return != -1) { - NOTIFICATION_ERR("sqlite3_get_table failed [%d][%s]", sql_return, sql_query); + NOTIFICATION_ERR("sqlite3_get_table failed [%d][%s]", sql_return, sql_query); /* LCOV_EXCL_LINE */ err = NOTIFICATION_ERROR_FROM_DB; goto out; } if (!row_count) { - NOTIFICATION_DBG("No setting found for [%s]", package_name); + NOTIFICATION_DBG("No setting found for [%s]", package_name); /* LCOV_EXCL_LINE */ err = NOTIFICATION_ERROR_NOT_EXIST_ID; goto out; } @@ -139,7 +145,7 @@ EXPORT_API int noti_setting_service_get_setting_by_package_name(const char *pack row_count = 1; if (!(result_setting_array = (struct notification_setting *)malloc(sizeof(struct notification_setting) * row_count))) { - NOTIFICATION_ERR("malloc failed..."); + NOTIFICATION_ERR("malloc failed..."); /* LCOV_EXCL_LINE */ err = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto out; } @@ -163,7 +169,7 @@ out: if (local_db_handle) { sql_return = db_util_close(local_db_handle); if (sql_return != SQLITE_OK) - NOTIFICATION_WARN("fail to db_util_close - [%d]", sql_return); + NOTIFICATION_WARN("fail to db_util_close - [%d]", sql_return); /* LCOV_EXCL_LINE */ } return err; @@ -185,7 +191,7 @@ EXPORT_API int noti_setting_get_setting_array(notification_setting_h *setting_ar notification_setting_h result_setting_array = NULL; if (setting_array == NULL || count == NULL) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); + NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); /* LCOV_EXCL_LINE */ err = NOTIFICATION_ERROR_INVALID_PARAMETER; goto out; } @@ -193,7 +199,7 @@ EXPORT_API int noti_setting_get_setting_array(notification_setting_h *setting_ar sql_return = db_util_open(DBPATH, &local_db_handle, 0); if (sql_return != SQLITE_OK || local_db_handle == NULL) { - NOTIFICATION_ERR("db_util_open failed [%d]", sql_return); + NOTIFICATION_ERR("db_util_open failed [%d]", sql_return); /* LCOV_EXCL_LINE */ err = NOTIFICATION_ERROR_FROM_DB; goto out; } @@ -203,7 +209,7 @@ EXPORT_API int noti_setting_get_setting_array(notification_setting_h *setting_ar "ORDER BY package_name", NOTIFICATION_SETTING_DB_TABLE, uid); if (!sql_query) { - NOTIFICATION_ERR("fail to alloc query"); + NOTIFICATION_ERR("fail to alloc query"); /* LCOV_EXCL_LINE */ err = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto out; } @@ -211,20 +217,20 @@ EXPORT_API int noti_setting_get_setting_array(notification_setting_h *setting_ar sql_return = sqlite3_get_table(local_db_handle, sql_query, &query_result, &row_count, &column_count, NULL); if (sql_return != SQLITE_OK && sql_return != -1) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_FROM_DB failed [%d][%s]", sql_return, sql_query); + NOTIFICATION_ERR("NOTIFICATION_ERROR_FROM_DB failed [%d][%s]", sql_return, sql_query); /* LCOV_EXCL_LINE */ err = NOTIFICATION_ERROR_FROM_DB; goto out; } if (!row_count) { - NOTIFICATION_DBG("No setting found..."); + NOTIFICATION_DBG("No setting found..."); /* LCOV_EXCL_LINE */ err = NOTIFICATION_ERROR_NOT_EXIST_ID; goto out; } NOTIFICATION_DBG("row_count [%d] column_count [%d]", row_count, column_count); if (!(result_setting_array = (struct notification_setting *)malloc(sizeof(struct notification_setting) * row_count))) { - NOTIFICATION_ERR("malloc failed..."); + NOTIFICATION_ERR("malloc failed..."); /* LCOV_EXCL_LINE */ err = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto out; } @@ -251,7 +257,7 @@ out: if (local_db_handle) { sql_return = db_util_close(local_db_handle); if (sql_return != SQLITE_OK) - NOTIFICATION_WARN("fail to db_util_close - [%d]", sql_return); + NOTIFICATION_WARN("fail to db_util_close - [%d]", sql_return); /* LCOV_EXCL_LINE */ } return err; @@ -271,7 +277,7 @@ EXPORT_API int noti_system_setting_load_system_setting(notification_system_setti notification_system_setting_h result_system_setting = NULL; if (system_setting == NULL) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); + NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); /* LCOV_EXCL_LINE */ err = NOTIFICATION_ERROR_INVALID_PARAMETER; goto out; } @@ -279,7 +285,7 @@ EXPORT_API int noti_system_setting_load_system_setting(notification_system_setti sql_return = db_util_open(DBPATH, &local_db_handle, 0); if (sql_return != SQLITE_OK || local_db_handle == NULL) { - NOTIFICATION_ERR("db_util_open failed [%d]", sql_return); + NOTIFICATION_ERR("db_util_open failed [%d]", sql_return); /* LCOV_EXCL_LINE */ err = NOTIFICATION_ERROR_FROM_DB; goto out; } @@ -288,7 +294,7 @@ EXPORT_API int noti_system_setting_load_system_setting(notification_system_setti "FROM %s WHERE uid = %d", NOTIFICATION_SYSTEM_SETTING_DB_TABLE, uid); if (!sql_query) { - NOTIFICATION_ERR("fail to alloc query"); + NOTIFICATION_ERR("fail to alloc query"); /* LCOV_EXCL_LINE */ err = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto out; } @@ -296,27 +302,29 @@ EXPORT_API int noti_system_setting_load_system_setting(notification_system_setti sql_return = sqlite3_get_table(local_db_handle, sql_query, &query_result, &row_count, &column_count, NULL); if (sql_return != SQLITE_OK && sql_return != -1) { - NOTIFICATION_ERR("sqlite3_get_table failed [%d][%s]", sql_return, sql_query); + NOTIFICATION_ERR("sqlite3_get_table failed [%d][%s]", sql_return, sql_query); /* LCOV_EXCL_LINE */ err = NOTIFICATION_ERROR_FROM_DB; goto out; } NOTIFICATION_DBG("row_count [%d] column_count [%d]", row_count, column_count); if (!(result_system_setting = (struct notification_system_setting *)malloc(sizeof(struct notification_system_setting)))) { - NOTIFICATION_ERR("malloc failed..."); + NOTIFICATION_ERR("malloc failed..."); /* LCOV_EXCL_LINE */ err = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto out; } /* no system setting record. allow everyting */ if (!row_count) { - NOTIFICATION_DBG("No setting found..."); + NOTIFICATION_DBG("No setting found..."); /* LCOV_EXCL_LINE */ result_system_setting->do_not_disturb = 0; result_system_setting->visibility_class = 0; } else { + /* LCOV_EXCL_START */ col_index = column_count; _get_table_field_data_int(query_result, (int *)&(result_system_setting->do_not_disturb), col_index++); _get_table_field_data_int(query_result, &(result_system_setting->visibility_class), col_index++); + /* LCOV_EXCL_STOP */ } *system_setting = result_system_setting; @@ -330,7 +338,7 @@ out: if (local_db_handle) { sql_return = db_util_close(local_db_handle); if (sql_return != SQLITE_OK) - NOTIFICATION_WARN("fail to db_util_close - [%d]", sql_return); + NOTIFICATION_WARN("fail to db_util_close - [%d]", sql_return); /* LCOV_EXCL_LINE */ } return err; diff --git a/src/notification_status.c b/src/notification_status.c index e9d79afd..59428f63 100755 --- a/src/notification_status.c +++ b/src/notification_status.c @@ -56,13 +56,17 @@ static void __notification_status_message_dbus_callback(GDBusConnection *connect g_variant_get(parameters, "(&s)", &message); if (strlen(message) <= 0) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("message has only NULL"); return; + /* LCOV_EXCL_STOP */ } if (!md.callback) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("no callback"); return; + /* LCOV_EXCL_STOP */ } md.callback(message, md.data); @@ -79,10 +83,12 @@ int notification_status_monitor_message_cb_set(notification_status_message_cb ca if (md.conn == NULL) { md.conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error); if (md.conn == NULL) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("Failed to connect to the D-BUS Daemon: %s", error->message); g_error_free(error); return NOTIFICATION_ERROR_FROM_DBUS; + /* LCOV_EXCL_STOP */ } } @@ -98,9 +104,11 @@ int notification_status_monitor_message_cb_set(notification_status_message_cb ca NULL, NULL); if (md.message_id == 0) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("g_dbus_connection_signal_subscribe() failed."); g_object_unref(md.conn); return NOTIFICATION_ERROR_FROM_DBUS; + /* LCOV_EXCL_STOP */ } } @@ -144,9 +152,11 @@ int notification_status_message_post(const char *message) conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err); if (conn == NULL) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("g_bus_get_sync() failed: %s", err->message); ret = NOTIFICATION_ERROR_FROM_DBUS; goto end; + /* LCOV_EXCL_STOP */ } param = g_variant_new("(s)", message); @@ -158,22 +168,26 @@ int notification_status_message_post(const char *message) MEMBER_NAME, param, &err) == FALSE) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("g_dbus_connection_emit_signal() failed: %s", err->message); return NOTIFICATION_ERROR_FROM_DBUS; goto end; + /* LCOV_EXCL_STOP */ } if (g_dbus_connection_flush_sync(conn, NULL, &err) == FALSE) { + /* LCOV_EXCL_START */ NOTIFICATION_ERR("g_dbus_connection_flush_sync() failed: %s", err->message); return NOTIFICATION_ERROR_FROM_DBUS; goto end; + /* LCOV_EXCL_STOP */ } end: if (err) - g_error_free(err); + g_error_free(err); /* LCOV_EXCL_LINE */ if (conn) g_object_unref(conn);