diff options
Diffstat (limited to 'base/word_iterator.cc')
-rw-r--r-- | base/word_iterator.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/base/word_iterator.cc b/base/word_iterator.cc index 9137f71..1e59a2f 100644 --- a/base/word_iterator.cc +++ b/base/word_iterator.cc @@ -8,7 +8,7 @@ #include "unicode/ubrk.h" #include "unicode/ustring.h" -const int WordIterator::npos = -1; +const size_t npos = -1; WordIterator::WordIterator(const std::wstring& str, BreakType break_type) : iter_(NULL), @@ -72,7 +72,7 @@ bool WordIterator::Advance() { pos_ = npos; return false; } else { - pos_ = static_cast<int>(pos); + pos_ = static_cast<size_t>(pos); return true; } } @@ -82,7 +82,7 @@ bool WordIterator::IsWord() const { } std::wstring WordIterator::GetWord() const { - DCHECK(prev_ >= 0 && pos_ >= 0); + DCHECK(prev_ != npos && pos_ != npos); return string_.substr(prev_, pos_ - prev_); } |