CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/11/08 23:20:37
Modified files: . : ChangeLog server : as_environment.cpp Log message: * server/as_environment.cpp (find_object_{slash,dot}syntax): use get_path_element instead of get_member to get next element from an old-style path. Fixes http://www.orgamez.com/files/swf/alphazoo.swf. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4811&r2=1.4812 http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_environment.cpp?cvsroot=gnash&r1=1.105&r2=1.106 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4811 retrieving revision 1.4812 diff -u -b -r1.4811 -r1.4812 --- ChangeLog 8 Nov 2007 22:40:43 -0000 1.4811 +++ ChangeLog 8 Nov 2007 23:20:36 -0000 1.4812 @@ -1,5 +1,9 @@ 2007-11-08 Sandro Santilli <[EMAIL PROTECTED]> + * server/as_environment.cpp (find_object_{slash,dot}syntax): + use get_path_element instead of get_member to get next element + from an old-style path. + Fixes http://www.orgamez.com/files/swf/alphazoo.swf. * server/asobj/Color.cpp (color_ctor): parse first argument to Color constructor as a string (if not a MovieClip). Fixes http://www.lsfrench.com/school/couleur/colorepaint.swf. Index: server/as_environment.cpp =================================================================== RCS file: /sources/gnash/gnash/server/as_environment.cpp,v retrieving revision 1.105 retrieving revision 1.106 diff -u -b -r1.105 -r1.106 --- server/as_environment.cpp 26 Oct 2007 13:03:56 -0000 1.105 +++ server/as_environment.cpp 8 Nov 2007 23:20:37 -0000 1.106 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: as_environment.cpp,v 1.105 2007/10/26 13:03:56 strk Exp $ */ +/* $Id: as_environment.cpp,v 1.106 2007/11/08 23:20:37 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -680,14 +680,16 @@ } #ifdef DEBUG_TARGET_FINDING - log_debug(_("Invoking get_member(%s) on object %p"), subpart.c_str(), (void *)env); + log_debug(_("Invoking get_path_element(%s) on object %p"), subpart.c_str(), (void *)env); #endif - as_value tmp; + //as_value tmp; string_table::key subpartkey = vm.getStringTable().find(subpart); // TODO: make sure sprite_instances know about ".." - if (!env->get_member(subpartkey, &tmp) ) + as_object* nextElement = env->get_path_element(subpartkey); + if ( ! nextElement ) + //if (!env->get_member(subpartkey, &tmp) ) { // Try this and _global, but only at first iteration... @@ -702,31 +704,25 @@ if ( subpart == "this" ) { - tmp.set_as_object(m_target); + //tmp.set_as_object(m_target); + nextElement = m_target; } - else if ( ! vm.getGlobal()->get_member(subpartkey, &tmp) ) + else + { + nextElement = vm.getGlobal()->get_path_element(subpartkey); + if ( ! nextElement ) { IF_VERBOSE_ASCODING_ERRORS( - log_aserror(_("Element '%s' of variable '%s' not found in object %p nor in _global (dotsyntax)"), + log_aserror(_("Path element '%s' of variable '%s' not found in object %p nor in _global (dotsyntax)"), subpart.c_str(), path.c_str(), (void *)env); ); return NULL; } } - - // Debugging only: - if ( ! tmp.is_object() ) - { - IF_VERBOSE_ASCODING_ERRORS( - log_aserror(_("Member %s of object %p doesn't cast to an Object (%s) " - "evaluating target path %s (dotsyntax)"), - subpart.c_str(), (void *)env, tmp.to_debug_string().c_str(), - path.c_str()); - ); - return NULL; } + assert(nextElement); - env = tmp.to_object().get(); + env = nextElement; // tmp.to_object().get(); #ifndef GNASH_USE_GC assert(env->get_ref_count() > 0); // still alive... #endif // ndef GNASH_USE_GC @@ -852,12 +848,14 @@ { #ifdef DEBUG_TARGET_FINDING - log_debug(_("Invoking get_member(%s) on object %p"), subpart.c_str(), (void *)env); + log_debug(_("Invoking get_path_element(%s) on object %p"), subpart.c_str(), (void *)env); #endif - as_value tmp; + //as_value tmp; string_table::key subpartkey = vm.getStringTable().find(subpart); // TODO: make sure sprite_instances know about ".." - if (!env->get_member(subpartkey, &tmp) ) + as_object* nextElement = env->get_path_element(subpartkey); + if ( ! nextElement ) + //if (!env->get_member(subpartkey, &tmp) ) { // Try this and _global, but only at first iteration... @@ -872,10 +870,14 @@ if ( subpart == "this" ) { - tmp.set_as_object(m_target); + //tmp.set_as_object(m_target); + nextElement = m_target; } - else if (!vm.getGlobal()->get_member(subpartkey, &tmp) ) + else + { + nextElement = vm.getGlobal()->get_path_element(subpartkey); + if ( ! nextElement ) { IF_VERBOSE_ASCODING_ERRORS( log_aserror(_("Element '%s' of variable '%s' not found in object %p nor in _global (slashsyntax)"), @@ -884,21 +886,11 @@ return NULL; } } - - // Debugging only: - if ( ! tmp.is_object() ) - { - IF_VERBOSE_ASCODING_ERRORS( - log_aserror(_("Member %s of object %p doesn't cast " - "to an Object (%s) evaluating target path %s " - "(slashsyntax)"), - subpart.c_str(), (void *)env, - tmp.to_debug_string().c_str(), path.c_str()); - ); - return NULL; } - env = tmp.to_object().get(); + assert(nextElement); + + env = nextElement; #ifndef GNASH_USE_GC assert(env->get_ref_count() > 0); #endif // ndef GNASH_USE_GC _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit