Upgrade limonp to v0.5.6 to fix hidden trouble.

This commit is contained in:
yanyiwu 2016-03-18 14:05:18 +08:00
parent 643148edf5
commit 92fdf009cb
2 changed files with 11 additions and 2 deletions

View File

@ -1,5 +1,9 @@
# CppJieba ChangeLog
## next version
+ Upgrade limonp to v0.5.6 to fix hidden trouble.
## v4.5.1
+ Upgrade limonp to v0.5.5 to solve macro name conficts in some special case.

View File

@ -78,13 +78,18 @@ inline string& Lower(string& str) {
return str;
}
inline bool IsSpace(unsigned c) {
// when passing large int as the argument of isspace, it core dump, so here need a type cast.
return c > 0xff ? false : std::isspace(c & 0xff);
}
inline std::string& LTrim(std::string &s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<unsigned, bool>(IsSpace))));
return s;
}
inline std::string& RTrim(std::string &s) {
s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<unsigned, bool>(IsSpace))).base(), s.end());
return s;
}