CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/10/24 23:26:24
Modified files: . : ChangeLog server/asobj : string.cpp testsuite/swfdec: PASSING Log message: * server/asobj/string.cpp (string_sub_str): fix corner cases exposed by swfdec's substr tests. * testsuite/swfdec/PASSING: succeed in substr tests. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4697&r2=1.4698 http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/string.cpp?cvsroot=gnash&r1=1.39&r2=1.40 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/swfdec/PASSING?cvsroot=gnash&r1=1.45&r2=1.46 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4697 retrieving revision 1.4698 diff -u -b -r1.4697 -r1.4698 --- ChangeLog 24 Oct 2007 22:43:22 -0000 1.4697 +++ ChangeLog 24 Oct 2007 23:26:23 -0000 1.4698 @@ -1,5 +1,11 @@ 2007-10-24 Sandro Santilli <[EMAIL PROTECTED]> + * server/asobj/string.cpp (string_sub_str): fix corner cases + exposed by swfdec's substr tests. + * testsuite/swfdec/PASSING: succeed in substr tests. + +2007-10-24 Sandro Santilli <[EMAIL PROTECTED]> + * server/PropertyList.cpp: addProperty can always override pre-existing properties, and inherits flags in that case. * testsuite/swfdec/PASSING: addProperty-flags succeeds. Index: server/asobj/string.cpp =================================================================== RCS file: /sources/gnash/gnash/server/asobj/string.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -u -b -r1.39 -r1.40 --- server/asobj/string.cpp 6 Oct 2007 08:17:48 -0000 1.39 +++ server/asobj/string.cpp 24 Oct 2007 23:26:24 -0000 1.40 @@ -16,7 +16,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: string.cpp,v 1.39 2007/10/06 08:17:48 strk Exp $ */ +/* $Id: string.cpp,v 1.40 2007/10/24 23:26:24 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -342,12 +342,24 @@ ENSURE_FN_ARGS(1, 2, str); - int start = valid_index(str, fn.arg(0).to_number<int>()); + as_environment& env = fn.env(); + + int start = valid_index(str, fn.arg(0).to_int(env)); int num = str.size(); - if (fn.nargs >= 2) { - num = fn.arg(1).to_number<int>(); + if (fn.nargs >= 2) + { + num = fn.arg(1).to_int(env); + if ( num < 0 ) + { + if ( -num <= start ) num = 0; + else + { + num = str.size()+num; + if ( num < 0 ) return as_value(""); + } + } } return as_value(str.substr(start, num)); Index: testsuite/swfdec/PASSING =================================================================== RCS file: /sources/gnash/gnash/testsuite/swfdec/PASSING,v retrieving revision 1.45 retrieving revision 1.46 diff -u -b -r1.45 -r1.46 --- testsuite/swfdec/PASSING 24 Oct 2007 22:43:23 -0000 1.45 +++ testsuite/swfdec/PASSING 24 Oct 2007 23:26:24 -0000 1.46 @@ -396,6 +396,9 @@ stylesheet-load-6.swf:e3b34170df069108049f1381e93572c6 stylesheet-parse-5.swf:f77505087f69427b13c91f30a9c103ad stylesheet-parse-6.swf:0c070dfd772d1b7280ac53b711dcbb1c +substr-5.swf:cf154038f95d1d654f2d162f16c60a5b +substr-6.swf:d16644cf5ac2775cceb46f19c8663fcd +substr-7.swf:5fd2eea885c31f6b5bd881addc0f11ba super-calls-5.swf:b68c3168ff4881a0cd780f6d4cb21950 super-different-5.swf:8ab7ab25c38807751e3fb7e8bce42217 super-equals-this-5.swf:8a903f417fdaa5a9b010f757fa6c0a45 _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit