Silence a warning

This commit is contained in:
Thomas Goyne 2015-07-28 11:55:05 -07:00
parent 09b2736103
commit 4a3b411092
1 changed files with 3 additions and 4 deletions

View File

@ -93,9 +93,9 @@ public:
class WordSplitter { class WordSplitter {
std::string const& text; std::string const& text;
std::vector<DialogueToken> &tokens; std::vector<DialogueToken> &tokens;
size_t pos; size_t pos = 0;
void SwitchTo(size_t &i, int type, int len) { void SwitchTo(size_t &i, int type, size_t len) {
auto old = tokens[i]; auto old = tokens[i];
tokens[i].type = type; tokens[i].type = type;
tokens[i].length = len; tokens[i].length = len;
@ -110,7 +110,7 @@ class WordSplitter {
using namespace boost::locale::boundary; using namespace boost::locale::boundary;
ssegment_index map(word, text.begin() + pos, text.begin() + pos + tokens[i].length); ssegment_index map(word, text.begin() + pos, text.begin() + pos + tokens[i].length);
for (auto const& segment : map) { for (auto const& segment : map) {
int len = distance(begin(segment), end(segment)); auto len = static_cast<size_t>(distance(begin(segment), end(segment)));
if (segment.rule() & word_letters) if (segment.rule() & word_letters)
SwitchTo(i, dt::WORD, len); SwitchTo(i, dt::WORD, len);
else else
@ -122,7 +122,6 @@ public:
WordSplitter(std::string const& text, std::vector<DialogueToken> &tokens) WordSplitter(std::string const& text, std::vector<DialogueToken> &tokens)
: text(text) : text(text)
, tokens(tokens) , tokens(tokens)
, pos(0)
{ } { }
void SplitWords() { void SplitWords() {