CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/08/23 16:50:56
Modified files: . : ChangeLog server : as_environment.h character.cpp character.h sprite_instance.cpp server/vm : ASHandlers.cpp testsuite/actionscript.all: case.as Log message: * server/as_environment.h: document case-sensitiveness of find_target. * server/character.{h,cpp} (get_relative_target_common): document and fix case-sensitiveness. * server/vm/ASHandlers.cpp (ActionSetProperty): log a actionscript error if trying to set the property of an unknown target. * server/sprite_instance.cpp (get_member, get_relative_target): be case sensitive/insensitive based on SWF target version. * testsuite/actionscript.all/case.as: more tests; some unexpected successes, some unexpected failures. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4085&r2=1.4086 http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_environment.h?cvsroot=gnash&r1=1.54&r2=1.55 http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.cpp?cvsroot=gnash&r1=1.47&r2=1.48 http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.h?cvsroot=gnash&r1=1.88&r2=1.89 http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.310&r2=1.311 http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.124&r2=1.125 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/case.as?cvsroot=gnash&r1=1.7&r2=1.8 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4085 retrieving revision 1.4086 diff -u -b -r1.4085 -r1.4086 --- ChangeLog 23 Aug 2007 15:27:59 -0000 1.4085 +++ ChangeLog 23 Aug 2007 16:50:55 -0000 1.4086 @@ -1,3 +1,16 @@ +2007-08-23 Sandro Santilli <[EMAIL PROTECTED]> + + * server/as_environment.h: document case-sensitiveness of + find_target. + * server/character.{h,cpp} (get_relative_target_common): + document and fix case-sensitiveness. + * server/vm/ASHandlers.cpp (ActionSetProperty): log a actionscript + error if trying to set the property of an unknown target. + * server/sprite_instance.cpp (get_member, get_relative_target): be + case sensitive/insensitive based on SWF target version. + * testsuite/actionscript.all/case.as: more tests; some unexpected + successes, some unexpected failures. + 2007-08-23 Udo Giacomozzi <[EMAIL PROTECTED]> * backend/render_handler_agg.cpp: remove need_shape_bounds() Index: server/as_environment.h =================================================================== RCS file: /sources/gnash/gnash/server/as_environment.h,v retrieving revision 1.54 retrieving revision 1.55 diff -u -b -r1.54 -r1.55 --- server/as_environment.h 25 Jul 2007 15:40:11 -0000 1.54 +++ server/as_environment.h 23 Aug 2007 16:50:56 -0000 1.55 @@ -342,6 +342,7 @@ /// Find the sprite/movie referenced by the given path. // /// Supports both /slash/syntax and dot.syntax + /// Case insensitive for SWF up to 6, sensitive from 7 up /// character* find_target(const std::string& path) const; Index: server/character.cpp =================================================================== RCS file: /sources/gnash/gnash/server/character.cpp,v retrieving revision 1.47 retrieving revision 1.48 diff -u -b -r1.47 -r1.48 --- server/character.cpp 11 Jul 2007 00:33:57 -0000 1.47 +++ server/character.cpp 23 Aug 2007 16:50:56 -0000 1.48 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: character.cpp,v 1.47 2007/07/11 00:33:57 strk Exp $ */ +/* $Id: character.cpp,v 1.48 2007/08/23 16:50:56 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -152,8 +152,9 @@ } character* -character::get_relative_target_common(const std::string& name) +character::get_relative_target_common(const std::string& name_orig) { + string name = PROPNAME(name_orig); // convert name to lowercase in SWF<6 if (name == "." || name == "this") { return this; Index: server/character.h =================================================================== RCS file: /sources/gnash/gnash/server/character.h,v retrieving revision 1.88 retrieving revision 1.89 diff -u -b -r1.88 -r1.89 --- server/character.h 18 Aug 2007 16:12:38 -0000 1.88 +++ server/character.h 23 Aug 2007 16:50:56 -0000 1.89 @@ -19,7 +19,7 @@ // // -/* $Id: character.h,v 1.88 2007/08/18 16:12:38 strk Exp $ */ +/* $Id: character.h,v 1.89 2007/08/23 16:50:56 strk Exp $ */ #ifndef GNASH_CHARACTER_H #define GNASH_CHARACTER_H @@ -213,6 +213,9 @@ void do_mouse_drag(); /// look for '.', 'this', '..', '_parent', '_level0' and '_root' + // + /// NOTE: case insensitive up to SWF6, sensitive from SWF7 up + /// character* get_relative_target_common(const std::string& name); /// \brief @@ -664,6 +667,7 @@ /// /// In ActionScript 1.0, everything seems to be CASE /// INSENSITIVE. + /// virtual character* get_relative_target(const std::string& name) { return get_relative_target_common(name); Index: server/sprite_instance.cpp =================================================================== RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v retrieving revision 1.310 retrieving revision 1.311 diff -u -b -r1.310 -r1.311 --- server/sprite_instance.cpp 22 Aug 2007 04:54:56 -0000 1.310 +++ server/sprite_instance.cpp 23 Aug 2007 16:50:56 -0000 1.311 @@ -1841,7 +1841,10 @@ // Try items on our display list. - character* ch = m_display_list.get_character_by_name_i(name); + character* ch; + if ( _vm.getSWFVersion() >= 7 ) ch = m_display_list.get_character_by_name(name); + else ch = m_display_list.get_character_by_name_i(name); + if (ch) { // Found object. @@ -2179,7 +2182,9 @@ if ( ch ) return ch; // See if we have a match on the display list. - ch = m_display_list.get_character_by_name(name); + if ( _vm.getSWFVersion() >= 7 ) ch = m_display_list.get_character_by_name(name); + else ch = m_display_list.get_character_by_name_i(name); + // TODO: should we check for isActionScriptReferenceable here ? if ( ch ) { Index: server/vm/ASHandlers.cpp =================================================================== RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v retrieving revision 1.124 retrieving revision 1.125 diff -u -b -r1.124 -r1.125 --- server/vm/ASHandlers.cpp 22 Aug 2007 17:32:45 -0000 1.124 +++ server/vm/ASHandlers.cpp 23 Aug 2007 16:50:56 -0000 1.125 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: ASHandlers.cpp,v 1.124 2007/08/22 17:32:45 strk Exp $ */ +/* $Id: ASHandlers.cpp,v 1.125 2007/08/23 16:50:56 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1128,6 +1128,14 @@ } } + else + { + IF_VERBOSE_ASCODING_ERRORS ( + log_aserror(_("ActionSetProperty: can't find target %s for setting property %s"), + env.top(2).to_debug_string().c_str(), get_property_names()[prop_number].c_str()); + ) + + } env.drop(3); } @@ -3585,7 +3593,7 @@ { // GNASH_REPORT_FUNCTION; - as_environment& env = thread.env; + //as_environment& env = thread.env; const action_buffer& code = thread.code; size_t pc = thread.pc; Index: testsuite/actionscript.all/case.as =================================================================== RCS file: /sources/gnash/gnash/testsuite/actionscript.all/case.as,v retrieving revision 1.7 retrieving revision 1.8 diff -u -b -r1.7 -r1.8 --- testsuite/actionscript.all/case.as 23 Aug 2007 09:55:55 -0000 1.7 +++ testsuite/actionscript.all/case.as 23 Aug 2007 16:50:56 -0000 1.8 @@ -22,11 +22,11 @@ * Test case sensitivity */ -rcsid="$Id: case.as,v 1.7 2007/08/23 09:55:55 strk Exp $"; +rcsid="$Id: case.as,v 1.8 2007/08/23 16:50:56 strk Exp $"; #include "check.as" -#if OUTPUT_VERSION <= 6 +#if OUTPUT_VERSION <= 6 // { aBcD = 100; oBj = new Object(); obj.xYZ = 100; @@ -34,13 +34,23 @@ check_equals(ABCD, 100); check_equals(typeof(OBJ), 'object'); check_equals(OBJ.xyz, 100); -#else +#else // OUTPUT_VERSION > 6 }{ //swf7 and above are case sensitive check_equals(ABCD, undefined); check_equals(OBJ, undefined); -#endif +#endif // OUTPUT_VERSION > 6 } + +#if OUTPUT_VERSION <= 6 +check_equals(_root, _ROOT); +check_equals(_level0, _LEVEL0); +#else // OUTPUT_VERSION >= 7 +check(_root != _ROOT); +check(_level0 != _LEVEL0); +#endif // OUTPUT_VERSION >= 7 + +#if OUTPUT_VERSION == 6 // { + -#if OUTPUT_VERSION == 6 // // create _root.mc0 and _root.mc0.mc1 // @@ -49,7 +59,7 @@ mC0.createEmptyMovieClip("mC1", 3); check_equals(typeof(mc0.mc1), 'movieclip'); -#ifdef MING_SUPPORTS_ASM +#ifdef MING_SUPPORTS_ASM // { asm{ push "/_ROOT/MC0/" push 0.0 @@ -57,8 +67,8 @@ setproperty }; // check setproperty -xcheck_equals(mC0._X, 100); -xcheck_equals(mC0._x, 100); +check_equals(mC0._X, 100); +check_equals(mC0._x, 100); // // check _name and _target, they still keep the case @@ -67,18 +77,20 @@ check_equals(mC0._target, "/mC0"); check_equals(mC0.mC1._name, "mC1"); check_equals(mC0.mC1._target, "/mC0/mC1"); -#endif // MING_SUPPORTS_ASM -#endif // OUTPUT_VERSION == 6 +#endif // MING_SUPPORTS_ASM } +#endif // OUTPUT_VERSION == 6 } + +#if OUTPUT_VERSION >= 6 // { -#if OUTPUT_VERSION >= 6 // -// creat two movieclips named by same letters but different cases +// create two movieclips named by same letters but different cases // mcRef = new Array(10); i = 0; MovieClip.prototype.onConstruct = function () { mcRef[i++] = this; + note("Constructed "+this+" in depth "+this.getDepth()+" and assigned to mcRef["+(i-1)+"]"); }; _root.createEmptyMovieClip("clip", 6); //this will invoke the onConstruct listener @@ -113,22 +125,49 @@ check(mcRef[0]!= mcRef[1]); check_equals(mcRef[0].getDepth(), 6); -check_equals(mcRef[1].getDepth(), 7); check_equals(mcRef[0]._name, "clip"); -check_equals(mcRef[1]._name, "CLIP"); check_equals(mcRef[0]._target, "/clip"); + +#if OUTPUT_VERSION > 6 +check_equals(mcRef[1].getDepth(), 7); +check_equals(mcRef[1]._name, "CLIP"); check_equals(mcRef[1]._target, "/CLIP"); -#endif +#else // OUTPUT_VERSION <= 6 +// Gnash fails these due to "soft references" +// Basically, a MOVIECLIP as_value stores the clip +// target, but in SWF<7 the target is insensitive +// so /clip and /CLIP both resolve to the *same* +// character. +// +xcheck_equals(mcRef[1].getDepth(), 7); +xcheck_equals(mcRef[1]._name, "CLIP"); +xcheck_equals(mcRef[1]._target, "/CLIP"); +#endif // OUTPUT_VERSION <= 6 + #if OUTPUT_VERSION <= 6 //case insensitive, so they reference the same movieclip. //Or both are undefined with OUTPUT_VERSION <= 5 check(clip == CLIP); -#else +#else // OUTPUT_VERSION >= 7 //case sensitive, so they are different -xcheck(clip != CLIP); +check(clip != CLIP); +check_equals(clip.getDepth(), 6); +check_equals(CLIP.getDepth(), 7); +#endif // OUTPUT_VERSION >= 7 + +_root.createEmptyMovieClip("CLIP2", 8); //this will invoke the onConstruct listener +_root.createEmptyMovieClip("clip2", 9); //this will invoke the onConstruct listener + check_equals(clip.getDepth(), 6); -xcheck_equals(CLIP.getDepth(), 7); +#if OUTPUT_VERSION < 7 +check_equals(CLIP.getDepth(), 6); +check_equals(CLIP2.getDepth(), 8); +check_equals(clip2.getDepth(), 8); +#else // OUTPUT_VERSION >= 7 +check_equals(CLIP.getDepth(), 7); +check_equals(clip2.getDepth(), 9); +check_equals(CLIP2.getDepth(), 8); #endif -//_root.totals(); // this is done by dejagnu_so_fini.as +#endif // OUTPUT_VERSION >= 6 } _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit