Fix string.compare() logic. It happens to be working luckily.

Change-Id: I262c6d5779124e5b09ad1a66ca3c9ddb2fc6d7d5
This commit is contained in:
Ken Wakasa 2012-08-09 19:32:03 +09:00
parent 71b379df51
commit 805ac949d2

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