Commit 7cdc24c0 by John Kessenich

PP: Address #1456: Strip float suffixes before using platform library.

parent 994d4bf3
......@@ -317,8 +317,19 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
} else {
// slow path
ppToken->dval = 0.0;
// remove suffix
TString numstr(ppToken->name);
if (numstr.back() == 'f' || numstr.back() == 'F')
numstr.pop_back();
if (numstr.back() == 'h' || numstr.back() == 'H')
numstr.pop_back();
if (numstr.back() == 'l' || numstr.back() == 'L')
numstr.pop_back();
// use platform library
strtodStream.clear();
strtodStream.str(ppToken->name);
strtodStream.str(numstr.c_str());
strtodStream >> ppToken->dval;
if (strtodStream.fail()) {
// Assume failure combined with a large exponent was overflow, in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment