Check coding style 12/189212/4
authormk5004.lee <mk5004.lee@samsung.com>
Fri, 14 Sep 2018 08:08:00 +0000 (17:08 +0900)
committermk5004.lee <mk5004.lee@samsung.com>
Fri, 14 Sep 2018 08:54:21 +0000 (17:54 +0900)
Change-Id: Iff58d860d4a5fa762b933c0a477711e5187594c7
Signed-off-by: mk5004.lee <mk5004.lee@samsung.com>
src/notification.c
src/notification_db.c
src/notification_init.c
src/notification_internal.c
src/notification_ipc.c
src/notification_noti.c
src/notification_setting.c
src/notification_setting_service.c
src/notification_shared_file.c

index 33ab222eb4965dfdd6a353a76d768fcf144ef3b2..698b15055be7db8b6846a0e97d425eb5f1be95d6 100644 (file)
@@ -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;
 
index 134f5101b9141b79077b27a8c4421f46bc155ed2..37b412e8f046ba3dedc5fbd4a50c8eb98c9ebc02 100644 (file)
@@ -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;
 
index a97cdd1f8972318d7ff5f10eca88a4818a9665e4..72d6cdcfbd55c2bbcf317ee5526ad5f1b9578b67 100644 (file)
 #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();
index 12b292a216c30ea1c4e0b83951ec6cb5fbc15ce9..1709a8e89fbbb322d6f183efb3620983c3a4983f 100644 (file)
@@ -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;
index a7c4f7560c44fbcbae64392b2146760d1913bc82..0bb6959ac87ca23f388d8e5ba6e36f0030ba669f 100644 (file)
@@ -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,
index 43efcd322ea41397c1e8f71331c97c6572a20cb1..1c92b618323a4b56aa4b5ae174251588c3d99668 100644 (file)
@@ -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;
index f53aa719afffbdf3c3a7e132421cc4214e79b606..6be851f66e136388aa528f837e57ed39907459bc 100644 (file)
@@ -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;
index c748c363f50c51a1dae0a943f72d61a317b2df74..9d815aa9e74752b115c6e6d7f73ca603e8e6006c 100644 (file)
@@ -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;
index cd2cc81a51cf893cbd8e6617111b2e3dc8fe2daf..7ca23d9cef9be2324f5ce59de59deb9dd3e68531 100644 (file)
@@ -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);