summaryrefslogtreecommitdiff
path: root/lib/parse_plural.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:22:36 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:22:36 +0200
commitecb1524f8da7901338b263384fed3c612f117b4c (patch)
treee7e06423fe27ea5ab45f27fc4b39ae597ba72490 /lib/parse_plural.h
parent5.10 (diff)
downloadFreeFileSync-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.h12
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
bgstack15