Fix issue detected by static analysis tool 81/139081/1 accepted/tizen/unified/20170720.062151 submit/tizen/20170720.014256
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 17 Jul 2017 07:46:12 +0000 (16:46 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 17 Jul 2017 07:46:14 +0000 (16:46 +0900)
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>
src/ime-core/imi_view_classic.cpp

index 37384d9..ec5054c 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)