diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:22:36 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:22:36 +0200 |
commit | ecb1524f8da7901338b263384fed3c612f117b4c (patch) | |
tree | e7e06423fe27ea5ab45f27fc4b39ae597ba72490 /lib/parse_plural.h | |
parent | 5.10 (diff) | |
download | FreeFileSync-ecb1524f8da7901338b263384fed3c612f117b4c.tar.gz FreeFileSync-ecb1524f8da7901338b263384fed3c612f117b4c.tar.bz2 FreeFileSync-ecb1524f8da7901338b263384fed3c612f117b4c.zip |
5.11
Diffstat (limited to 'lib/parse_plural.h')
-rw-r--r-- | lib/parse_plural.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/parse_plural.h b/lib/parse_plural.h index 2b78de89..7af6809e 100644 --- a/lib/parse_plural.h +++ b/lib/parse_plural.h @@ -152,6 +152,7 @@ private: }; Token(Type t) : type(t), number(0) {} + Token(int num) : type(TK_CONST_NUMBER), number(num) {} Type type; int number; //if type == TK_CONST_NUMBER @@ -195,13 +196,12 @@ private: } auto digitEnd = std::find_if(pos, stream.end(), [](char c) { return !zen::isDigit(c); }); - ptrdiff_t digitCount = digitEnd - pos; - if (digitCount != 0) + + if (digitEnd != pos) { - Token out(Token::TK_CONST_NUMBER); - out.number = zen::stringTo<int>(std::string(&*pos, digitCount)); - pos += digitCount; - return out; + int number = zen::stringTo<int>(std::string(&*pos, digitEnd - pos)); + pos = digitEnd; + return number; } throw ParsingError(); //unknown token |