summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/notification.c45
-rw-r--r--src/notification_db.c5
-rw-r--r--src/notification_ipc.c44
-rw-r--r--src/notification_noti.c42
-rw-r--r--src/notification_old.c4
-rw-r--r--src/notification_ongoing.c2
-rw-r--r--src/notification_permission.c7
-rw-r--r--src/notification_setting.c44
-rw-r--r--src/notification_status.c11
-rw-r--r--test-app/main.c151
10 files changed, 168 insertions, 187 deletions
diff --git a/src/notification.c b/src/notification.c
index 2d33a36..05bb482 100644
--- a/src/notification.c
+++ b/src/notification.c
@@ -650,8 +650,7 @@ EXPORT_API int notification_get_text(notification_h noti,
ret_var_type = atoi(ret_val);
}
if (ret_var_type ==
- NOTIFICATION_VARIABLE_TYPE_COUNT)
- {
+ NOTIFICATION_VARIABLE_TYPE_COUNT) {
/* Get notification count */
notification_noti_get_count
(noti->type,
@@ -756,8 +755,7 @@ EXPORT_API int notification_get_text(notification_h noti,
ret_var_type = atoi(ret_val);
}
if (ret_var_type ==
- NOTIFICATION_VARIABLE_TYPE_COUNT)
- {
+ NOTIFICATION_VARIABLE_TYPE_COUNT) {
/* Get notification count */
notification_noti_get_count
(noti->type,
@@ -1381,8 +1379,7 @@ EXPORT_API int notification_get_event_handler(notification_h noti, notification_
err = app_control_import_from_bundle(app_control_new, b);
if (err == APP_CONTROL_ERROR_NONE) {
*event_handler = app_control_new;
- }
- else {
+ } else {
app_control_destroy(app_control_new);
app_control_new = NULL;
NOTIFICATION_ERR("Failed to import app control from bundle [%d]", err);
@@ -1825,51 +1822,51 @@ EXPORT_API int notification_clone(notification_h noti, notification_h *clone)
new_noti->internal_group_id = noti->internal_group_id;
new_noti->priv_id = noti->priv_id;
- if(noti->caller_pkgname != NULL) {
+ if (noti->caller_pkgname != NULL) {
new_noti->caller_pkgname = strdup(noti->caller_pkgname);
} else {
new_noti->caller_pkgname = notification_get_pkgname_by_pid();
}
- if(noti->launch_pkgname != NULL) {
+ if (noti->launch_pkgname != NULL) {
new_noti->launch_pkgname = strdup(noti->launch_pkgname);
} else {
new_noti->launch_pkgname = NULL;
}
- if(noti->args != NULL) {
+ if (noti->args != NULL) {
new_noti->args = bundle_dup(noti->args);
} else {
new_noti->args = NULL;
}
- if(noti->group_args != NULL) {
+ if (noti->group_args != NULL) {
new_noti->group_args = bundle_dup(noti->group_args);
} else {
new_noti->group_args = NULL;
}
- if(noti->b_execute_option != NULL) {
+ if (noti->b_execute_option != NULL) {
new_noti->b_execute_option = bundle_dup(noti->b_execute_option);
} else {
new_noti->b_execute_option = NULL;
}
- if(noti->b_service_responding != NULL) {
+ if (noti->b_service_responding != NULL) {
new_noti->b_service_responding = bundle_dup(noti->b_service_responding);
} else {
new_noti->b_service_responding = NULL;
}
- if(noti->b_service_single_launch != NULL) {
+ if (noti->b_service_single_launch != NULL) {
new_noti->b_service_single_launch = bundle_dup(noti->b_service_single_launch);
} else {
new_noti->b_service_single_launch = NULL;
}
- if(noti->b_service_multi_launch != NULL) {
+ if (noti->b_service_multi_launch != NULL) {
new_noti->b_service_multi_launch = bundle_dup(noti->b_service_multi_launch);
} else {
new_noti->b_service_multi_launch = NULL;
}
for (i = 0; i < NOTIFICATION_EVENT_TYPE_MAX; i++) {
- if(noti->b_event_handler[i] != NULL) {
+ if (noti->b_event_handler[i] != NULL) {
new_noti->b_event_handler[i] = bundle_dup(noti->b_event_handler[i]);
} else {
new_noti->b_event_handler[i] = NULL;
@@ -1877,13 +1874,13 @@ EXPORT_API int notification_clone(notification_h noti, notification_h *clone)
}
new_noti->sound_type = noti->sound_type;
- if(noti->sound_path != NULL) {
+ if (noti->sound_path != NULL) {
new_noti->sound_path = strdup(noti->sound_path);
} else {
new_noti->sound_path = NULL;
}
new_noti->vibration_type = noti->vibration_type;
- if(noti->vibration_path != NULL) {
+ if (noti->vibration_path != NULL) {
new_noti->vibration_path = strdup(noti->vibration_path);
} else {
new_noti->vibration_path = NULL;
@@ -1893,35 +1890,35 @@ EXPORT_API int notification_clone(notification_h noti, notification_h *clone)
new_noti->led_on_ms = noti->led_on_ms;
new_noti->led_off_ms = noti->led_off_ms;
- if(noti->domain != NULL) {
+ if (noti->domain != NULL) {
new_noti->domain = strdup(noti->domain);
} else {
new_noti->domain = NULL;
}
- if(noti->dir != NULL) {
+ if (noti->dir != NULL) {
new_noti->dir = strdup(noti->dir);
} else {
new_noti->dir = NULL;
}
- if(noti->b_text != NULL) {
+ if (noti->b_text != NULL) {
new_noti->b_text = bundle_dup(noti->b_text);
} else {
new_noti->b_text = NULL;
}
- if(noti->b_key != NULL) {
+ if (noti->b_key != NULL) {
new_noti->b_key = bundle_dup(noti->b_key);
} else {
new_noti->b_key = NULL;
}
- if(noti->b_format_args != NULL) {
+ if (noti->b_format_args != NULL) {
new_noti->b_format_args = bundle_dup(noti->b_format_args);
} else {
new_noti->b_format_args = NULL;
}
new_noti->num_format_args = noti->num_format_args;
- if(noti->b_image_path != NULL) {
+ if (noti->b_image_path != NULL) {
new_noti->b_image_path = bundle_dup(noti->b_image_path);
} else {
new_noti->b_image_path = NULL;
@@ -1984,7 +1981,7 @@ EXPORT_API int notification_free(notification_h noti)
}
for (i = 0; i < NOTIFICATION_EVENT_TYPE_MAX; i++) {
- if(noti->b_event_handler[i] != NULL) {
+ if (noti->b_event_handler[i] != NULL) {
bundle_free(noti->b_event_handler[i]);
}
}
diff --git a/src/notification_db.c b/src/notification_db.c
index 6450641..7fabeac 100644
--- a/src/notification_db.c
+++ b/src/notification_db.c
@@ -35,14 +35,13 @@
sqlite3 * notification_db_open(const char *dbfile)
{
int ret = 0;
- sqlite3 *db =0;
+ sqlite3 *db = 0;
ret = db_util_open(dbfile, &db, 0);
if (ret != SQLITE_OK) {
if (ret == SQLITE_PERM) {
set_last_result(NOTIFICATION_ERROR_PERMISSION_DENIED);
- }
- else {
+ } else {
set_last_result(NOTIFICATION_ERROR_FROM_DB);
}
return NULL;
diff --git a/src/notification_ipc.c b/src/notification_ipc.c
index bb6c891..dc02d91 100644
--- a/src/notification_ipc.c
+++ b/src/notification_ipc.c
@@ -103,7 +103,8 @@ static inline char *_string_get(char *string)
/*!
* functions to check state of master
*/
-static inline void _set_master_started_cb(vconf_callback_fn cb) {
+static inline void _set_master_started_cb(vconf_callback_fn cb)
+{
int ret = -1;
ret = vconf_notify_key_changed(VCONFKEY_MASTER_STARTED,
@@ -114,7 +115,8 @@ static inline void _set_master_started_cb(vconf_callback_fn cb) {
}
}
-static inline void _unset_master_started_cb(vconf_callback_fn cb) {
+static inline void _unset_master_started_cb(vconf_callback_fn cb)
+{
int ret = -1;
ret = vconf_ignore_key_changed(VCONFKEY_MASTER_STARTED,
@@ -235,7 +237,8 @@ notification_ipc_del_deffered_task(
return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
-static void _do_deffered_task(void) {
+static void _do_deffered_task(void)
+{
task_list *list_do = NULL;
task_list *list_temp = NULL;
@@ -1030,7 +1033,7 @@ static struct packet *_handler_delete_multiple(pid_t pid, int handle, const stru
int i = 0;
for (i = 0 ; i < 10 ; i++) {
- NOTIFICATION_INFO("packet data[%d]:%d",i, buf[i]);
+ NOTIFICATION_INFO("packet data[%d]:%d", i, buf[i]);
}
if (ret == 11) {
@@ -1221,8 +1224,7 @@ int notification_ipc_request_insert(notification_h noti, int *priv_id)
NOTIFICATION_ERR("failed to receive answer(insert)");
if (notification_ipc_is_master_ready() == 1) {
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- }
- else {
+ } else {
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
}
@@ -1258,8 +1260,7 @@ int notification_ipc_request_delete_single(notification_type_e type, char *pkgna
NOTIFICATION_ERR("failed to receive answer(delete)");
if (notification_ipc_is_master_ready() == 1) {
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- }
- else {
+ } else {
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
}
@@ -1292,8 +1293,7 @@ int notification_ipc_request_delete_multiple(notification_type_e type, char *pkg
NOTIFICATION_ERR("failed to receive answer(delete multiple)");
if (notification_ipc_is_master_ready() == 1) {
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- }
- else {
+ } else {
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
}
@@ -1325,8 +1325,7 @@ int notification_ipc_request_update(notification_h noti)
NOTIFICATION_ERR("failed to receive answer(update)");
if (notification_ipc_is_master_ready() == 1) {
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- }
- else {
+ } else {
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
}
@@ -1395,8 +1394,7 @@ int notification_ipc_request_update_async(notification_h noti,
NOTIFICATION_DBG("Failed to init client: %d", s_info.server_cl_fd);
if (notification_ipc_is_master_ready() == 1) {
ret = NOTIFICATION_ERROR_PERMISSION_DENIED;
- }
- else {
+ } else {
ret = NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
goto fail;
@@ -1462,8 +1460,7 @@ int notification_ipc_request_refresh(void)
NOTIFICATION_ERR("failed to receive answer(refresh)");
if (notification_ipc_is_master_ready() == 1) {
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- }
- else {
+ } else {
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
}
@@ -1496,8 +1493,7 @@ int notification_ipc_update_setting(notification_setting_h setting)
NOTIFICATION_ERR("failed to receive answer(delete)");
if (notification_ipc_is_master_ready() == 1) {
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- }
- else {
+ } else {
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
}
@@ -1532,8 +1528,7 @@ int notification_ipc_update_system_setting(notification_system_setting_h system_
if (notification_ipc_is_master_ready() == 1) {
status = NOTIFICATION_ERROR_PERMISSION_DENIED;
goto out;
- }
- else {
+ } else {
status = NOTIFICATION_ERROR_SERVICE_NOT_READY;
goto out;
}
@@ -1570,8 +1565,7 @@ int notification_ipc_noti_setting_property_set(const char *pkgname, const char *
NOTIFICATION_ERR("failed to receive answer(delete)");
if (notification_ipc_is_master_ready() == 1) {
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- }
- else {
+ } else {
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
}
@@ -1606,8 +1600,7 @@ int notification_ipc_noti_setting_property_get(const char *pkgname, const char *
NOTIFICATION_ERR("failed to receive answer(delete)");
if (notification_ipc_is_master_ready() == 1) {
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- }
- else {
+ } else {
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
}
@@ -1638,8 +1631,7 @@ int notification_ipc_request_load_noti_by_tag(notification_h noti, const char *p
NOTIFICATION_ERR("failed to receive answer(load noti by tag)");
if (notification_ipc_is_master_ready() == 1) {
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- }
- else {
+ } else {
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
}
}
diff --git a/src/notification_noti.c b/src/notification_noti.c
index 6c3e7c6..1762281 100644
--- a/src/notification_noti.c
+++ b/src/notification_noti.c
@@ -41,7 +41,8 @@
#define NOTI_BURST_DELETE_UNIT 10
-static void __free_and_set(void **target_ptr, void *new_ptr) {
+static void __free_and_set(void **target_ptr, void *new_ptr)
+{
if (target_ptr != NULL) {
if (*target_ptr != NULL) {
free(*target_ptr);
@@ -559,7 +560,8 @@ static int _update_query_create(notification_h noti, char **query)
return NOTIFICATION_ERROR_NONE;
}
-static void _notification_noti_populate_from_stmt(sqlite3_stmt * stmt, notification_h noti) {
+static void _notification_noti_populate_from_stmt(sqlite3_stmt * stmt, notification_h noti)
+{
int col = 0;
int i = 0;
@@ -675,7 +677,7 @@ int notification_noti_get_tag_type(const char *tagged_str)
if (tagged_str == NULL)
return TAG_TYPE_INVALID;
- if (strlen(tagged_str)== 0)
+ if (strlen(tagged_str) == 0)
return TAG_TYPE_INVALID;
char *b_f_s = strstr(tagged_str, "<");
@@ -687,7 +689,7 @@ int notification_noti_get_tag_type(const char *tagged_str)
char *start = b_f_s + 1;
int len_tag = b_f_e - b_f_s - 1;
- if (strncmp(start,TAG_TIME,len_tag) == 0) {
+ if (strncmp(start, TAG_TIME, len_tag) == 0) {
return TAG_TYPE_TIME;
}
@@ -776,13 +778,12 @@ static bool _is_allowed_to_notify(const char *caller_package_name)
err = notification_setting_get_setting_by_package_name(caller_package_name, &setting);
if (err != NOTIFICATION_ERROR_NONE) {
/* Retry with package id */
- err = _get_package_id_by_app_id (caller_package_name, &package_id);
+ err = _get_package_id_by_app_id(caller_package_name, &package_id);
if (err != NOTIFICATION_ERROR_NONE || package_id == NULL) {
NOTIFICATION_ERR("_get_package_id_by_app_id failed [%d]", err);
goto out;
- }
- else {
+ } else {
err = notification_setting_get_setting_by_package_name(package_id, &setting);
if (err != NOTIFICATION_ERROR_NONE) {
NOTIFICATION_ERR("notification_setting_get_setting_by_package_name failed [%d]", err);
@@ -847,13 +848,12 @@ static int _handle_do_not_disturb_option(notification_h noti)
if (err != NOTIFICATION_ERROR_NONE) {
/* Retry with package id */
- err = _get_package_id_by_app_id (noti->caller_pkgname, &package_id);
+ err = _get_package_id_by_app_id(noti->caller_pkgname, &package_id);
if (err != NOTIFICATION_ERROR_NONE || package_id == NULL) {
NOTIFICATION_ERR("_get_package_id_by_app_id failed [%d]", err);
goto out;
- }
- else {
+ } else {
err = notification_setting_get_setting_by_package_name(package_id, &setting);
if (err != NOTIFICATION_ERROR_NONE) {
NOTIFICATION_ERR("notification_setting_get_setting_by_package_name failed [%d]", err);
@@ -978,7 +978,7 @@ EXPORT_API int notification_noti_insert(notification_h noti)
NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db));
goto err;
}
- ret = _notification_noti_bind_query_double(stmt, "$progress_size",noti->progress_size);
+ ret = _notification_noti_bind_query_double(stmt, "$progress_size", noti->progress_size);
if (ret != NOTIFICATION_ERROR_NONE) {
NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db));
if (stmt) {
@@ -986,7 +986,7 @@ EXPORT_API int notification_noti_insert(notification_h noti)
}
return ret;
}
- ret = _notification_noti_bind_query_double(stmt, "$progress_percentage",noti->progress_percentage);
+ ret = _notification_noti_bind_query_double(stmt, "$progress_percentage", noti->progress_percentage);
if (ret != NOTIFICATION_ERROR_NONE) {
NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db));
if (stmt) {
@@ -1055,7 +1055,7 @@ int notification_noti_get_by_priv_id(notification_h noti, char *pkgname, int pri
if (pkgname != NULL) {
query = sqlite3_mprintf("%s where caller_pkgname = '%s' and priv_id = %d",
- base_query ,pkgname, priv_id);
+ base_query, pkgname, priv_id);
} else {
query = sqlite3_mprintf("%s where priv_id = %d", base_query, priv_id);
}
@@ -1237,12 +1237,12 @@ EXPORT_API int notification_noti_update(notification_h noti)
NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db));
goto err;
}
- ret = _notification_noti_bind_query_double(stmt, "$progress_size",noti->progress_size);
+ ret = _notification_noti_bind_query_double(stmt, "$progress_size", noti->progress_size);
if (ret != NOTIFICATION_ERROR_NONE) {
NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db));
goto err;
}
- ret = _notification_noti_bind_query_double(stmt, "$progress_percentage",noti->progress_percentage);
+ ret = _notification_noti_bind_query_double(stmt, "$progress_percentage", noti->progress_percentage);
if (ret != NOTIFICATION_ERROR_NONE) {
NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db));
goto err;
@@ -1323,7 +1323,7 @@ EXPORT_API int notification_noti_delete_all(notification_type_e type, const char
goto err;
}
- while(sqlite3_step(stmt) == SQLITE_ROW) {
+ while (sqlite3_step(stmt) == SQLITE_ROW) {
if (data_cnt % 8 == 0) {
int *tmp;
@@ -1364,9 +1364,9 @@ EXPORT_API int notification_noti_delete_all(notification_type_e type, const char
}
}
snprintf(buf, sizeof(buf) - 1, "%s%d", (i % NOTI_BURST_DELETE_UNIT == 0) ? "" : ",", *((*list_deleted_rowid) + i));
- strncat(query_where, buf,sizeof(query_where) - strlen(query_where) - 1);
+ strncat(query_where, buf, sizeof(query_where) - strlen(query_where) - 1);
}
- if ((i <= NOTI_BURST_DELETE_UNIT) || ((i % NOTI_BURST_DELETE_UNIT) > 0) ) {
+ if ((i <= NOTI_BURST_DELETE_UNIT) || ((i % NOTI_BURST_DELETE_UNIT) > 0)) {
snprintf(query, sizeof(query) - 1, "%s where priv_id in (%s)", query_base, query_where);
ret_tmp = notification_db_exec(db, query, NULL);
if (ret == NOTIFICATION_ERROR_NONE) {
@@ -1450,7 +1450,7 @@ int notification_noti_delete_group_by_group_id(const char *pkgname,
goto err;
}
- while(sqlite3_step(stmt) == SQLITE_ROW) {
+ while (sqlite3_step(stmt) == SQLITE_ROW) {
if (data_cnt % 8 == 0) {
int *tmp;
tmp = (int *)realloc(*list_deleted_rowid, sizeof(int) * (data_cnt + 8 + 1));
@@ -1485,9 +1485,9 @@ int notification_noti_delete_group_by_group_id(const char *pkgname,
}
}
snprintf(buf, sizeof(buf) - 1, "%s%d", (i % NOTI_BURST_DELETE_UNIT == 0) ? "" : ",", *((*list_deleted_rowid) + i));
- strncat(query_where, buf,sizeof(query_where) - strlen(query_where) - 1);
+ strncat(query_where, buf, sizeof(query_where) - strlen(query_where) - 1);
}
- if ((i <= NOTI_BURST_DELETE_UNIT) || ((i % NOTI_BURST_DELETE_UNIT) > 0) ) {
+ if ((i <= NOTI_BURST_DELETE_UNIT) || ((i % NOTI_BURST_DELETE_UNIT) > 0)) {
snprintf(query, sizeof(query) - 1, "%s where priv_id in (%s)", query_base, query_where);
ret_tmp = notification_db_exec(db, query, NULL);
if (ret == NOTIFICATION_ERROR_NONE) {
diff --git a/src/notification_old.c b/src/notification_old.c
index 3b071cf..5184336 100644
--- a/src/notification_old.c
+++ b/src/notification_old.c
@@ -57,7 +57,7 @@ EXPORT_API int notification_wait_response(notification_h noti,
If its bundle does not already contain a "tid" hint (which
complex applications such as xwalk may overwrite), we will
try to find the TID and set it in the bundle ourselves. */
- notification_get_execute_option (noti, NOTIFICATION_EXECUTE_TYPE_RESPONDING,
+ notification_get_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_RESPONDING,
NULL, &b);
if (b == NULL)
@@ -69,7 +69,7 @@ EXPORT_API int notification_wait_response(notification_h noti,
asprintf((char **)&tid_c, "%d", tid);
bc = bundle_dup(b);
bundle_add(bc, "tid", tid_c);
- notification_set_execute_option (noti, NOTIFICATION_EXECUTE_TYPE_RESPONDING,
+ notification_set_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_RESPONDING,
NULL, NULL, bc);
bundle_free(bc);
notification_update(noti);
diff --git a/src/notification_ongoing.c b/src/notification_ongoing.c
index f67665a..a261998 100644
--- a/src/notification_ongoing.c
+++ b/src/notification_ongoing.c
@@ -144,7 +144,7 @@ int notification_ongoing_update_content(const char *caller_pkgname,
return NOTIFICATION_ERROR_FROM_DBUS;
}
- if(content == NULL) {
+ if (content == NULL) {
ret = dbus_message_append_args(signal,
DBUS_TYPE_STRING, &caller_pkgname,
DBUS_TYPE_INT32, &priv_id,
diff --git a/src/notification_permission.c b/src/notification_permission.c
index c9de272..66415e9 100644
--- a/src/notification_permission.c
+++ b/src/notification_permission.c
@@ -35,7 +35,8 @@
#define NOTIFICATION_DB_ACCESS_WRITE 1
#if 0
-int notification_permission_check_by_pid(const char *noti_pkgname, int pid, int access) {
+int notification_permission_check_by_pid(const char *noti_pkgname, int pid, int access)
+{
int ret = 0;
char pkgname[512 + 1] = { 0, };
bool preload = false;
@@ -55,11 +56,11 @@ int notification_permission_check_by_pid(const char *noti_pkgname, int pid, int
}
package_manager_compare_package_cert_info(noti_pkgname, &compare_result);
- if (compare_result == PACKAGE_MANAGER_COMPARE_MATCH ) {
+ if (compare_result == PACKAGE_MANAGER_COMPARE_MATCH) {
return NOTIFICATION_ERROR_NONE;
}
}
return NOTIFICATION_ERROR_PERMISSION_DENIED;
}
-#endif \ No newline at end of file
+#endif
diff --git a/src/notification_setting.c b/src/notification_setting.c
index 2ba4a9b..d5a2801 100644
--- a/src/notification_setting.c
+++ b/src/notification_setting.c
@@ -71,7 +71,7 @@ static int _get_table_field_data_string(char **table, char **buf, int ucs2, int
*buf = NULL;
else {
sLen = strlen(pTemp);
- if(sLen) {
+ if (sLen) {
*buf = (char *) malloc(sLen + 1);
if (*buf == NULL) {
NOTIFICATION_ERR("malloc is failed");
@@ -79,8 +79,7 @@ static int _get_table_field_data_string(char **table, char **buf, int ucs2, int
}
memset(*buf, 0, sLen + 1);
strncpy(*buf, pTemp, sLen);
- }
- else
+ } else
*buf = NULL;
}
@@ -103,7 +102,7 @@ EXPORT_API int notification_setting_get_setting_array(notification_setting_h *se
int column_count = 0;
int i = 0;
int col_index = 0;
- notification_setting_h result_setting_array= NULL;
+ notification_setting_h result_setting_array = NULL;
if (setting_array == NULL || count == NULL) {
NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER");
@@ -138,12 +137,12 @@ EXPORT_API int notification_setting_get_setting_array(notification_setting_h *se
}
if (!row_count) {
- NOTIFICATION_DBG ("No setting found...");
- err= NOTIFICATION_ERROR_NOT_EXIST_ID;
+ NOTIFICATION_DBG("No setting found...");
+ err = NOTIFICATION_ERROR_NOT_EXIST_ID;
goto out;
}
- NOTIFICATION_DBG ("row_count [%d] column_count [%d]", row_count, column_count);
+ 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...");
err = NOTIFICATION_ERROR_OUT_OF_MEMORY;
@@ -190,7 +189,7 @@ EXPORT_API int notification_setting_get_setting_by_package_name(const char *pack
int column_count = 0;
int i = 0;
int col_index = 0;
- notification_setting_h result_setting_array= NULL;
+ notification_setting_h result_setting_array = NULL;
if (package_name == NULL || setting == NULL) {
NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER");
@@ -225,12 +224,12 @@ EXPORT_API int notification_setting_get_setting_by_package_name(const char *pack
}
if (!row_count) {
- NOTIFICATION_DBG ("No setting found for [%s]", package_name);
- err= NOTIFICATION_ERROR_NOT_EXIST_ID;
+ NOTIFICATION_DBG("No setting found for [%s]", package_name);
+ err = NOTIFICATION_ERROR_NOT_EXIST_ID;
goto out;
}
- NOTIFICATION_DBG ("row_count [%d] column_count [%d]", row_count, column_count);
+ NOTIFICATION_DBG("row_count [%d] column_count [%d]", row_count, column_count);
row_count = 1;
@@ -647,8 +646,7 @@ out:
if (db) {
if (err == NOTIFICATION_ERROR_NONE) {
sqlite3_exec(db, "END;", NULL, NULL, NULL);
- }
- else {
+ } else {
sqlite3_exec(db, "ROLLBACK;", NULL, NULL, NULL);
}
@@ -689,7 +687,7 @@ static int _notification_setting_alter_package_list(notification_setting_operati
is_package_in_setting_table = _is_package_in_setting_table(db, package_name);
switch (operation_type) {
- case OPERATION_TYPE_INSERT_RECORD :
+ case OPERATION_TYPE_INSERT_RECORD:
if (is_package_in_setting_table == true) {
NOTIFICATION_INFO("[%s] is already exist", package_name);
goto out;
@@ -698,7 +696,7 @@ static int _notification_setting_alter_package_list(notification_setting_operati
sqlite3_ret = sqlite3_prepare_v2(db, "INSERT INTO notification_setting (package_name) VALUES (?) ", -1, &db_statement, NULL);
break;
- case OPERATION_TYPE_DELETE_RECORD :
+ case OPERATION_TYPE_DELETE_RECORD:
if (is_package_in_setting_table == false) {
NOTIFICATION_INFO("[%s] is not exist", package_name);
goto out;
@@ -706,7 +704,7 @@ static int _notification_setting_alter_package_list(notification_setting_operati
NOTIFICATION_INFO("[%s] will be removed", package_name);
sqlite3_ret = sqlite3_prepare_v2(db, "DELETE FROM notification_setting WHERE package_name = ? ", -1, &db_statement, NULL);
break;
- default :
+ default:
break;
}
@@ -734,8 +732,7 @@ out:
NOTIFICATION_INFO("err [%d]", err);
if (err == NOTIFICATION_ERROR_NONE) {
sqlite3_exec(db, "END;", NULL, NULL, NULL);
- }
- else {
+ } else {
sqlite3_exec(db, "ROLLBACK;", NULL, NULL, NULL);
}
@@ -815,7 +812,7 @@ EXPORT_API int notification_system_setting_load_system_setting(notification_syst
int row_count = 0;
int column_count = 0;
int col_index = 0;
- notification_system_setting_h result_system_setting= NULL;
+ notification_system_setting_h result_system_setting = NULL;
if (system_setting == NULL) {
NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER");
@@ -849,12 +846,12 @@ EXPORT_API int notification_system_setting_load_system_setting(notification_syst
}
if (!row_count) {
- NOTIFICATION_DBG ("No setting found...");
- err= NOTIFICATION_ERROR_NOT_EXIST_ID;
+ NOTIFICATION_DBG("No setting found...");
+ err = NOTIFICATION_ERROR_NOT_EXIST_ID;
goto out;
}
- NOTIFICATION_DBG ("row_count [%d] column_count [%d]", row_count, column_count);
+ NOTIFICATION_DBG("row_count [%d] column_count [%d]", row_count, column_count);
row_count = 1;
@@ -1047,8 +1044,7 @@ return_close_db:
if (db) {
if (err == NOTIFICATION_ERROR_NONE) {
sqlite3_exec(db, "END;", NULL, NULL, NULL);
- }
- else {
+ } else {
sqlite3_exec(db, "ROLLBACK;", NULL, NULL, NULL);
}
sqlret = db_util_close(db);
diff --git a/src/notification_status.c b/src/notification_status.c
index 20062fb..97fb04a 100644
--- a/src/notification_status.c
+++ b/src/notification_status.c
@@ -58,8 +58,7 @@ static void __notification_status_message_dbus_callback(void *data, DBusMessage
DBusError err;
char *message = NULL;
- if(data==NULL||msg==NULL)
- {
+ if (data == NULL || msg == NULL) {
NOTIFICATION_ERR("message is NULL");
return;
}
@@ -68,8 +67,7 @@ static void __notification_status_message_dbus_callback(void *data, DBusMessage
ret = dbus_message_get_args(msg, &err,
DBUS_TYPE_STRING, &message,
DBUS_TYPE_INVALID);
- if(ret == 0)
- {
+ if (ret == 0) {
NOTIFICATION_ERR("dbus_message_get_args error");
return;
}
@@ -82,7 +80,7 @@ static void __notification_status_message_dbus_callback(void *data, DBusMessage
if (!md.callback)
return;
- if (strlen(message) <= 0){
+ if (strlen(message) <= 0) {
NOTIFICATION_ERR("message has only NULL");
return;
}
@@ -110,8 +108,7 @@ int notification_status_monitor_message_cb_set(notification_status_message_cb ca
INTERFACE_NAME, MEMBER_NAME,
__notification_status_message_dbus_callback,
user_data);
- if (dbus_handler_size == NULL)
- {
+ if (dbus_handler_size == NULL) {
NOTIFICATION_ERR("fail to add size signal");
return NOTIFICATION_ERROR_FROM_DBUS;
}
diff --git a/test-app/main.c b/test-app/main.c
index 82b1668..52e02cb 100644
--- a/test-app/main.c
+++ b/test-app/main.c
@@ -51,43 +51,43 @@ typedef enum testapp_menu_type {
/*-----------------------------------------------------------------------------------------*/
/* function prototypes */
-static void testapp_system_signal_handler (int signal_number);
-void testapp_show_prompt (testapp_menu_type_e menu);
+static void testapp_system_signal_handler(int signal_number);
+void testapp_show_prompt(testapp_menu_type_e menu);
/*-----------------------------------------------------------------------------------------*/
/* implementation */
-void testapp_print (char *fmt, ...)
+void testapp_print(char *fmt, ...)
{
va_list args = {0};
va_start(args, fmt);
- vfprintf (stdout, fmt, args);
- va_end (args);
- fflush (stdout);
+ vfprintf(stdout, fmt, args);
+ va_end(args);
+ fflush(stdout);
}
-static gboolean testapp_initialize_testing ()
+static gboolean testapp_initialize_testing()
{
struct timeval tv_1, tv_2;
int interval;
/* register signal handler */
- if ( signal (SIGINT, testapp_system_signal_handler) == SIG_ERR ) {
- testapp_print ("register signal handler fail\n");
+ if (signal(SIGINT, testapp_system_signal_handler) == SIG_ERR) {
+ testapp_print("register signal handler fail\n");
return FALSE;
}
- if ( signal (SIGQUIT, testapp_system_signal_handler) == SIG_ERR ) {
- testapp_print ("register signal handler fail\n");
+ if (signal(SIGQUIT, testapp_system_signal_handler) == SIG_ERR) {
+ testapp_print("register signal handler fail\n");
return FALSE;
}
- if ( signal (SIGTSTP, testapp_system_signal_handler) == SIG_ERR ) {
- testapp_print ("register signal handler fail\n");
+ if (signal(SIGTSTP, testapp_system_signal_handler) == SIG_ERR) {
+ testapp_print("register signal handler fail\n");
return FALSE;
}
- if ( signal (SIGTERM, testapp_system_signal_handler) == SIG_ERR ) {
- testapp_print ("register signal handler fail\n");
+ if (signal(SIGTERM, testapp_system_signal_handler) == SIG_ERR) {
+ testapp_print("register signal handler fail\n");
return FALSE;
}
@@ -98,22 +98,22 @@ static gboolean testapp_initialize_testing ()
gettimeofday(&tv_2, NULL);
interval = tv_2.tv_usec - tv_1.tv_usec;
- testapp_print("\t Initializing Proceed time %d us\n",interval);
+ testapp_print("\t Initializing Proceed time %d us\n", interval);
return TRUE;
}
-static gboolean testapp_finalize_testing ()
+static gboolean testapp_finalize_testing()
{
/* TODO : finalizing notification */
return TRUE;
}
-static void testapp_system_signal_handler (int signal_number)
+static void testapp_system_signal_handler(int signal_number)
{
- testapp_print ("signal:%d\n", signal_number);
+ testapp_print("signal:%d\n", signal_number);
switch (signal_number) {
case SIGQUIT:
case SIGINT:
@@ -123,7 +123,7 @@ static void testapp_system_signal_handler (int signal_number)
break;
default:
- testapp_print ("unhandled signal:%d\n", signal_number);
+ testapp_print("unhandled signal:%d\n", signal_number);
break;
}
exit(0);
@@ -132,42 +132,42 @@ static void testapp_system_signal_handler (int signal_number)
-void testapp_show_menu (testapp_menu_type_e menu)
+void testapp_show_menu(testapp_menu_type_e menu)
{
switch (menu) {
case TESTAPP_MENU_TYPE_MAIN_MENU:
- testapp_print ("==========================================\n");
- testapp_print (" Notification test application \n");
- testapp_print ("==========================================\n");
- testapp_print ("1. Basic Test\n");
- testapp_print ("2. Setting Test\n");
- testapp_print ("0. Exit \n");
- testapp_print ("------------------------------------------\n");
+ testapp_print("==========================================\n");
+ testapp_print(" Notification test application \n");
+ testapp_print("==========================================\n");
+ testapp_print("1. Basic Test\n");
+ testapp_print("2. Setting Test\n");
+ testapp_print("0. Exit \n");
+ testapp_print("------------------------------------------\n");
break;
case TESTAPP_MENU_TYPE_BASIC_TEST_MENU:
- testapp_print ("==========================================\n");
- testapp_print (" Basic test menu \n");
- testapp_print ("==========================================\n");
- testapp_print (" 1. Post a simple notification\n");
- testapp_print (" 2. Post simple notifications repeatedly\n");
- testapp_print (" 3. Post a notification on indicator\n");
- testapp_print (" 4. Post status status message\n");
- testapp_print (" 5. Delete all notification\n");
- testapp_print (" 6. Post a heads notification with a button\n");
- testapp_print (" 7. Post a notification with domain text\n");
- testapp_print (" 8. Load by tag\n");
- testapp_print (" 9. Get list\n");
- testapp_print ("------------------------------------------\n");
+ testapp_print("==========================================\n");
+ testapp_print(" Basic test menu \n");
+ testapp_print("==========================================\n");
+ testapp_print(" 1. Post a simple notification\n");
+ testapp_print(" 2. Post simple notifications repeatedly\n");
+ testapp_print(" 3. Post a notification on indicator\n");
+ testapp_print(" 4. Post status status message\n");
+ testapp_print(" 5. Delete all notification\n");
+ testapp_print(" 6. Post a heads notification with a button\n");
+ testapp_print(" 7. Post a notification with domain text\n");
+ testapp_print(" 8. Load by tag\n");
+ testapp_print(" 9. Get list\n");
+ testapp_print("------------------------------------------\n");
break;
case TESTAPP_MENU_TYPE_SETTING_TEST_MENU:
- testapp_print ("==========================================\n");
- testapp_print (" Setting test menu \n");
- testapp_print ("==========================================\n");
- testapp_print (" 1. Get setting list\n");
- testapp_print (" 2. Update setting\n");
- testapp_print (" 3. Update system setting\n");
- testapp_print (" 4. Refresh setting table\n");
- testapp_print ("------------------------------------------\n");
+ testapp_print("==========================================\n");
+ testapp_print(" Setting test menu \n");
+ testapp_print("==========================================\n");
+ testapp_print(" 1. Get setting list\n");
+ testapp_print(" 2. Update setting\n");
+ testapp_print(" 3. Update system setting\n");
+ testapp_print(" 4. Refresh setting table\n");
+ testapp_print("------------------------------------------\n");
break;
default:
break;
@@ -281,7 +281,7 @@ static int testapp_test_post_notification_on_indicator()
noti_err = notification_set_display_applist(noti_handle, NOTIFICATION_DISPLAY_APP_TICKER | NOTIFICATION_DISPLAY_APP_INDICATOR);
- if(noti_err != NOTIFICATION_ERROR_NONE) {
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
testapp_print("notification_set_display_applist failed[%d]", noti_err);
goto FINISH_OFF;
}
@@ -307,7 +307,7 @@ static int testapp_test_post_status_message()
noti_err = notification_status_message_post("This is only a test");
- if(noti_err != NOTIFICATION_ERROR_NONE) {
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
testapp_print("notification_status_message_post failed[%d]", noti_err);
}
@@ -359,13 +359,13 @@ static int testapp_test_post_heads_up_notification_with_button()
}
app_control_err = app_control_create(&app_control);
- if (app_control_err != APP_CONTROL_ERROR_NONE ) {
+ if (app_control_err != APP_CONTROL_ERROR_NONE) {
testapp_print("app_control_create failed[%d]\n", app_control_err);
goto FINISH_OFF;
}
app_control_err = app_control_set_app_id(app_control, "org.tizen.quickpanel");
- if (app_control_err != APP_CONTROL_ERROR_NONE ) {
+ if (app_control_err != APP_CONTROL_ERROR_NONE) {
testapp_print("app_control_set_app_id failed[%d]\n", app_control_err);
goto FINISH_OFF;
}
@@ -407,7 +407,7 @@ static int testapp_test_post_heads_up_notification_with_button()
noti_err = notification_get_event_handler(noti_handle, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, &app_control);
- if (noti_err != NOTIFICATION_ERROR_NONE ||app_control == NULL) {
+ if (noti_err != NOTIFICATION_ERROR_NONE || app_control == NULL) {
testapp_print("notification_get_event_handler failed[%d]", noti_err);
goto FINISH_OFF;
}
@@ -548,7 +548,7 @@ FINISH_OFF:
return noti_err;
}
-static gboolean testapp_interpret_command_basic_test (int selected_number)
+static gboolean testapp_interpret_command_basic_test(int selected_number)
{
gboolean go_to_loop = TRUE;
@@ -601,14 +601,14 @@ static gboolean testapp_interpret_command_basic_test (int selected_number)
}
-void testapp_notification_main ()
+void testapp_notification_main()
{
gboolean go_to_loop = TRUE;
int menu_number = 0;
while (go_to_loop) {
- testapp_show_menu (TESTAPP_MENU_TYPE_BASIC_TEST_MENU);
- testapp_show_prompt (TESTAPP_MENU_TYPE_BASIC_TEST_MENU);
+ testapp_show_menu(TESTAPP_MENU_TYPE_BASIC_TEST_MENU);
+ testapp_show_prompt(TESTAPP_MENU_TYPE_BASIC_TEST_MENU);
if (0 >= scanf("%d", &menu_number))
testapp_print("Invalid input");
@@ -642,7 +642,7 @@ static int testapp_test_get_setting_list()
notification_setting_get_visibility_class(setting_array + i, &visibility_class);
testapp_print("[%d] : package_name[%s], allow_to_notify[%d], do_not_disturb_except[%d], visibility_class[%d]\n"
- ,i, package_name, allow_to_notify, do_not_disturb_except, visibility_class);
+ , i, package_name, allow_to_notify, do_not_disturb_except, visibility_class);
free(package_name);
}
@@ -660,8 +660,7 @@ static int testapp_test_update_setting()
if (err != NOTIFICATION_ERROR_NONE || setting == NULL) {
testapp_print("notification_setting_get_setting_by_package_name failed [%d]", err);
- }
- else {
+ } else {
notification_setting_set_allow_to_notify(setting, 0);
notification_setting_update_setting(setting);
}
@@ -726,7 +725,7 @@ out:
return err;
}
-static gboolean testapp_interpret_command_setting_test (int selected_number)
+static gboolean testapp_interpret_command_setting_test(int selected_number)
{
gboolean go_to_loop = TRUE;
@@ -765,8 +764,8 @@ void testapp_setting_main()
int menu_number = 0;
while (go_to_loop) {
- testapp_show_menu (TESTAPP_MENU_TYPE_SETTING_TEST_MENU);
- testapp_show_prompt (TESTAPP_MENU_TYPE_SETTING_TEST_MENU);
+ testapp_show_menu(TESTAPP_MENU_TYPE_SETTING_TEST_MENU);
+ testapp_show_prompt(TESTAPP_MENU_TYPE_SETTING_TEST_MENU);
if (0 >= scanf("%d", &menu_number))
testapp_print("Invalid input");
@@ -777,7 +776,7 @@ void testapp_setting_main()
/* Setting Test } ---------------------------------------------------------------*/
/* Main { ---------------------------------------------------------------------*/
-static gboolean testapp_interpret_command (int menu_number)
+static gboolean testapp_interpret_command(int menu_number)
{
gboolean go_to_loop = TRUE;
@@ -801,39 +800,39 @@ static gboolean testapp_interpret_command (int menu_number)
return go_to_loop;
}
-void testapp_show_prompt (testapp_menu_type_e menu)
+void testapp_show_prompt(testapp_menu_type_e menu)
{
switch (menu) {
case TESTAPP_MENU_TYPE_MAIN_MENU:
- testapp_print ("[MAIN]# ");
+ testapp_print("[MAIN]# ");
break;
case TESTAPP_MENU_TYPE_BASIC_TEST_MENU:
- testapp_print ("[BASIC_TEST]# ");
+ testapp_print("[BASIC_TEST]# ");
break;
case TESTAPP_MENU_TYPE_SETTING_TEST_MENU:
- testapp_print ("[SETTING_TEST]# ");
+ testapp_print("[SETTING_TEST]# ");
break;
}
}
-int main (int argc, char *argv[])
+int main(int argc, char *argv[])
{
gboolean go_to_loop = TRUE;
int menu_number = 0;
- if ( testapp_initialize_testing() == FALSE ) {
- testapp_print ("Initializing failed.\n");
+ if (testapp_initialize_testing() == FALSE) {
+ testapp_print("Initializing failed.\n");
return 1;
}
while (go_to_loop) {
- testapp_show_menu (TESTAPP_MENU_TYPE_MAIN_MENU);
- testapp_show_prompt (TESTAPP_MENU_TYPE_MAIN_MENU);
- if (0 >= scanf ("%d", &menu_number))
+ testapp_show_menu(TESTAPP_MENU_TYPE_MAIN_MENU);
+ testapp_show_prompt(TESTAPP_MENU_TYPE_MAIN_MENU);
+ if (0 >= scanf("%d", &menu_number))
testapp_print("Invalid input");
- go_to_loop = testapp_interpret_command (menu_number);
+ go_to_loop = testapp_interpret_command(menu_number);
}
testapp_finalize_testing();