[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/as_value.cpp server/as_v...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/as_value.cpp server/as_v... |
Date: |
Sun, 04 Mar 2007 00:56:43 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/03/04 00:56:43
Modified files:
. : ChangeLog
server : as_value.cpp as_value.h
Log message:
* server/as_value.{cpp,h}: always check for real type
of an as_object to properly set type to AS_FUNCTION
for actual as_function instances. always check
for NULL pointers to properly set type to NULLTYPE.
Fixes latest tests in Function.as.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2528&r2=1.2529
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.cpp?cvsroot=gnash&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.h?cvsroot=gnash&r1=1.26&r2=1.27
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2528
retrieving revision 1.2529
diff -u -b -r1.2528 -r1.2529
--- ChangeLog 4 Mar 2007 00:18:25 -0000 1.2528
+++ ChangeLog 4 Mar 2007 00:56:43 -0000 1.2529
@@ -1,5 +1,10 @@
2007-03-03 Sandro Santilli <address@hidden>
+ * server/as_value.{cpp,h}: always check for real type
+ of an as_object to properly set type to AS_FUNCTION
+ for actual as_function instances. always check
+ for NULL pointers to properly set type to NULLTYPE.
+ Fixes latest tests in Function.as.
* server/: as_object.h, as_function.h:
Add virtual to_function() method to reduce RTTI use.
* testsuite/actionscript.all/Function.as:
Index: server/as_value.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_value.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- server/as_value.cpp 3 Mar 2007 17:22:59 -0000 1.20
+++ server/as_value.cpp 4 Mar 2007 00:56:43 -0000 1.21
@@ -51,29 +51,6 @@
//
-as_value::as_value(as_object* obj)
- :
- m_type(OBJECT),
- m_object_value(obj)
-{
- if (m_object_value)
- {
- sprite_instance* sp = m_object_value->to_movie();
- if ( sp && 0)
- {
- m_type = MOVIECLIP;
- // TODO: simplify next statement when m_string_value
- // will become a std::string
- m_string_value = sp->get_text_value();
- }
- else
- {
- m_object_value->add_ref();
- }
- }
-}
-
-
as_value::as_value(as_function* func)
:
m_type(AS_FUNCTION),
@@ -81,6 +58,8 @@
{
if (m_as_function_value) {
m_as_function_value->add_ref();
+ } else {
+ m_type = NULLTYPE;
}
}
@@ -479,6 +458,12 @@
set_sprite(*sp);
return;
}
+ as_function* func = obj->to_function();
+ if ( func )
+ {
+ set_as_function(func);
+ return;
+ }
if (m_type != OBJECT || m_object_value != obj)
{
drop_refs();
@@ -500,6 +485,8 @@
m_as_function_value = func;
if (m_as_function_value) {
m_as_function_value->add_ref();
+ } else {
+ m_type = NULLTYPE;
}
}
}
Index: server/as_value.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_value.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- server/as_value.h 9 Feb 2007 05:52:49 -0000 1.26
+++ server/as_value.h 4 Mar 2007 00:56:43 -0000 1.27
@@ -14,7 +14,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-/* $Id: as_value.h,v 1.26 2007/02/09 05:52:49 rsavoye Exp $ */
+/* $Id: as_value.h,v 1.27 2007/03/04 00:56:43 strk Exp $ */
#ifndef GNASH_AS_VALUE_H
#define GNASH_AS_VALUE_H
@@ -92,7 +92,12 @@
/// Object reference
OBJECT,
- /// Internal function pointer
+ /// Internal function pointer (to drop)
+ //
+ /// TODO: deprecate this ! *every* function
+ /// in actionscript must be equipped with
+ /// ActionScript properties. Every as_value
+ /// function MUST be an AS_FUNCTION !!
C_FUNCTION,
/// ActionScript function reference
@@ -203,10 +208,30 @@
{
}
- /// Construct an OBJECT value
- as_value(as_object* obj);
+ /// Construct a NULL, OBJECT, MOVIECLIP or AS_FUNCTION value
+ //
+ /// See as_object::to_movie and as_object::to_function
+ ///
+ /// Internally adds a reference to the ref-counted as_object,
+ /// if not-null
+ ///
+ as_value(as_object* obj)
+ :
+ // Initialize to non-object type here,
+ // or set_as_object will call
+ // drop_ref on undefined memory !!
+ m_type(UNDEFINED)
+ {
+ set_as_object(obj);
+ }
/// Construct a C_FUNCTION value
+ //
+ /// TODO: deprecate this ! *every* function
+ /// in actionscript must be equipped with
+ /// ActionScript properties. Every as_value
+ /// function MUST be an AS_FUNCTION !!
+ ///
as_value(as_c_function_ptr func)
:
m_type(C_FUNCTION),
@@ -214,7 +239,7 @@
{
}
- /// Construct an AS_FUNCTION value
+ /// Construct a NULL or AS_FUNCTION value
as_value(as_function* func);
~as_value() { drop_refs(); }
@@ -410,14 +435,21 @@
void set_int(int val) { set_double(val); }
void set_nan() { double x = 0.0; set_double(x/x); }
- /// Make this value an as_object.
- /// Internally adds a reference to the ref-counted as_object.
+ /// Make this value a NULL, OBJECT, MOVIECLIP or AS_FUNCTION value
+ //
+ /// See as_object::to_movie and as_object::to_function
+ ///
+ /// Internally adds a reference to the ref-counted as_object,
+ /// if not-null
+ ///
void set_as_object(as_object* obj);
void set_as_c_function_ptr(as_c_function_ptr func)
{
drop_refs(); m_type = C_FUNCTION; m_c_function_value = func;
}
+
+ /// Make this a NULL or AS_FUNCTION value
void set_as_function(as_function* func);
void set_undefined() { drop_refs(); m_type = UNDEFINED; }
- [Gnash-commit] gnash ChangeLog server/as_value.cpp server/as_v...,
Sandro Santilli <=
- [Gnash-commit] gnash ChangeLog server/as_value.cpp server/as_v..., Sandro Santilli, 2007/03/09
- [Gnash-commit] gnash ChangeLog server/as_value.cpp server/as_v..., Sandro Santilli, 2007/03/16
- [Gnash-commit] gnash ChangeLog server/as_value.cpp server/as_v..., Sandro Santilli, 2007/03/16
- [Gnash-commit] gnash ChangeLog server/as_value.cpp server/as_v..., Sandro Santilli, 2007/03/20
- [Gnash-commit] gnash ChangeLog server/as_value.cpp server/as_v..., Sandro Santilli, 2007/03/22