From 8dc0636933c685769d8e808be21c306fe0eee89f Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 17 Jul 2017 16:46:12 +0900 Subject: [PATCH] Fix issue detected by static analysis tool 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 --- src/ime-core/imi_view_classic.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ime-core/imi_view_classic.cpp b/src/ime-core/imi_view_classic.cpp index 37384d9..ec5054c 100644 --- a/src/ime-core/imi_view_classic.cpp +++ b/src/ime-core/imi_view_classic.cpp @@ -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) -- 2.7.4