azraelly / ticpp

Automatically exported from code.google.com/p/ticpp
0 stars 0 forks source link

Base::FromString() introduces problems when converting string to values #29

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
With a xml element that looks like the following:
<MyElement value="10-">

and a code to parse the element:
int value = 0;
MyElement.GetAttribute();

One would usually expect the above code to produce an exception because the
value is incorrectly given, but the first two digits are converted into
integer value, and no exception is produced.

I suggest that there be additional mechanism that checks if the full string
is converted, in FromString() function

Original issue reported on code.google.com by thicli...@gmail.com on 29 Oct 2008 at 11:01

GoogleCodeExporter commented 9 years ago
I ran into the same issue.  I changed line 107 on ticpp.h to
if (val.eof()==false)

which works for me,  I think that may also trigger the exception if there are 
extra spaces as well which may/or may not be desired behavior

Original comment by phl...@gmail.com on 9 Aug 2014 at 3:27