summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormk5004.lee <mk5004.lee@samsung.com>2018-09-14 08:55:10 (GMT)
committermk5004.lee <mk5004.lee@samsung.com>2018-09-14 09:55:17 (GMT)
commit8b0a6aede39df89ee8a9263797e658b876d34cb1 (patch)
tree0a664202e2050bebbc263f513923dcbf8542fd3e
parentc5e7e84e0aac631d59ad205dfcf3f5cc0f127cde (diff)
downloadbadge-8b0a6aede39df89ee8a9263797e658b876d34cb1.zip
badge-8b0a6aede39df89ee8a9263797e658b876d34cb1.tar.gz
badge-8b0a6aede39df89ee8a9263797e658b876d34cb1.tar.bz2
Check coding stylerefs/changes/17/189217/3
Change-Id: Ic9d4c6aacd79d12beedad9c582b4dc50f8012d10 Signed-off-by: mk5004.lee <mk5004.lee@samsung.com>
-rw-r--r--src/badge_db.c8
-rw-r--r--src/badge_init.c2
-rw-r--r--src/badge_internal.c33
-rw-r--r--src/badge_ipc.c10
-rw-r--r--src/badge_setting_service.c28
5 files changed, 35 insertions, 46 deletions
diff --git a/src/badge_db.c b/src/badge_db.c
index ec5f7a4..0bbc57a 100644
--- a/src/badge_db.c
+++ b/src/badge_db.c
@@ -58,12 +58,12 @@ static bool is_db_corrupted = false;
static int __check_integrity_cb(void *pid, int argc, char **argv, char **notUsed)
{
if (strcmp(argv[0], "ok") != 0) {
- ERR("db integrity result : %s" , argv[0]);
+ ERR("db integrity result : %s", argv[0]);
is_db_corrupted = true;
return -1;
}
- INFO("db integrity result : %s" , argv[0]);
+ INFO("db integrity result : %s", argv[0]);
return 0;
}
/* LCOV_EXCL_STOP */
@@ -81,7 +81,7 @@ static int __recover_corrupted_db(sqlite3 *db)
unlink(BADGE_DB_PATH);
sql_ret = sqlite3_open_v2(BADGE_DB_PATH, &db,
- SQLITE_OPEN_CREATE |SQLITE_OPEN_READWRITE,
+ SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE,
NULL);
if (sql_ret != SQLITE_OK) {
ERR("Failed to open badge db[%d]", sql_ret);
@@ -105,7 +105,7 @@ out:
/* LCOV_EXCL_STOP */
/* LCOV_EXCL_START */
-EXPORT_API int badge_db_init()
+EXPORT_API int badge_db_init(void)
{
int ret = BADGE_ERROR_NONE;
int sql_ret;
diff --git a/src/badge_init.c b/src/badge_init.c
index 2d3fdae..a6cf681 100644
--- a/src/badge_init.c
+++ b/src/badge_init.c
@@ -37,7 +37,7 @@
#undef _E
#endif
#define _E(fmt, arg...) fprintf(stderr, "[BADGE_INIT][E][%s,%d] "fmt"\n", \
- __FUNCTION__, __LINE__, ##arg);
+ __func__, __LINE__, ##arg)
static int __is_authorized(void)
{
diff --git a/src/badge_internal.c b/src/badge_internal.c
index 1360133..51eb94e 100644
--- a/src/badge_internal.c
+++ b/src/badge_internal.c
@@ -502,11 +502,7 @@ int _badge_insert(badge_h *badge, uid_t uid)
}
sqlbuf = sqlite3_mprintf("INSERT INTO %q " \
- "(pkgname, " \
- "writable_pkgs, " \
- "uid) "\
- "VALUES " \
- "(%Q, %Q, %d);",
+ "(pkgname, writable_pkgs, uid) VALUES (%Q, %Q, %d);",
BADGE_TABLE_NAME,
badge->pkgname, badge->writable_pkgs, uid);
if (!sqlbuf) {
@@ -535,12 +531,9 @@ int _badge_insert(badge_h *badge, uid_t uid)
}
sqlbuf = sqlite3_mprintf("INSERT INTO %q " \
- "(pkgname, " \
- "uid) " \
- "VALUES "
- "(%Q, %d);",
+ "(pkgname, uid) VALUES (%Q, %d);",
BADGE_OPTION_TABLE_NAME,
- badge->pkgname, uid);
+ badge->pkgname, uid);
if (!sqlbuf) {
/* LCOV_EXCL_START */
ERR("Failed to alloc query");
@@ -864,8 +857,8 @@ int _badge_set_count(const char *caller, const char *pkgname,
}
sqlbuf = sqlite3_mprintf("UPDATE %q SET badge = %d " \
- "WHERE pkgname = %Q AND uid = %d",
- BADGE_TABLE_NAME, count, pkgname, uid);
+ "WHERE pkgname = %Q AND uid = %d",
+ BADGE_TABLE_NAME, count, pkgname, uid);
if (!sqlbuf) {
/* LCOV_EXCL_START */
ERR("Failed to alloc query");
@@ -925,8 +918,8 @@ int _badge_get_count(const char *pkgname, unsigned int *count, uid_t uid)
}
sqlbuf = sqlite3_mprintf("SELECT badge FROM %q " \
- "WHERE pkgname = %Q AND uid = %d",
- BADGE_TABLE_NAME, pkgname, uid);
+ "WHERE pkgname = %Q AND uid = %d",
+ BADGE_TABLE_NAME, pkgname, uid);
if (!sqlbuf) {
/* LCOV_EXCL_START */
ERR("Failed to alloc query");
@@ -1018,11 +1011,7 @@ int _badge_set_display(const char *pkgname, unsigned int is_display, uid_t uid)
} else if (ret == BADGE_ERROR_NOT_EXIST) {
sqlbuf = sqlite3_mprintf("INSERT INTO %q " \
- "(pkgname, " \
- "display, " \
- "uid) " \
- "VALUES "
- "(%Q, %d, %d);",
+ "(pkgname, display, uid) VALUES (%Q, %d, %d);",
BADGE_OPTION_TABLE_NAME,
pkgname, is_display, uid);
if (!sqlbuf) {
@@ -1166,7 +1155,7 @@ static int _badge_changed_monitor_init(uid_t uid)
return badge_ipc_monitor_init(uid);
}
-static void _badge_chanaged_monitor_fini()
+static void _badge_chanaged_monitor_fini(void)
{
badge_ipc_monitor_fini();
}
@@ -1188,6 +1177,7 @@ static gint _badge_data_compare(gconstpointer a, gconstpointer b)
static struct _badge_cb_data *__malloc_badge_cb_data(badge_change_cb callback, void *data)
{
struct _badge_cb_data *bd = NULL;
+
bd = (struct _badge_cb_data *)malloc(sizeof(struct _badge_cb_data));
if (bd == NULL) {
/* LCOV_EXCL_START */
@@ -1278,7 +1268,7 @@ char *_badge_pkgs_new(int *err, const char *pkg1, ...)
va_start(args, pkg1);
s = va_arg(args, char *);
while (s) {
- length += strlen(s) ;
+ length += strlen(s);
s = va_arg(args, char *);
}
va_end(args);
@@ -1436,6 +1426,7 @@ int badge_foreach_for_uid(badge_foreach_cb callback, void *user_data, uid_t uid)
{
CHECK_BADGE_FEATURE();
int result = BADGE_ERROR_NONE;
+
result = badge_ipc_request_get_list(callback, user_data, uid);
if (result == BADGE_ERROR_IO_ERROR)
result = BADGE_ERROR_FROM_DB;
diff --git a/src/badge_ipc.c b/src/badge_ipc.c
index cd9d193..372753e 100644
--- a/src/badge_ipc.c
+++ b/src/badge_ipc.c
@@ -42,7 +42,7 @@ struct _task_list {
task_list *prev;
task_list *next;
- void (*task_cb) (void *data);
+ void (*task_cb)(void *data);
void *data;
};
static task_list *g_task_list;
@@ -293,7 +293,7 @@ static int _dbus_init(void)
return BADGE_ERROR_NONE;
}
-static int _dbus_signal_init()
+static int _dbus_signal_init(void)
{
int ret = BADGE_ERROR_NONE;
int id;
@@ -642,7 +642,7 @@ int badge_ipc_request_set_count(const char *pkgname, const char *caller, int cou
result = _send_sync_badge(body, &reply, "set_badge_count");
if (reply)
- g_object_unref(reply);
+ g_object_unref(reply);
DBG("badge_ipc_request_set_count done [%d]", result);
return result;
@@ -710,9 +710,9 @@ int badge_ipc_request_set_display(const char *pkgname, const char *caller,
int badge_ipc_request_get_display(const char *pkgname, unsigned int *is_display, uid_t uid)
{
- int result ;
+ int result;
GDBusMessage *reply = NULL;
- GVariant *body ;
+ GVariant *body;
GVariant *reply_body;
unsigned int ret_is_display;
diff --git a/src/badge_setting_service.c b/src/badge_setting_service.c
index ee3a382..fc2b0bd 100644
--- a/src/badge_setting_service.c
+++ b/src/badge_setting_service.c
@@ -415,8 +415,7 @@ EXPORT_API int badge_db_update_pkg_disabled(const char *pkg_id, bool disabled, u
(The first bit indicates allow information, and the second bit indicates app disable information.)
*/
sqlbuf = sqlite3_mprintf("UPDATE %s SET allow_to_display = (allow_to_display & ~%d ) | %d " \
- "WHERE pkgname = %Q " \
- "AND uid = %d;",
+ "WHERE pkgname = %Q AND uid = %d;",
BADGE_SETTING_DB_TABLE, BAGDE_APP_DISABLE_BIT, flag, pkg_id, uid);
if (!sqlbuf) {
/* LCOV_EXCL_START */
@@ -518,13 +517,13 @@ static bool _is_package_in_setting_table(sqlite3 *db, const char *pkgname, const
sqlite3_stmt *stmt = NULL;
if (appid != NULL)
- query = sqlite3_mprintf("SELECT appid FROM badge_setting "
- "WHERE uid = %d AND pkgname = %Q AND appid = %Q",
- uid, pkgname, appid);
+ query = sqlite3_mprintf("SELECT appid FROM badge_setting " \
+ "WHERE uid = %d AND pkgname = %Q AND appid = %Q",
+ uid, pkgname, appid);
else
- query = sqlite3_mprintf("SELECT pkgname FROM badge_setting "
- "WHERE uid = %d AND pkgname = %Q",
- uid, pkgname);
+ query = sqlite3_mprintf("SELECT pkgname FROM badge_setting " \
+ "WHERE uid = %d AND pkgname = %Q",
+ uid, pkgname);
if (query == NULL) {
/* LCOV_EXCL_START */
ERR("Out of Memory");
@@ -592,10 +591,9 @@ static int app_info_callback(const pkgmgrinfo_appinfo_h handle, void *user_data)
goto out;
}
- query = sqlite3_mprintf("INSERT INTO badge_setting "
- "(uid, pkgname, appid) "
- "VALUES (%d, %Q, %Q) ",
- info->uid, pkgname, appid);
+ query = sqlite3_mprintf("INSERT INTO badge_setting " \
+ "(uid, pkgname, appid) VALUES (%d, %Q, %Q) ",
+ info->uid, pkgname, appid);
if (query == NULL) {
ERR("Out of memory");
goto out;
@@ -771,7 +769,7 @@ EXPORT_API int badge_setting_delete_package_for_uid(const char *pkgname, uid_t u
sqlite3_exec(db, "BEGIN immediate;", NULL, NULL, NULL);
- query = sqlite3_mprintf("DELETE FROM badge_setting "
+ query = sqlite3_mprintf("DELETE FROM badge_setting " \
"WHERE uid = %d AND pkgname = %Q ",
uid, pkgname);
if (query == NULL) {
@@ -890,7 +888,7 @@ EXPORT_API int badge_setting_arrange_tables(uid_t uid)
return BADGE_ERROR_FROM_DB;
}
- sqlbuf = sqlite3_mprintf("DELETE FROM %Q WHERE pkgname not in "
+ sqlbuf = sqlite3_mprintf("DELETE FROM %Q WHERE pkgname not in " \
"(SELECT pkgname FROM %Q) AND uid = %d",
BADGE_TABLE_NAME, BADGE_SETTING_DB_TABLE, uid);
if (sqlbuf == NULL) {
@@ -908,7 +906,7 @@ EXPORT_API int badge_setting_arrange_tables(uid_t uid)
sqlbuf = NULL;
}
- sqlbuf = sqlite3_mprintf("DELETE FROM %Q WHERE pkgname not in "
+ sqlbuf = sqlite3_mprintf("DELETE FROM %Q WHERE pkgname not in " \
"(SELECT pkgname FROM %Q) AND uid = %d",
BADGE_OPTION_TABLE_NAME, BADGE_SETTING_DB_TABLE,
uid);