Fix issue detected by static analysis tool 96/265296/1
authorInHong Han <inhong1.han@samsung.com>
Thu, 14 Oct 2021 07:47:41 +0000 (16:47 +0900)
committerInHong Han <inhong1.han@samsung.com>
Thu, 14 Oct 2021 07:54:45 +0000 (16:54 +0900)
Fix a sign extension issue.

Change-Id: If9c57ffe8f18f389a4459cf30aff9e89496fcb3e

ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp
ism/src/scim_socket.cpp
ism/src/scim_utility.cpp

index f90f685..238a6d7 100644 (file)
@@ -1909,8 +1909,8 @@ wsc_send_preedit_style (WSCContextISF* wsc_ctx)
                         start_index = i->get_start ();
                         end_index = i->get_end ();
                         if (end_index <= wlen && start_index < end_index) {
-                            start_index = g_utf8_offset_to_pointer (mbs.c_str (), i->get_start ()) - mbs.c_str ();
-                            end_index = g_utf8_offset_to_pointer (mbs.c_str (), i->get_end ()) - mbs.c_str ();
+                            start_index = g_utf8_offset_to_pointer (mbs.c_str (), (int)i->get_start ()) - mbs.c_str ();
+                            end_index = g_utf8_offset_to_pointer (mbs.c_str (), (int)i->get_end ()) - mbs.c_str ();
                             if (i->get_type () == SCIM_ATTR_DECORATE) {
                                 switch (i->get_value ())
                                 {
index 692ecd1..11d64d5 100644 (file)
@@ -837,7 +837,7 @@ private:
                 }
                 if (*timeout > 0) {
                     tv.tv_sec = *timeout / 1000;
-                    tv.tv_usec = ((unsigned long int)*timeout % 1000) * 1000;
+                    tv.tv_usec = ((long int)*timeout % 1000) * 1000;
                 } else {
                     tv.tv_sec = 0;
                     tv.tv_usec = 0;
index 8c0a04b..e5af825 100644 (file)
@@ -1371,8 +1371,8 @@ scim_usleep (unsigned int usec)
 #if HAVE_NANOSLEEP
     struct timespec req, rem;
 
-    req.tv_sec = usec / 1000000;
-    req.tv_nsec = ((unsigned long int)usec % 1000000) * 1000;
+    req.tv_sec = (long int)usec / 1000000;
+    req.tv_nsec = ((long int)usec % 1000000) * 1000;
 
     while (nanosleep (&req, &rem) == -1 && errno == EINTR && (rem.tv_sec != 0 || rem.tv_nsec != 0))
         req = rem;