[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11408: Minor cleanups and improveme
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11408: Minor cleanups and improvements to constructor. |
Date: |
Tue, 11 Aug 2009 16:05:26 +0200 |
User-agent: |
Bazaar (1.16.1) |
------------------------------------------------------------
revno: 11408 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Tue 2009-08-11 16:05:26 +0200
message:
Minor cleanups and improvements to constructor.
modified:
libcore/asobj/Boolean_as.cpp
libcore/asobj/Number_as.cpp
libcore/asobj/String_as.cpp
=== modified file 'libcore/asobj/Boolean_as.cpp'
--- a/libcore/asobj/Boolean_as.cpp 2009-08-11 13:01:01 +0000
+++ b/libcore/asobj/Boolean_as.cpp 2009-08-11 13:23:30 +0000
@@ -46,12 +46,7 @@
public:
- Boolean_as()
- :
- as_object(getBooleanInterface())
- {}
-
- Boolean_as(bool val)
+ explicit Boolean_as(bool val)
:
as_object(getBooleanInterface())
{
=== modified file 'libcore/asobj/Number_as.cpp'
--- a/libcore/asobj/Number_as.cpp 2009-08-11 12:59:44 +0000
+++ b/libcore/asobj/Number_as.cpp 2009-08-11 13:23:40 +0000
@@ -41,12 +41,9 @@
class Number_as : public as_object
{
- // the number value
- double _val;
-
public:
- Number_as(double val = 0.0)
+ Number_as(double val)
:
as_object(getNumberInterface()),
_val(val)
@@ -70,6 +67,12 @@
return _val;
}
+private:
+
+ // the number value
+ double _val;
+
+
};
namespace {
=== modified file 'libcore/asobj/String_as.cpp'
--- a/libcore/asobj/String_as.cpp 2009-08-11 08:35:50 +0000
+++ b/libcore/asobj/String_as.cpp 2009-08-11 13:30:37 +0000
@@ -69,7 +69,6 @@
size_t validIndex(const std::wstring& subject, int index);
void attachStringInterface(as_object& o);
as_object* getStringInterface();
- as_object* getStringConstructor(Global_as& gl);
inline bool checkArgs(const fn_call& fn, size_t min, size_t max,
const std::string& function);
@@ -134,17 +133,18 @@
// extern (used by Global.cpp)
void
-string_class_init(as_object& global, const ObjectURI& uri)
+string_class_init(as_object& where, const ObjectURI& uri)
{
// This is going to be the global String "class"/"function"
- boost::intrusive_ptr<as_object> cl =
- getStringConstructor(*getGlobal(global));
-
- // Register _global.String (should be only visible from SWF5 up)
- // TODO: register as ASnative(251, 0)
- // TODO: register as ASnative(3, 0) for SWF5 ?
+
+ Global_as* gl = getGlobal(where);
+ as_object* proto = getStringInterface();
+ as_object* cl = gl->createClass(&string_ctor, proto);
+
+ cl->init_member("fromCharCode", getVM(*gl).getNative(251, 14));
+
int flags = PropFlags::dontEnum;
- global.init_member(getName(uri), cl.get(), flags, getNamespace(uri));
+ where.init_member(getName(uri), cl, flags, getNamespace(uri));
}
@@ -174,17 +174,31 @@
as_object*
getStringInterface()
{
+
+ if (isAS3(VM::get())) {
+ static boost::intrusive_ptr<as_object> o;
+
+ if ( o == NULL )
+ {
+ o = new as_object(getObjectInterface());
+ VM::get().addStatic(o.get());
+
+ attachStringInterface(*o);
+ }
+ return o.get();
+ }
+
static boost::intrusive_ptr<as_object> o;
if ( o == NULL )
{
o = new as_object(getObjectInterface());
- VM::get().addStatic(o.get());
+ VM::get().addStatic(o.get());
attachStringInterface(*o);
}
-
return o.get();
+
}
// all the arguments will be converted to string and concatenated.
@@ -584,7 +598,6 @@
as_value
string_fromCharCode(const fn_call& fn)
{
- boost::intrusive_ptr<as_object> obj = ensureType<as_object>(fn.this_ptr);
const int version = getSWFVersion(fn);
@@ -824,23 +837,6 @@
return as_value(obj.get());
}
-as_object*
-getStringConstructor(Global_as& gl)
-{
- // This is going to be the global String "class"/"function"
-
- static as_object* cl = 0;
-
- as_object* proto = getStringInterface();
- if (!cl) {
- cl = gl.createClass(&string_ctor, proto);
- cl->init_member("fromCharCode", getVM(gl).getNative(251, 14));
- }
-
- return cl;
-}
-
-
/// Check the number of arguments, returning false if there
/// aren't enough, or true if there are either enough or too many.
/// Logs an error if the number isn't between min and max.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11408: Minor cleanups and improvements to constructor.,
Benjamin Wolsey <=