Skip to content

Commit

Permalink
possible fix for #123
Browse files Browse the repository at this point in the history
  • Loading branch information
beltoforion committed Oct 31, 2023
1 parent 310b56c commit ddb6f07
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/muParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,23 @@ namespace mu
*/
int Parser::IsVal(const char_type* a_szExpr, int* a_iPos, value_type* a_fVal)
{
// fix for #123; std::Stringstream is broken on Mac; use std::stod instead
try
{
std::size_t charsProcessed;
value_type fVal = static_cast<value_type>(std::stod(string_type(a_szExpr), &charsProcessed));
if (charsProcessed == 0)
return 0;

*a_iPos += (int)charsProcessed;
*a_fVal = fVal;
return 1;
}
catch (...)
{
return 0;
}
/*
value_type fVal(0);
stringstream_type stream(a_szExpr);
Expand All @@ -68,6 +85,7 @@ namespace mu
*a_iPos += (int)iEnd;
*a_fVal = fVal;
return 1;
*/
}


Expand Down

0 comments on commit ddb6f07

Please sign in to comment.