[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog testsuite/actionscript.all/Glob...
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] gnash ChangeLog testsuite/actionscript.all/Glob... |
Date: |
Tue, 18 Mar 2008 14:01:01 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Benjamin Wolsey <bwy> 08/03/18 14:01:01
Modified files:
. : ChangeLog
testsuite/actionscript.all: Global.as
server : as_value.cpp
server/asobj : string.cpp
server/vm : ASHandlers.cpp
Log message:
* server/as_value.cpp: minor changes to to_int. It's a bit
complicated but seems to replicate how the pp converts to
integers.
Don't need to use fmod().
* server/vm/ASHandlers.cpp: use to_int() for ActionInt(). This
fixes
handling of all negative non-integer numbers.
* testsuite/actionscript.all/Global.as: add regression tests for
int().
* server/asobj/string.cpp: minor cleanups; use safer
string.at().
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5958&r2=1.5959
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Global.as?cvsroot=gnash&r1=1.45&r2=1.46
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.cpp?cvsroot=gnash&r1=1.119&r2=1.120
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/string.cpp?cvsroot=gnash&r1=1.60&r2=1.61
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.218&r2=1.219
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5958
retrieving revision 1.5959
diff -u -b -r1.5958 -r1.5959
--- ChangeLog 18 Mar 2008 11:26:53 -0000 1.5958
+++ ChangeLog 18 Mar 2008 14:00:59 -0000 1.5959
@@ -1,3 +1,14 @@
+2008-03-18 Benjamin Wolsey <address@hidden>
+
+ * server/as_value.cpp: minor changes to to_int. It's a bit
+ complicated but seems to replicate how the pp converts to integers.
+ Don't need to use fmod().
+ * server/vm/ASHandlers.cpp: use to_int() for ActionInt(). This fixes
+ handling of all negative non-integer numbers.
+ * testsuite/actionscript.all/Global.as: add regression tests for
+ int().
+ * server/asobj/string.cpp: minor cleanups; use safer string.at().
+
2008-03-18 Sandro Santilli <address@hidden>
* server/array.{cpp,h}: add concept of 'holes' in arrays, don't
Index: testsuite/actionscript.all/Global.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Global.as,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- testsuite/actionscript.all/Global.as 11 Mar 2008 19:31:47 -0000
1.45
+++ testsuite/actionscript.all/Global.as 18 Mar 2008 14:01:00 -0000
1.46
@@ -22,7 +22,7 @@
// execute it like this gnash -1 -r 0 -v out.swf
-rcsid="$Id: Global.as,v 1.45 2008/03/11 19:31:47 strk Exp $";
+rcsid="$Id: Global.as,v 1.46 2008/03/18 14:01:00 bwy Exp $";
#include "check.as"
#if OUTPUT_VERSION > 5
@@ -358,21 +358,42 @@
check_equals(tmp.length, 2);
+/// Tests for int
+
+check_equals (int(1.5), 1);
+check_equals (int(0), 0);
+check_equals (int(s), 0);
+check_equals (int(-1.e-15), 0);
+check_equals (int(-0.99999999999999), 0);
+check_equals (int(0.99999999999), 0);
+check_equals (int(-7.8), -7);
+check_equals (int(6.1), 6);
+
+check_equals (int(0xffffffff), -1);
+
+check_equals (int(2147483648), -2147483648);
+check_equals (int(-2147483648), -2147483648);
+
+check_equals (int(2147483649), -2147483647);
+check_equals (int(-2147483649), 2147483647);
+check_equals (int(4294967296), 0);
+check_equals (int(-4294967296), 0);
+check_equals (int(infinity), 0);
//------------------------------------------------------------
// END OF TEST
//------------------------------------------------------------
#if OUTPUT_VERSION == 5
- check_totals(82); // SWF5
+ check_totals(98); // SWF5
#else
# if OUTPUT_VERSION == 6
- check_totals(116); // SWF6
+ check_totals(132); // SWF6
# else
# if OUTPUT_VERSION == 7
- check_totals(98); // SWF7
+ check_totals(114); // SWF7
# else
- check_totals(85); // SWF8+
+ check_totals(101); // SWF8+
# endif
# endif
#endif
Index: server/as_value.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_value.cpp,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -b -r1.119 -r1.120
--- server/as_value.cpp 10 Mar 2008 23:23:10 -0000 1.119
+++ server/as_value.cpp 18 Mar 2008 14:01:00 -0000 1.120
@@ -478,21 +478,24 @@
/* NOTREACHED */
}
-boost::int32_t
+// This returns an as_value as an integer. It is
+// probably used for most implicit conversions to
+// int, for instance in the String class.
as_value::to_int() const
{
double d = to_number();
- int i=0;
if ( ! isfinite(d) ) return 0;
+ boost::int32_t i = 0;
+
if (d < 0)
{
- i = - (boost::uint32_t) fmod (-d, 4294967296.0);
+ i = - static_cast<boost::uint32_t>(-d) % (1 << 32));
}
else
{
- i = (boost::uint32_t) fmod (d, 4294967296.0);
+ i = static_cast<boost::uint32_t>(d) % (1 << 32));
}
return i;
Index: server/asobj/string.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/string.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- server/asobj/string.cpp 17 Mar 2008 12:05:16 -0000 1.60
+++ server/asobj/string.cpp 18 Mar 2008 14:01:00 -0000 1.61
@@ -596,7 +596,7 @@
return rv;
}
- return as_value(wstr[index]);
+ return as_value(wstr.at(index));
}
static as_value
Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v
retrieving revision 1.218
retrieving revision 1.219
diff -u -b -r1.218 -r1.219
--- server/vm/ASHandlers.cpp 17 Mar 2008 17:27:57 -0000 1.218
+++ server/vm/ASHandlers.cpp 18 Mar 2008 14:01:00 -0000 1.219
@@ -988,7 +988,7 @@
// GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
thread.ensureStack(1);
- env.top(0).set_int(int(floor(env.top(0).to_number()))); // TODO: use
to_int ?
+ env.top(0).set_int((env.top(0).to_int()));
}
void