summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormk5004.lee <mk5004.lee@samsung.com>2018-09-14 17:08:00 +0900
committermk5004.lee <mk5004.lee@samsung.com>2018-09-14 17:54:21 +0900
commit4cdebe42762e88efa0e7c1c343bfbb0276387a44 (patch)
tree8bb4e558d85af9ad9cc2dfbb3e923d0d732b6d2e
parent81dcc9db36799afd893602848347f46cff506304 (diff)
downloadnotification-4cdebe42762e88efa0e7c1c343bfbb0276387a44.tar.gz
notification-4cdebe42762e88efa0e7c1c343bfbb0276387a44.tar.bz2
notification-4cdebe42762e88efa0e7c1c343bfbb0276387a44.zip
Check coding style
Change-Id: Iff58d860d4a5fa762b933c0a477711e5187594c7 Signed-off-by: mk5004.lee <mk5004.lee@samsung.com>
-rw-r--r--src/notification.c13
-rw-r--r--src/notification_db.c12
-rw-r--r--src/notification_init.c4
-rw-r--r--src/notification_internal.c22
-rw-r--r--src/notification_ipc.c7
-rw-r--r--src/notification_noti.c6
-rw-r--r--src/notification_setting.c7
-rw-r--r--src/notification_setting_service.c9
-rw-r--r--src/notification_shared_file.c5
9 files changed, 47 insertions, 38 deletions
diff --git a/src/notification.c b/src/notification.c
index 33ab222..698b150 100644
--- a/src/notification.c
+++ b/src/notification.c
@@ -461,8 +461,8 @@ EXPORT_API int notification_get_text(notification_h noti,
if (type <= NOTIFICATION_TEXT_TYPE_NONE
|| type > NOTIFICATION_TEXT_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- else
- text_type = type;
+
+ text_type = type;
if (noti->b_key != NULL) {
b = noti->b_key;
@@ -1104,7 +1104,7 @@ EXPORT_API int notification_get_led_time_period(notification_h noti,
}
EXPORT_API int notification_set_launch_option(notification_h noti,
- notification_launch_option_type type, void *option)
+ notification_launch_option_type type, void *option)
{
int err = NOTIFICATION_ERROR_NONE;
int ret = 0;
@@ -1116,7 +1116,8 @@ EXPORT_API int notification_set_launch_option(notification_h noti,
goto out;
}
- if ((ret = app_control_export_as_bundle(app_control, &b)) != APP_CONTROL_ERROR_NONE) {
+ ret = app_control_export_as_bundle(app_control, &b);
+ if (ret != APP_CONTROL_ERROR_NONE) {
ERR("Failed to convert appcontrol to bundle[%d]", ret);
err = NOTIFICATION_ERROR_INVALID_PARAMETER;
goto out;
@@ -1196,7 +1197,8 @@ EXPORT_API int notification_set_event_handler(notification_h noti, notification_
goto out;
}
- if ((err = app_control_export_as_bundle(event_handler, &app_control_bundle)) != APP_CONTROL_ERROR_NONE) {
+ err = app_control_export_as_bundle(event_handler, &app_control_bundle);
+ if (err != APP_CONTROL_ERROR_NONE) {
ERR("Failed to export app_control to bundle[%d]", err);
goto out;
}
@@ -1740,6 +1742,7 @@ EXPORT_API int notification_clone(notification_h noti, notification_h *clone)
EXPORT_API int notification_free(notification_h noti)
{
int i = 0;
+
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
diff --git a/src/notification_db.c b/src/notification_db.c
index 134f510..37b412e 100644
--- a/src/notification_db.c
+++ b/src/notification_db.c
@@ -35,12 +35,12 @@ static int __check_integrity_cb(void *pid, int argc, char **argv, char **notUsed
char *check_str = "ok";
if (strncmp(argv[0], check_str, strlen(check_str))) {
- ERR("db integrity result : %s" , argv[0]);
+ ERR("db integrity result : %s", argv[0]);
is_db_corrupted = true;
return -1;
}
- INFO("db integrity result : %s" , argv[0]);
+ INFO("db integrity result : %s", argv[0]);
return 0;
}
/* LCOV_EXCL_STOP */
@@ -58,7 +58,7 @@ static int __recover_corrupted_db(sqlite3 *db)
unlink(DBPATH);
sql_ret = sqlite3_open_v2(DBPATH, &db,
- SQLITE_OPEN_CREATE |SQLITE_OPEN_READWRITE,
+ SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE,
NULL);
if (sql_ret != SQLITE_OK) {
ERR("Failed to open db[%d]", sql_ret);
@@ -82,7 +82,7 @@ out:
/* LCOV_EXCL_STOP */
/* LCOV_EXCL_START */
-EXPORT_API int notification_db_init()
+EXPORT_API int notification_db_init(void)
{
int ret = NOTIFICATION_ERROR_NONE;
int sql_ret;
@@ -206,7 +206,7 @@ int notification_db_exec(sqlite3 *db, const char *query, int *num_changes)
return ret;
}
-char *notification_db_column_text(sqlite3_stmt * stmt, int col)
+char *notification_db_column_text(sqlite3_stmt *stmt, int col)
{
const unsigned char *col_text = NULL;
@@ -217,7 +217,7 @@ char *notification_db_column_text(sqlite3_stmt * stmt, int col)
return strdup((char *)col_text);
}
-bundle *notification_db_column_bundle(sqlite3_stmt * stmt, int col)
+bundle *notification_db_column_bundle(sqlite3_stmt *stmt, int col)
{
const unsigned char *col_bundle = NULL;
diff --git a/src/notification_init.c b/src/notification_init.c
index a97cdd1..72d6cdc 100644
--- a/src/notification_init.c
+++ b/src/notification_init.c
@@ -38,10 +38,10 @@
#undef _E
#endif
#define _E(fmt, arg...) fprintf(stderr, "[NOTIFICATION_INIT][E][%s,%d] "fmt"\n", \
- __FUNCTION__, __LINE__, ##arg);
+ __func__, __LINE__, ##arg)
/* LCOV_EXCL_START */
-static int _is_authorized()
+static int _is_authorized(void)
{
/* pkg_init db should be called by as root privilege. */
uid_t uid = getuid();
diff --git a/src/notification_internal.c b/src/notification_internal.c
index 12b292a..1709a8e 100644
--- a/src/notification_internal.c
+++ b/src/notification_internal.c
@@ -54,8 +54,8 @@ typedef enum __notification_cb_type {
struct _notification_cb_info {
_notification_cb_type_e cb_type;
- void (*changed_cb) (void *data, notification_type_e type);
- void (*detailed_changed_cb) (void *data, notification_type_e type, notification_op *op_list, int num_op);
+ void (*changed_cb)(void *data, notification_type_e type);
+ void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op);
void *data;
};
@@ -89,6 +89,7 @@ void notification_reset_event_handler_list(void)
static void __free_changed_cb_info(gpointer data)
{
notification_cb_info_s *noti_cb_info = (notification_cb_info_s *)data;
+
if (noti_cb_info)
free(noti_cb_info);
}
@@ -118,9 +119,9 @@ void notification_call_changed_cb_for_uid(notification_op *op_list, int op_num,
for (; noti_cb_list != NULL; noti_cb_list = noti_cb_list->next) {
noti_cb_info = noti_cb_list->data;
- if (noti_cb_info->cb_type == NOTIFICATION_CB_NORMAL && noti_cb_info->changed_cb) {
+ if (noti_cb_info->cb_type == NOTIFICATION_CB_NORMAL && noti_cb_info->changed_cb)
noti_cb_info->changed_cb(noti_cb_info->data, type);
- }
+
if (noti_cb_info->cb_type == NOTIFICATION_CB_DETAILED && noti_cb_info->detailed_changed_cb) {
noti_cb_info->detailed_changed_cb(noti_cb_info->data,
type, op_list, op_num);
@@ -336,8 +337,8 @@ EXPORT_API int notification_update_progress(notification_h noti,
if (priv_id <= NOTIFICATION_PRIV_ID_NONE) {
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- else
- input_priv_id = noti->priv_id;
+
+ input_priv_id = noti->priv_id;
} else {
input_priv_id = priv_id;
}
@@ -375,8 +376,8 @@ EXPORT_API int notification_update_size(notification_h noti,
if (priv_id <= NOTIFICATION_PRIV_ID_NONE) {
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- else
- input_priv_id = noti->priv_id;
+
+ input_priv_id = noti->priv_id;
} else {
input_priv_id = priv_id;
}
@@ -411,8 +412,8 @@ EXPORT_API int notification_update_content(notification_h noti,
if (priv_id <= NOTIFICATION_PRIV_ID_NONE) {
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- else
- input_priv_id = noti->priv_id;
+
+ input_priv_id = noti->priv_id;
} else {
input_priv_id = priv_id;
}
@@ -800,7 +801,6 @@ EXPORT_API int notification_op_get_data(notification_op *noti_op, notification_o
break;
default:
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- break;
}
return NOTIFICATION_ERROR_NONE;
diff --git a/src/notification_ipc.c b/src/notification_ipc.c
index a7c4f75..0bb6959 100644
--- a/src/notification_ipc.c
+++ b/src/notification_ipc.c
@@ -60,7 +60,7 @@ struct _task_list {
task_list *prev;
task_list *next;
- void (*task_cb) (void *data);
+ void (*task_cb)(void *data);
void *data;
};
@@ -104,7 +104,7 @@ static void __provider_vanished_cb(GDBusConnection *connection,
}
/* LCOV_EXCL_STOP */
-static int _dbus_init()
+static int _dbus_init(void)
{
GError *error = NULL;
@@ -636,7 +636,7 @@ static int _dbus_event_handler_signal_init(void)
return ret;
}
-static int _dbus_signal_init()
+static int _dbus_signal_init(void)
{
int id;
int ret = NOTIFICATION_ERROR_NONE;
@@ -2356,6 +2356,7 @@ EXPORT_API int notification_ipc_make_noti_from_gvariant(notification_h noti,
EXPORT_API GVariant *notification_ipc_make_gvariant_from_system_setting(struct notification_system_setting *noti_setting)
{
GVariant *body = NULL;
+
body = g_variant_new("(iiiiiiiii)",
noti_setting->do_not_disturb,
noti_setting->visibility_class,
diff --git a/src/notification_noti.c b/src/notification_noti.c
index 43efcd3..1c92b61 100644
--- a/src/notification_noti.c
+++ b/src/notification_noti.c
@@ -63,7 +63,7 @@ static void __notification_noti_populate_from_stmt(sqlite3_stmt *stmt, notificat
int i = 0;
if (stmt == NULL || noti == NULL)
- return ;
+ return;
noti->type = sqlite3_column_int(stmt, col++);
noti->layout = sqlite3_column_int(stmt, col++);
@@ -245,7 +245,7 @@ static int _create_insertion_query(sqlite3 *db, notification_h noti, sqlite3_stm
char *b_service_responding = NULL;
char *b_service_single_launch = NULL;
char *b_service_multi_launch = NULL;
- char *b_event_handler[NOTIFICATION_EVENT_TYPE_MAX+1] = { NULL , };
+ char *b_event_handler[NOTIFICATION_EVENT_TYPE_MAX+1] = { NULL, };
int flag_simmode = 0;
int idx = 1;
int i = 0;
@@ -427,7 +427,7 @@ static int _create_update_query(sqlite3 *db, notification_h noti, sqlite3_stmt *
char *b_service_responding = NULL;
char *b_service_single_launch = NULL;
char *b_service_multi_launch = NULL;
- char *b_event_handler[NOTIFICATION_EVENT_TYPE_MAX+1] = { NULL , };
+ char *b_event_handler[NOTIFICATION_EVENT_TYPE_MAX+1] = { NULL, };
int flag_simmode = 0;
int idx = 1;
int i = 0;
diff --git a/src/notification_setting.c b/src/notification_setting.c
index f53aa71..6be851f 100644
--- a/src/notification_setting.c
+++ b/src/notification_setting.c
@@ -299,7 +299,8 @@ EXPORT_API int notification_setting_free_notification(notification_setting_h set
return NOTIFICATION_ERROR_NONE;
}
-static bool _is_package_in_setting_table(sqlite3 *db, const char *package_name, const char* app_id, uid_t uid)
+static bool _is_package_in_setting_table(sqlite3 *db, const char *package_name,
+ const char *app_id, uid_t uid)
{
sqlite3_stmt *stmt = NULL;
char *query = NULL;
@@ -952,9 +953,9 @@ EXPORT_API int notification_register_system_setting_dnd_changed_cb_for_uid(dnd_c
ERR("Already existing callback");
free(dnd_data);
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- } else {
- noti_dnd_list = g_list_append(noti_dnd_list, dnd_data);
}
+
+ noti_dnd_list = g_list_append(noti_dnd_list, dnd_data);
}
return NOTIFICATION_ERROR_NONE;
diff --git a/src/notification_setting_service.c b/src/notification_setting_service.c
index c748c36..9d815aa 100644
--- a/src/notification_setting_service.c
+++ b/src/notification_setting_service.c
@@ -145,7 +145,8 @@ int noti_setting_service_get_setting_by_app_id(const char *app_id, notification_
row_count = 1;
- if (!(result_setting_array = (struct notification_setting *)malloc(sizeof(struct notification_setting) * row_count))) {
+ result_setting_array = (struct notification_setting *)malloc(sizeof(struct notification_setting) * row_count);
+ if (result_setting_array == NULL) {
/* LCOV_EXCL_START */
ERR("Failed to alloc memory");
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
@@ -232,7 +233,8 @@ int noti_setting_get_setting_array(notification_setting_h *setting_array, int *c
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))) {
+ result_setting_array = (struct notification_setting *)malloc(sizeof(struct notification_setting) * row_count);
+ if (result_setting_array == NULL) {
/* LCOV_EXCL_START */
ERR("Failed to alloc memory"); /* LCOV_EXCL_LINE */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
@@ -537,7 +539,8 @@ int notification_system_setting_get_dnd_schedule_enabled_uid(uid_t **uids, int *
goto out;
}
- if (!(result_uids = (uid_t *)malloc(sizeof(int) * row_count))) {
+ result_uids = (uid_t *)malloc(sizeof(int) * row_count);
+ if (result_uids == NULL) {
ERR("Failed to alloc memory");
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto out;
diff --git a/src/notification_shared_file.c b/src/notification_shared_file.c
index cd2cc81..7ca23d9 100644
--- a/src/notification_shared_file.c
+++ b/src/notification_shared_file.c
@@ -46,7 +46,7 @@ do { \
free_fun; \
return ret_value; \
} \
-} while (0);
+} while (0)
GList *__uid_list;
typedef struct uid_info {
@@ -258,7 +258,7 @@ static void __free_file_info(gpointer data)
/* LCOV_EXCL_START */
static void __free_req_info(gpointer data)
{
- sharing_req_data_s * info = (sharing_req_data_s *)data;
+ sharing_req_data_s *info = (sharing_req_data_s *)data;
if (info == NULL)
return;
@@ -339,6 +339,7 @@ static gint __comp_dst_path(gconstpointer a, gconstpointer b)
static sharing_file_info_s *__dup_file_info(sharing_file_info_s *src)
{
sharing_file_info_s *file_info;
+
file_info = (sharing_file_info_s *)calloc(1, sizeof(sharing_file_info_s));
__OOM_CHECK(file_info, NULL, DUMMY_PARAM);