am 805ac949: Fix string.compare() logic. It happens to be working luckily.

* commit '805ac949d22946e60cbe311676e32d1f4f02ced3':
  Fix string.compare() logic.  It happens to be working luckily.
main
Ken Wakasa 2012-08-09 04:03:05 -07:00 committed by Android Git Automerger
commit 3b53045515
1 changed files with 3 additions and 6 deletions

View File

@ -40,8 +40,9 @@ class AdditionalProximityChars {
static const int32_t EN_US_ADDITIONAL_U[];
static bool isEnLocale(const std::string *locale_str) {
return locale_str && locale_str->size() >= LOCALE_EN_US.size()
&& LOCALE_EN_US.compare(0, LOCALE_EN_US.size(), *locale_str);
const size_t LOCALE_EN_US_SIZE = LOCALE_EN_US.size();
return locale_str && locale_str->size() >= LOCALE_EN_US_SIZE
&& locale_str->compare(0, LOCALE_EN_US_SIZE, LOCALE_EN_US) == 0;
}
public:
@ -84,10 +85,6 @@ class AdditionalProximityChars {
return 0;
}
}
static bool hasAdditionalChars(const std::string *locale_str, const int32_t c) {
return getAdditionalCharsSize(locale_str, c) > 0;
}
};
} // namespace latinime
#endif // LATINIME_ADDITIONAL_PROXIMITY_CHARS_H