From daf8e2874995588541f3304ec69ed9acb4199771 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 7 Oct 2014 13:13:22 +0800 Subject: [PATCH] pinyin/segmentor.h: fix comparision operator * fix a bunch of sign-compare warnings Change-Id: Iacfa7983917080ef8b99dabd1c99b3e8e32bea9f --- src/ime-core/imi_view_classic.cpp | 6 +++--- src/pinyin/segmentor.h | 2 +- src/portability.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ime-core/imi_view_classic.cpp b/src/ime-core/imi_view_classic.cpp index ec5054c..db2f021 100644 --- a/src/ime-core/imi_view_classic.cpp +++ b/src/ime-core/imi_view_classic.cpp @@ -197,11 +197,11 @@ CIMIClassicView::onKeyEvent(const CKeyEvent& key) && !m_pIC->isEmpty()) { changeMasks |= KEYEVENT_USED; if (m_candiPageFirst > 0) { - if (m_candiPageFirst > m_candiWindowSize) + if (m_candiPageFirst > m_candiWindowSize) { m_candiPageFirst -= m_candiWindowSize; - else + } else { m_candiPageFirst = 0; - + } changeMasks |= CANDIDATE_MASK; } } else if (((modifiers == 0 && keycode == IM_VK_PAGE_DOWN) diff --git a/src/pinyin/segmentor.h b/src/pinyin/segmentor.h index 9af15f1..162f7cb 100644 --- a/src/pinyin/segmentor.h +++ b/src/pinyin/segmentor.h @@ -62,7 +62,7 @@ struct IPySegmentor { return true; if (m_start == other.m_start) - return m_len < m_len; + return m_len < other.m_len; return false; } diff --git a/src/portability.cpp b/src/portability.cpp index 58a06a6..ea3b4fb 100644 --- a/src/portability.cpp +++ b/src/portability.cpp @@ -194,7 +194,7 @@ MBSTOWCS(TWCHAR *pwcs, const char* s, size_t n) const unsigned char *src = (const unsigned char*)s; TWCHAR* dst = pwcs; - while (dst - pwcs < n) { + while (dst - pwcs < (ssize_t)n) { if (*src < 0xc0 || *src >= 0xfe) { if (*src < 0x80) *dst++ = *src; if (*src++ == 0) break; -- 2.7.4