Fix static analysis issue 46/280846/1
authorInkyun Kil <inkyun.kil@samsung.com>
Tue, 6 Sep 2022 01:47:54 +0000 (10:47 +0900)
committerInkyun Kil <inkyun.kil@samsung.com>
Tue, 6 Sep 2022 01:48:20 +0000 (10:48 +0900)
Change-Id: Ife3f1a86d2251bd139876e163a38e48e888d64a7
Signed-off-by: Inkyun Kil <inkyun.kil@samsung.com>
lib/alarm-lib.c
session-agent/agent.c

index 7396c3e..38c35e0 100644 (file)
@@ -539,10 +539,10 @@ EXPORT_API int alarmmgr_init(const char *appid)
        char service_name[MAX_SERVICE_NAME_LEN] = { 0 };
        char service_name_mod[MAX_SERVICE_NAME_LEN] = { 0 };
        int ret;
-       int len = 0;
+       size_t len = 0;
        guint owner_id = 0;
-       int i = 0;
-       int j = 0;
+       size_t i = 0;
+       size_t j = 0;
        bool is_user = false;
 
        if (appid == NULL) {
@@ -1035,8 +1035,8 @@ EXPORT_API int alarmmgr_add_alarm_with_localtime(alarm_entry_t *alarm,
        alarm_mode_t *mode;
        int ret;
        int error_code;
-       int i = 0;
-       int j = 0;
+       size_t i = 0;
+       size_t j = 0;
 
        LOGD("[alarm-lib]:alarm_create() is called\n");
 
@@ -1289,8 +1289,8 @@ static int _alarmmgr_add_alarm(int alarm_type,
 {
        char dst_service_name[MAX_SERVICE_NAME_LEN] = { 0 };
        char dst_service_name_mod[MAX_SERVICE_NAME_LEN] = { 0 };
-       int i = 0;
-       int j = 0;
+       size_t i = 0;
+       size_t j = 0;
        int error_code;
        base_info_t base_info;
        int ret;
index a88af1c..308d235 100755 (executable)
@@ -151,10 +151,10 @@ static void _send_noti(char *service_name, int alarm_id, int msec)
        g_object_unref(conn);
 }
 
-static void flush_data(int fd, uint32_t len)
+static void flush_data(int fd, size_t len)
 {
-       int r;
-       uint32_t s;
+       ssize_t r;
+       size_t s;
        char buf[4096];
 
        while (len > 0) {
@@ -172,7 +172,7 @@ static gboolean _alarm_agent_main(gint fd, GIOCondition condition,
                gpointer user_data)
 {
        int r;
-       int len;
+       size_t len;
        int alarm_id;
        int msec;
        int clifd;
@@ -182,7 +182,7 @@ static gboolean _alarm_agent_main(gint fd, GIOCondition condition,
        socklen_t addrlen;
        GVariant *gv;
 
-       addrlen = sizeof(sa);
+       addrlen = (socklen_t)sizeof(sa);
        clifd = accept(fd, (struct sockaddr *)&sa, &addrlen);
        if (clifd == -1) {
                LOGE("Accept: %d", errno);