From 61f2031e4bc74f292537042f518228c5257aa91b Mon Sep 17 00:00:00 2001 From: Qin Wenfeng Date: Sat, 29 Nov 2014 19:36:55 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=88=A0=E9=99=A4=20MPSegment.hpp=20?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E9=87=8D=E5=A4=8D=E5=A4=B4=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MPSegment.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/MPSegment.hpp b/src/MPSegment.hpp index 333fe65..f6976fd 100644 --- a/src/MPSegment.hpp +++ b/src/MPSegment.hpp @@ -6,7 +6,6 @@ #include #include "Limonp/Logger.hpp" #include "DictTrie.hpp" -#include "DictTrie.hpp" #include "ISegment.hpp" #include "SegmentBase.hpp" From 2b522b20ff9147023f06279b30c3fef9567580c2 Mon Sep 17 00:00:00 2001 From: Qin Wenfeng Date: Sat, 29 Nov 2014 19:41:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BD=BF=E7=94=A8=20uint8=5Ft=20=E9=80=9A?= =?UTF-8?q?=E8=BF=87=20UBSAN=20=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Limonp/StringUtil.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Limonp/StringUtil.hpp b/src/Limonp/StringUtil.hpp index e6cc15d..ed8fdbc 100644 --- a/src/Limonp/StringUtil.hpp +++ b/src/Limonp/StringUtil.hpp @@ -204,7 +204,7 @@ namespace Limonp vec.push_back(str[i]); i++; } - else if ((unsigned char)str[i] <= 0xdf && i + 1 < len) // 110xxxxxx + else if ((uint8_t)str[i] <= 0xdf && i + 1 < len) // 110xxxxxx { ch1 = (str[i] >> 2) & 0x07; ch2 = (str[i+1] & 0x3f) | ((str[i] & 0x03) << 6 ); @@ -212,10 +212,10 @@ namespace Limonp vec.push_back(tmp); i += 2; } - else if((unsigned char)str[i] <= 0xef && i + 2 < len) + else if((uint8_t)str[i] <= 0xef && i + 2 < len) { - ch1 = (str[i] << 4) | ((str[i+1] >> 2) & 0x0f ); - ch2 = ((str[i+1]<<6) & 0xc0) | (str[i+2] & 0x3f); + ch1 = ((uint8_t)str[i] << 4) | ((str[i+1] >> 2) & 0x0f ); + ch2 = (((uint8_t)str[i+1]<<6) & 0xc0) | (str[i+2] & 0x3f); tmp = (((uint16_t(ch1) & 0x00ff ) << 8) | (uint16_t(ch2) & 0x00ff)); vec.push_back(tmp); i += 3;