CVSROOT: /sources/gnash Module name: gnash Changes by: Benjamin Wolsey <bwy> 07/10/06 12:01:00
Modified files: . : ChangeLog server : as_value.cpp Log message: * server/as_value.cpp (to_number): use boost::lexical_cast instead of strtod to avoid differences in decimal point between locales (not really verified with actionscript behaviour). CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4558&r2=1.4559 http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.cpp?cvsroot=gnash&r1=1.84&r2=1.85 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4558 retrieving revision 1.4559 diff -u -b -r1.4558 -r1.4559 --- ChangeLog 6 Oct 2007 10:32:28 -0000 1.4558 +++ ChangeLog 6 Oct 2007 12:00:59 -0000 1.4559 @@ -1,3 +1,8 @@ +2007-10-06 Benjamin Wolsey <[EMAIL PROTECTED]> + + * server/as_value.cpp (to_number): use boost::lexical_cast instead + of strtod to avoid differences in decimal point between locales + (not really verified with actionscript behaviour). 2007-10-06 Sandro Santilli <[EMAIL PROTECTED]> Index: server/as_value.cpp =================================================================== RCS file: /sources/gnash/gnash/server/as_value.cpp,v retrieving revision 1.84 retrieving revision 1.85 diff -u -b -r1.84 -r1.85 --- server/as_value.cpp 4 Oct 2007 15:32:11 -0000 1.84 +++ server/as_value.cpp 6 Oct 2007 12:01:00 -0000 1.85 @@ -36,6 +36,8 @@ #include "namedStrings.h" #include <boost/algorithm/string/case_conv.hpp> +#include <boost/lexical_cast.hpp> + using namespace std; @@ -219,26 +221,23 @@ // @@ Moock says the rule here is: if the // string is a valid float literal, then it // gets converted; otherwise it is set to NaN. - char* tail=0; - const char* s = getStr().c_str(); - double d = strtod(s, &tail); - // Detect failure by "tail" still being at the start of - // the string or there being extra junk after the - // converted characters. - if ( tail == s || *tail != 0 ) - { - // Failed conversion to Number. - return (double)NAN; - } + try { + + double d = boost::lexical_cast<double>(getStr()); - // "Infinity" and "-Infinity" are recognized by strtod() - // but Flash Player returns NaN for them. if ( isinf(d) ) { return (double)NAN; } return d; + + } catch (boost::bad_lexical_cast &) { + + return (double)NAN; + + } + } case NULLTYPE: _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit