summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjusung son <jusung07.son@samsung.com>2016-01-04 16:37:01 +0900
committerjusung son <jusung07.son@samsung.com>2016-01-05 14:14:52 +0900
commit1ef0da7a24fdcadb1ddb08440c54050764bb32b2 (patch)
tree23f98efbeb46b18ebc6b71bcc623e48468fc68f5
parentdada02a2f7f1d4f4d2ea49d588050eb4aa1701f6 (diff)
downloadnotification-1ef0da7a24fdcadb1ddb08440c54050764bb32b2.tar.gz
notification-1ef0da7a24fdcadb1ddb08440c54050764bb32b2.tar.bz2
notification-1ef0da7a24fdcadb1ddb08440c54050764bb32b2.zip
Apply coding rule
Change-Id: I1088231e12ce4160450f56e94b18db5c1b4a3d3c Signed-off-by: jusung son <jusung07.son@samsung.com>
-rwxr-xr-x[-rw-r--r--]src/notification.c536
-rwxr-xr-x[-rw-r--r--]src/notification_db.c26
-rwxr-xr-x[-rw-r--r--]src/notification_group.c51
-rwxr-xr-x[-rw-r--r--]src/notification_internal.c423
-rwxr-xr-x[-rw-r--r--]src/notification_ipc.c368
-rwxr-xr-x[-rw-r--r--]src/notification_list.c31
-rwxr-xr-x[-rw-r--r--]src/notification_noti.c716
-rwxr-xr-x[-rw-r--r--]src/notification_ongoing.c24
-rwxr-xr-x[-rw-r--r--]src/notification_permission.c11
-rwxr-xr-x[-rw-r--r--]src/notification_setting.c89
-rwxr-xr-x[-rw-r--r--]src/notification_status.c3
-rwxr-xr-x[-rw-r--r--]test-app/main.c23
12 files changed, 982 insertions, 1319 deletions
diff --git a/src/notification.c b/src/notification.c
index 104ed77..78fa01f 100644..100755
--- a/src/notification.c
+++ b/src/notification.c
@@ -61,26 +61,24 @@ char *notification_get_pkgname_by_pid(void)
int pid = 0, ret = AUL_R_OK;
int fd;
char *dup_pkgname;
+ char buf[NOTI_PKGNAME_LEN + 1] = { 0, };
pid = getpid();
ret = aul_app_get_pkgname_bypid(pid, pkgname, sizeof(pkgname));
if (ret != AUL_R_OK) {
- char buf[NOTI_PKGNAME_LEN + 1] = { 0, };
snprintf(buf, sizeof(buf), "/proc/%d/cmdline", pid);
fd = open(buf, O_RDONLY);
- if (fd < 0) {
+ if (fd < 0)
return NULL;
- }
ret = read(fd, pkgname, sizeof(pkgname) - 1);
close(fd);
- if (ret <= 0) {
+ if (ret <= 0)
return NULL;
- }
pkgname[ret] = '\0';
/*!
@@ -89,9 +87,8 @@ char *notification_get_pkgname_by_pid(void)
* if the system is not going wrong.
*/
} else {
- if (strlen(pkgname) <= 0) {
+ if (strlen(pkgname) <= 0)
return NULL;
- }
}
dup_pkgname = strdup(pkgname);
@@ -110,15 +107,13 @@ EXPORT_API int notification_set_image(notification_h noti,
char *ret_val = NULL;
/* Check noti and image_path are valid data */
- if (noti == NULL || image_path == NULL) {
+ if (noti == NULL || image_path == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Check image type is valid type */
if (type <= NOTIFICATION_IMAGE_TYPE_NONE
- || type >= NOTIFICATION_IMAGE_TYPE_MAX) {
+ || type >= NOTIFICATION_IMAGE_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Check image path bundle is exist */
if (noti->b_image_path) {
@@ -130,10 +125,9 @@ EXPORT_API int notification_set_image(notification_h noti,
/* Get value using key */
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+ if (ret_val != NULL)
/* If key is exist, remove this value to store new image path */
bundle_del(b, buf_key);
- }
/* Add new image path with type key */
bundle_add_str(b, buf_key, image_path);
@@ -163,15 +157,13 @@ EXPORT_API int notification_get_image(notification_h noti,
char *ret_val = NULL;
/* Check noti and image_path is valid data */
- if (noti == NULL || image_path == NULL) {
+ if (noti == NULL || image_path == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Check image type is valid data */
if (type <= NOTIFICATION_IMAGE_TYPE_NONE
- || type >= NOTIFICATION_IMAGE_TYPE_MAX) {
+ || type >= NOTIFICATION_IMAGE_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Check image path bundle exist */
if (noti->b_image_path) {
@@ -194,12 +186,11 @@ EXPORT_API int notification_get_image(notification_h noti,
/* order : user icon -> launch_pkgname icon -> caller_pkgname icon -> service app icon */
if (*image_path == NULL && type == NOTIFICATION_IMAGE_TYPE_ICON) {
/* Check App icon path is already set */
- if (noti->app_icon_path != NULL) {
+ if (noti->app_icon_path != NULL)
/* image path will be app icon path */
*image_path = noti->app_icon_path;
- } else {
+ else
*image_path = NULL;
- }
}
return NOTIFICATION_ERROR_NONE;
@@ -209,17 +200,15 @@ EXPORT_API int notification_set_time(notification_h noti,
time_t input_time)
{
/* Check noti is valid data */
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- if (input_time == 0) {
+ if (input_time == 0)
/* If input time is 0, set current time */
noti->time = time(NULL);
- } else {
+ else
/* save input time */
noti->time = input_time;
- }
return NOTIFICATION_ERROR_NONE;
}
@@ -228,9 +217,8 @@ EXPORT_API int notification_get_time(notification_h noti,
time_t * ret_time)
{
/* Check noti and time is valid data */
- if (noti == NULL || ret_time == NULL) {
+ if (noti == NULL || ret_time == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Set time infomation */
*ret_time = noti->time;
@@ -242,9 +230,8 @@ EXPORT_API int notification_get_insert_time(notification_h noti,
time_t * ret_time)
{
/* Check noti and ret_time is valid data */
- if (noti == NULL || ret_time == NULL) {
+ if (noti == NULL || ret_time == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Set insert time information */
*ret_time = noti->insert_time;
@@ -273,15 +260,13 @@ EXPORT_API int notification_set_text(notification_h noti,
NOTIFICATION_COUNT_POS_NONE;
/* Check noti is valid data */
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Check text type is valid type */
if (type <= NOTIFICATION_TEXT_TYPE_NONE
- || type >= NOTIFICATION_TEXT_TYPE_MAX) {
+ || type >= NOTIFICATION_TEXT_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Check text bundle exist */
if (text != NULL) {
@@ -294,10 +279,10 @@ EXPORT_API int notification_set_text(notification_h noti,
/* Get value using type key */
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+
+ if (ret_val != NULL)
/* If value exist, remove this to add new value */
bundle_del(b, buf_key);
- }
snprintf(buf_val, sizeof(buf_val), "%s", text);
@@ -329,10 +314,9 @@ EXPORT_API int notification_set_text(notification_h noti,
/* Get value using type key */
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+ if (ret_val != NULL)
/* If value exist, remove this */
bundle_del(b, buf_key);
- }
}
}
@@ -348,10 +332,9 @@ EXPORT_API int notification_set_text(notification_h noti,
/* Get value using type key */
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+ if (ret_val != NULL)
/* If value exist, remove this to add new value */
bundle_del(b, buf_key);
- }
snprintf(buf_val, sizeof(buf_val), "%s", key);
@@ -383,18 +366,16 @@ EXPORT_API int notification_set_text(notification_h noti,
/* Get value using type key */
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+ if (ret_val != NULL)
/* If value exist, remove this */
bundle_del(b, buf_key);
- }
}
}
- if (noti->b_format_args != NULL) {
+ if (noti->b_format_args != NULL)
b = noti->b_format_args;
- } else {
+ else
b = bundle_create();
- }
va_start(var_args, args_type);
@@ -407,9 +388,8 @@ EXPORT_API int notification_set_text(notification_h noti,
snprintf(buf_val, sizeof(buf_val), "%d", var_type);
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+ if (ret_val != NULL)
bundle_del(b, buf_key);
- }
bundle_add_str(b, buf_key, buf_val);
@@ -423,12 +403,12 @@ EXPORT_API int notification_set_text(notification_h noti,
snprintf(buf_val, sizeof(buf_val), "%d", var_value_int);
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+ if (ret_val != NULL)
bundle_del(b, buf_key);
- }
bundle_add_str(b, buf_key, buf_val);
break;
+
case NOTIFICATION_VARIABLE_TYPE_DOUBLE:
var_value_double = va_arg(var_args, double);
@@ -439,12 +419,12 @@ EXPORT_API int notification_set_text(notification_h noti,
var_value_double);
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+ if (ret_val != NULL)
bundle_del(b, buf_key);
- }
bundle_add_str(b, buf_key, buf_val);
break;
+
case NOTIFICATION_VARIABLE_TYPE_STRING:
var_value_string = va_arg(var_args, char *);
@@ -455,12 +435,12 @@ EXPORT_API int notification_set_text(notification_h noti,
var_value_string);
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+ if (ret_val != NULL)
bundle_del(b, buf_key);
- }
bundle_add_str(b, buf_key, buf_val);
break;
+
case NOTIFICATION_VARIABLE_TYPE_COUNT:
var_value_count =
va_arg(var_args, notification_count_pos_type_e);
@@ -472,12 +452,12 @@ EXPORT_API int notification_set_text(notification_h noti,
var_value_count);
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+ if (ret_val != NULL)
bundle_del(b, buf_key);
- }
bundle_add_str(b, buf_key, buf_val);
break;
+
default:
NOTIFICATION_ERR("Error. invalid variable type. : %d",
var_type);
@@ -490,19 +470,17 @@ EXPORT_API int notification_set_text(notification_h noti,
}
va_end(var_args);
- if (noti_err == NOTIFICATION_ERROR_NONE) {
+ if (noti_err == NOTIFICATION_ERROR_NONE)
noti->num_format_args = num_args;
- } else {
+ else
noti->num_format_args = 0;
- }
snprintf(buf_key, sizeof(buf_key), "num%d", type);
snprintf(buf_val, sizeof(buf_val), "%d", noti->num_format_args);
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+ if (ret_val != NULL)
bundle_del(b, buf_key);
- }
bundle_add_str(b, buf_key, buf_val);
@@ -520,7 +498,7 @@ EXPORT_API int notification_get_text(notification_h noti,
char *ret_val = NULL;
char *get_str = NULL;
notification_text_type_e check_type = NOTIFICATION_TEXT_TYPE_NONE;
- //int display_option_flag = 0;
+ /* int display_option_flag = 0; */
char *temp_str = NULL;
char *translated_str = NULL;
@@ -534,22 +512,21 @@ EXPORT_API int notification_get_text(notification_h noti,
int max_len = 0;
/* Check noti is valid data */
- if (noti == NULL || text == NULL) {
+ if (noti == NULL || text == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Check text type is valid type */
if (type <= NOTIFICATION_TEXT_TYPE_NONE
- || type >= NOTIFICATION_TEXT_TYPE_MAX) {
+ || type >= NOTIFICATION_TEXT_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
+
/* Check key */
if (noti->b_key != NULL) {
b = noti->b_key;
/* Get text domain and dir */
- //_notification_get_text_domain(noti);
+ /* _notification_get_text_domain(noti); */
snprintf(buf_key, sizeof(buf_key), "%d", type);
@@ -586,9 +563,8 @@ EXPORT_API int notification_get_text(notification_h noti,
if (b != NULL) {
snprintf(buf_key, sizeof(buf_key), "num%d", check_type);
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+ if (ret_val != NULL)
noti->num_format_args = atoi(ret_val);
- }
}
if (noti->num_format_args == 0) {
@@ -598,18 +574,16 @@ EXPORT_API int notification_get_text(notification_h noti,
snprintf(buf_key, sizeof(buf_key), "%dtype%d",
check_type, num_args);
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+ if (ret_val != NULL)
ret_var_type = atoi(ret_val);
- }
if (ret_var_type == NOTIFICATION_VARIABLE_TYPE_COUNT) {
/* Get var Value */
snprintf(buf_key, sizeof(buf_key), "%dvalue%d",
check_type, num_args);
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+ if (ret_val != NULL)
ret_variable_int = atoi(ret_val);
- }
if (ret_variable_int ==
NOTIFICATION_COUNT_POS_LEFT) {
@@ -648,9 +622,9 @@ EXPORT_API int notification_get_text(notification_h noti,
"%dtype%d", check_type,
num_args);
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+ if (ret_val != NULL)
ret_var_type = atoi(ret_val);
- }
+
if (ret_var_type ==
NOTIFICATION_VARIABLE_TYPE_COUNT) {
/* Get notification count */
@@ -668,9 +642,8 @@ EXPORT_API int notification_get_text(notification_h noti,
check_type,
num_args);
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+ if (ret_val != NULL)
ret_variable_int = atoi(ret_val);
- }
}
snprintf(buf_str,
@@ -722,9 +695,8 @@ EXPORT_API int notification_get_text(notification_h noti,
"%dvalue%d",
check_type, num_args);
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+ if (ret_val != NULL)
ret_variable_double = atof(ret_val);
- }
snprintf(buf_str,
sizeof(buf_str),
@@ -747,9 +719,9 @@ EXPORT_API int notification_get_text(notification_h noti,
"%dtype%d", check_type,
num_args + *(temp_str + 1) - 49);
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+ if (ret_val != NULL)
ret_var_type = atoi(ret_val);
- }
+
if (ret_var_type ==
NOTIFICATION_VARIABLE_TYPE_COUNT) {
/* Get notification count */
@@ -768,9 +740,9 @@ EXPORT_API int notification_get_text(notification_h noti,
check_type,
num_args + *(temp_str + 1) - 49);
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+ if (ret_val != NULL)
ret_variable_int = atoi(ret_val);
- }
+
}
snprintf(buf_str,
@@ -808,9 +780,8 @@ EXPORT_API int notification_get_text(notification_h noti,
"%dvalue%d",
check_type, num_args + *(temp_str + 1) - 49);
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+ if (ret_val != NULL)
ret_variable_double = atof(ret_val);
- }
snprintf(buf_str,
sizeof(buf_str),
@@ -834,9 +805,8 @@ EXPORT_API int notification_get_text(notification_h noti,
snprintf(buf_key, sizeof(buf_key), "%dtype%d",
check_type, num_args);
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+ if (ret_val != NULL)
ret_var_type = atoi(ret_val);
- }
if (ret_var_type ==
NOTIFICATION_VARIABLE_TYPE_COUNT) {
@@ -845,9 +815,8 @@ EXPORT_API int notification_get_text(notification_h noti,
"%dvalue%d", check_type,
num_args);
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+ if (ret_val != NULL)
ret_variable_int = atoi(ret_val);
- }
if (ret_variable_int ==
NOTIFICATION_COUNT_POS_RIGHT) {
@@ -912,23 +881,22 @@ EXPORT_API int notification_set_text_domain(notification_h noti,
const char *dir)
{
/* check noti and domain is valid data */
- if (noti == NULL || domain == NULL || dir == NULL) {
+ if (noti == NULL || domain == NULL || dir == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Check domain */
- if (noti->domain) {
+ if (noti->domain)
/* Remove previous domain */
free(noti->domain);
- }
+
/* Copy domain */
noti->domain = strdup(domain);
/* Check locale dir */
- if (noti->dir) {
+ if (noti->dir)
/* Remove previous locale dir */
free(noti->dir);
- }
+
/* Copy locale dir */
noti->dir = strdup(dir);
@@ -940,19 +908,16 @@ EXPORT_API int notification_get_text_domain(notification_h noti,
char **dir)
{
/* Check noti is valid data */
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Get domain */
- if (domain != NULL && noti->domain != NULL) {
+ if (domain != NULL && noti->domain != NULL)
*domain = noti->domain;
- }
/* Get locale dir */
- if (dir != NULL && noti->dir != NULL) {
+ if (dir != NULL && noti->dir != NULL)
*dir = noti->dir;
- }
return NOTIFICATION_ERROR_NONE;
}
@@ -964,24 +929,22 @@ EXPORT_API int notification_set_time_to_text(notification_h noti, notification_t
char buf[256] = { 0, };
char buf_tag[512] = { 0, };
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- if (time <= 0) {
+
+ if (time <= 0)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
+
if (type <= NOTIFICATION_TEXT_TYPE_NONE
- || type >= NOTIFICATION_TEXT_TYPE_MAX) {
+ || type >= NOTIFICATION_TEXT_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
snprintf(buf, sizeof(buf), "%lu", time);
ret = notification_noti_set_tag(TAG_TIME, buf, buf_tag, sizeof(buf_tag));
- if (ret != NOTIFICATION_ERROR_NONE) {
+ if (ret != NOTIFICATION_ERROR_NONE)
return ret;
- }
return notification_set_text(noti, type, buf_tag, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
}
@@ -990,34 +953,30 @@ EXPORT_API int notification_get_time_from_text(notification_h noti, notification
time_t *time)
{
int ret = NOTIFICATION_ERROR_NONE;
+ char *ret_text = NULL;
+ char *tag_value;
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- if (time == NULL) {
+
+ if (time == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
+
if (type <= NOTIFICATION_TEXT_TYPE_NONE
- || type >= NOTIFICATION_TEXT_TYPE_MAX) {
+ || type >= NOTIFICATION_TEXT_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- char *ret_text = NULL;
ret = notification_get_text(noti, type, &ret_text);
- if (ret != NOTIFICATION_ERROR_NONE || ret_text == NULL) {
+ if (ret != NOTIFICATION_ERROR_NONE || ret_text == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- if (notification_noti_get_tag_type(ret_text) == TAG_TYPE_INVALID) {
+ if (notification_noti_get_tag_type(ret_text) == TAG_TYPE_INVALID)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- char *tag_value = NULL;
tag_value = notification_noti_strip_tag(ret_text);
- if (tag_value == NULL) {
+ if (tag_value == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
*time = atol(tag_value);
free(tag_value);
@@ -1030,24 +989,22 @@ EXPORT_API int notification_set_sound(notification_h noti,
const char *path)
{
/* Check noti is valid data */
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
+
/* Check type is valid */
if (type < NOTIFICATION_SOUND_TYPE_NONE
- || type >= NOTIFICATION_SOUND_TYPE_MAX) {
+ || type >= NOTIFICATION_SOUND_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Save sound type */
noti->sound_type = type;
/* Save sound path if user data type */
if (type == NOTIFICATION_SOUND_TYPE_USER_DATA && path != NULL) {
- if (noti->sound_path != NULL) {
+ if (noti->sound_path != NULL)
free(noti->sound_path);
- }
noti->sound_path = strdup(path);
} else {
@@ -1069,18 +1026,16 @@ EXPORT_API int notification_get_sound(notification_h noti,
const char **path)
{
/* check noti and type is valid data */
- if (noti == NULL || type == NULL) {
+ if (noti == NULL || type == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Set sound type */
*type = noti->sound_type;
/* Set sound path if user data type */
if (noti->sound_type == NOTIFICATION_SOUND_TYPE_USER_DATA
- && path != NULL) {
+ && path != NULL)
*path = noti->sound_path;
- }
return NOTIFICATION_ERROR_NONE;
}
@@ -1090,24 +1045,21 @@ EXPORT_API int notification_set_vibration(notification_h noti,
const char *path)
{
/* Check noti is valid data */
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Check type is valid */
if (type < NOTIFICATION_VIBRATION_TYPE_NONE
- || type >= NOTIFICATION_VIBRATION_TYPE_MAX) {
+ || type >= NOTIFICATION_VIBRATION_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Save vibration type */
noti->vibration_type = type;
/* Save sound path if user data type */
if (type == NOTIFICATION_VIBRATION_TYPE_USER_DATA && path != NULL) {
- if (noti->vibration_path != NULL) {
+ if (noti->vibration_path != NULL)
free(noti->vibration_path);
- }
noti->vibration_path = strdup(path);
} else {
@@ -1130,18 +1082,16 @@ EXPORT_API int notification_get_vibration(notification_h noti,
const char **path)
{
/* check noti and type is valid data */
- if (noti == NULL || type == NULL) {
+ if (noti == NULL || type == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Set vibration type */
*type = noti->vibration_type;
/* Set sound path if user data type */
if (noti->vibration_type == NOTIFICATION_VIBRATION_TYPE_USER_DATA
- && path != NULL) {
+ && path != NULL)
*path = noti->vibration_path;
- }
return NOTIFICATION_ERROR_NONE;
}
@@ -1151,23 +1101,20 @@ EXPORT_API int notification_set_led(notification_h noti,
int led_argb)
{
/* Check noti is valid data */
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Check operation is valid */
if (operation < NOTIFICATION_LED_OP_OFF
- || operation >= NOTIFICATION_LED_OP_MAX) {
+ || operation >= NOTIFICATION_LED_OP_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Save led operation */
noti->led_operation = operation;
/* Save led argb if operation is turning on LED with custom color */
- if (operation == NOTIFICATION_LED_OP_ON_CUSTOM_COLOR) {
+ if (operation == NOTIFICATION_LED_OP_ON_CUSTOM_COLOR)
noti->led_argb = led_argb;
- }
return NOTIFICATION_ERROR_NONE;
}
@@ -1177,18 +1124,16 @@ EXPORT_API int notification_get_led(notification_h noti,
int *led_argb)
{
/* check noti and operation is valid data */
- if (noti == NULL || operation == NULL) {
+ if (noti == NULL || operation == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Set led operation */
*operation = noti->led_operation;
/* Save led argb if operation is turning on LED with custom color */
if (noti->led_operation == NOTIFICATION_LED_OP_ON_CUSTOM_COLOR
- && led_argb != NULL) {
+ && led_argb != NULL)
*led_argb = noti->led_argb;
- }
return NOTIFICATION_ERROR_NONE;
}
@@ -1197,9 +1142,8 @@ EXPORT_API int notification_set_led_time_period(notification_h noti,
int on_ms, int off_ms)
{
/* Check noti is valid data */
- if (noti == NULL || on_ms < 0 || off_ms < 0) {
+ if (noti == NULL || on_ms < 0 || off_ms < 0)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Save led operation */
noti->led_on_ms = on_ms;
@@ -1212,9 +1156,8 @@ EXPORT_API int notification_get_led_time_period(notification_h noti,
int *on_ms, int *off_ms)
{
/* check noti and operation is valid data */
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
if (on_ms)
*(on_ms) = noti->led_on_ms;
@@ -1260,15 +1203,15 @@ EXPORT_API int notification_get_launch_option(notification_h noti,
app_control_h *app_control = (app_control_h *)option;
app_control_h app_control_new = NULL;
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- if (app_control == NULL) {
+
+ if (app_control == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- if (type != NOTIFICATION_LAUNCH_OPTION_APP_CONTROL) {
+
+ if (type != NOTIFICATION_LAUNCH_OPTION_APP_CONTROL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
+
ret = notification_get_execute_option(noti,
NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH,
@@ -1320,9 +1263,8 @@ EXPORT_API int notification_set_event_handler(notification_h noti, notification_
goto out;
}
- if (noti->b_event_handler[event_type] != NULL) {
+ if (noti->b_event_handler[event_type] != NULL)
bundle_free(noti->b_event_handler[event_type]);
- }
noti->b_event_handler[event_type] = app_control_bundle;
@@ -1394,9 +1336,8 @@ EXPORT_API int notification_set_property(notification_h noti,
int flags)
{
/* Check noti is valid data */
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Set flags */
noti->flags_for_property = flags;
@@ -1408,9 +1349,8 @@ EXPORT_API int notification_get_property(notification_h noti,
int *flags)
{
/* Check noti and flags are valid data */
- if (noti == NULL || flags == NULL) {
+ if (noti == NULL || flags == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Set flags */
*flags = noti->flags_for_property;
@@ -1422,14 +1362,14 @@ EXPORT_API int notification_set_display_applist(notification_h noti,
int applist)
{
/* Check noti is valid data */
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
+
/* Set app list */
- if (applist == 0xffffffff) { /* 0xffffffff means old NOTIFICATION_DISPLAY_APP_ALL */
+ if (applist == 0xffffffff) /* 0xffffffff means old NOTIFICATION_DISPLAY_APP_ALL */
applist = NOTIFICATION_DISPLAY_APP_ALL;
- }
+
noti->display_applist = applist;
return NOTIFICATION_ERROR_NONE;
@@ -1439,9 +1379,8 @@ EXPORT_API int notification_get_display_applist(notification_h noti,
int *applist)
{
/* Check noti and applist are valid data */
- if (noti == NULL || applist == NULL) {
+ if (noti == NULL || applist == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Set app list */
*applist = noti->display_applist;
@@ -1453,9 +1392,8 @@ EXPORT_API int notification_set_size(notification_h noti,
double size)
{
/* Check noti is valid data */
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Save progress size */
noti->progress_size = size;
@@ -1467,9 +1405,8 @@ EXPORT_API int notification_get_size(notification_h noti,
double *size)
{
/* Check noti and size is valid data */
- if (noti == NULL || size == NULL) {
+ if (noti == NULL || size == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Set progress size */
*size = noti->progress_size;
@@ -1481,9 +1418,8 @@ EXPORT_API int notification_set_progress(notification_h noti,
double percentage)
{
/* Check noti is valid data */
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Save progress percentage */
noti->progress_percentage = percentage;
@@ -1495,9 +1431,8 @@ EXPORT_API int notification_get_progress(notification_h noti,
double *percentage)
{
/* Check noti and percentage are valid data */
- if (noti == NULL || percentage == NULL) {
+ if (noti == NULL || percentage == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Set progress percentage */
*percentage = noti->progress_percentage;
@@ -1509,16 +1444,14 @@ EXPORT_API int notification_get_pkgname(notification_h noti,
char **pkgname)
{
/* Check noti and pkgname are valid data */
- if (noti == NULL || pkgname == NULL) {
+ if (noti == NULL || pkgname == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Get caller pkgname */
- if (noti->caller_pkgname) {
+ if (noti->caller_pkgname)
*pkgname = noti->caller_pkgname;
- } else {
+ else
*pkgname = NULL;
- }
return NOTIFICATION_ERROR_NONE;
}
@@ -1527,9 +1460,8 @@ EXPORT_API int notification_set_layout(notification_h noti,
notification_ly_type_e layout)
{
/* check noti and pkgname are valid data */
- if (noti == NULL || (layout < NOTIFICATION_LY_NONE || layout >= NOTIFICATION_LY_MAX)) {
+ if (noti == NULL || (layout < NOTIFICATION_LY_NONE || layout >= NOTIFICATION_LY_MAX))
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
noti->layout = layout;
@@ -1540,9 +1472,8 @@ EXPORT_API int notification_get_layout(notification_h noti,
notification_ly_type_e *layout)
{
/* Check noti and pkgname are valid data */
- if (noti == NULL || layout == NULL) {
+ if (noti == NULL || layout == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
*layout = noti->layout;
@@ -1555,9 +1486,8 @@ EXPORT_API int notification_get_type(notification_h noti,
notification_type_e *type)
{
/* Check noti and type is valid data */
- if (noti == NULL || type == NULL) {
+ if (noti == NULL || type == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Set noti type */
*type = noti->type;
@@ -1571,23 +1501,21 @@ EXPORT_API int notification_post(notification_h noti)
int id = 0;
/* Check noti is vaild data */
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Check noti type is valid type */
if (noti->type <= NOTIFICATION_TYPE_NONE
- || noti->type >= NOTIFICATION_TYPE_MAX) {
+ || noti->type >= NOTIFICATION_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Save insert time */
noti->insert_time = time(NULL);
ret = notification_ipc_request_insert(noti, &id);
- if (ret != NOTIFICATION_ERROR_NONE) {
+ if (ret != NOTIFICATION_ERROR_NONE)
return ret;
- }
+
noti->priv_id = id;
NOTIFICATION_DBG("from master:%d", id);
@@ -1617,17 +1545,15 @@ EXPORT_API int notification_delete_all(notification_type_e type)
int ret = 0;
char *caller_pkgname = NULL;
- if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX) {
+ if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
caller_pkgname = notification_get_pkgname_by_pid();
ret = notification_ipc_request_delete_multiple(type, caller_pkgname);
- if (caller_pkgname) {
+ if (caller_pkgname)
free(caller_pkgname);
- }
return ret;
}
@@ -1636,9 +1562,8 @@ EXPORT_API int notification_delete(notification_h noti)
{
int ret = 0;
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
ret = notification_ipc_request_delete_single(NOTIFICATION_TYPE_NONE, noti->caller_pkgname, noti->priv_id);
@@ -1720,21 +1645,17 @@ static notification_h _notification_create(notification_type_e type)
noti->dir = strdup(locale_directory);
out:
- if (domain_name) {
+ if (domain_name)
free(domain_name);
- }
- if (app_id) {
+ if (app_id)
free(app_id);
- }
- if (app_root_path) {
+ if (app_root_path)
free(app_root_path);
- }
- if (package_info) {
+ if (package_info)
package_info_destroy(package_info);
- }
/*!
* \NOTE
@@ -1814,107 +1735,101 @@ 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 {
+ 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 {
+ else
new_noti->launch_pkgname = NULL;
- }
- if (noti->args != NULL) {
+ if (noti->args != NULL)
new_noti->args = bundle_dup(noti->args);
- } else {
+ 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 {
+ 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 {
+ 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 {
+ 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 {
+ 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 {
+ 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 {
+ else
new_noti->b_event_handler[i] = NULL;
- }
}
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 {
+ 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 {
+ else
new_noti->vibration_path = NULL;
- }
+
new_noti->led_operation = noti->led_operation;
new_noti->led_argb = noti->led_argb;
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 {
+ else
new_noti->domain = NULL;
- }
- if (noti->dir != NULL) {
+
+ if (noti->dir != NULL)
new_noti->dir = strdup(noti->dir);
- } else {
+ 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 {
+ 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 {
+ 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 {
+ 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 {
+ else
new_noti->b_image_path = NULL;
- }
new_noti->time = noti->time;
new_noti->insert_time = noti->insert_time;
@@ -1942,86 +1857,76 @@ 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) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- if (noti->caller_pkgname) {
+ if (noti->caller_pkgname)
free(noti->caller_pkgname);
- }
- if (noti->launch_pkgname) {
+
+ if (noti->launch_pkgname)
free(noti->launch_pkgname);
- }
- if (noti->args) {
+
+ if (noti->args)
bundle_free(noti->args);
- }
- if (noti->group_args) {
+
+ if (noti->group_args)
bundle_free(noti->group_args);
- }
- if (noti->b_execute_option) {
+ if (noti->b_execute_option)
bundle_free(noti->b_execute_option);
- }
- if (noti->b_service_responding) {
+
+ if (noti->b_service_responding)
bundle_free(noti->b_service_responding);
- }
- if (noti->b_service_single_launch) {
+
+ if (noti->b_service_single_launch)
bundle_free(noti->b_service_single_launch);
- }
- if (noti->b_service_multi_launch) {
+
+ if (noti->b_service_multi_launch)
bundle_free(noti->b_service_multi_launch);
- }
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]);
- }
}
- if (noti->sound_path) {
+ if (noti->sound_path)
free(noti->sound_path);
- }
- if (noti->vibration_path) {
+
+ if (noti->vibration_path)
free(noti->vibration_path);
- }
- if (noti->domain) {
+ if (noti->domain)
free(noti->domain);
- }
- if (noti->dir) {
+
+ if (noti->dir)
free(noti->dir);
- }
- if (noti->b_text) {
+ if (noti->b_text)
bundle_free(noti->b_text);
- }
- if (noti->b_key) {
+
+ if (noti->b_key)
bundle_free(noti->b_key);
- }
- if (noti->b_format_args) {
+
+ if (noti->b_format_args)
bundle_free(noti->b_format_args);
- }
- if (noti->b_image_path) {
+ if (noti->b_image_path)
bundle_free(noti->b_image_path);
- }
- if (noti->app_icon_path) {
+ if (noti->app_icon_path)
free(noti->app_icon_path);
- }
- if (noti->app_name) {
+
+ if (noti->app_name)
free(noti->app_name);
- }
- if (noti->temp_title) {
+
+ if (noti->temp_title)
free(noti->temp_title);
- }
- if (noti->temp_content) {
+
+ if (noti->temp_content)
free(noti->temp_content);
- }
- if (noti->tag) {
+ if (noti->tag)
free(noti->tag);
- }
free(noti);
@@ -2031,15 +1936,14 @@ EXPORT_API int notification_free(notification_h noti)
EXPORT_API int notification_set_tag(notification_h noti, const char *tag)
{
/* Check noti is valid data */
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
if (tag != NULL) {
/* save input TAG */
- if (noti->tag != NULL) {
+ if (noti->tag != NULL)
free(noti->tag);
- }
+
noti->tag = strdup(tag);
}
@@ -2050,9 +1954,8 @@ EXPORT_API int notification_set_tag(notification_h noti, const char *tag)
EXPORT_API int notification_get_tag(notification_h noti, const char **tag)
{
/* Check noti is valid data */
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
*tag = noti->tag;
return NOTIFICATION_ERROR_NONE;
@@ -2060,9 +1963,8 @@ EXPORT_API int notification_get_tag(notification_h noti, const char **tag)
void notification_call_posted_toast_cb(const char *message)
{
- if (posted_toast_message_cb != NULL) {
+ if (posted_toast_message_cb != NULL)
posted_toast_message_cb((void*)message);
- }
}
EXPORT_API int notification_set_ongoing_flag(notification_h noti, bool ongoing_flag)
diff --git a/src/notification_db.c b/src/notification_db.c
index 7fabeac..a89188b 100644..100755
--- a/src/notification_db.c
+++ b/src/notification_db.c
@@ -39,11 +39,11 @@ sqlite3 * notification_db_open(const char *dbfile)
ret = db_util_open(dbfile, &db, 0);
if (ret != SQLITE_OK) {
- if (ret == SQLITE_PERM) {
+ if (ret == SQLITE_PERM)
set_last_result(NOTIFICATION_ERROR_PERMISSION_DENIED);
- } else {
+ else
set_last_result(NOTIFICATION_ERROR_FROM_DB);
- }
+
return NULL;
}
@@ -54,9 +54,8 @@ int notification_db_close(sqlite3 ** db)
{
int ret = 0;
- if (db == NULL || *db == NULL) {
+ if (db == NULL || *db == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
ret = db_util_close(*db);
if (ret != SQLITE_OK) {
@@ -74,12 +73,11 @@ int notification_db_exec(sqlite3 * db, const char *query, int *num_changes)
int ret = 0;
sqlite3_stmt *stmt = NULL;
- if (db == NULL) {
+ if (db == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- if (query == NULL) {
+
+ if (query == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
if (ret != SQLITE_OK) {
@@ -91,9 +89,9 @@ int notification_db_exec(sqlite3 * db, const char *query, int *num_changes)
if (stmt != NULL) {
ret = sqlite3_step(stmt);
if (ret == SQLITE_OK || ret == SQLITE_DONE) {
- if (num_changes != NULL) {
+ if (num_changes != NULL)
*num_changes = sqlite3_changes(db);
- }
+
sqlite3_finalize(stmt);
} else {
NOTIFICATION_ERR("DB err(%d) : %s", ret,
@@ -113,9 +111,8 @@ char *notification_db_column_text(sqlite3_stmt * stmt, int col)
const unsigned char *col_text = NULL;
col_text = sqlite3_column_text(stmt, col);
- if (col_text == NULL || col_text[0] == '\0') {
+ if (col_text == NULL || col_text[0] == '\0')
return NULL;
- }
return strdup((char *)col_text);
}
@@ -125,9 +122,8 @@ bundle *notification_db_column_bundle(sqlite3_stmt * stmt, int col)
const unsigned char *col_bundle = NULL;
col_bundle = sqlite3_column_text(stmt, col);
- if (col_bundle == NULL || col_bundle[0] == '\0') {
+ if (col_bundle == NULL || col_bundle[0] == '\0')
return NULL;
- }
return bundle_decode(col_bundle, strlen((char *)col_bundle));
}
diff --git a/src/notification_group.c b/src/notification_group.c
index 439d9c8..3f4d718 100644..100755
--- a/src/notification_group.c
+++ b/src/notification_group.c
@@ -46,20 +46,19 @@ static int _notification_group_check_data_inserted(const char *pkgname,
}
ret = sqlite3_step(stmt);
- if (ret == SQLITE_ROW) {
+ if (ret == SQLITE_ROW)
result = sqlite3_column_int(stmt, 0);
- } else {
+ else
result = 0;
- }
+
NOTIFICATION_INFO("Check Data Inserted : query[%s], result : [%d]",
query, result);
sqlite3_finalize(stmt);
- if (result > 0) {
+ if (result > 0)
return NOTIFICATION_ERROR_ALREADY_EXIST_ID;
- }
return NOTIFICATION_ERROR_NONE;
}
@@ -75,9 +74,8 @@ int notification_group_set_badge(const char *pkgname,
/* Open DB */
db = notification_db_open(DBPATH);
- if (!db) {
+ if (!db)
return get_last_result();
- }
/* Check pkgname & group_id */
ret = _notification_group_check_data_inserted(pkgname, group_id, db);
@@ -102,31 +100,27 @@ int notification_group_set_badge(const char *pkgname,
NOTIFICATION_ERR("Insert Query : %s", query);
NOTIFICATION_ERR("Insert DB error(%d) : %s", ret,
sqlite3_errmsg(db));
- if (stmt) {
+ if (stmt)
sqlite3_finalize(stmt);
- }
- if (db) {
+ if (db)
notification_db_close(&db);
- }
+
return NOTIFICATION_ERROR_FROM_DB;
}
ret = sqlite3_step(stmt);
- if (ret == SQLITE_OK || ret == SQLITE_DONE) {
+ if (ret == SQLITE_OK || ret == SQLITE_DONE)
result = NOTIFICATION_ERROR_NONE;
- } else {
+ else
result = NOTIFICATION_ERROR_FROM_DB;
- }
- if (stmt) {
+ if (stmt)
sqlite3_finalize(stmt);
- }
/* Close DB */
- if (db) {
+ if (db)
notification_db_close(&db);
- }
return result;
}
@@ -142,31 +136,28 @@ int notification_group_get_badge(const char *pkgname,
/* Open DB */
db = notification_db_open(DBPATH);
- if (!db) {
+ if (!db)
return get_last_result();
- }
/* Make query */
if (group_id == NOTIFICATION_GROUP_ID_NONE) {
/* Check Group id None is exist */
- ret =
- _notification_group_check_data_inserted(pkgname, group_id,
- db);
+ ret = _notification_group_check_data_inserted(pkgname, group_id, db);
- if (ret == NOTIFICATION_ERROR_NONE) {
+ if (ret == NOTIFICATION_ERROR_NONE)
/* Get all of pkgname count if none group id is not exist */
snprintf(query, sizeof(query),
"select sum(badge) "
"from noti_group_data "
"where caller_pkgname = '%s'", pkgname);
- } else {
+ else
/* Get none group id count */
snprintf(query, sizeof(query),
"select badge "
"from noti_group_data "
"where caller_pkgname = '%s' and group_id = %d",
pkgname, group_id);
- }
+
} else {
snprintf(query, sizeof(query),
"select badge "
@@ -187,16 +178,14 @@ int notification_group_get_badge(const char *pkgname,
}
ret = sqlite3_step(stmt);
- if (ret == SQLITE_ROW) {
+ if (ret == SQLITE_ROW)
*count = sqlite3_column_int(stmt, col++);
- }
sqlite3_finalize(stmt);
- // db close
- if (db) {
+ /* db close */
+ if (db)
notification_db_close(&db);
- }
return NOTIFICATION_ERROR_NONE;
}
diff --git a/src/notification_internal.c b/src/notification_internal.c
index 05b2284..c14c68c 100644..100755
--- a/src/notification_internal.c
+++ b/src/notification_internal.c
@@ -71,14 +71,14 @@ void notification_call_changed_cb(notification_op *op_list, int op_num)
notification_cb_list_s *noti_cb_list = NULL;
notification_type_e type = 0;
- if (g_notification_cb_list == NULL) {
+ if (g_notification_cb_list == NULL)
return;
- }
+
noti_cb_list = g_notification_cb_list;
- while (noti_cb_list->prev != NULL) {
+ while (noti_cb_list->prev != NULL)
noti_cb_list = noti_cb_list->prev;
- }
+
if (op_list == NULL) {
NOTIFICATION_ERR("invalid data");
@@ -104,9 +104,8 @@ void notification_call_changed_cb(notification_op *op_list, int op_num)
EXPORT_API int notification_add_deferred_task(
void (*deferred_task_cb)(void *data), void *user_data)
{
- if (deferred_task_cb == NULL) {
+ if (deferred_task_cb == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
return notification_ipc_add_deffered_task(deferred_task_cb, user_data);
}
@@ -114,9 +113,8 @@ EXPORT_API int notification_add_deferred_task(
EXPORT_API int notification_del_deferred_task(
void (*deferred_task_cb)(void *data))
{
- if (deferred_task_cb == NULL) {
+ if (deferred_task_cb == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
return notification_ipc_del_deffered_task(deferred_task_cb);
}
@@ -128,12 +126,11 @@ EXPORT_API int notification_resister_changed_cb(void (*changed_cb)
notification_cb_list_s *noti_cb_list_new = NULL;
notification_cb_list_s *noti_cb_list = NULL;
- if (changed_cb == NULL) {
+ if (changed_cb == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- if (notification_ipc_monitor_init() != NOTIFICATION_ERROR_NONE) {
+
+ if (notification_ipc_monitor_init() != NOTIFICATION_ERROR_NONE)
return NOTIFICATION_ERROR_IO_ERROR;
- }
noti_cb_list_new =
(notification_cb_list_s *) malloc(sizeof(notification_cb_list_s));
@@ -156,9 +153,9 @@ EXPORT_API int notification_resister_changed_cb(void (*changed_cb)
} else {
noti_cb_list = g_notification_cb_list;
- while (noti_cb_list->next != NULL) {
+ while (noti_cb_list->next != NULL)
noti_cb_list = noti_cb_list->next;
- }
+
noti_cb_list->next = noti_cb_list_new;
noti_cb_list_new->prev = noti_cb_list;
@@ -175,32 +172,30 @@ EXPORT_API int notification_unresister_changed_cb(void (*changed_cb)
noti_cb_list = g_notification_cb_list;
- if (changed_cb == NULL) {
+ if (changed_cb == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- if (noti_cb_list == NULL) {
+
+ if (noti_cb_list == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- while (noti_cb_list->prev != NULL) {
+ while (noti_cb_list->prev != NULL)
noti_cb_list = noti_cb_list->prev;
- }
+
do {
if (noti_cb_list->changed_cb == changed_cb) {
noti_cb_list_prev = noti_cb_list->prev;
noti_cb_list_next = noti_cb_list->next;
- if (noti_cb_list_prev == NULL) {
+ if (noti_cb_list_prev == NULL)
g_notification_cb_list = noti_cb_list_next;
- } else {
+ else
noti_cb_list_prev->next = noti_cb_list_next;
- }
if (noti_cb_list_next == NULL) {
- if (noti_cb_list_prev != NULL) {
+ if (noti_cb_list_prev != NULL)
noti_cb_list_prev->next = NULL;
- }
+
} else {
noti_cb_list_next->prev = noti_cb_list_prev;
}
@@ -228,35 +223,32 @@ EXPORT_API int notification_update_progress(notification_h noti,
double input_progress = 0.0;
if (priv_id <= NOTIFICATION_PRIV_ID_NONE) {
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- } else {
+ else
input_priv_id = noti->priv_id;
- }
+
} else {
input_priv_id = priv_id;
}
- if (noti == NULL) {
+ if (noti == NULL)
caller_pkgname = notification_get_pkgname_by_pid();
- } else {
+ else
caller_pkgname = strdup(noti->caller_pkgname);
- }
- if (progress < 0.0) {
+ if (progress < 0.0)
input_progress = 0.0;
- } else if (progress > 1.0) {
+ else if (progress > 1.0)
input_progress = 1.0;
- } else {
+ else
input_progress = progress;
- }
ret = notification_ongoing_update_progress(caller_pkgname, input_priv_id,
input_progress);
- if (caller_pkgname) {
+ if (caller_pkgname)
free(caller_pkgname);
- }
return ret;
}
@@ -271,33 +263,29 @@ EXPORT_API int notification_update_size(notification_h noti,
double input_size = 0.0;
if (priv_id <= NOTIFICATION_PRIV_ID_NONE) {
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- } else {
+ else
input_priv_id = noti->priv_id;
- }
} else {
input_priv_id = priv_id;
}
- if (noti == NULL) {
+ if (noti == NULL)
caller_pkgname = notification_get_pkgname_by_pid();
- } else {
+ else
caller_pkgname = strdup(noti->caller_pkgname);
- }
- if (size < 0.0) {
+ if (size < 0.0)
input_size = 0.0;
- } else {
+ else
input_size = size;
- }
ret = notification_ongoing_update_size(caller_pkgname, input_priv_id,
input_size);
- if (caller_pkgname) {
+ if (caller_pkgname)
free(caller_pkgname);
- }
return ret;
}
@@ -311,27 +299,25 @@ EXPORT_API int notification_update_content(notification_h noti,
int ret = 0;
if (priv_id <= NOTIFICATION_PRIV_ID_NONE) {
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- } else {
+ else
input_priv_id = noti->priv_id;
- }
+
} else {
input_priv_id = priv_id;
}
- if (noti == NULL) {
+ if (noti == NULL)
caller_pkgname = notification_get_pkgname_by_pid();
- } else {
+ else
caller_pkgname = strdup(noti->caller_pkgname);
- }
ret = notification_ongoing_update_content(caller_pkgname, input_priv_id,
content);
- if (caller_pkgname) {
+ if (caller_pkgname)
free(caller_pkgname);
- }
return ret;
}
@@ -360,12 +346,9 @@ EXPORT_API int notification_get_icon(notification_h noti,
notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
&ret_image_path);
- if (ret_err == NOTIFICATION_ERROR_NONE && icon_path != NULL) {
+ if (ret_err == NOTIFICATION_ERROR_NONE && icon_path != NULL)
*icon_path = ret_image_path;
- //NOTIFICATION_DBG("Get icon : %s", *icon_path);
- }
-
return ret_err;
}
@@ -393,13 +376,11 @@ EXPORT_API int notification_get_title(notification_h noti,
notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
&ret_text);
- if (title != NULL) {
+ if (title != NULL)
*title = ret_text;
- }
- if (loc_title != NULL) {
+ if (loc_title != NULL)
*loc_title = NULL;
- }
return noti_err;
}
@@ -428,13 +409,11 @@ EXPORT_API int notification_get_content(notification_h noti,
notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
&ret_text);
- if (content != NULL) {
+ if (content != NULL)
*content = ret_text;
- }
- if (loc_content != NULL) {
+ if (loc_content != NULL)
*loc_content = NULL;
- }
return noti_err;
@@ -444,13 +423,11 @@ EXPORT_API int notification_get_content(notification_h noti,
(VCONFKEY_SETAPPL_STATE_TICKER_NOTI_DISPLAY_CONTENT_BOOL, &boolval);
if (ret == -1 || boolval == 0) {
- if (content != NULL && noti->default_content != NULL) {
+ if (content != NULL && noti->default_content != NULL)
*content = noti->default_content;
- }
- if (loc_content != NULL && noti->loc_default_content != NULL) {
+ if (loc_content != NULL && noti->loc_default_content != NULL)
*loc_content = noti->loc_default_content;
- }
}
#endif
}
@@ -458,13 +435,11 @@ EXPORT_API int notification_get_content(notification_h noti,
EXPORT_API int notification_set_application(notification_h noti,
const char *pkgname)
{
- if (noti == NULL || pkgname == NULL) {
+ if (noti == NULL || pkgname == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- if (noti->launch_pkgname) {
+ if (noti->launch_pkgname)
free(noti->launch_pkgname);
- }
noti->launch_pkgname = strdup(pkgname);
@@ -474,15 +449,13 @@ EXPORT_API int notification_set_application(notification_h noti,
EXPORT_API int notification_get_application(notification_h noti,
char **pkgname)
{
- if (noti == NULL || pkgname == NULL) {
+ if (noti == NULL || pkgname == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- if (noti->launch_pkgname) {
+ if (noti->launch_pkgname)
*pkgname = noti->launch_pkgname;
- } else {
+ else
*pkgname = noti->caller_pkgname;
- }
return NOTIFICATION_ERROR_NONE;
}
@@ -491,13 +464,11 @@ EXPORT_API int notification_set_args(notification_h noti,
bundle * args,
bundle * group_args)
{
- if (noti == NULL || args == NULL) {
+ if (noti == NULL || args == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- if (noti->args) {
+ if (noti->args)
bundle_free(noti->args);
- }
noti->args = bundle_dup(args);
@@ -506,9 +477,8 @@ EXPORT_API int notification_set_args(notification_h noti,
noti->group_args = NULL;
}
- if (group_args != NULL) {
+ if (group_args != NULL)
noti->group_args = bundle_dup(group_args);
- }
return NOTIFICATION_ERROR_NONE;
}
@@ -517,19 +487,16 @@ EXPORT_API int notification_get_args(notification_h noti,
bundle ** args,
bundle ** group_args)
{
- if (noti == NULL || args == NULL) {
+ if (noti == NULL || args == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- if (noti->args) {
+ if (noti->args)
*args = noti->args;
- } else {
+ else
*args = NULL;
- }
- if (group_args != NULL && noti->group_args) {
+ if (group_args != NULL && noti->group_args)
*group_args = noti->group_args;
- }
return NOTIFICATION_ERROR_NONE;
}
@@ -540,14 +507,12 @@ EXPORT_API int notification_get_grouping_list(notification_type_e type, int coun
notification_list_h get_list = NULL;
int ret = 0;
- if (list == NULL) {
+ if (list == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
ret = notification_noti_get_grouping_list(type, count, &get_list);
- if (ret != NOTIFICATION_ERROR_NONE) {
+ if (ret != NOTIFICATION_ERROR_NONE)
return ret;
- }
*list = get_list;
@@ -561,23 +526,22 @@ EXPORT_API int notification_delete_group_by_group_id(const char *pkgname,
int ret = 0;
char *caller_pkgname = NULL;
- if (pkgname == NULL) {
+ if (pkgname == NULL)
caller_pkgname = notification_get_pkgname_by_pid();
- } else {
+ else
caller_pkgname = strdup(pkgname);
- }
ret = notification_ipc_request_delete_multiple(type, caller_pkgname);
if (ret != NOTIFICATION_ERROR_NONE) {
- if (caller_pkgname) {
+ if (caller_pkgname)
free(caller_pkgname);
- }
+
return ret;
}
- if (caller_pkgname) {
+ if (caller_pkgname)
free(caller_pkgname);
- }
+
return NOTIFICATION_ERROR_NONE;
}
@@ -588,23 +552,22 @@ EXPORT_API int notification_delete_group_by_priv_id(const char *pkgname,
int ret = 0;
char *caller_pkgname = NULL;
- if (pkgname == NULL) {
+ if (pkgname == NULL)
caller_pkgname = notification_get_pkgname_by_pid();
- } else {
+ else
caller_pkgname = strdup(pkgname);
- }
ret = notification_ipc_request_delete_single(type, caller_pkgname, priv_id);
if (ret != NOTIFICATION_ERROR_NONE) {
- if (caller_pkgname) {
+ if (caller_pkgname)
free(caller_pkgname);
- }
+
return ret;
}
- if (caller_pkgname) {
+ if (caller_pkgname)
free(caller_pkgname);
- }
+
return NOTIFICATION_ERROR_NONE;
}
@@ -616,16 +579,14 @@ EXPORT_API int notification_get_count(notification_type_e type,
int ret = 0;
int noti_count = 0;
- if (count == NULL) {
+ if (count == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
ret =
notification_noti_get_count(type, pkgname, group_id, priv_id,
&noti_count);
- if (ret != NOTIFICATION_ERROR_NONE) {
+ if (ret != NOTIFICATION_ERROR_NONE)
return ret;
- }
*count = noti_count;
@@ -636,9 +597,8 @@ EXPORT_API int notification_clear(notification_type_e type)
{
int ret = 0;
- if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX) {
+ if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
ret = notification_ipc_request_delete_multiple(type, NULL);
@@ -648,29 +608,28 @@ EXPORT_API int notification_clear(notification_type_e type)
EXPORT_API int notification_op_get_data(notification_op *noti_op, notification_op_data_type_e type,
void *data)
{
- if (noti_op == NULL || data == NULL) {
+ if (noti_op == NULL || data == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
switch (type) {
- case NOTIFICATION_OP_DATA_TYPE:
- *((int*)data) = noti_op->type;
- break;
- case NOTIFICATION_OP_DATA_PRIV_ID:
- *((int*)data) = noti_op->priv_id;
- break;
- case NOTIFICATION_OP_DATA_NOTI:
- *((notification_h *)data) = noti_op->noti;
- break;
- case NOTIFICATION_OP_DATA_EXTRA_INFO_1:
- *((int*)data) = noti_op->extra_info_1;
- break;
- case NOTIFICATION_OP_DATA_EXTRA_INFO_2:
- *((int*)data) = noti_op->extra_info_2;
- break;
- default:
- return NOTIFICATION_ERROR_INVALID_PARAMETER;
- break;
+ case NOTIFICATION_OP_DATA_TYPE:
+ *((int*)data) = noti_op->type;
+ break;
+ case NOTIFICATION_OP_DATA_PRIV_ID:
+ *((int*)data) = noti_op->priv_id;
+ break;
+ case NOTIFICATION_OP_DATA_NOTI:
+ *((notification_h *)data) = noti_op->noti;
+ break;
+ case NOTIFICATION_OP_DATA_EXTRA_INFO_1:
+ *((int*)data) = noti_op->extra_info_1;
+ break;
+ case NOTIFICATION_OP_DATA_EXTRA_INFO_2:
+ *((int*)data) = noti_op->extra_info_2;
+ break;
+ default:
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ break;
}
return NOTIFICATION_ERROR_NONE;
@@ -680,9 +639,8 @@ EXPORT_API int notification_set_pkgname(notification_h noti,
const char *pkgname)
{
/* check noti and pkgname are valid data */
- if (noti == NULL || pkgname == NULL) {
+ if (noti == NULL || pkgname == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Remove previous caller pkgname */
if (noti->caller_pkgname) {
@@ -701,21 +659,18 @@ EXPORT_API int notification_delete_all_by_type(const char *pkgname,
int ret = 0;
char *caller_pkgname = NULL;
- if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX) {
+ if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- if (pkgname == NULL) {
+ if (pkgname == NULL)
caller_pkgname = notification_get_pkgname_by_pid();
- } else {
+ else
caller_pkgname = strdup(pkgname);
- }
ret = notification_ipc_request_delete_multiple(type, caller_pkgname);
- if (caller_pkgname) {
+ if (caller_pkgname)
free(caller_pkgname);
- }
return ret;
}
@@ -727,21 +682,18 @@ EXPORT_API int notification_delete_by_priv_id(const char *pkgname,
int ret = 0;
char *caller_pkgname = NULL;
- if (priv_id <= NOTIFICATION_PRIV_ID_NONE) {
+ if (priv_id <= NOTIFICATION_PRIV_ID_NONE)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- if (pkgname == NULL) {
+ if (pkgname == NULL)
caller_pkgname = notification_get_pkgname_by_pid();
- } else {
+ else
caller_pkgname = strdup(pkgname);
- }
ret = notification_ipc_request_delete_single(type, caller_pkgname, priv_id);
- if (caller_pkgname) {
+ if (caller_pkgname)
free(caller_pkgname);
- }
return ret;
}
@@ -756,19 +708,16 @@ EXPORT_API int notification_set_execute_option(notification_h noti,
char *ret_val = NULL;
bundle *b = NULL;
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
if (type <= NOTIFICATION_EXECUTE_TYPE_NONE
- || type >= NOTIFICATION_EXECUTE_TYPE_MAX) {
+ || type >= NOTIFICATION_EXECUTE_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Create execute option bundle if does not exist */
- if (noti->b_execute_option == NULL) {
+ if (noti->b_execute_option == NULL)
noti->b_execute_option = bundle_create();
- }
b = noti->b_execute_option;
@@ -779,10 +728,9 @@ EXPORT_API int notification_set_execute_option(notification_h noti,
/* Check text key exist */
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+ if (ret_val != NULL)
/* Remove previous data */
bundle_del(b, buf_key);
- }
/* Add text data */
bundle_add_str(b, buf_key, text);
@@ -795,54 +743,53 @@ EXPORT_API int notification_set_execute_option(notification_h noti,
/* Check key key exist */
bundle_get_str(b, buf_key, &ret_val);
- if (ret_val != NULL) {
+ if (ret_val != NULL)
/* Remove previous data */
bundle_del(b, buf_key);
- }
/* Add text data */
bundle_add_str(b, buf_key, key);
}
switch ((int)type) {
- case NOTIFICATION_EXECUTE_TYPE_RESPONDING:
- /* Remove previous data if exist */
- if (noti->b_service_responding != NULL) {
- bundle_free(noti->b_service_responding);
- noti->b_service_responding = NULL;
- }
+ case NOTIFICATION_EXECUTE_TYPE_RESPONDING:
+ /* Remove previous data if exist */
+ if (noti->b_service_responding != NULL) {
+ bundle_free(noti->b_service_responding);
+ noti->b_service_responding = NULL;
+ }
- /* Save service handle */
- if (service_handle != NULL) {
- noti->b_service_responding = bundle_dup(service_handle);
- }
- break;
- case NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH:
- /* Remove previous data if exist */
- if (noti->b_service_single_launch != NULL) {
- bundle_free(noti->b_service_single_launch);
- noti->b_service_single_launch = NULL;
- }
+ /* Save service handle */
+ if (service_handle != NULL)
+ noti->b_service_responding = bundle_dup(service_handle);
- /* Save service handle */
- if (service_handle != NULL) {
- noti->b_service_single_launch =
- bundle_dup(service_handle);
- }
- break;
- case NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH:
- /* Remove previous data if exist */
- if (noti->b_service_multi_launch != NULL) {
- bundle_free(noti->b_service_multi_launch);
- noti->b_service_multi_launch = NULL;
- }
+ break;
+ case NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH:
+ /* Remove previous data if exist */
+ if (noti->b_service_single_launch != NULL) {
+ bundle_free(noti->b_service_single_launch);
+ noti->b_service_single_launch = NULL;
+ }
- /* Save service handle */
- if (service_handle != NULL) {
- noti->b_service_multi_launch =
- bundle_dup(service_handle);
- }
- break;
+ /* Save service handle */
+ if (service_handle != NULL)
+ noti->b_service_single_launch =
+ bundle_dup(service_handle);
+
+ break;
+ case NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH:
+ /* Remove previous data if exist */
+ if (noti->b_service_multi_launch != NULL) {
+ bundle_free(noti->b_service_multi_launch);
+ noti->b_service_multi_launch = NULL;
+ }
+
+ /* Save service handle */
+ if (service_handle != NULL)
+ noti->b_service_multi_launch =
+ bundle_dup(service_handle);
+
+ break;
}
return NOTIFICATION_ERROR_NONE;
@@ -852,25 +799,22 @@ EXPORT_API int notification_get_id(notification_h noti,
int *group_id, int *priv_id)
{
/* check noti is valid data */
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Check group_id is valid data */
if (group_id) {
/* Set group id */
- if (noti->group_id < NOTIFICATION_GROUP_ID_NONE) {
+ if (noti->group_id < NOTIFICATION_GROUP_ID_NONE)
*group_id = NOTIFICATION_GROUP_ID_NONE;
- } else {
+ else
*group_id = noti->group_id;
- }
}
/* Check priv_id is valid data */
- if (priv_id) {
+ if (priv_id)
/* Set priv_id */
*priv_id = noti->priv_id;
- }
return NOTIFICATION_ERROR_NONE;
}
@@ -904,6 +848,7 @@ EXPORT_API notification_h notification_new(notification_type_e type,
static void _notification_get_text_domain(notification_h noti)
{
+/*
if (noti->domain != NULL) {
}
@@ -911,6 +856,7 @@ static void _notification_get_text_domain(notification_h noti)
if (noti->dir != NULL) {
}
+*/
}
EXPORT_API int notification_get_execute_option(notification_h noti,
@@ -923,14 +869,13 @@ EXPORT_API int notification_get_execute_option(notification_h noti,
char *get_str = NULL;
bundle *b = NULL;
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
if (type <= NOTIFICATION_EXECUTE_TYPE_NONE
- || type >= NOTIFICATION_EXECUTE_TYPE_MAX) {
+ || type >= NOTIFICATION_EXECUTE_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
+
switch (type) {
case NOTIFICATION_EXECUTE_TYPE_RESPONDING:
@@ -947,12 +892,11 @@ EXPORT_API int notification_get_execute_option(notification_h noti,
}
if (b != NULL) {
- // Return text
+ /* Return text */
if (text != NULL) {
- // Get text domain and dir
- if (noti->domain == NULL || noti->dir == NULL) {
+ /* Get text domain and dir */
+ if (noti->domain == NULL || noti->dir == NULL)
_notification_get_text_domain(noti);
- }
/* Make key */
snprintf(buf_key, sizeof(buf_key), "key%d", type);
@@ -984,9 +928,8 @@ EXPORT_API int notification_get_execute_option(notification_h noti,
}
}
- if (service_handle != NULL) {
+ if (service_handle != NULL)
*service_handle = b;
- }
return NOTIFICATION_ERROR_NONE;
}
@@ -998,29 +941,26 @@ EXPORT_API int notification_insert(notification_h noti,
int id = 0;
/* Check noti is vaild data */
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Check noti type is valid type */
if (noti->type <= NOTIFICATION_TYPE_NONE
- || noti->type >= NOTIFICATION_TYPE_MAX) {
+ || noti->type >= NOTIFICATION_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Save insert time */
noti->insert_time = time(NULL);
ret = notification_ipc_request_insert(noti, &id);
- if (ret != NOTIFICATION_ERROR_NONE) {
+ if (ret != NOTIFICATION_ERROR_NONE)
return ret;
- }
+
noti->priv_id = id;
NOTIFICATION_DBG("from master:%d", id);
/* If priv_id is valid data, set priv_id */
- if (priv_id != NULL) {
+ if (priv_id != NULL)
*priv_id = noti->priv_id;
- }
return NOTIFICATION_ERROR_NONE;
}
@@ -1030,9 +970,8 @@ EXPORT_API int notification_update_async(notification_h noti,
{
int ret = 0;
- if (noti == NULL) {
+ if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Update insert time ? */
noti->insert_time = time(NULL);
@@ -1048,12 +987,11 @@ EXPORT_API int notification_register_detailed_changed_cb(
notification_cb_list_s *noti_cb_list_new = NULL;
notification_cb_list_s *noti_cb_list = NULL;
- if (detailed_changed_cb == NULL) {
+ if (detailed_changed_cb == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- if (notification_ipc_monitor_init() != NOTIFICATION_ERROR_NONE) {
+
+ if (notification_ipc_monitor_init() != NOTIFICATION_ERROR_NONE)
return NOTIFICATION_ERROR_IO_ERROR;
- }
noti_cb_list_new =
(notification_cb_list_s *) malloc(sizeof(notification_cb_list_s));
@@ -1076,9 +1014,9 @@ EXPORT_API int notification_register_detailed_changed_cb(
} else {
noti_cb_list = g_notification_cb_list;
- while (noti_cb_list->next != NULL) {
+ while (noti_cb_list->next != NULL)
noti_cb_list = noti_cb_list->next;
- }
+
noti_cb_list->next = noti_cb_list_new;
noti_cb_list_new->prev = noti_cb_list;
@@ -1096,32 +1034,31 @@ EXPORT_API int notification_unregister_detailed_changed_cb(
noti_cb_list = g_notification_cb_list;
- if (detailed_changed_cb == NULL) {
+ if (detailed_changed_cb == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- if (noti_cb_list == NULL) {
+
+ if (noti_cb_list == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- while (noti_cb_list->prev != NULL) {
+
+ while (noti_cb_list->prev != NULL)
noti_cb_list = noti_cb_list->prev;
- }
+
do {
if (noti_cb_list->detailed_changed_cb == detailed_changed_cb) {
noti_cb_list_prev = noti_cb_list->prev;
noti_cb_list_next = noti_cb_list->next;
- if (noti_cb_list_prev == NULL) {
+ if (noti_cb_list_prev == NULL)
g_notification_cb_list = noti_cb_list_next;
- } else {
+ else
noti_cb_list_prev->next = noti_cb_list_next;
- }
if (noti_cb_list_next == NULL) {
- if (noti_cb_list_prev != NULL) {
+ if (noti_cb_list_prev != NULL)
noti_cb_list_prev->next = NULL;
- }
+
} else {
noti_cb_list_next->prev = noti_cb_list_prev;
}
diff --git a/src/notification_ipc.c b/src/notification_ipc.c
index dc02d91..b74ab04 100644..100755
--- a/src/notification_ipc.c
+++ b/src/notification_ipc.c
@@ -90,12 +90,11 @@ static void _master_started_cb_task(keynode_t *node, void *data);
static inline char *_string_get(char *string)
{
- if (string == NULL) {
+ if (string == NULL)
return NULL;
- }
- if (string[0] == '\0') {
+
+ if (string[0] == '\0')
return NULL;
- }
return string;
}
@@ -107,24 +106,20 @@ static inline void _set_master_started_cb(vconf_callback_fn cb)
{
int ret = -1;
- ret = vconf_notify_key_changed(VCONFKEY_MASTER_STARTED,
- cb, NULL);
- if (ret != 0) {
+ ret = vconf_notify_key_changed(VCONFKEY_MASTER_STARTED, cb, NULL);
+ if (ret != 0)
NOTIFICATION_ERR("failed to notify key(%s) : %d",
VCONFKEY_MASTER_STARTED, ret);
- }
}
static inline void _unset_master_started_cb(vconf_callback_fn cb)
{
int ret = -1;
- ret = vconf_ignore_key_changed(VCONFKEY_MASTER_STARTED,
- cb);
- if (ret != 0) {
+ ret = vconf_ignore_key_changed(VCONFKEY_MASTER_STARTED, cb);
+ if (ret != 0)
NOTIFICATION_ERR("failed to notify key(%s) : %d",
VCONFKEY_MASTER_STARTED, ret);
- }
}
int notification_ipc_is_master_ready(void)
@@ -142,8 +137,7 @@ int notification_ipc_is_master_ready(void)
return is_master_started;
}
-int
-notification_ipc_add_deffered_task(
+int notification_ipc_add_deffered_task(
void (*deferred_task_cb)(void *data),
void *user_data)
{
@@ -153,9 +147,8 @@ notification_ipc_add_deffered_task(
list_new =
(task_list *) malloc(sizeof(task_list));
- if (list_new == NULL) {
+ if (list_new == NULL)
return NOTIFICATION_ERROR_OUT_OF_MEMORY;
- }
if (s_info.is_started_cb_set_task == 0) {
_set_master_started_cb(_master_started_cb_task);
@@ -173,9 +166,9 @@ notification_ipc_add_deffered_task(
} else {
list = g_task_list;
- while (list->next != NULL) {
+ while (list->next != NULL)
list = list->next;
- }
+
list->next = list_new;
list_new->prev = list;
@@ -193,29 +186,28 @@ notification_ipc_del_deffered_task(
list_del = g_task_list;
- if (list_del == NULL) {
+ if (list_del == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
- while (list_del->prev != NULL) {
+
+ while (list_del->prev != NULL)
list_del = list_del->prev;
- }
+
do {
if (list_del->task_cb == deferred_task_cb) {
list_prev = list_del->prev;
list_next = list_del->next;
- if (list_prev == NULL) {
+ if (list_prev == NULL)
g_task_list = list_next;
- } else {
+ else
list_prev->next = list_next;
- }
if (list_next == NULL) {
- if (list_prev != NULL) {
+ if (list_prev != NULL)
list_prev->next = NULL;
- }
+
} else {
list_next->prev = list_prev;
}
@@ -242,9 +234,8 @@ static void _do_deffered_task(void)
task_list *list_do = NULL;
task_list *list_temp = NULL;
- if (g_task_list == NULL) {
+ if (g_task_list == NULL)
return;
- }
list_do = g_task_list;
g_task_list = NULL;
@@ -253,9 +244,9 @@ static void _do_deffered_task(void)
s_info.is_started_cb_set_task = 0;
}
- while (list_do->prev != NULL) {
+ while (list_do->prev != NULL)
list_do = list_do->prev;
- }
+
while (list_do != NULL) {
if (list_do->task_cb != NULL) {
@@ -275,28 +266,27 @@ static void _master_started_cb_service(keynode_t *node,
if (notification_ipc_is_master_ready()) {
NOTIFICATION_ERR("try to register a notification service");
ret = notification_ipc_monitor_deregister();
- if (ret != NOTIFICATION_ERROR_NONE) {
+ if (ret != NOTIFICATION_ERROR_NONE)
NOTIFICATION_ERR("failed to unregister a monitor");
- }
+
ret = notification_ipc_monitor_register();
- if (ret != NOTIFICATION_ERROR_NONE) {
+ if (ret != NOTIFICATION_ERROR_NONE)
NOTIFICATION_ERR("failed to register a monitor");
- }
+
} else {
NOTIFICATION_ERR("try to unregister a notification service");
ret = notification_ipc_monitor_deregister();
- if (ret != NOTIFICATION_ERROR_NONE) {
+ if (ret != NOTIFICATION_ERROR_NONE)
NOTIFICATION_ERR("failed to deregister a monitor");
- }
+
}
}
static void _master_started_cb_task(keynode_t *node,
void *data) {
- if (notification_ipc_is_master_ready()) {
+ if (notification_ipc_is_master_ready())
_do_deffered_task();
- }
}
/*!
@@ -307,9 +297,8 @@ notification_op *notification_ipc_create_op(notification_op_type_e type, int num
int i = 0;
notification_op *op_list = NULL;
- if (num_op <= 0) {
+ if (num_op <= 0)
return NULL;
- }
op_list = (notification_op *)malloc(sizeof(notification_op) * num_op);
@@ -322,12 +311,11 @@ notification_op *notification_ipc_create_op(notification_op_type_e type, int num
for (i = 0; i < num_op; i++) {
(op_list + i)->type = type;
- if (list_priv_id != NULL) {
+ if (list_priv_id != NULL)
(op_list + i)->priv_id = *(list_priv_id + i);
- }
- if (noti_list != NULL) {
+
+ if (noti_list != NULL)
(op_list + i)->noti = *(noti_list + i);
- }
}
return op_list;
@@ -340,12 +328,11 @@ static inline char *_dup_string(const char *string)
{
char *ret;
- if (string == NULL) {
+ if (string == NULL)
return NULL;
- }
- if (string[0] == '\0') {
+
+ if (string[0] == '\0')
return NULL;
- }
ret = strdup(string);
if (!ret)
@@ -356,12 +343,11 @@ static inline char *_dup_string(const char *string)
static inline bundle *_create_bundle_from_string(unsigned char *string)
{
- if (string == NULL) {
+ if (string == NULL)
return NULL;
- }
- if (string[0] == '\0') {
+
+ if (string[0] == '\0')
return NULL;
- }
return bundle_decode(string, strlen((char *)string));
}
@@ -492,9 +478,9 @@ EXPORT_API int notification_ipc_make_noti_from_packet(notification_h noti, const
noti->b_service_responding = _create_bundle_from_string(b_service_responding);
noti->b_service_single_launch = _create_bundle_from_string(b_service_single_launch);
noti->b_service_multi_launch = _create_bundle_from_string(b_service_multi_launch);
- for (i = 0; i < NOTIFICATION_EVENT_TYPE_MAX; i++) {
+ for (i = 0; i < NOTIFICATION_EVENT_TYPE_MAX; i++)
noti->b_event_handler[i] = _create_bundle_from_string(b_event_handler[i]);
- }
+
noti->domain = _dup_string(domain);
noti->dir = _dup_string(dir);
noti->b_text = _create_bundle_from_string(b_text);
@@ -554,53 +540,49 @@ EXPORT_API struct packet *notification_ipc_make_packet_from_noti(notification_h
char buf_key[32] = { 0, };
/* Decode bundle to insert DB */
- if (noti->args) {
+ if (noti->args)
bundle_encode(noti->args, (bundle_raw **) & args, NULL);
- }
- if (noti->group_args) {
+
+ if (noti->group_args)
bundle_encode(noti->group_args, (bundle_raw **) & group_args,
&b_encode_len);
- }
- if (noti->b_execute_option) {
+ if (noti->b_execute_option)
bundle_encode(noti->b_execute_option,
(bundle_raw **) & b_execute_option, &b_encode_len);
- }
- if (noti->b_service_responding) {
+
+ if (noti->b_service_responding)
bundle_encode(noti->b_service_responding,
(bundle_raw **) & b_service_responding, &b_encode_len);
- }
- if (noti->b_service_single_launch) {
+
+ if (noti->b_service_single_launch)
bundle_encode(noti->b_service_single_launch,
(bundle_raw **) & b_service_single_launch, &b_encode_len);
- }
- if (noti->b_service_multi_launch) {
+
+ if (noti->b_service_multi_launch)
bundle_encode(noti->b_service_multi_launch,
(bundle_raw **) & b_service_multi_launch, &b_encode_len);
- }
for (i = 0; i < NOTIFICATION_EVENT_TYPE_MAX; i++) {
- if (noti->b_event_handler[i]) {
+ if (noti->b_event_handler[i])
bundle_encode(noti->b_event_handler[i],
(bundle_raw **) & b_event_handler[i], &b_encode_len);
- }
+
}
- if (noti->b_text) {
+ if (noti->b_text)
bundle_encode(noti->b_text, (bundle_raw **) & b_text, &b_encode_len);
- }
- if (noti->b_key) {
+
+ if (noti->b_key)
bundle_encode(noti->b_key, (bundle_raw **) & b_key, &b_encode_len);
- }
- if (noti->b_format_args) {
+
+ if (noti->b_format_args)
bundle_encode(noti->b_format_args,
(bundle_raw **) & b_format_args, &b_encode_len);
- }
- if (noti->b_image_path) {
+ if (noti->b_image_path)
bundle_encode(noti->b_image_path,
(bundle_raw **) & b_image_path, &b_encode_len);
- }
if (noti->b_key != NULL) {
snprintf(buf_key, sizeof(buf_key), "%d",
@@ -616,17 +598,16 @@ EXPORT_API struct packet *notification_ipc_make_packet_from_noti(notification_h
bundle_get_str(noti->b_text, buf_key, &title_key);
}
- if (title_key == NULL) {
+ if (title_key == NULL)
title_key = noti->caller_pkgname;
- }
+
if (packet_type == 1)
func_to_create_packet = packet_create;
else if (packet_type == 2)
func_to_create_packet = packet_create_noack;
- else {
+ else
goto out;
- }
result = func_to_create_packet(command,
"iiiiisssssssssssssssssssssisisisiiiiiiiiddsssssii",
@@ -682,45 +663,40 @@ EXPORT_API struct packet *notification_ipc_make_packet_from_noti(notification_h
out:
/* Free decoded data */
- if (args) {
+ if (args)
free(args);
- }
- if (group_args) {
+
+ if (group_args)
free(group_args);
- }
- if (b_execute_option) {
+ if (b_execute_option)
free(b_execute_option);
- }
- if (b_service_responding) {
+
+ if (b_service_responding)
free(b_service_responding);
- }
- if (b_service_single_launch) {
+
+ if (b_service_single_launch)
free(b_service_single_launch);
- }
- if (b_service_multi_launch) {
+
+ if (b_service_multi_launch)
free(b_service_multi_launch);
- }
for (i = 0; i < NOTIFICATION_EVENT_TYPE_MAX; i++) {
- if (b_event_handler[i]) {
+ if (b_event_handler[i])
free(b_event_handler[i]);
- }
}
- if (b_text) {
+ if (b_text)
free(b_text);
- }
- if (b_key) {
+
+ if (b_key)
free(b_key);
- }
- if (b_format_args) {
+
+ if (b_format_args)
free(b_format_args);
- }
- if (b_image_path) {
+ if (b_image_path)
free(b_image_path);
- }
return result;
}
@@ -745,53 +721,48 @@ EXPORT_API struct packet *notification_ipc_make_reply_packet_from_noti(notificat
char buf_key[32] = { 0, };
/* Decode bundle to insert DB */
- if (noti->args) {
+ if (noti->args)
bundle_encode(noti->args, (bundle_raw **) & args, &b_encode_len);
- }
- if (noti->group_args) {
+
+ if (noti->group_args)
bundle_encode(noti->group_args, (bundle_raw **) & group_args,
&b_encode_len);
- }
- if (noti->b_execute_option) {
+ if (noti->b_execute_option)
bundle_encode(noti->b_execute_option,
(bundle_raw **) & b_execute_option, &b_encode_len);
- }
- if (noti->b_service_responding) {
+
+ if (noti->b_service_responding)
bundle_encode(noti->b_service_responding,
(bundle_raw **) & b_service_responding, &b_encode_len);
- }
- if (noti->b_service_single_launch) {
+
+ if (noti->b_service_single_launch)
bundle_encode(noti->b_service_single_launch,
(bundle_raw **) & b_service_single_launch, &b_encode_len);
- }
- if (noti->b_service_multi_launch) {
+
+ if (noti->b_service_multi_launch)
bundle_encode(noti->b_service_multi_launch,
(bundle_raw **) & b_service_multi_launch, &b_encode_len);
- }
for (i = 0; i < NOTIFICATION_EVENT_TYPE_MAX; i++) {
- if (noti->b_event_handler[i]) {
+ if (noti->b_event_handler[i])
bundle_encode(noti->b_event_handler[i],
(bundle_raw **) & b_event_handler[i], &b_encode_len);
- }
}
- if (noti->b_text) {
+ if (noti->b_text)
bundle_encode(noti->b_text, (bundle_raw **) & b_text, &b_encode_len);
- }
- if (noti->b_key) {
+
+ if (noti->b_key)
bundle_encode(noti->b_key, (bundle_raw **) & b_key, &b_encode_len);
- }
- if (noti->b_format_args) {
+
+ if (noti->b_format_args)
bundle_encode(noti->b_format_args,
(bundle_raw **) & b_format_args, &b_encode_len);
- }
- if (noti->b_image_path) {
+ if (noti->b_image_path)
bundle_encode(noti->b_image_path,
(bundle_raw **) & b_image_path, &b_encode_len);
- }
if (noti->b_key != NULL) {
snprintf(buf_key, sizeof(buf_key), "%d",
@@ -807,9 +778,8 @@ EXPORT_API struct packet *notification_ipc_make_reply_packet_from_noti(notificat
bundle_get_str(noti->b_text, buf_key, &title_key);
}
- if (title_key == NULL) {
+ if (title_key == NULL)
title_key = noti->caller_pkgname;
- }
result = packet_create_reply(packet,
"iiiiisssssssssssssssssssssisisisiiiiiiiiddsssssii",
@@ -864,45 +834,41 @@ EXPORT_API struct packet *notification_ipc_make_reply_packet_from_noti(notificat
noti->auto_remove);
/* Free decoded data */
- if (args) {
+ if (args)
free(args);
- }
- if (group_args) {
+
+ if (group_args)
free(group_args);
- }
- if (b_execute_option) {
+ if (b_execute_option)
free(b_execute_option);
- }
- if (b_service_responding) {
+
+ if (b_service_responding)
free(b_service_responding);
- }
- if (b_service_single_launch) {
+
+ if (b_service_single_launch)
free(b_service_single_launch);
- }
- if (b_service_multi_launch) {
+
+ if (b_service_multi_launch)
free(b_service_multi_launch);
- }
+
for (i = 0; i < NOTIFICATION_EVENT_TYPE_MAX; i++) {
- if (b_event_handler[i]) {
+ if (b_event_handler[i])
free(b_event_handler[i]);
- }
}
- if (b_text) {
+ if (b_text)
free(b_text);
- }
- if (b_key) {
+
+ if (b_key)
free(b_key);
- }
- if (b_format_args) {
+
+ if (b_format_args)
free(b_format_args);
- }
- if (b_image_path) {
+ if (b_image_path)
free(b_image_path);
- }
return result;
}
@@ -913,6 +879,7 @@ EXPORT_API struct packet *notification_ipc_make_reply_packet_from_noti(notificat
static struct packet *_handler_insert(pid_t pid, int handle, const struct packet *packet)
{
notification_h noti = NULL;
+ notification_op *noti_op;
if (!packet) {
NOTIFICATION_ERR("a packet is null");
@@ -930,7 +897,7 @@ static struct packet *_handler_insert(pid_t pid, int handle, const struct packet
/* Disable changed cb */
} else {
/* Enable changed cb */
- notification_op *noti_op = notification_ipc_create_op(NOTIFICATION_OP_INSERT, 1, &(noti->priv_id), 1, &noti);
+ noti_op = notification_ipc_create_op(NOTIFICATION_OP_INSERT, 1, &(noti->priv_id), 1, &noti);
if (noti_op != NULL) {
notification_call_changed_cb(noti_op, 1);
free(noti_op);
@@ -944,6 +911,7 @@ static struct packet *_handler_insert(pid_t pid, int handle, const struct packet
static struct packet *_handler_update(pid_t pid, int handle, const struct packet *packet)
{
notification_h noti = NULL;
+ notification_op *noti_op;
if (!packet) {
NOTIFICATION_ERR("a packet is null");
@@ -958,7 +926,7 @@ static struct packet *_handler_update(pid_t pid, int handle, const struct packet
notification_ipc_make_noti_from_packet(noti, packet);
- notification_op *noti_op = notification_ipc_create_op(NOTIFICATION_OP_UPDATE, 1, &(noti->priv_id), 1, &noti);
+ noti_op = notification_ipc_create_op(NOTIFICATION_OP_UPDATE, 1, &(noti->priv_id), 1, &noti);
if (noti_op != NULL) {
notification_call_changed_cb(noti_op, 1);
free(noti_op);
@@ -971,11 +939,14 @@ static struct packet *_handler_update(pid_t pid, int handle, const struct packet
static struct packet *_handler_refresh(pid_t pid, int handle, const struct packet *packet)
{
+ notification_op *noti_op;
+
if (!packet) {
NOTIFICATION_ERR("a packet is null");
return NULL;
}
- notification_op *noti_op = notification_ipc_create_op(NOTIFICATION_OP_REFRESH, 1, NULL, 0, NULL);
+
+ noti_op = notification_ipc_create_op(NOTIFICATION_OP_REFRESH, 1, NULL, 0, NULL);
if (noti_op != NULL) {
notification_call_changed_cb(noti_op, 1);
free(noti_op);
@@ -988,13 +959,14 @@ static struct packet *_handler_delete_single(pid_t pid, int handle, const struct
{
int num_deleted = 0;
int priv_id = NOTIFICATION_PRIV_ID_NONE;
+ notification_op *noti_op;
if (!packet) {
NOTIFICATION_ERR("a packet is null");
return NULL;
}
if (packet_get(packet, "ii", &num_deleted, &priv_id) == 2) {
- notification_op *noti_op = notification_ipc_create_op(NOTIFICATION_OP_DELETE, 1, &priv_id, 1, NULL);
+ noti_op = notification_ipc_create_op(NOTIFICATION_OP_DELETE, 1, &priv_id, 1, NULL);
if (noti_op != NULL) {
notification_call_changed_cb(noti_op, 1);
free(noti_op);
@@ -1009,6 +981,7 @@ static struct packet *_handler_delete_multiple(pid_t pid, int handle, const stru
int ret = 0;
int buf[10] = {0,};
int num_deleted = 0;
+ notification_op *noti_op;
NOTIFICATION_INFO("delete_noti_multiple");
@@ -1032,12 +1005,12 @@ static struct packet *_handler_delete_multiple(pid_t pid, int handle, const stru
NOTIFICATION_INFO("packet data num deleted:%d", num_deleted);
int i = 0;
- for (i = 0 ; i < 10 ; i++) {
+ for (i = 0 ; i < 10 ; i++)
NOTIFICATION_INFO("packet data[%d]:%d", i, buf[i]);
- }
+
if (ret == 11) {
- notification_op *noti_op = notification_ipc_create_op(
+ noti_op = notification_ipc_create_op(
NOTIFICATION_OP_DELETE, num_deleted, buf, num_deleted, NULL);
if (noti_op == NULL) {
NOTIFICATION_ERR("notification_ipc_create_op failed");
@@ -1053,6 +1026,7 @@ static struct packet *_handler_delete_multiple(pid_t pid, int handle, const stru
static int _handler_service_register(pid_t pid, int handle, const struct packet *packet, void *data)
{
int ret;
+ notification_op *noti_op;
if (!packet) {
NOTIFICATION_ERR("Packet is not valid\n");
@@ -1062,7 +1036,7 @@ static int _handler_service_register(pid_t pid, int handle, const struct packet
ret = NOTIFICATION_ERROR_INVALID_PARAMETER;
} else {
if (ret == 0) {
- notification_op *noti_op = notification_ipc_create_op(NOTIFICATION_OP_SERVICE_READY, 1, NULL, 1, NULL);
+ noti_op = notification_ipc_create_op(NOTIFICATION_OP_SERVICE_READY, 1, NULL, 1, NULL);
if (noti_op != NULL) {
notification_call_changed_cb(noti_op, 1);
free(noti_op);
@@ -1106,11 +1080,10 @@ static int notification_ipc_monitor_register(void)
},
};
- if (s_info.initialized == 1) {
+ if (s_info.initialized == 1)
return NOTIFICATION_ERROR_NONE;
- } else {
+ else
s_info.initialized = 1;
- }
NOTIFICATION_ERR("register a service\n");
@@ -1145,9 +1118,8 @@ static int notification_ipc_monitor_register(void)
int notification_ipc_monitor_deregister(void)
{
- if (s_info.initialized == 0) {
+ if (s_info.initialized == 0)
return NOTIFICATION_ERROR_NONE;
- }
com_core_packet_client_fini(s_info.server_fd);
s_info.server_fd = NOTIFICATION_ERROR_INVALID_PARAMETER;
@@ -1161,9 +1133,8 @@ int notification_ipc_monitor_init(void)
{
int ret = NOTIFICATION_ERROR_NONE;
- if (notification_ipc_is_master_ready()) {
+ if (notification_ipc_is_master_ready())
ret = notification_ipc_monitor_register();
- }
if (s_info.is_started_cb_set_svc == 0) {
_set_master_started_cb(_master_started_cb_service);
@@ -1222,16 +1193,14 @@ int notification_ipc_request_insert(notification_h noti, int *priv_id)
packet_unref(result);
} else {
NOTIFICATION_ERR("failed to receive answer(insert)");
- if (notification_ipc_is_master_ready() == 1) {
+ if (notification_ipc_is_master_ready() == 1)
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- } else {
+ else
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
- }
}
- if (priv_id != NULL) {
+ if (priv_id != NULL)
*priv_id = id;
- }
return NOTIFICATION_ERROR_NONE;
}
@@ -1258,11 +1227,10 @@ int notification_ipc_request_delete_single(notification_type_e type, char *pkgna
packet_unref(result);
} else {
NOTIFICATION_ERR("failed to receive answer(delete)");
- if (notification_ipc_is_master_ready() == 1) {
+ if (notification_ipc_is_master_ready() == 1)
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- } else {
+ else
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
- }
}
return status;
@@ -1291,11 +1259,10 @@ int notification_ipc_request_delete_multiple(notification_type_e type, char *pkg
packet_unref(result);
} else {
NOTIFICATION_ERR("failed to receive answer(delete multiple)");
- if (notification_ipc_is_master_ready() == 1) {
+ if (notification_ipc_is_master_ready() == 1)
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- } else {
+ else
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
- }
}
return status;
@@ -1323,11 +1290,10 @@ int notification_ipc_request_update(notification_h noti)
packet_unref(result);
} else {
NOTIFICATION_ERR("failed to receive answer(update)");
- if (notification_ipc_is_master_ready() == 1) {
+ if (notification_ipc_is_master_ready() == 1)
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- } else {
+ else
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
- }
}
return status;
@@ -1359,9 +1325,9 @@ static int _notification_ipc_update_cb(pid_t pid, int handle, const struct packe
}
}
- if (cb_item->result_cb != NULL) {
+ if (cb_item->result_cb != NULL)
cb_item->result_cb(id, status, cb_item->data);
- }
+
free(cb_item);
return status;
@@ -1392,11 +1358,11 @@ int notification_ipc_request_update_async(notification_h noti,
s_info.server_cl_fd = com_core_packet_client_init(s_info.socket_file, 0, NULL);
if (s_info.server_cl_fd < 0) {
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 {
- ret = NOTIFICATION_ERROR_SERVICE_NOT_READY;
- }
+ if (notification_ipc_is_master_ready() == 1)
+ ret = NOTIFICATION_ERROR_PERMISSION_DENIED;
+ else
+ ret = NOTIFICATION_ERROR_SERVICE_NOT_READY;
+
goto fail;
}
s_info.server_cl_fd_ref_cnt = 1;
@@ -1458,11 +1424,10 @@ int notification_ipc_request_refresh(void)
packet_unref(result);
} else {
NOTIFICATION_ERR("failed to receive answer(refresh)");
- if (notification_ipc_is_master_ready() == 1) {
+ if (notification_ipc_is_master_ready() == 1)
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- } else {
+ else
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
- }
}
return status;
@@ -1491,11 +1456,10 @@ int notification_ipc_update_setting(notification_setting_h setting)
packet_unref(result);
} else {
NOTIFICATION_ERR("failed to receive answer(delete)");
- if (notification_ipc_is_master_ready() == 1) {
+ if (notification_ipc_is_master_ready() == 1)
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- } else {
+ else
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
- }
}
return status;
@@ -1534,9 +1498,8 @@ int notification_ipc_update_system_setting(notification_system_setting_h system_
}
}
out:
- if (result) {
+ if (result)
packet_unref(result);
- }
return status;
}
@@ -1563,11 +1526,10 @@ int notification_ipc_noti_setting_property_set(const char *pkgname, const char *
packet_unref(result);
} else {
NOTIFICATION_ERR("failed to receive answer(delete)");
- if (notification_ipc_is_master_ready() == 1) {
+ if (notification_ipc_is_master_ready() == 1)
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- } else {
+ else
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
- }
}
return status;
@@ -1592,17 +1554,16 @@ int notification_ipc_noti_setting_property_get(const char *pkgname, const char *
packet_unref(result);
return NOTIFICATION_ERROR_IO_ERROR;
}
- if (status == NOTIFICATION_ERROR_NONE && ret != NULL) {
+ if (status == NOTIFICATION_ERROR_NONE && ret != NULL)
*value = strdup(ret);
- }
+
packet_unref(result);
} else {
NOTIFICATION_ERR("failed to receive answer(delete)");
- if (notification_ipc_is_master_ready() == 1) {
+ if (notification_ipc_is_master_ready() == 1)
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- } else {
+ else
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
- }
}
return status;
@@ -1629,11 +1590,10 @@ int notification_ipc_request_load_noti_by_tag(notification_h noti, const char *p
packet_unref(result);
} else {
NOTIFICATION_ERR("failed to receive answer(load noti by tag)");
- if (notification_ipc_is_master_ready() == 1) {
+ if (notification_ipc_is_master_ready() == 1)
return NOTIFICATION_ERROR_PERMISSION_DENIED;
- } else {
+ else
return NOTIFICATION_ERROR_SERVICE_NOT_READY;
- }
}
return NOTIFICATION_ERROR_NONE;
diff --git a/src/notification_list.c b/src/notification_list.c
index 8da4b57..e7220c7 100644..100755
--- a/src/notification_list.c
+++ b/src/notification_list.c
@@ -66,9 +66,8 @@ EXPORT_API notification_list_h notification_list_get_head(notification_list_h li
cur_list = list;
- while (cur_list->prev != NULL) {
+ while (cur_list->prev != NULL)
cur_list = cur_list->prev;
- }
set_last_result(NOTIFICATION_ERROR_NONE);
return cur_list;
@@ -86,9 +85,8 @@ EXPORT_API notification_list_h notification_list_get_tail(notification_list_h li
cur_list = list;
- while (cur_list->next != NULL) {
+ while (cur_list->next != NULL)
cur_list = cur_list->next;
- }
set_last_result(NOTIFICATION_ERROR_NONE);
return cur_list;
@@ -194,7 +192,7 @@ EXPORT_API notification_list_h notification_list_remove(notification_list_h list
cur_list = notification_list_get_head(list);
while (cur_list != NULL) {
if (cur_list->noti == noti) {
- //remove
+ /* remove */
prev_list = cur_list->prev;
next_list = cur_list->next;
@@ -206,9 +204,8 @@ EXPORT_API notification_list_h notification_list_remove(notification_list_h list
next_list->prev = NULL;
}
} else {
- if (prev_list != NULL) {
+ if (prev_list != NULL)
prev_list->next = NULL;
- }
}
free(cur_list);
@@ -218,11 +215,10 @@ EXPORT_API notification_list_h notification_list_remove(notification_list_h list
cur_list = cur_list->next;
}
- if (prev_list != NULL) {
+ if (prev_list != NULL)
return notification_list_get_head(prev_list);
- } else if (next_list != NULL) {
+ else if (next_list != NULL)
return next_list;
- }
return NULL;
}
@@ -234,14 +230,12 @@ EXPORT_API int notification_get_list(notification_type_e type,
notification_list_h get_list = NULL;
int ret = 0;
- if (list == NULL) {
+ if (list == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
ret = notification_noti_get_grouping_list(type, count, &get_list);
- if (ret != NOTIFICATION_ERROR_NONE) {
+ if (ret != NOTIFICATION_ERROR_NONE)
return ret;
- }
*list = get_list;
@@ -257,16 +251,14 @@ EXPORT_API int notification_get_detail_list(const char *pkgname,
notification_list_h get_list = NULL;
int ret = 0;
- if (list == NULL) {
+ if (list == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
ret =
notification_noti_get_detail_list(pkgname, group_id, priv_id, count,
&get_list);
- if (ret != NOTIFICATION_ERROR_NONE) {
+ if (ret != NOTIFICATION_ERROR_NONE)
return ret;
- }
*list = get_list;
@@ -278,9 +270,8 @@ EXPORT_API int notification_free_list(notification_list_h list)
notification_list_h cur_list = NULL;
notification_h noti = NULL;
- if (list == NULL) {
+ if (list == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
cur_list = notification_list_get_head(list);
diff --git a/src/notification_noti.c b/src/notification_noti.c
index 1762281..e4a117f 100644..100755
--- a/src/notification_noti.c
+++ b/src/notification_noti.c
@@ -44,9 +44,9 @@
static void __free_and_set(void **target_ptr, void *new_ptr)
{
if (target_ptr != NULL) {
- if (*target_ptr != NULL) {
+ if (*target_ptr != NULL)
free(*target_ptr);
- }
+
*target_ptr = new_ptr;
}
}
@@ -120,23 +120,20 @@ static int _notification_noti_check_priv_id(notification_h noti, sqlite3 * db)
}
ret = sqlite3_step(stmt);
- if (ret == SQLITE_ROW) {
+ if (ret == SQLITE_ROW)
result = sqlite3_column_int(stmt, 0);
- } else {
+ else
result = 0;
- }
sqlite3_finalize(stmt);
/* If result > 0, there is priv_id in DB */
- if (result > 0) {
+ if (result > 0)
ret = NOTIFICATION_ERROR_ALREADY_EXIST_ID;
- }
err:
- if (query) {
+ if (query)
sqlite3_free(query);
- }
return ret;
}
@@ -165,24 +162,20 @@ static int _notification_noti_get_internal_group_id_by_priv_id(const char *pkgna
}
ret = sqlite3_step(stmt);
- if (ret == SQLITE_ROW) {
+ if (ret == SQLITE_ROW)
result = sqlite3_column_int(stmt, 0);
- } else {
+ else
result = 0;
- }
err:
- if (stmt) {
+ if (stmt)
sqlite3_finalize(stmt);
- }
- if (query) {
+ if (query)
sqlite3_free(query);
- }
- if (ret != NOTIFICATION_ERROR_NONE) {
+ if (ret != NOTIFICATION_ERROR_NONE)
NOTIFICATION_ERR("failed to internal group ID:%d", ret);
- }
return result;
}
@@ -204,118 +197,112 @@ static int _insertion_query_create(notification_h noti, char **query)
char *b_format_args = NULL;
int flag_simmode = 0;
- if (query == NULL) {
+ if (query == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Decode bundle to insert DB */
- if (noti->args) {
+ if (noti->args)
bundle_encode(noti->args, (bundle_raw **) & args, &b_encode_len);
- }
- if (noti->group_args) {
+
+ if (noti->group_args)
bundle_encode(noti->group_args, (bundle_raw **) & group_args,
&b_encode_len);
- }
- if (noti->b_execute_option) {
+ if (noti->b_execute_option)
bundle_encode(noti->b_execute_option,
(bundle_raw **) & b_execute_option, &b_encode_len);
- }
- if (noti->b_service_responding) {
+
+ if (noti->b_service_responding)
bundle_encode(noti->b_service_responding,
(bundle_raw **) & b_service_responding, &b_encode_len);
- }
- if (noti->b_service_single_launch) {
+
+ if (noti->b_service_single_launch)
bundle_encode(noti->b_service_single_launch,
(bundle_raw **) & b_service_single_launch, &b_encode_len);
- }
- if (noti->b_service_multi_launch) {
+
+ if (noti->b_service_multi_launch)
bundle_encode(noti->b_service_multi_launch,
(bundle_raw **) & b_service_multi_launch, &b_encode_len);
- }
+
for (i = 0; i < NOTIFICATION_EVENT_TYPE_MAX; i++) {
- if (noti->b_event_handler[i]) {
+ if (noti->b_event_handler[i])
bundle_encode(noti->b_event_handler[i],
(bundle_raw **) & b_event_handler[i], &b_encode_len);
- }
}
- if (noti->b_text) {
+ if (noti->b_text)
bundle_encode(noti->b_text, (bundle_raw **) & b_text, &b_encode_len);
- }
- if (noti->b_key) {
+
+ if (noti->b_key)
bundle_encode(noti->b_key, (bundle_raw **) & b_key, &b_encode_len);
- }
- if (noti->b_format_args) {
+
+ if (noti->b_format_args)
bundle_encode(noti->b_format_args,
(bundle_raw **) & b_format_args, &b_encode_len);
- }
- if (noti->b_image_path) {
+ if (noti->b_image_path)
bundle_encode(noti->b_image_path,
(bundle_raw **) & b_image_path, &b_encode_len);
- }
/* Check only simmode property is enable */
- if (noti->flags_for_property & NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE) {
+ if (noti->flags_for_property & NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE)
flag_simmode = 1;
- }
/* Make query */
*query = sqlite3_mprintf("INSERT INTO noti_list ("
- "type, "
- "layout, "
- "caller_pkgname, launch_pkgname, "
- "image_path, "
- "group_id, internal_group_id, priv_id, "
- "title_key, "
- "b_text, b_key, tag, b_format_args, num_format_args, "
- "text_domain, text_dir, "
- "time, insert_time, "
- "args, group_args, "
- "b_execute_option, "
- "b_service_responding, b_service_single_launch, b_service_multi_launch, "
- "b_event_handler_click_on_button_1, b_event_handler_click_on_button_2, b_event_handler_click_on_button_3, "
- "b_event_handler_click_on_button_4, b_event_handler_click_on_button_5, b_event_handler_click_on_button_6, "
- "b_event_handler_click_on_icon, b_event_handler_click_on_thumbnail, "
- "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, "
- "flags_for_property, flag_simmode, display_applist, "
- "progress_size, progress_percentage, ongoing_flag, auto_remove) values ("
- "%d, "
- "%d, "
- "'%s', '%s', "
- "'%s', "
- "%d, %d, %d, "
- "$title_key, "
- "'%s', '%s', $tag, '%s', %d, "
- "'%s', '%s', "
- "%d, %d, "
- "'%s', '%s', "
- "'%s', "
- "'%s', '%s', '%s', "
- "'%s', '%s', '%s', "
- "'%s', '%s', '%s', "
- "'%s', '%s', "
- "%d, '%s', %d, '%s', %d, %d, %d, %d,"
- "%d, %d, %d, "
- "$progress_size, $progress_percentage, %d, %d)",
- noti->type,
- noti->layout,
- NOTIFICATION_CHECK_STR(noti->caller_pkgname),
- NOTIFICATION_CHECK_STR(noti->launch_pkgname),
- NOTIFICATION_CHECK_STR(b_image_path), noti->group_id,
- noti->internal_group_id, noti->priv_id,
- NOTIFICATION_CHECK_STR(b_text), NOTIFICATION_CHECK_STR(b_key),
- NOTIFICATION_CHECK_STR(b_format_args), noti->num_format_args,
- NOTIFICATION_CHECK_STR(noti->domain),
- NOTIFICATION_CHECK_STR(noti->dir), (int)noti->time,
- (int)noti->insert_time, NOTIFICATION_CHECK_STR(args),
- NOTIFICATION_CHECK_STR(group_args),
- NOTIFICATION_CHECK_STR(b_execute_option),
- NOTIFICATION_CHECK_STR(b_service_responding),
- NOTIFICATION_CHECK_STR(b_service_single_launch),
- NOTIFICATION_CHECK_STR(b_service_multi_launch),
+ "type, "
+ "layout, "
+ "caller_pkgname, launch_pkgname, "
+ "image_path, "
+ "group_id, internal_group_id, priv_id, "
+ "title_key, "
+ "b_text, b_key, tag, b_format_args, num_format_args, "
+ "text_domain, text_dir, "
+ "time, insert_time, "
+ "args, group_args, "
+ "b_execute_option, "
+ "b_service_responding, b_service_single_launch, b_service_multi_launch, "
+ "b_event_handler_click_on_button_1, b_event_handler_click_on_button_2, b_event_handler_click_on_button_3, "
+ "b_event_handler_click_on_button_4, b_event_handler_click_on_button_5, b_event_handler_click_on_button_6, "
+ "b_event_handler_click_on_icon, b_event_handler_click_on_thumbnail, "
+ "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, "
+ "flags_for_property, flag_simmode, display_applist, "
+ "progress_size, progress_percentage, ongoing_flag, auto_remove) values ("
+ "%d, "
+ "%d, "
+ "'%s', '%s', "
+ "'%s', "
+ "%d, %d, %d, "
+ "$title_key, "
+ "'%s', '%s', $tag, '%s', %d, "
+ "'%s', '%s', "
+ "%d, %d, "
+ "'%s', '%s', "
+ "'%s', "
+ "'%s', '%s', '%s', "
+ "'%s', '%s', '%s', "
+ "'%s', '%s', '%s', "
+ "'%s', '%s', "
+ "%d, '%s', %d, '%s', %d, %d, %d, %d,"
+ "%d, %d, %d, "
+ "$progress_size, $progress_percentage, %d, %d)",
+ noti->type,
+ noti->layout,
+ NOTIFICATION_CHECK_STR(noti->caller_pkgname),
+ NOTIFICATION_CHECK_STR(noti->launch_pkgname),
+ NOTIFICATION_CHECK_STR(b_image_path), noti->group_id,
+ noti->internal_group_id, noti->priv_id,
+ NOTIFICATION_CHECK_STR(b_text), NOTIFICATION_CHECK_STR(b_key),
+ NOTIFICATION_CHECK_STR(b_format_args), noti->num_format_args,
+ NOTIFICATION_CHECK_STR(noti->domain),
+ NOTIFICATION_CHECK_STR(noti->dir), (int)noti->time,
+ (int)noti->insert_time, NOTIFICATION_CHECK_STR(args),
+ NOTIFICATION_CHECK_STR(group_args),
+ NOTIFICATION_CHECK_STR(b_execute_option),
+ NOTIFICATION_CHECK_STR(b_service_responding),
+ NOTIFICATION_CHECK_STR(b_service_single_launch),
+ NOTIFICATION_CHECK_STR(b_service_multi_launch),
NOTIFICATION_CHECK_STR(b_event_handler[NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1]),
NOTIFICATION_CHECK_STR(b_event_handler[NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_2]),
NOTIFICATION_CHECK_STR(b_event_handler[NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_3]),
@@ -324,55 +311,50 @@ static int _insertion_query_create(notification_h noti, char **query)
NOTIFICATION_CHECK_STR(b_event_handler[NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_6]),
NOTIFICATION_CHECK_STR(b_event_handler[NOTIFICATION_EVENT_TYPE_CLICK_ON_ICON]),
NOTIFICATION_CHECK_STR(b_event_handler[NOTIFICATION_EVENT_TYPE_CLICK_ON_THUMBNAIL]),
- noti->sound_type, NOTIFICATION_CHECK_STR(noti->sound_path),
- noti->vibration_type,
- NOTIFICATION_CHECK_STR(noti->vibration_path),
- noti->led_operation,
- noti->led_argb,
- noti->led_on_ms,
- noti->led_off_ms,
- noti->flags_for_property, flag_simmode, noti->display_applist,
- noti->ongoing_flag,
- noti->auto_remove);
+ noti->sound_type, NOTIFICATION_CHECK_STR(noti->sound_path),
+ noti->vibration_type,
+ NOTIFICATION_CHECK_STR(noti->vibration_path),
+ noti->led_operation,
+ noti->led_argb,
+ noti->led_on_ms,
+ noti->led_off_ms,
+ noti->flags_for_property, flag_simmode, noti->display_applist,
+ noti->ongoing_flag,
+ noti->auto_remove);
/* Free decoded data */
- if (args) {
+ if (args)
free(args);
- }
- if (group_args) {
+
+ if (group_args)
free(group_args);
- }
- if (b_execute_option) {
+ if (b_execute_option)
free(b_execute_option);
- }
- if (b_service_responding) {
+
+ if (b_service_responding)
free(b_service_responding);
- }
- if (b_service_single_launch) {
+
+ if (b_service_single_launch)
free(b_service_single_launch);
- }
- if (b_service_multi_launch) {
+
+ if (b_service_multi_launch)
free(b_service_multi_launch);
- }
- if (b_text) {
+ if (b_text)
free(b_text);
- }
- if (b_key) {
+
+ if (b_key)
free(b_key);
- }
- if (b_format_args) {
+
+ if (b_format_args)
free(b_format_args);
- }
- if (b_image_path) {
+ if (b_image_path)
free(b_image_path);
- }
- if (*query == NULL) {
+ if (*query == NULL)
return NOTIFICATION_ERROR_OUT_OF_MEMORY;
- }
return NOTIFICATION_ERROR_NONE;
}
@@ -395,110 +377,103 @@ static int _update_query_create(notification_h noti, char **query)
char *b_format_args = NULL;
int flag_simmode = 0;
- if (query == NULL) {
+ if (query == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Decode bundle to update DB */
- if (noti->args) {
+ if (noti->args)
bundle_encode(noti->args, (bundle_raw **) & args, &b_encode_len);
- }
- if (noti->group_args) {
+
+ if (noti->group_args)
bundle_encode(noti->group_args, (bundle_raw **) & group_args,
&b_encode_len);
- }
- if (noti->b_execute_option) {
+ if (noti->b_execute_option)
bundle_encode(noti->b_execute_option,
(bundle_raw **) & b_execute_option, &b_encode_len);
- }
- if (noti->b_service_responding) {
+
+ if (noti->b_service_responding)
bundle_encode(noti->b_service_responding,
(bundle_raw **) & b_service_responding, &b_encode_len);
- }
- if (noti->b_service_single_launch) {
+
+ if (noti->b_service_single_launch)
bundle_encode(noti->b_service_single_launch,
(bundle_raw **) & b_service_single_launch, &b_encode_len);
- }
- if (noti->b_service_multi_launch) {
+
+ if (noti->b_service_multi_launch)
bundle_encode(noti->b_service_multi_launch,
(bundle_raw **) & b_service_multi_launch, &b_encode_len);
- }
for (i = 0; i < NOTIFICATION_EVENT_TYPE_MAX; i++) {
- if (noti->b_event_handler[i]) {
+ if (noti->b_event_handler[i])
bundle_encode(noti->b_event_handler[i],
(bundle_raw **) & b_event_handler[i], &b_encode_len);
- }
}
- if (noti->b_text) {
+ if (noti->b_text)
bundle_encode(noti->b_text, (bundle_raw **) & b_text, &b_encode_len);
- }
- if (noti->b_key) {
+
+ if (noti->b_key)
bundle_encode(noti->b_key, (bundle_raw **) & b_key, &b_encode_len);
- }
- if (noti->b_format_args) {
+
+ if (noti->b_format_args)
bundle_encode(noti->b_format_args,
(bundle_raw **) & b_format_args, &b_encode_len);
- }
- if (noti->b_image_path) {
+ if (noti->b_image_path)
bundle_encode(noti->b_image_path,
(bundle_raw **) & b_image_path, &b_encode_len);
- }
/* Check only simmode property is enable */
- if (noti->flags_for_property & NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE) {
+ if (noti->flags_for_property & NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE)
flag_simmode = 1;
- }
/* Make query */
*query = sqlite3_mprintf("UPDATE noti_list SET "
- "type = %d, "
- "layout = %d, "
- "launch_pkgname = '%s', "
- "image_path = '%s', "
- "b_text = '%s', b_key = '%s', tag = $tag, "
- "b_format_args = '%s', num_format_args = %d, "
- "text_domain = '%s', text_dir = '%s', "
- "time = %d, insert_time = %d, "
- "args = '%s', group_args = '%s', "
- "b_execute_option = '%s', "
- "b_service_responding = '%s', "
- "b_service_single_launch = '%s', "
- "b_service_multi_launch = '%s', "
- "b_event_handler_click_on_button_1 = '%s', "
- "b_event_handler_click_on_button_2= '%s', "
- "b_event_handler_click_on_button_3= '%s', "
- "b_event_handler_click_on_button_4= '%s', "
- "b_event_handler_click_on_button_5= '%s', "
- "b_event_handler_click_on_button_6= '%s', "
- "b_event_handler_click_on_icon= '%s', "
- "b_event_handler_click_on_thumbnail= '%s', "
- "sound_type = %d, sound_path = '%s', "
- "vibration_type = %d, vibration_path = '%s', "
- "led_operation = %d, led_argb = %d, "
- "led_on_ms = %d, led_off_ms = %d, "
- "flags_for_property = %d, flag_simmode = %d, "
- "display_applist = %d, "
- "progress_size = $progress_size, progress_percentage = $progress_percentage, "
- "ongoing_flag = %d, auto_remove = %d "
- "where priv_id = %d ",
- noti->type,
- noti->layout,
- NOTIFICATION_CHECK_STR(noti->launch_pkgname),
- NOTIFICATION_CHECK_STR(b_image_path),
- NOTIFICATION_CHECK_STR(b_text), NOTIFICATION_CHECK_STR(b_key),
- NOTIFICATION_CHECK_STR(b_format_args), noti->num_format_args,
- NOTIFICATION_CHECK_STR(noti->domain),
- NOTIFICATION_CHECK_STR(noti->dir),
- (int)noti->time, (int)noti->insert_time,
- NOTIFICATION_CHECK_STR(args), NOTIFICATION_CHECK_STR(group_args),
- NOTIFICATION_CHECK_STR(b_execute_option),
- NOTIFICATION_CHECK_STR(b_service_responding),
- NOTIFICATION_CHECK_STR(b_service_single_launch),
- NOTIFICATION_CHECK_STR(b_service_multi_launch),
+ "type = %d, "
+ "layout = %d, "
+ "launch_pkgname = '%s', "
+ "image_path = '%s', "
+ "b_text = '%s', b_key = '%s', tag = $tag, "
+ "b_format_args = '%s', num_format_args = %d, "
+ "text_domain = '%s', text_dir = '%s', "
+ "time = %d, insert_time = %d, "
+ "args = '%s', group_args = '%s', "
+ "b_execute_option = '%s', "
+ "b_service_responding = '%s', "
+ "b_service_single_launch = '%s', "
+ "b_service_multi_launch = '%s', "
+ "b_event_handler_click_on_button_1 = '%s', "
+ "b_event_handler_click_on_button_2= '%s', "
+ "b_event_handler_click_on_button_3= '%s', "
+ "b_event_handler_click_on_button_4= '%s', "
+ "b_event_handler_click_on_button_5= '%s', "
+ "b_event_handler_click_on_button_6= '%s', "
+ "b_event_handler_click_on_icon= '%s', "
+ "b_event_handler_click_on_thumbnail= '%s', "
+ "sound_type = %d, sound_path = '%s', "
+ "vibration_type = %d, vibration_path = '%s', "
+ "led_operation = %d, led_argb = %d, "
+ "led_on_ms = %d, led_off_ms = %d, "
+ "flags_for_property = %d, flag_simmode = %d, "
+ "display_applist = %d, "
+ "progress_size = $progress_size, progress_percentage = $progress_percentage, "
+ "ongoing_flag = %d, auto_remove = %d "
+ "where priv_id = %d ",
+ noti->type,
+ noti->layout,
+ NOTIFICATION_CHECK_STR(noti->launch_pkgname),
+ NOTIFICATION_CHECK_STR(b_image_path),
+ NOTIFICATION_CHECK_STR(b_text), NOTIFICATION_CHECK_STR(b_key),
+ NOTIFICATION_CHECK_STR(b_format_args), noti->num_format_args,
+ NOTIFICATION_CHECK_STR(noti->domain),
+ NOTIFICATION_CHECK_STR(noti->dir),
+ (int)noti->time, (int)noti->insert_time,
+ NOTIFICATION_CHECK_STR(args), NOTIFICATION_CHECK_STR(group_args),
+ NOTIFICATION_CHECK_STR(b_execute_option),
+ NOTIFICATION_CHECK_STR(b_service_responding),
+ NOTIFICATION_CHECK_STR(b_service_single_launch),
+ NOTIFICATION_CHECK_STR(b_service_multi_launch),
NOTIFICATION_CHECK_STR(b_event_handler[NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1]),
NOTIFICATION_CHECK_STR(b_event_handler[NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_2]),
NOTIFICATION_CHECK_STR(b_event_handler[NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_3]),
@@ -507,55 +482,50 @@ static int _update_query_create(notification_h noti, char **query)
NOTIFICATION_CHECK_STR(b_event_handler[NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_6]),
NOTIFICATION_CHECK_STR(b_event_handler[NOTIFICATION_EVENT_TYPE_CLICK_ON_ICON]),
NOTIFICATION_CHECK_STR(b_event_handler[NOTIFICATION_EVENT_TYPE_CLICK_ON_THUMBNAIL]),
- noti->sound_type, NOTIFICATION_CHECK_STR(noti->sound_path),
- noti->vibration_type,
- NOTIFICATION_CHECK_STR(noti->vibration_path),
- noti->led_operation,
- noti->led_argb,
- noti->led_on_ms,
- noti->led_off_ms,
- noti->flags_for_property, flag_simmode, noti->display_applist,
- noti->ongoing_flag, noti->auto_remove,
- noti->priv_id);
+ noti->sound_type, NOTIFICATION_CHECK_STR(noti->sound_path),
+ noti->vibration_type,
+ NOTIFICATION_CHECK_STR(noti->vibration_path),
+ noti->led_operation,
+ noti->led_argb,
+ noti->led_on_ms,
+ noti->led_off_ms,
+ noti->flags_for_property, flag_simmode, noti->display_applist,
+ noti->ongoing_flag, noti->auto_remove,
+ noti->priv_id);
/* Free decoded data */
- if (args) {
+ if (args)
free(args);
- }
- if (group_args) {
+
+ if (group_args)
free(group_args);
- }
- if (b_execute_option) {
+ if (b_execute_option)
free(b_execute_option);
- }
- if (b_service_responding) {
+
+ if (b_service_responding)
free(b_service_responding);
- }
- if (b_service_single_launch) {
+
+ if (b_service_single_launch)
free(b_service_single_launch);
- }
- if (b_service_multi_launch) {
+
+ if (b_service_multi_launch)
free(b_service_multi_launch);
- }
- if (b_text) {
+ if (b_text)
free(b_text);
- }
- if (b_key) {
+
+ if (b_key)
free(b_key);
- }
- if (b_format_args) {
+
+ if (b_format_args)
free(b_format_args);
- }
- if (b_image_path) {
+ if (b_image_path)
free(b_image_path);
- }
- if (*query == NULL) {
+ if (*query == NULL)
return NOTIFICATION_ERROR_OUT_OF_MEMORY;
- }
return NOTIFICATION_ERROR_NONE;
}
@@ -565,9 +535,9 @@ static void _notification_noti_populate_from_stmt(sqlite3_stmt * stmt, notificat
int col = 0;
int i = 0;
- if (stmt == NULL || noti == NULL) {
+ if (stmt == NULL || noti == NULL)
return ;
- }
+
noti->type = sqlite3_column_int(stmt, col++);
noti->layout = sqlite3_column_int(stmt, col++);
@@ -598,9 +568,9 @@ static void _notification_noti_populate_from_stmt(sqlite3_stmt * stmt, notificat
noti->b_service_multi_launch =
notification_db_column_bundle(stmt, col++);
- for (i = 0; i < NOTIFICATION_EVENT_TYPE_MAX; i++) {
+ for (i = 0; i < NOTIFICATION_EVENT_TYPE_MAX; i++)
noti->b_event_handler[i] = notification_db_column_bundle(stmt, col++);
- }
+
noti->sound_type = sqlite3_column_int(stmt, col++);
__free_and_set((void **)&(noti->sound_path), notification_db_column_text(stmt, col++));
@@ -630,9 +600,8 @@ static notification_h _notification_noti_get_item(sqlite3_stmt * stmt)
notification_h noti = NULL;
noti = (notification_h) calloc(1, sizeof(struct _notification));
- if (noti == NULL) {
+ if (noti == NULL)
return NULL;
- }
_notification_noti_populate_from_stmt(stmt, noti);
@@ -689,9 +658,8 @@ 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;
- }
return TAG_TYPE_INVALID;
}
@@ -717,9 +685,8 @@ static int _notification_noti_update_priv_id(sqlite3 * db, int rowid)
ret = notification_db_exec(db, query, NULL);
err:
- if (query) {
+ if (query)
sqlite3_free(query);
- }
return ret;
}
@@ -798,18 +765,15 @@ static bool _is_allowed_to_notify(const char *caller_package_name)
goto out;
}
- if (ret != true) {
+ if (ret != true)
NOTIFICATION_DBG("[%s] is not allowed to notify", caller_package_name);
- }
out:
- if (package_id) {
+ if (package_id)
free(package_id);
- }
- if (setting) {
+ if (setting)
notification_setting_free_notification(setting);
- }
return ret;
}
@@ -888,13 +852,11 @@ static int _handle_do_not_disturb_option(notification_h noti)
out:
SAFE_FREE(package_id);
- if (system_setting) {
+ if (system_setting)
notification_system_setting_free_system_setting(system_setting);
- }
- if (setting) {
+ if (setting)
notification_setting_free_notification(setting);
- }
return err;
}
@@ -918,15 +880,14 @@ EXPORT_API int notification_noti_insert(notification_h noti)
return NOTIFICATION_ERROR_PERMISSION_DENIED;
}
- if (_handle_do_not_disturb_option(noti) != NOTIFICATION_ERROR_NONE) {
+ if (_handle_do_not_disturb_option(noti) != NOTIFICATION_ERROR_NONE)
NOTIFICATION_WARN("_handle_do_not_disturb_option failed");
- }
+
/* Open DB */
db = notification_db_open(DBPATH);
- if (!db) {
+ if (!db)
return get_last_result();
- }
/* Initialize private ID */
noti->priv_id = NOTIFICATION_PRIV_ID_NONE;
@@ -935,9 +896,9 @@ EXPORT_API int notification_noti_insert(notification_h noti)
/* make query */
ret = _insertion_query_create(noti, &query);
- if (ret != NOTIFICATION_ERROR_NONE) {
+ if (ret != NOTIFICATION_ERROR_NONE)
goto err;
- }
+
ret = sqlite3_prepare_v2(db, query, -1, &stmt, NULL);
if (ret != SQLITE_OK) {
@@ -963,9 +924,9 @@ EXPORT_API int notification_noti_insert(notification_h noti)
bundle_get_str(noti->b_text, buf_key, &title_key);
}
- if (title_key == NULL) {
+ if (title_key == NULL)
title_key = noti->caller_pkgname;
- }
+
/* Bind query */
ret = _notification_noti_bind_query_text(stmt, "$tag", noti->tag);
@@ -981,44 +942,42 @@ EXPORT_API int notification_noti_insert(notification_h noti)
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) {
+ if (stmt)
sqlite3_finalize(stmt);
- }
+
return ret;
}
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) {
+ if (stmt)
sqlite3_finalize(stmt);
- }
+
return ret;
}
ret = sqlite3_step(stmt);
if (ret == SQLITE_OK || ret == SQLITE_DONE) {
noti->priv_id = (int)sqlite3_last_insert_rowid(db);
- if (_notification_noti_update_priv_id(db, noti->priv_id) == 0) {
+
+ if (_notification_noti_update_priv_id(db, noti->priv_id) == 0)
ret = NOTIFICATION_ERROR_NONE;
- } else {
+ else
ret = NOTIFICATION_ERROR_FROM_DB;
- }
+
} else {
ret = NOTIFICATION_ERROR_FROM_DB;
}
err:
- if (stmt) {
+ if (stmt)
sqlite3_finalize(stmt);
- }
/* Close DB */
- if (db) {
+ if (db)
notification_db_close(&db);
- }
- if (query) {
+ if (query)
sqlite3_free(query);
- }
return ret;
}
@@ -1037,9 +996,8 @@ int notification_noti_get_by_priv_id(notification_h noti, char *pkgname, int pri
/* Open DB */
db = notification_db_open(DBPATH);
- if (!db) {
+ if (!db)
return get_last_result();
- }
char *base_query = "select "
"type, layout, caller_pkgname, launch_pkgname, image_path, group_id, priv_id, "
@@ -1053,12 +1011,12 @@ int notification_noti_get_by_priv_id(notification_h noti, char *pkgname, int pri
"flags_for_property, display_applist, progress_size, progress_percentage, ongoing_flag, auto_remove "
"from noti_list ";
- if (pkgname != NULL) {
+ if (pkgname != NULL)
query = sqlite3_mprintf("%s where caller_pkgname = '%s' and priv_id = %d",
base_query, pkgname, priv_id);
- } else {
+ else
query = sqlite3_mprintf("%s where priv_id = %d", base_query, priv_id);
- }
+
if (query == NULL) {
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
@@ -1080,19 +1038,17 @@ int notification_noti_get_by_priv_id(notification_h noti, char *pkgname, int pri
} else {
ret = NOTIFICATION_ERROR_FROM_DB;
}
+
err:
- if (query) {
+ if (query)
sqlite3_free(query);
- }
- if (stmt) {
+ if (stmt)
sqlite3_finalize(stmt);
- }
/* Close DB */
- if (db != NULL) {
+ if (db != NULL)
notification_db_close(&db);
- }
return ret;
}
@@ -1110,9 +1066,8 @@ EXPORT_API int notification_noti_get_by_tag(notification_h noti, char *pkgname,
/* Open DB */
db = notification_db_open(DBPATH);
- if (!db) {
+ if (!db)
return get_last_result();
- }
if (pkgname != NULL) {
ret = sqlite3_prepare_v2(db, "select "
@@ -1141,7 +1096,7 @@ EXPORT_API int notification_noti_get_by_tag(notification_h noti, char *pkgname,
if (ret != SQLITE_OK) {
NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db));
goto err;
- }
+ }
} else {
ret = sqlite3_prepare_v2(db, "select "
"type, layout, caller_pkgname, launch_pkgname, image_path, group_id, priv_id, "
@@ -1176,14 +1131,12 @@ EXPORT_API int notification_noti_get_by_tag(notification_h noti, char *pkgname,
err:
- if (stmt) {
+ if (stmt)
sqlite3_finalize(stmt);
- }
/* Close DB */
- if (db != NULL) {
+ if (db != NULL)
notification_db_close(&db);
- }
return ret;
}
@@ -1197,18 +1150,17 @@ EXPORT_API int notification_noti_update(notification_h noti)
/* Open DB */
db = notification_db_open(DBPATH);
- if (!db) {
+ if (!db)
return get_last_result();
- }
if (_is_allowed_to_notify((const char*)noti->caller_pkgname) == false) {
NOTIFICATION_DBG("[%s] is not allowed to notify", noti->caller_pkgname);
return NOTIFICATION_ERROR_PERMISSION_DENIED;
}
- if (_handle_do_not_disturb_option(noti) != NOTIFICATION_ERROR_NONE) {
+ if (_handle_do_not_disturb_option(noti) != NOTIFICATION_ERROR_NONE)
NOTIFICATION_WARN("_handle_do_not_disturb_option failed");
- }
+
/* Check private ID is exist */
ret = _notification_noti_check_priv_id(noti, db);
@@ -1219,9 +1171,8 @@ EXPORT_API int notification_noti_update(notification_h noti)
/* make update query */
ret = _update_query_create(noti, &query);
- if (ret != NOTIFICATION_ERROR_NONE) {
+ if (ret != NOTIFICATION_ERROR_NONE)
goto err;
- }
ret = sqlite3_prepare_v2(db, query, -1, &stmt, NULL);
if (ret != SQLITE_OK) {
@@ -1249,24 +1200,21 @@ EXPORT_API int notification_noti_update(notification_h noti)
}
ret = sqlite3_step(stmt);
- if (ret == SQLITE_OK || ret == SQLITE_DONE) {
+ if (ret == SQLITE_OK || ret == SQLITE_DONE)
ret = NOTIFICATION_ERROR_NONE;
- } else {
+ else
ret = NOTIFICATION_ERROR_FROM_DB;
- }
+
err:
- if (stmt) {
+ if (stmt)
sqlite3_finalize(stmt);
- }
/* Close DB */
- if (db) {
+ if (db)
notification_db_close(&db);
- }
- if (query) {
+ if (query)
sqlite3_free(query);
- }
return ret;
}
@@ -1285,29 +1233,28 @@ EXPORT_API int notification_noti_delete_all(notification_type_e type, const char
/* Open DB */
db = notification_db_open(DBPATH);
- if (!db) {
+ if (!db)
return get_last_result();
- }
if (pkgname == NULL) {
- if (type != NOTIFICATION_TYPE_NONE) {
+ if (type != NOTIFICATION_TYPE_NONE)
snprintf(query_where, sizeof(query_where),
"where type = %d ", type);
- }
+
} else {
- if (type == NOTIFICATION_TYPE_NONE) {
+ if (type == NOTIFICATION_TYPE_NONE)
snprintf(query_where, sizeof(query_where),
"where caller_pkgname = '%s' ", pkgname);
- } else {
+ else
snprintf(query_where, sizeof(query_where),
"where caller_pkgname = '%s' and type = %d ",
pkgname, type);
- }
+
}
- if (num_deleted != NULL) {
+ if (num_deleted != NULL)
*num_deleted = 0;
- }
+
if (list_deleted_rowid != NULL) {
*list_deleted_rowid = NULL;
snprintf(query, sizeof(query),
@@ -1359,9 +1306,9 @@ EXPORT_API int notification_noti_delete_all(notification_type_e type, const char
snprintf(query, sizeof(query) - 1, "%s where priv_id in (%s)", query_base, query_where);
ret_tmp = notification_db_exec(db, query, NULL);
query_where[0] = '\0';
- if (ret == NOTIFICATION_ERROR_NONE) {
+ 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);
@@ -1369,18 +1316,17 @@ EXPORT_API int notification_noti_delete_all(notification_type_e type, const char
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) {
+ if (ret == NOTIFICATION_ERROR_NONE)
ret = ret_tmp;
- }
}
} else {
free(*list_deleted_rowid);
*list_deleted_rowid = NULL;
}
- if (num_deleted != NULL) {
+ if (num_deleted != NULL)
*num_deleted = data_cnt;
- }
+
} else {
/* Make main query */
snprintf(query_base, sizeof(query_base), "delete from noti_list ");
@@ -1388,19 +1334,18 @@ EXPORT_API int notification_noti_delete_all(notification_type_e type, const char
ret = notification_db_exec(db, query, NULL);
- if (num_deleted != NULL) {
+ if (num_deleted != NULL)
*num_deleted = sqlite3_changes(db);
- }
+
}
err:
- if (stmt) {
+ if (stmt)
sqlite3_finalize(stmt);
- }
+
/* Close DB */
- if (db) {
+ if (db)
notification_db_close(&db);
- }
return ret;
}
@@ -1419,22 +1364,20 @@ int notification_noti_delete_group_by_group_id(const char *pkgname,
char query_where[NOTIFICATION_QUERY_MAX] = { 0, };
/* Check pkgname is valid */
- if (pkgname == NULL) {
+ if (pkgname == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
snprintf(query_where, sizeof(query_where),
"where caller_pkgname = '%s' and group_id = %d", pkgname, group_id);
/* Open DB */
db = notification_db_open(DBPATH);
- if (!db) {
+ if (!db)
return get_last_result();
- }
- if (num_deleted != NULL) {
+ if (num_deleted != NULL)
*num_deleted = 0;
- }
+
if (list_deleted_rowid != NULL) {
*list_deleted_rowid = NULL;
snprintf(query, sizeof(query),
@@ -1480,9 +1423,8 @@ int notification_noti_delete_group_by_group_id(const char *pkgname,
snprintf(query, sizeof(query) - 1, "%s where priv_id in (%s)", query_base, query_where);
ret_tmp = notification_db_exec(db, query, NULL);
query_where[0] = '\0';
- if (ret == NOTIFICATION_ERROR_NONE) {
+ 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);
@@ -1490,18 +1432,17 @@ int notification_noti_delete_group_by_group_id(const char *pkgname,
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) {
+ if (ret == NOTIFICATION_ERROR_NONE)
ret = ret_tmp;
- }
}
} else {
free(*list_deleted_rowid);
*list_deleted_rowid = NULL;
}
- if (num_deleted != NULL) {
+ if (num_deleted != NULL)
*num_deleted = data_cnt;
- }
+
} else {
/* Make query */
snprintf(query, sizeof(query), "delete from noti_list %s", query_where);
@@ -1511,13 +1452,12 @@ int notification_noti_delete_group_by_group_id(const char *pkgname,
}
err:
- if (stmt) {
+ if (stmt)
sqlite3_finalize(stmt);
- }
+
/* Close DB */
- if (db) {
+ if (db)
notification_db_close(&db);
- }
return ret;
}
@@ -1530,15 +1470,13 @@ int notification_noti_delete_group_by_priv_id(const char *pkgname, int priv_id)
int ret;
/* Check pkgname is valid */
- if (pkgname == NULL) {
+ if (pkgname == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Open DB */
db = notification_db_open(DBPATH);
- if (!db) {
+ if (!db)
return get_last_result();
- }
/* Get internal group id using priv id */
internal_group_id =
@@ -1566,15 +1504,13 @@ EXPORT_API int notification_noti_delete_by_priv_id(const char *pkgname, int priv
int ret;
/* Check pkgname is valid */
- if (pkgname == NULL) {
+ if (pkgname == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Open DB */
db = notification_db_open(DBPATH);
- if (!db) {
+ if (!db)
return get_last_result();
- }
/* Make query */
snprintf(query, sizeof(query), "delete from noti_list "
@@ -1585,9 +1521,8 @@ EXPORT_API int notification_noti_delete_by_priv_id(const char *pkgname, int priv
ret = notification_db_exec(db, query, NULL);
/* Close DB */
- if (db) {
+ if (db)
notification_db_close(&db);
- }
return ret;
}
@@ -1599,15 +1534,13 @@ EXPORT_API int notification_noti_delete_by_priv_id_get_changes(const char *pkgna
int ret;
/* Check pkgname is valid */
- if (pkgname == NULL) {
+ if (pkgname == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
/* Open DB */
db = notification_db_open(DBPATH);
- if (!db) {
+ if (!db)
return get_last_result();
- }
/* Make query */
snprintf(query, sizeof(query), "delete from noti_list "
@@ -1617,14 +1550,12 @@ EXPORT_API int notification_noti_delete_by_priv_id_get_changes(const char *pkgna
/* execute DB */
ret = notification_db_exec(db, query, num_changes);
- if (num_changes != NULL) {
+ if (num_changes != NULL)
NOTIFICATION_DBG("deleted num:%d", *num_changes);
- }
/* Close DB */
- if (db) {
+ if (db)
notification_db_close(&db);
- }
return ret;
}
@@ -1649,9 +1580,8 @@ int notification_noti_get_count(notification_type_e type,
/* Open DB */
db = notification_db_open(DBPATH);
- if (!db) {
+ if (!db)
return get_last_result();
- }
/* Check current sim status */
ret_vconf = vconf_get_int(VCONFKEY_TELEPHONY_SIM_SLOT, &status);
@@ -1742,21 +1672,19 @@ int notification_noti_get_count(notification_type_e type,
}
ret = sqlite3_step(stmt);
- if (ret == SQLITE_ROW) {
+ if (ret == SQLITE_ROW)
get_count = sqlite3_column_int(stmt, 0);
- }
ret = NOTIFICATION_ERROR_NONE;
err:
- if (stmt) {
+ if (stmt)
sqlite3_finalize(stmt);
- }
+
/* Close DB */
- if (db) {
+ if (db)
notification_db_close(&db);
- }
*count = get_count;
@@ -1782,9 +1710,8 @@ int notification_noti_get_grouping_list(notification_type_e type,
/* Open DB */
db = notification_db_open(DBPATH);
- if (!db) {
+ if (!db)
return get_last_result();
- }
/* Check current sim status */
ret = vconf_get_int(VCONFKEY_TELEPHONY_SIM_SLOT, &status);
@@ -1803,18 +1730,16 @@ int notification_noti_get_grouping_list(notification_type_e type,
"from noti_list ");
if (status == VCONFKEY_TELEPHONY_SIM_INSERTED) {
- if (type != NOTIFICATION_TYPE_NONE) {
+ if (type != NOTIFICATION_TYPE_NONE)
snprintf(query_where, sizeof(query_where),
"where type = %d ", type);
- }
} else {
- if (type != NOTIFICATION_TYPE_NONE) {
+ if (type != NOTIFICATION_TYPE_NONE)
snprintf(query_where, sizeof(query_where),
"where type = %d and flag_simmode = 0 ", type);
- } else {
+ else
snprintf(query_where, sizeof(query_where),
"where flag_simmode = 0 ");
- }
}
snprintf(query, sizeof(query),
@@ -1852,18 +1777,15 @@ int notification_noti_get_grouping_list(notification_type_e type,
ret = NOTIFICATION_ERROR_NONE;
err:
- if (stmt) {
+ if (stmt)
sqlite3_finalize(stmt);
- }
/* Close DB */
- if (db) {
+ if (db)
notification_db_close(&db);
- }
- if (get_list != NULL) {
+ if (get_list != NULL)
*list = notification_list_get_head(get_list);
- }
return ret;
}
@@ -1888,9 +1810,8 @@ int notification_noti_get_detail_list(const char *pkgname,
/* Open DB */
db = notification_db_open(DBPATH);
- if (!db) {
+ if (!db)
return get_last_result();
- }
/* Check current sim status */
ret = vconf_get_int(VCONFKEY_TELEPHONY_SIM_SLOT, &status);
@@ -1909,27 +1830,26 @@ int notification_noti_get_detail_list(const char *pkgname,
"from noti_list ");
if (priv_id == NOTIFICATION_PRIV_ID_NONE && group_id == NOTIFICATION_GROUP_ID_NONE) {
- if (status == VCONFKEY_TELEPHONY_SIM_INSERTED) {
+ if (status == VCONFKEY_TELEPHONY_SIM_INSERTED)
snprintf(query_where, sizeof(query_where),
"where caller_pkgname = '%s' ", pkgname);
- } else {
+ else
snprintf(query_where, sizeof(query_where),
"where caller_pkgname = '%s' and flag_simmode = 0 ", pkgname);
- }
+
} else {
internal_group_id =
_notification_noti_get_internal_group_id_by_priv_id(pkgname,
priv_id, db);
- if (status == VCONFKEY_TELEPHONY_SIM_INSERTED) {
+ if (status == VCONFKEY_TELEPHONY_SIM_INSERTED)
snprintf(query_where, sizeof(query_where),
"where caller_pkgname = '%s' and internal_group_id = %d ",
pkgname, internal_group_id);
- } else {
+ else
snprintf(query_where, sizeof(query_where),
"where caller_pkgname = '%s' and internal_group_id = %d and flag_simmode = 0 ",
pkgname, internal_group_id);
- }
}
snprintf(query, sizeof(query),
@@ -1966,18 +1886,15 @@ int notification_noti_get_detail_list(const char *pkgname,
ret = NOTIFICATION_ERROR_NONE;
err:
- if (stmt) {
+ if (stmt)
sqlite3_finalize(stmt);
- }
/* Close DB */
- if (db) {
+ if (db)
notification_db_close(&db);
- }
- if (get_list != NULL) {
+ if (get_list != NULL)
*list = notification_list_get_head(get_list);
- }
return ret;
}
@@ -1989,15 +1906,13 @@ EXPORT_API int notification_noti_check_tag(notification_h noti)
sqlite3 *db;
sqlite3_stmt *stmt = NULL;
- if (noti->tag == NULL) {
+ if (noti->tag == NULL)
return NOTIFICATION_ERROR_NOT_EXIST_ID;
- }
/* Open DB */
db = notification_db_open(DBPATH);
- if (!db) {
+ if (!db)
return get_last_result();
- }
ret = sqlite3_prepare_v2(db, "SELECT priv_id FROM noti_list WHERE caller_pkgname = ? and tag = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
@@ -2018,11 +1933,10 @@ EXPORT_API int notification_noti_check_tag(notification_h noti)
}
ret = sqlite3_step(stmt);
- if (ret == SQLITE_ROW) {
+ if (ret == SQLITE_ROW)
result = sqlite3_column_int(stmt, 0);
- } else {
+ else
result = 0;
- }
sqlite3_finalize(stmt);
diff --git a/src/notification_ongoing.c b/src/notification_ongoing.c
index a261998..565496e 100644..100755
--- a/src/notification_ongoing.c
+++ b/src/notification_ongoing.c
@@ -62,16 +62,14 @@ int notification_ongoing_update_progress(const char *caller_pkgname,
if (ret) {
ret = dbus_connection_send(connection, signal, NULL);
- if (ret) {
+ if (ret)
dbus_connection_flush(connection);
- }
}
dbus_message_unref(signal);
- if (ret) {
+ if (ret)
return NOTIFICATION_ERROR_NONE;
- }
return NOTIFICATION_ERROR_FROM_DBUS;
}
@@ -107,16 +105,14 @@ int notification_ongoing_update_size(const char *caller_pkgname,
if (ret) {
ret = dbus_connection_send(connection, signal, NULL);
- if (ret) {
+ if (ret)
dbus_connection_flush(connection);
- }
}
dbus_message_unref(signal);
- if (ret) {
+ if (ret)
return NOTIFICATION_ERROR_NONE;
- }
return NOTIFICATION_ERROR_FROM_DBUS;
}
@@ -144,31 +140,29 @@ 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,
DBUS_TYPE_INVALID);
- } else {
+ else
ret = dbus_message_append_args(signal,
DBUS_TYPE_STRING, &caller_pkgname,
DBUS_TYPE_INT32, &priv_id,
DBUS_TYPE_STRING, &content,
DBUS_TYPE_INVALID);
- }
+
if (ret) {
ret = dbus_connection_send(connection, signal, NULL);
- if (ret) {
+ if (ret)
dbus_connection_flush(connection);
- }
}
dbus_message_unref(signal);
- if (ret) {
+ if (ret)
return NOTIFICATION_ERROR_NONE;
- }
return NOTIFICATION_ERROR_FROM_DBUS;
}
diff --git a/src/notification_permission.c b/src/notification_permission.c
index 66415e9..5a0709d 100644..100755
--- a/src/notification_permission.c
+++ b/src/notification_permission.c
@@ -42,23 +42,20 @@ int notification_permission_check_by_pid(const char *noti_pkgname, int pid, int
bool preload = false;
package_manager_compare_result_type_e compare_result;
- //get pkgname by pid
+ /* get pkgname by pid */
const char *pkgname = aul_app_get_pkgname_bypid(pid);
ret = aul_app_get_pkgname_bypid(pid, pkgname, sizeof(pkgname));
if (ret == AUL_R_OK) {
- if (strcmp(pkgname, noti_pkgname) == 0) {
+ if (strcmp(pkgname, noti_pkgname) == 0)
return NOTIFICATION_ERROR_NONE;
- }
package_manager_is_preload_package_by_app_id(pkgname, &preload);
- if (preload == true) {
+ if (preload == true)
return NOTIFICATION_ERROR_NONE;
- }
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;
diff --git a/src/notification_setting.c b/src/notification_setting.c
index d5a2801..d54e5ec 100644..100755
--- a/src/notification_setting.c
+++ b/src/notification_setting.c
@@ -67,9 +67,9 @@ static int _get_table_field_data_string(char **table, char **buf, int ucs2, int
char *pTemp = table[index];
int sLen = 0;
- if (pTemp == NULL)
+ if (pTemp == NULL) {
*buf = NULL;
- else {
+ } else {
sLen = strlen(pTemp);
if (sLen) {
*buf = (char *) malloc(sLen + 1);
@@ -79,8 +79,9 @@ 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;
+ }
}
ret = true;
@@ -170,9 +171,8 @@ out:
if (local_db_handle) {
sql_return = db_util_close(local_db_handle);
- if (sql_return != SQLITE_OK) {
+ if (sql_return != SQLITE_OK)
NOTIFICATION_WARN("fail to db_util_close - [%d]", sql_return);
- }
}
return err;
@@ -257,9 +257,8 @@ out:
if (local_db_handle) {
sql_return = db_util_close(local_db_handle);
- if (sql_return != SQLITE_OK) {
+ if (sql_return != SQLITE_OK)
NOTIFICATION_WARN("fail to db_util_close - [%d]", sql_return);
- }
}
return err;
@@ -315,9 +314,8 @@ EXPORT_API int notification_setting_set_package_name(notification_setting_h sett
goto out;
}
- if (setting->package_name != NULL) {
+ if (setting->package_name != NULL)
free(setting->package_name);
- }
setting->package_name = SAFE_STRDUP(value);
@@ -495,14 +493,13 @@ EXPORT_API int notification_setting_db_update(const char *package_name, int allo
err = notification_db_exec(db, sqlbuf, NULL);
- return_close_db:
+return_close_db:
if (sqlbuf)
sqlite3_free(sqlbuf);
sqlret = db_util_close(db);
- if (sqlret != SQLITE_OK) {
+ if (sqlret != SQLITE_OK)
NOTIFICATION_WARN("fail to db_util_close - [%d]", sqlret);
- }
return err;
}
@@ -538,9 +535,8 @@ static bool _is_package_in_setting_table(sqlite3 *db, const char *package_name)
goto out;
}
out:
- if (db_statement) {
+ if (db_statement)
sqlite3_finalize(db_statement);
- }
return err;
}
@@ -588,9 +584,8 @@ static int foreach_package_info_callback(const pkgmgrinfo_pkginfo_h package_info
}
out:
- if (db_statement) {
+ if (db_statement)
sqlite3_finalize(db_statement);
- }
NOTIFICATION_INFO("foreach_package_info_callback returns[%d]", err);
return err;
@@ -644,15 +639,13 @@ EXPORT_API int notification_setting_refresh_setting_table()
out:
if (db) {
- if (err == NOTIFICATION_ERROR_NONE) {
+ if (err == NOTIFICATION_ERROR_NONE)
sqlite3_exec(db, "END;", NULL, NULL, NULL);
- } else {
+ else
sqlite3_exec(db, "ROLLBACK;", NULL, NULL, NULL);
- }
- if ((sqlite3_ret = db_util_close(db)) != SQLITE_OK) {
+ if ((sqlite3_ret = db_util_close(db)) != SQLITE_OK)
NOTIFICATION_WARN("fail to db_util_close - [%d]", sqlite3_ret);
- }
}
NOTIFICATION_INFO("notification_setting_refresh_setting_table returns [%08X]", err);
@@ -724,21 +717,20 @@ static int _notification_setting_alter_package_list(notification_setting_operati
}
out:
- if (db_statement) {
+ if (db_statement)
sqlite3_finalize(db_statement);
- }
if (db) {
NOTIFICATION_INFO("err [%d]", err);
- if (err == NOTIFICATION_ERROR_NONE) {
+ if (err == NOTIFICATION_ERROR_NONE)
sqlite3_exec(db, "END;", NULL, NULL, NULL);
- } else {
+ else
sqlite3_exec(db, "ROLLBACK;", NULL, NULL, NULL);
- }
- if ((sqlite3_ret = db_util_close(db)) != SQLITE_OK) {
+
+ if ((sqlite3_ret = db_util_close(db)) != SQLITE_OK)
NOTIFICATION_WARN("fail to db_util_close - [%d]", sqlite3_ret);
- }
+
}
return err;
@@ -777,9 +769,8 @@ static bool _has_privilege(const char *package_id)
out:
- if (package_info) {
+ if (package_info)
package_info_destroy(package_info);
- }
return found;
}
@@ -788,9 +779,8 @@ EXPORT_API int notification_setting_insert_package(const char *package_id)
{
int err = NOTIFICATION_ERROR_NONE;
- if (_has_privilege(package_id) == true) {
+ if (_has_privilege(package_id) == true)
err = _notification_setting_alter_package_list(OPERATION_TYPE_INSERT_RECORD, package_id);
- }
return err;
}
@@ -877,9 +867,8 @@ out:
if (local_db_handle) {
sql_return = db_util_close(local_db_handle);
- if (sql_return != SQLITE_OK) {
+ if (sql_return != SQLITE_OK)
NOTIFICATION_WARN("fail to db_util_close - [%d]", sql_return);
- }
}
return err;
@@ -1032,27 +1021,26 @@ EXPORT_API int notification_setting_db_update_system_setting(int do_not_disturb,
sqlret = sqlite3_changes(db);
- if (sqlret == 0) {
+ if (sqlret == 0)
NOTIFICATION_WARN("No changes on DB");
- }
+
return_close_db:
- if (db_statement) {
+ if (db_statement)
sqlite3_finalize(db_statement);
- }
+
if (db) {
- if (err == NOTIFICATION_ERROR_NONE) {
+ 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);
}
- if (sqlret != SQLITE_OK) {
+ if (sqlret != SQLITE_OK)
NOTIFICATION_WARN("fail to db_util_close - [%d]", sqlret);
- }
return err;
}
@@ -1176,7 +1164,7 @@ static int _is_record_exist(const char *pkgname, sqlite3 *db)
else
result = NOTIFICATION_ERROR_NOT_EXIST_ID;
- free_and_return:
+free_and_return:
if (sqlbuf)
sqlite3_free(sqlbuf);
@@ -1231,14 +1219,13 @@ EXPORT_API int notification_setting_db_set(const char *pkgname, const char *prop
result = notification_db_exec(db, sqlbuf, NULL);
- return_close_db:
+return_close_db:
if (sqlbuf)
sqlite3_free(sqlbuf);
sqlret = db_util_close(db);
- if (sqlret != SQLITE_OK) {
+ if (sqlret != SQLITE_OK)
NOTIFICATION_WARN("fail to db_util_close - [%d]", sqlret);
- }
return result;
}
@@ -1311,7 +1298,7 @@ EXPORT_API int notification_setting_db_get(const char *pkgname, const char *prop
}
}
- return_close_db:
+return_close_db:
if (sqlbuf)
sqlite3_free(sqlbuf);
@@ -1339,9 +1326,8 @@ EXPORT_API int notification_setting_property_set(const char *pkgname, const char
return NOTIFICATION_ERROR_INVALID_PARAMETER;
ret = notification_ipc_noti_setting_property_set(pkgname, property, value);
- if (ret != NOTIFICATION_ERROR_NONE) {
+ if (ret != NOTIFICATION_ERROR_NONE)
return ret;
- }
return NOTIFICATION_ERROR_NONE;
}
@@ -1360,9 +1346,8 @@ EXPORT_API int notification_setting_property_get(const char *pkgname, const char
return NOTIFICATION_ERROR_INVALID_PARAMETER;
ret = notification_ipc_noti_setting_property_get(pkgname, property, value);
- if (ret != NOTIFICATION_ERROR_NONE) {
+ if (ret != NOTIFICATION_ERROR_NONE)
return ret;
- }
return NOTIFICATION_ERROR_NONE;
}
diff --git a/src/notification_status.c b/src/notification_status.c
index 97fb04a..6ca7275 100644..100755
--- a/src/notification_status.c
+++ b/src/notification_status.c
@@ -181,9 +181,8 @@ int notification_status_message_post(const char *message)
if (ret) {
ret = dbus_connection_send(connection, signal, NULL);
- if (ret) {
+ if (ret)
dbus_connection_flush(connection);
- }
}
dbus_message_unref(signal);
diff --git a/test-app/main.c b/test-app/main.c
index 52e02cb..e775f6a 100644..100755
--- a/test-app/main.c
+++ b/test-app/main.c
@@ -209,16 +209,16 @@ static int testapp_add_a_notification()
goto FINISH_OFF;
}
- FINISH_OFF:
+FINISH_OFF:
if (noti_handle)
notification_free(noti_handle);
return noti_err;
}
-/* Common } ------------------------------------------------------------------*/
+/* Common } ------------------------------------------------------------------ */
-/* Basic Test { --------------------------------------------------------------*/
+/* Basic Test { -------------------------------------------------------------- */
static int testapp_test_post_notification()
{
int err = NOTIFICATION_ERROR_NONE;
@@ -229,7 +229,7 @@ static int testapp_test_post_notification()
}
- FINISH_OFF:
+FINISH_OFF:
return err;
}
@@ -276,9 +276,10 @@ static int testapp_test_post_notification_on_indicator()
}
noti_err = notification_set_image(noti_handle, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, "/usr/apps/org.tizen.indicator/res/icons/Shealth/B03_shealth.png");
- // noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_TITLE, "I'm Title", "TITLE", NOTIFICATION_VARIABLE_TYPE_NONE);
- // noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_CONTENT, "I'm Content", "This is very loooooooooooooooooooooooooooooooooooooooooong message", NOTIFICATION_VARIABLE_TYPE_NONE);
-
+ /*
+ noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_TITLE, "I'm Title", "TITLE", NOTIFICATION_VARIABLE_TYPE_NONE);
+ noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_CONTENT, "I'm Content", "This is very loooooooooooooooooooooooooooooooooooooooooong message", NOTIFICATION_VARIABLE_TYPE_NONE);
+ */
noti_err = notification_set_display_applist(noti_handle, NOTIFICATION_DISPLAY_APP_TICKER | NOTIFICATION_DISPLAY_APP_INDICATOR);
if (noti_err != NOTIFICATION_ERROR_NONE) {
@@ -293,7 +294,7 @@ static int testapp_test_post_notification_on_indicator()
goto FINISH_OFF;
}
- FINISH_OFF:
+FINISH_OFF:
if (noti_handle)
notification_free(noti_handle);
@@ -307,9 +308,8 @@ 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);
- }
return noti_err;
}
@@ -665,9 +665,8 @@ static int testapp_test_update_setting()
notification_setting_update_setting(setting);
}
- if (setting) {
+ if (setting)
notification_setting_free_notification(setting);
- }
return err;
}