summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMyungki Lee <mk5004.lee@samsung.com>2016-11-21 14:15:33 +0900
committerMyungki Lee <mk5004.lee@samsung.com>2016-11-21 14:15:33 +0900
commita77dd8048bc6617f7a27b8517c8615d3a003bb05 (patch)
treee4ec689c91974610d03f372e130f618ab57d16ca
parentec37f8e0a1e1fc8498788c5520e60b89c66d9f31 (diff)
downloadnotification-a77dd8048bc6617f7a27b8517c8615d3a003bb05.tar.gz
notification-a77dd8048bc6617f7a27b8517c8615d3a003bb05.tar.bz2
notification-a77dd8048bc6617f7a27b8517c8615d3a003bb05.zip
Adjust coding style
Change-Id: I39b4186396ba096f83484f9e823d9c7825aa7663 Signed-off-by: Myungki Lee <mk5004.lee@samsung.com>
-rwxr-xr-xsrc/notification.c4
-rw-r--r--src/notification_error.c4
-rwxr-xr-xsrc/notification_group.c9
-rwxr-xr-xsrc/notification_internal.c29
-rwxr-xr-xsrc/notification_noti.c14
-rw-r--r--src/notification_setting_service.c5
6 files changed, 32 insertions, 33 deletions
diff --git a/src/notification.c b/src/notification.c
index 9a1aaca..c8f950c 100755
--- a/src/notification.c
+++ b/src/notification.c
@@ -44,7 +44,7 @@
#include <notification_ipc.h>
#include <notification_internal.h>
-static void (*posted_toast_message_cb) (void *data);
+static void (*posted_toast_message_cb)(void *data);
#define NOTI_TEXT_RESULT_LEN 2048
#define NOTI_PKGNAME_LEN 512
@@ -56,7 +56,7 @@ char *notification_get_pkgname_by_pid(void)
char pkgname[NOTI_PKGNAME_LEN + 1] = { 0, };
int pid = 0, ret = AUL_R_OK;
int fd;
- char *dup_pkgname;
+ char *dup_pkgname;
char buf[NOTI_PKGNAME_LEN + 1] = { 0, };
pid = getpid();
diff --git a/src/notification_error.c b/src/notification_error.c
index 40ed959..3361ddd 100644
--- a/src/notification_error.c
+++ b/src/notification_error.c
@@ -38,9 +38,9 @@ EXPORT_API GQuark notification_error_quark(void)
static volatile gsize quark_volatile = 0;
static const char *domain_name = NULL;
- /* This is for preventing crash when notification api is used in ui-gadget */
+ /* This is for preventing crash when notification api is used in ui-gadget */
/* ui-gadget libraries can be unloaded when it is needed and the static string */
- /* parameter to g_dbus_error_register_error_domain may cause crash. */
+ /* parameter to g_dbus_error_register_error_domain may cause crash. */
GQuark quark = g_quark_try_string(NOTIFICATION_ERROR_QUARK);
if (quark == 0) {
diff --git a/src/notification_group.c b/src/notification_group.c
index edd2c22..fb44bbe 100755
--- a/src/notification_group.c
+++ b/src/notification_group.c
@@ -28,7 +28,8 @@ static int _notification_group_check_data_inserted(const char *pkgname,
{
sqlite3_stmt *stmt = NULL;
char query[NOTIFICATION_QUERY_MAX] = { 0, };
- int ret = NOTIFICATION_ERROR_NONE, result = 0;
+ int ret;
+ int result;
snprintf(query, sizeof(query),
"select count(*) from noti_group_data where caller_pkgname = '%s' and group_id = %d",
@@ -67,8 +68,8 @@ int notification_group_set_badge(const char *pkgname,
sqlite3 *db;
sqlite3_stmt *stmt = NULL;
char query[NOTIFICATION_QUERY_MAX] = { 0, };
- int ret = 0;
- int result = NOTIFICATION_ERROR_NONE;
+ int ret;
+ int result;
db = notification_db_open(DBPATH);
if (!db)
@@ -127,7 +128,7 @@ int notification_group_get_badge(const char *pkgname,
sqlite3 *db;
sqlite3_stmt *stmt = NULL;
char query[NOTIFICATION_QUERY_MAX] = { 0, };
- int ret = 0;
+ int ret;
int col = 0;
db = notification_db_open(DBPATH);
diff --git a/src/notification_internal.c b/src/notification_internal.c
index dac1bb8..78a5314 100755
--- a/src/notification_internal.c
+++ b/src/notification_internal.c
@@ -392,7 +392,6 @@ EXPORT_API int notification_update_content(notification_h noti,
return NOTIFICATION_ERROR_INVALID_PARAMETER;
else
input_priv_id = noti->priv_id;
-
} else {
input_priv_id = priv_id;
}
@@ -425,22 +424,22 @@ EXPORT_API int notification_set_icon(notification_h noti,
EXPORT_API int notification_get_icon(notification_h noti,
char **icon_path)
{
- int ret_err = NOTIFICATION_ERROR_NONE;
+ int ret = NOTIFICATION_ERROR_NONE;
char *ret_image_path = NULL;
- ret_err = notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
+ ret = notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
&ret_image_path);
- if (ret_err == NOTIFICATION_ERROR_NONE && icon_path != NULL)
+ if (ret == NOTIFICATION_ERROR_NONE && icon_path != NULL)
*icon_path = ret_image_path;
- return ret_err;
+ return ret;
}
/* LCOV_EXCL_STOP */
EXPORT_API int notification_translate_localized_text(notification_h noti)
{
- int noti_err = NOTIFICATION_ERROR_NONE;
+ int ret = NOTIFICATION_ERROR_NONE;
char *ret_text = NULL;
char buf_key[32];
char *bundle_val = NULL;
@@ -449,8 +448,8 @@ EXPORT_API int notification_translate_localized_text(notification_h noti)
notification_text_type_e type = NOTIFICATION_TEXT_TYPE_TITLE;
for (; type < NOTIFICATION_TEXT_TYPE_MAX; type++) {
- noti_err = notification_get_text(noti, type, &ret_text);
- if (noti_err == NOTIFICATION_ERROR_NONE && ret_text) {
+ ret = notification_get_text(noti, type, &ret_text);
+ if (ret == NOTIFICATION_ERROR_NONE && ret_text) {
if (noti->b_text == NULL) {
noti->b_text = bundle_create();
if (noti->b_text == NULL)
@@ -475,7 +474,7 @@ EXPORT_API int notification_translate_localized_text(notification_h noti)
}
}
- return noti_err;
+ return ret;
}
/* LCOV_EXCL_START */
@@ -494,10 +493,10 @@ EXPORT_API int notification_get_title(notification_h noti,
char **title,
char **loc_title)
{
- int noti_err = NOTIFICATION_ERROR_NONE;
+ int ret;
char *ret_text = NULL;
- noti_err = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
+ ret = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
&ret_text);
if (title != NULL)
@@ -506,7 +505,7 @@ EXPORT_API int notification_get_title(notification_h noti,
if (loc_title != NULL)
*loc_title = NULL;
- return noti_err;
+ return ret;
}
/* LCOV_EXCL_STOP */
@@ -526,10 +525,10 @@ EXPORT_API int notification_get_content(notification_h noti,
char **content,
char **loc_content)
{
- int noti_err = NOTIFICATION_ERROR_NONE;
+ int ret;
char *ret_text = NULL;
- noti_err = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
+ ret = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
&ret_text);
if (content != NULL)
@@ -538,7 +537,7 @@ EXPORT_API int notification_get_content(notification_h noti,
if (loc_content != NULL)
*loc_content = NULL;
- return noti_err;
+ return ret;
}
/* LCOV_EXCL_STOP */
diff --git a/src/notification_noti.c b/src/notification_noti.c
index 8b89f1e..440f374 100755
--- a/src/notification_noti.c
+++ b/src/notification_noti.c
@@ -778,9 +778,9 @@ static int _handle_do_not_disturb_option(notification_h noti)
if (do_not_disturb_exception == false) {
/* do_not_disturb is ON and do_not_disturb_exception is OFF */
- /* Then add this notification only on quick panel and indicator*/
+ /* Then add this notification only on quick panel and indicator */
noti->display_applist = noti->display_applist & (NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_INDICATOR);
- /* and reset all sound and vibration and led options*/
+ /* and reset all sound and vibration and led options */
noti->sound_type = NOTIFICATION_SOUND_TYPE_NONE;
SAFE_FREE(noti->sound_path);
noti->vibration_type = NOTIFICATION_VIBRATION_TYPE_NONE;
@@ -1223,7 +1223,8 @@ EXPORT_API int notification_noti_delete_all(notification_type_e type, const char
{
int ret = NOTIFICATION_ERROR_NONE;
int ret_tmp = NOTIFICATION_ERROR_NONE;
- int i = 0, data_cnt = 0;
+ int i = 0;
+ int data_cnt = 0;
sqlite3 *db = NULL;
sqlite3_stmt *stmt = NULL;
char buf[128] = { 0, };
@@ -1240,7 +1241,6 @@ EXPORT_API int notification_noti_delete_all(notification_type_e type, const char
if (type != NOTIFICATION_TYPE_NONE)
snprintf(query_where, sizeof(query_where),
"where type = %d and uid = %d", type, uid);
-
} else {
if (type == NOTIFICATION_TYPE_NONE)
snprintf(query_where, sizeof(query_where),
@@ -1307,7 +1307,6 @@ EXPORT_API int notification_noti_delete_all(notification_type_e type, const char
query_where[0] = '\0';
if (ret == NOTIFICATION_ERROR_NONE)
ret = ret_tmp;
-
}
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);
@@ -1325,7 +1324,6 @@ EXPORT_API int notification_noti_delete_all(notification_type_e type, const char
if (num_deleted != NULL)
*num_deleted = data_cnt;
-
} else {
/* Make main query */
snprintf(query_base, sizeof(query_base), "delete from noti_list ");
@@ -1335,7 +1333,6 @@ EXPORT_API int notification_noti_delete_all(notification_type_e type, const char
if (num_deleted != NULL)
*num_deleted = sqlite3_changes(db);
-
}
err:
@@ -1378,7 +1375,7 @@ EXPORT_API int notification_noti_delete_by_priv_id(const char *pkgname, int priv
EXPORT_API int notification_noti_delete_by_priv_id_get_changes(const char *pkgname, int priv_id, int *num_changes, uid_t uid)
{
sqlite3 *db = NULL;
- char query[NOTIFICATION_QUERY_MAX] = {0, };
+ char query[NOTIFICATION_QUERY_MAX] = { 0, };
int ret;
db = notification_db_open(DBPATH);
@@ -1512,7 +1509,6 @@ err:
if (stmt)
sqlite3_finalize(stmt);
-
if (db)
notification_db_close(&db);
diff --git a/src/notification_setting_service.c b/src/notification_setting_service.c
index d7f7fd2..8fe0fc1 100644
--- a/src/notification_setting_service.c
+++ b/src/notification_setting_service.c
@@ -475,7 +475,6 @@ return_close_db:
if (db_statement)
sqlite3_finalize(db_statement);
-
if (db) {
if (err == NOTIFICATION_ERROR_NONE)
sqlite3_exec(db, "END;", NULL, NULL, NULL);
@@ -792,10 +791,12 @@ EXPORT_API int notification_system_setting_update_dnd_allow_exception(int type,
out:
if (db_statement)
sqlite3_finalize(db_statement);
+
if (ret == NOTIFICATION_ERROR_NONE)
sqlite3_exec(db, "END;", NULL, NULL, NULL);
else
sqlite3_exec(db, "ROLLBACK;", NULL, NULL, NULL);
+
notification_db_close(&db);
return ret;
@@ -843,8 +844,10 @@ EXPORT_API int noti_system_setting_get_do_not_disturb(int *do_not_disturb, uid_t
out:
if (query_result)
sqlite3_free_table(query_result);
+
if (query)
sqlite3_free(query);
+
if (db)
notification_db_close(&db);