Fix issue detected by static analysis tool 91/139391/1 accepted/tizen/3.0/common/20170720.141629 accepted/tizen/3.0/ivi/20170720.010518 accepted/tizen/3.0/mobile/20170720.010448 accepted/tizen/3.0/tv/20170720.010500 submit/tizen_3.0/20170718.224708
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 17 Jul 2017 07:46:12 +0000 (16:46 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 18 Jul 2017 22:45:01 +0000 (22:45 +0000)
The variable m_candiPageFirst has unsigned type.
Therefore, the value of this variable cannot be less than zero.

Change-Id: I9d36ac47be4eb5bb7cd636299bad323c13e472a3
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
(cherry picked from commit 8dc0636933c685769d8e808be21c306fe0eee89f)

src/ime-core/imi_view_classic.cpp

index 37384d9f49fc259aafb2577b6b83a08a40a1d08a..ec5054c67e8cf557fffe05a10b1cecf394386dd5 100644 (file)
@@ -197,8 +197,11 @@ CIMIClassicView::onKeyEvent(const CKeyEvent& key)
                && !m_pIC->isEmpty()) {
         changeMasks |= KEYEVENT_USED;
         if (m_candiPageFirst > 0) {
-            m_candiPageFirst -= m_candiWindowSize;
-            if (m_candiPageFirst < 0) m_candiPageFirst = 0;
+            if (m_candiPageFirst > m_candiWindowSize)
+                m_candiPageFirst -= m_candiWindowSize;
+            else
+                m_candiPageFirst = 0;
+
             changeMasks |= CANDIDATE_MASK;
         }
     } else if (((modifiers == 0 && keycode == IM_VK_PAGE_DOWN)