gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/asobj/Global.cpp


From: Benjamin Wolsey
Subject: [Gnash-commit] gnash ChangeLog server/asobj/Global.cpp
Date: Thu, 06 Mar 2008 11:42:34 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Benjamin Wolsey <bwy>   08/03/06 11:42:34

Modified files:
        .              : ChangeLog 
        server/asobj   : Global.cpp 

Log message:
                * server/asobj/Global.cpp: use boost_lexical cast in parseFloat;
                  sscanf looks only for the decimal separator of the locale,
                  which since a localization change is now always the local
                  locale; actionscript uses the 'C' locale.
        
        Might not be the only case of this.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5816&r2=1.5817
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Global.cpp?cvsroot=gnash&r1=1.92&r2=1.93

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5816
retrieving revision 1.5817
diff -u -b -r1.5816 -r1.5817
--- ChangeLog   6 Mar 2008 11:15:27 -0000       1.5816
+++ ChangeLog   6 Mar 2008 11:42:33 -0000       1.5817
@@ -6,6 +6,10 @@
        * configure.ac: update version (flash compatibility) to 9,0,999 so
          that javascript flash detectors don't reject gnash (not helpful for
          implementing SWF9). 
+       * server/asobj/Global.cpp: use boost_lexical cast in parseFloat;
+         sscanf looks only for the decimal separator of the locale,
+         which since a localization change is now always the local
+         locale; actionscript uses the 'C' locale.
 
 2008-03-04 Bastiaan Jacques <address@hidden>
 

Index: server/asobj/Global.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Global.cpp,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -b -r1.92 -r1.93
--- server/asobj/Global.cpp     5 Mar 2008 03:56:00 -0000       1.92
+++ server/asobj/Global.cpp     6 Mar 2008 11:42:34 -0000       1.93
@@ -74,6 +74,7 @@
 #include "xmlsocket.h"
 
 #include <limits> // for numeric_limits<double>::quiet_NaN
+#include <boost/lexical_cast.hpp>
 
 // Common code to warn and return if a required single arg is not present
 // and to warn if there are extra args.
@@ -171,15 +172,15 @@
 {
     ASSERT_FN_ARGS_IS_1
 
-    float result;
     as_value rv;
 
-    // sscanf will handle the whitespace / unneeded characters etc. 
automatically
-    if (1 == sscanf(fn.arg(0).to_string().c_str(), "%f", &result))
-       rv = double(result);
-    else
-       // if sscanf didn't find anything, return NaN
+    try  {
+        float result = boost::lexical_cast<float>(fn.arg(0).to_string());
+        rv = static_cast<double>(result);
+    }
+    catch (boost::bad_lexical_cast& e) {
        rv.set_nan();
+    }
 
     return rv;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]