#include <notification_ipc.h>
#include <notification_internal.h>
-static void (*posted_toast_message_cb) (void *data);
+static void (*posted_toast_message_cb)(void *data);
#define NOTI_TEXT_RESULT_LEN 2048
#define NOTI_PKGNAME_LEN 512
char pkgname[NOTI_PKGNAME_LEN + 1] = { 0, };
int pid = 0, ret = AUL_R_OK;
int fd;
- char *dup_pkgname;
+ char *dup_pkgname;
char buf[NOTI_PKGNAME_LEN + 1] = { 0, };
pid = getpid();
static volatile gsize quark_volatile = 0;
static const char *domain_name = NULL;
- /* This is for preventing crash when notification api is used in ui-gadget */
+ /* This is for preventing crash when notification api is used in ui-gadget */
/* ui-gadget libraries can be unloaded when it is needed and the static string */
- /* parameter to g_dbus_error_register_error_domain may cause crash. */
+ /* parameter to g_dbus_error_register_error_domain may cause crash. */
GQuark quark = g_quark_try_string(NOTIFICATION_ERROR_QUARK);
if (quark == 0) {
{
sqlite3_stmt *stmt = NULL;
char query[NOTIFICATION_QUERY_MAX] = { 0, };
- int ret = NOTIFICATION_ERROR_NONE, result = 0;
+ int ret;
+ int result;
snprintf(query, sizeof(query),
"select count(*) from noti_group_data where caller_pkgname = '%s' and group_id = %d",
sqlite3 *db;
sqlite3_stmt *stmt = NULL;
char query[NOTIFICATION_QUERY_MAX] = { 0, };
- int ret = 0;
- int result = NOTIFICATION_ERROR_NONE;
+ int ret;
+ int result;
db = notification_db_open(DBPATH);
if (!db)
sqlite3 *db;
sqlite3_stmt *stmt = NULL;
char query[NOTIFICATION_QUERY_MAX] = { 0, };
- int ret = 0;
+ int ret;
int col = 0;
db = notification_db_open(DBPATH);
return NOTIFICATION_ERROR_INVALID_PARAMETER;
else
input_priv_id = noti->priv_id;
-
} else {
input_priv_id = priv_id;
}
EXPORT_API int notification_get_icon(notification_h noti,
char **icon_path)
{
- int ret_err = NOTIFICATION_ERROR_NONE;
+ int ret = NOTIFICATION_ERROR_NONE;
char *ret_image_path = NULL;
- ret_err = notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
+ ret = notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
&ret_image_path);
- if (ret_err == NOTIFICATION_ERROR_NONE && icon_path != NULL)
+ if (ret == NOTIFICATION_ERROR_NONE && icon_path != NULL)
*icon_path = ret_image_path;
- return ret_err;
+ return ret;
}
/* LCOV_EXCL_STOP */
EXPORT_API int notification_translate_localized_text(notification_h noti)
{
- int noti_err = NOTIFICATION_ERROR_NONE;
+ int ret = NOTIFICATION_ERROR_NONE;
char *ret_text = NULL;
char buf_key[32];
char *bundle_val = NULL;
notification_text_type_e type = NOTIFICATION_TEXT_TYPE_TITLE;
for (; type < NOTIFICATION_TEXT_TYPE_MAX; type++) {
- noti_err = notification_get_text(noti, type, &ret_text);
- if (noti_err == NOTIFICATION_ERROR_NONE && ret_text) {
+ ret = notification_get_text(noti, type, &ret_text);
+ if (ret == NOTIFICATION_ERROR_NONE && ret_text) {
if (noti->b_text == NULL) {
noti->b_text = bundle_create();
if (noti->b_text == NULL)
}
}
- return noti_err;
+ return ret;
}
/* LCOV_EXCL_START */
char **title,
char **loc_title)
{
- int noti_err = NOTIFICATION_ERROR_NONE;
+ int ret;
char *ret_text = NULL;
- noti_err = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
+ ret = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
&ret_text);
if (title != NULL)
if (loc_title != NULL)
*loc_title = NULL;
- return noti_err;
+ return ret;
}
/* LCOV_EXCL_STOP */
char **content,
char **loc_content)
{
- int noti_err = NOTIFICATION_ERROR_NONE;
+ int ret;
char *ret_text = NULL;
- noti_err = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
+ ret = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
&ret_text);
if (content != NULL)
if (loc_content != NULL)
*loc_content = NULL;
- return noti_err;
+ return ret;
}
/* LCOV_EXCL_STOP */
if (do_not_disturb_exception == false) {
/* do_not_disturb is ON and do_not_disturb_exception is OFF */
- /* Then add this notification only on quick panel and indicator*/
+ /* Then add this notification only on quick panel and indicator */
noti->display_applist = noti->display_applist & (NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_INDICATOR);
- /* and reset all sound and vibration and led options*/
+ /* and reset all sound and vibration and led options */
noti->sound_type = NOTIFICATION_SOUND_TYPE_NONE;
SAFE_FREE(noti->sound_path);
noti->vibration_type = NOTIFICATION_VIBRATION_TYPE_NONE;
{
int ret = NOTIFICATION_ERROR_NONE;
int ret_tmp = NOTIFICATION_ERROR_NONE;
- int i = 0, data_cnt = 0;
+ int i = 0;
+ int data_cnt = 0;
sqlite3 *db = NULL;
sqlite3_stmt *stmt = NULL;
char buf[128] = { 0, };
if (type != NOTIFICATION_TYPE_NONE)
snprintf(query_where, sizeof(query_where),
"where type = %d and uid = %d", type, uid);
-
} else {
if (type == NOTIFICATION_TYPE_NONE)
snprintf(query_where, sizeof(query_where),
query_where[0] = '\0';
if (ret == NOTIFICATION_ERROR_NONE)
ret = ret_tmp;
-
}
snprintf(buf, sizeof(buf) - 1, "%s%d", (i % NOTI_BURST_DELETE_UNIT == 0) ? "" : ",", *((*list_deleted_rowid) + i));
strncat(query_where, buf, sizeof(query_where) - strlen(query_where) - 1);
if (num_deleted != NULL)
*num_deleted = data_cnt;
-
} else {
/* Make main query */
snprintf(query_base, sizeof(query_base), "delete from noti_list ");
if (num_deleted != NULL)
*num_deleted = sqlite3_changes(db);
-
}
err:
EXPORT_API int notification_noti_delete_by_priv_id_get_changes(const char *pkgname, int priv_id, int *num_changes, uid_t uid)
{
sqlite3 *db = NULL;
- char query[NOTIFICATION_QUERY_MAX] = {0, };
+ char query[NOTIFICATION_QUERY_MAX] = { 0, };
int ret;
db = notification_db_open(DBPATH);
if (stmt)
sqlite3_finalize(stmt);
-
if (db)
notification_db_close(&db);
if (db_statement)
sqlite3_finalize(db_statement);
-
if (db) {
if (err == NOTIFICATION_ERROR_NONE)
sqlite3_exec(db, "END;", NULL, NULL, NULL);
out:
if (db_statement)
sqlite3_finalize(db_statement);
+
if (ret == NOTIFICATION_ERROR_NONE)
sqlite3_exec(db, "END;", NULL, NULL, NULL);
else
sqlite3_exec(db, "ROLLBACK;", NULL, NULL, NULL);
+
notification_db_close(&db);
return ret;
out:
if (query_result)
sqlite3_free_table(query_result);
+
if (query)
sqlite3_free(query);
+
if (db)
notification_db_close(&db);