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 testsui...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/asobj/Global.cpp testsui...
Date: Thu, 27 Sep 2007 15:42:11 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/09/27 15:42:11

Modified files:
        .              : ChangeLog 
        server/asobj   : Global.cpp 
        testsuite/actionscript.all: Global.as toString_valueOf.as 

Log message:
                * testsuite/actionscript.all/Global.as: add test for
                  parseInt(<stringObject>).
                * server/asobj/Global.cpp (as_global_parseint): fix
                  the parseInt(<stringObject>) case
                * testsuite/actionscript.all/toString_valueOf.as: xcheck =>
                  xcheck_equals

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4446&r2=1.4447
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Global.cpp?cvsroot=gnash&r1=1.70&r2=1.71
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Global.as?cvsroot=gnash&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/toString_valueOf.as?cvsroot=gnash&r1=1.16&r2=1.17

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4446
retrieving revision 1.4447
diff -u -b -r1.4446 -r1.4447
--- ChangeLog   27 Sep 2007 13:56:27 -0000      1.4446
+++ ChangeLog   27 Sep 2007 15:42:10 -0000      1.4447
@@ -1,3 +1,12 @@
+2007-09-27 Sandro Santilli <address@hidden>
+
+       * testsuite/actionscript.all/Global.as: add test for
+         parseInt(<stringObject>).
+       * server/asobj/Global.cpp (as_global_parseint): fix
+         the parseInt(<stringObject>) case
+       * testsuite/actionscript.all/toString_valueOf.as: xcheck =>
+         xcheck_equals
+
 2007-09-27 Benjamin Wolsey <address@hidden>
 
        * gui/gnash.cpp: remove ESC = Quit from gnash --help output. It's not 
true

Index: server/asobj/Global.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Global.cpp,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -b -r1.70 -r1.71
--- server/asobj/Global.cpp     24 Sep 2007 15:39:31 -0000      1.70
+++ server/asobj/Global.cpp     27 Sep 2007 15:42:11 -0000      1.71
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: Global.cpp,v 1.70 2007/09/24 15:39:31 cmusick Exp $ */
+/* $Id: Global.cpp,v 1.71 2007/09/27 15:42:11 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -189,7 +189,8 @@
 static as_value
 as_global_parseint(const fn_call& fn)
 {
-    as_environment* env = &fn.env();
+    as_environment& env = fn.env();
+
     // assert(fn.nargs == 2 || fn.nargs == 1);
     if (fn.nargs < 1) {
        IF_VERBOSE_ASCODING_ERRORS(
@@ -202,16 +203,26 @@
             log_aserror(_("%s has more than two arguments"), __FUNCTION__);
     )
 
+#if 0 // seems useless, will be done later
     // Make sure our argument is the correct type
     if (fn.nargs > 1)
+    {
        fn.arg(1).convert_to_number(env);
+    }
+#endif
+
+    const std::string& expr = fn.arg(0).to_string(&env);
+
+    int base = 10; // the default base
 
     // Set up some variables
     const string digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-    boost::scoped_array<char> input_buffer ( new 
char[fn.arg(0).to_string().size()+1] );
+
+    // TODO: does all this copying make any sense ?
+    //       Use a std::string::iterator instead ?
+    boost::scoped_array<char> input_buffer ( new char[expr.size()+1] );
     char *input = input_buffer.get();
-    strcpy(input,fn.arg(0).to_string().c_str());
-    int base;
+    strcpy(input, expr.c_str());
     bool bNegative;
 
     // Skip leading whitespace
@@ -234,7 +245,7 @@
     if (fn.nargs > 1)
        {
            // to_number returns a double. atoi() would be better
-           base = (int)(fn.arg(1).to_number(env));
+           base = (int)(fn.arg(1).to_number(&env));
        }
     // if the string starts with "0x" then a hex digit
     else if (strlen(input) > 2 && input[0] == '0' && input[1] == 'X'
@@ -252,7 +263,7 @@
        }
     else
        // default base is 10
-       base = 10;
+       assert(base == 10);
 
     if (base < 2 || base > 36)
        {

Index: testsuite/actionscript.all/Global.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Global.as,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- testsuite/actionscript.all/Global.as        31 Aug 2007 21:53:33 -0000      
1.27
+++ testsuite/actionscript.all/Global.as        27 Sep 2007 15:42:11 -0000      
1.28
@@ -21,7 +21,7 @@
 // compile this test case with Ming makeswf, and then
 // execute it like this gnash -1 -r 0 -v out.swf
 
-rcsid="$Id: Global.as,v 1.27 2007/08/31 21:53:33 strk Exp $";
+rcsid="$Id: Global.as,v 1.28 2007/09/27 15:42:11 strk Exp $";
 
 #include "check.as"
 
@@ -72,6 +72,7 @@
 check ( ! isFinite(parseInt('none')) );
 check ( ! isFinite(1/0) );
 check ( ! isNaN(1/0) );
+check_equals (parseInt(new String("10")), 10);
 
 // It's not reliable to compare a double type with ==, so we'll give it a
 // small range using >= and <=

Index: testsuite/actionscript.all/toString_valueOf.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/toString_valueOf.as,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- testsuite/actionscript.all/toString_valueOf.as      26 Sep 2007 14:54:43 
-0000      1.16
+++ testsuite/actionscript.all/toString_valueOf.as      27 Sep 2007 15:42:11 
-0000      1.17
@@ -186,8 +186,8 @@
 String.prototype.toString = function () {return "TO_STRING";};
 String.prototype.valueOf = function () {return "TO_VALUE";};
 
-xcheck(parseInt(str1) == 10); 
-xcheck(parseInt(str2) == 2);  
+xcheck_equals(parseInt(str1), 10); 
+xcheck_equals(parseInt(str2), 2);  
 str3 =  str1 + str2;
 check(typeof(str3) == "string");
 //valueOf called




reply via email to

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