[cig-commits] commit: Fix a bug when parsing a number with muparserx
Mercurial
hg at geodynamics.org
Wed Nov 9 00:47:56 PST 2011
changeset: 391:53bd66104b6f
user: Walter Landry <wlandry at caltech.edu>
date: Tue Nov 08 15:08:32 2011 -0800
files: muparserx/parser/mpValReader.cpp
description:
Fix a bug when parsing a number with muparserx
diff -r ca079735b744 -r 53bd66104b6f muparserx/parser/mpValReader.cpp
--- a/muparserx/parser/mpValReader.cpp Tue Nov 08 10:44:35 2011 -0800
+++ b/muparserx/parser/mpValReader.cpp Tue Nov 08 15:08:32 2011 -0800
@@ -51,13 +51,19 @@ MUP_NAMESPACE_START
{
stringstream_type stream(a_szExpr + a_iPos);
float_type fVal(0);
- std::streamoff iEnd(0);
stream >> fVal;
- iEnd = stream.tellg(); // Position after reading
+ if(stream.fail())
+ return false;
- if (iEnd==-1)
- return false;
+ if(stream.eof())
+ {
+ a_Val=cmplx_type(fVal,0.0);
+ a_iPos=strlen(a_szExpr);
+ return true;
+ }
+
+ std::streamoff iEnd(stream.tellg()); // Position after reading
a_iPos += (int)iEnd;
More information about the CIG-COMMITS
mailing list