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;
}
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;
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;
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;
}
EXPORT_API int notification_free(notification_h noti)
{
int i = 0;
+
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
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 */
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);
/* 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;
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;
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;
#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();
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;
};
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);
}
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);
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;
}
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;
}
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;
}
break;
default:
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- break;
}
return NOTIFICATION_ERROR_NONE;
task_list *prev;
task_list *next;
- void (*task_cb) (void *data);
+ void (*task_cb)(void *data);
void *data;
};
}
/* LCOV_EXCL_STOP */
-static int _dbus_init()
+static int _dbus_init(void)
{
GError *error = NULL;
return ret;
}
-static int _dbus_signal_init()
+static int _dbus_signal_init(void)
{
int id;
int ret = NOTIFICATION_ERROR_NONE;
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,
int i = 0;
if (stmt == NULL || noti == NULL)
- return ;
+ return;
noti->type = sqlite3_column_int(stmt, col++);
noti->layout = sqlite3_column_int(stmt, col++);
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;
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;
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;
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;
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;
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;
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;
free_fun; \
return ret_value; \
} \
-} while (0);
+} while (0)
GList *__uid_list;
typedef struct uid_info {
/* 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;
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);