Pekka Lampila
2008-Jan-15 07:40 UTC
[Swfdec] 4 commits - libswfdec/swfdec_as_array.c libswfdec/swfdec_as_types.c test/trace
libswfdec/swfdec_as_array.c | 25 ++++---- libswfdec/swfdec_as_types.c | 11 +++ test/trace/Makefile.am | 100 +++------------------------------ test/trace/array-movieclip-5.swf |binary test/trace/array-movieclip-5.swf.trace | 15 ++++ test/trace/array-movieclip-6.swf |binary test/trace/array-movieclip-6.swf.trace | 15 ++++ test/trace/array-movieclip-7.swf |binary test/trace/array-movieclip-7.swf.trace | 15 ++++ test/trace/array-movieclip-8.swf |binary test/trace/array-movieclip-8.swf.trace | 15 ++++ test/trace/array-movieclip.as | 42 +++++++++++++ 12 files changed, 135 insertions(+), 103 deletions(-) New commits: commit cb8b4a7040ee2e8aa502b7415e42c9e591bb9aee Author: Pekka Lampila <pekka.lampila at iki.fi> Date: Tue Jan 15 09:26:36 2008 +0200 Add a test for Array method's on movie clips diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am index 10da4f2..fdca6bc 100644 --- a/test/trace/Makefile.am +++ b/test/trace/Makefile.am @@ -92,6 +92,15 @@ EXTRA_DIST = \ arguments-8.swf.trace \ array.swf \ array.swf.trace \ + array-movieclip.as \ + array-movieclip-5.swf \ + array-movieclip-5.swf.trace \ + array-movieclip-6.swf \ + array-movieclip-6.swf.trace \ + array-movieclip-7.swf \ + array-movieclip-7.swf.trace \ + array-movieclip-8.swf \ + array-movieclip-8.swf.trace \ array-new.as \ array-new-5.swf \ array-new-5.swf.trace \ diff --git a/test/trace/array-movieclip-5.swf b/test/trace/array-movieclip-5.swf new file mode 100644 index 0000000..207a1d2 Binary files /dev/null and b/test/trace/array-movieclip-5.swf differ diff --git a/test/trace/array-movieclip-5.swf.trace b/test/trace/array-movieclip-5.swf.trace new file mode 100644 index 0000000..e8ad1e3 --- /dev/null +++ b/test/trace/array-movieclip-5.swf.trace @@ -0,0 +1,15 @@ + +undefined +undefined +undefined +undefined +undefined +undefined +undefined +undefined +undefined +undefined +undefined +undefined +undefined + diff --git a/test/trace/array-movieclip-6.swf b/test/trace/array-movieclip-6.swf new file mode 100644 index 0000000..c7ae484 Binary files /dev/null and b/test/trace/array-movieclip-6.swf differ diff --git a/test/trace/array-movieclip-6.swf.trace b/test/trace/array-movieclip-6.swf.trace new file mode 100644 index 0000000..af0d095 --- /dev/null +++ b/test/trace/array-movieclip-6.swf.trace @@ -0,0 +1,15 @@ +b,a, +_level0.a +undefined +undefined +undefined +undefined +undefined +undefined +undefined +undefined +undefined +undefined +undefined +undefined +b,a, diff --git a/test/trace/array-movieclip-7.swf b/test/trace/array-movieclip-7.swf new file mode 100644 index 0000000..9290cba Binary files /dev/null and b/test/trace/array-movieclip-7.swf differ diff --git a/test/trace/array-movieclip-7.swf.trace b/test/trace/array-movieclip-7.swf.trace new file mode 100644 index 0000000..af0d095 --- /dev/null +++ b/test/trace/array-movieclip-7.swf.trace @@ -0,0 +1,15 @@ +b,a, +_level0.a +undefined +undefined +undefined +undefined +undefined +undefined +undefined +undefined +undefined +undefined +undefined +undefined +b,a, diff --git a/test/trace/array-movieclip-8.swf b/test/trace/array-movieclip-8.swf new file mode 100644 index 0000000..00bcb70 Binary files /dev/null and b/test/trace/array-movieclip-8.swf differ diff --git a/test/trace/array-movieclip-8.swf.trace b/test/trace/array-movieclip-8.swf.trace new file mode 100644 index 0000000..af0d095 --- /dev/null +++ b/test/trace/array-movieclip-8.swf.trace @@ -0,0 +1,15 @@ +b,a, +_level0.a +undefined +undefined +undefined +undefined +undefined +undefined +undefined +undefined +undefined +undefined +undefined +undefined +b,a, diff --git a/test/trace/array-movieclip.as b/test/trace/array-movieclip.as new file mode 100644 index 0000000..b95e67d --- /dev/null +++ b/test/trace/array-movieclip.as @@ -0,0 +1,42 @@ +// makeswf -v 7 -r 1 -o array-movieclip-7.swf array-movieclip.as + +var a = this.createEmptyMovieClip ("a", 0); +a[0] = "b"; +a[1] = "a"; +a.length = 2; + +ASSetPropFlags (a, null, 0, 7); +ASSetPropFlags (Array.prototype, null, 0, 7); +for (var prop in Array.prototype) { + a[prop] = Array.prop; +} + +ASSetNative (Array.prototype, 252, "push,pop,concat,shift,unshift,slice,join,splice,toString,sort,reverse,sortOn", 1); + +var str = ""; +for (var i = 0; i < a.length; i++) { + str += a[i] + ","; +} +trace (str); + +trace (a); +trace (a.push ("c")); +trace (a.pop ()); +trace (a.concat (["d", "e"])); +trace (a.shift ()); +trace (a.unshift ("f")); +trace (a.slice (1, 2)); +trace (a.join (":")); +trace (a.splice (1, 1, "g")); +trace (a.toString ()); +trace (a.sort ()); +trace (a.reverse ()); +trace (a.sortOn ("a")); + +var str = ""; +for (var i = 0; i < a.length; i++) { + str += a[i] + ","; +} +trace (str); + +loadMovie ("FSCommand:quit", ""); commit c3bd8475e83618e9d46d006402752da9a7bae5e6 Author: Pekka Lampila <pekka.lampila at iki.fi> Date: Tue Jan 15 09:25:35 2008 +0200 Don't allow Array methods to work on movie clips diff --git a/libswfdec/swfdec_as_array.c b/libswfdec/swfdec_as_array.c index f28170c..344c087 100644 --- a/libswfdec/swfdec_as_array.c +++ b/libswfdec/swfdec_as_array.c @@ -33,6 +33,7 @@ #include "swfdec_as_native_function.h" #include "swfdec_as_string.h" #include "swfdec_as_strings.h" +#include "swfdec_movie.h" #include "swfdec_debug.h" G_DEFINE_TYPE (SwfdecAsArray, swfdec_as_array, SWFDEC_TYPE_AS_OBJECT) @@ -590,7 +591,7 @@ swfdec_as_array_join (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc, const char *var, *str, *sep; SwfdecAsValue val; - if (object == NULL) + if (object == NULL || SWFDEC_IS_MOVIE (object)) return; if (argc > 0) { @@ -626,7 +627,7 @@ void swfdec_as_array_toString (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret) { - if (object == NULL) + if (object == NULL || SWFDEC_IS_MOVIE (object)) return; swfdec_as_array_join (cx, object, 0, NULL, ret); @@ -637,7 +638,7 @@ void swfdec_as_array_do_push (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret) { - if (object == NULL) + if (object == NULL || SWFDEC_IS_MOVIE (object)) return; // if 0 args, just return the length @@ -659,7 +660,7 @@ swfdec_as_array_do_pop (SwfdecAsContext *cx, SwfdecAsObject *object, gint32 length; const char *var; - if (object == NULL) + if (object == NULL || SWFDEC_IS_MOVIE (object)) return; // we allow negative indexes here, but not 0 @@ -686,7 +687,7 @@ swfdec_as_array_do_unshift (SwfdecAsContext *cx, SwfdecAsObject *object, { gint32 length; - if (object == NULL) + if (object == NULL || SWFDEC_IS_MOVIE (object)) return; if (argc) { @@ -710,7 +711,7 @@ swfdec_as_array_do_shift (SwfdecAsContext *cx, SwfdecAsObject *object, gint32 length; const char *var; - if (object == NULL) + if (object == NULL || SWFDEC_IS_MOVIE (object)) return; // don't allow negative length @@ -760,7 +761,7 @@ swfdec_as_array_reverse (SwfdecAsContext *cx, SwfdecAsObject *object, { gint32 length; - if (object == NULL) + if (object == NULL || SWFDEC_IS_MOVIE (object)) return; length = swfdec_as_array_length (object); @@ -780,7 +781,7 @@ swfdec_as_array_concat (SwfdecAsContext *cx, SwfdecAsObject *object, SwfdecAsArray *array_new; const char *var; - if (object == NULL) + if (object == NULL || SWFDEC_IS_MOVIE (object)) return; object_new = swfdec_as_array_new (cx); @@ -816,7 +817,7 @@ swfdec_as_array_slice (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc, gint32 length, start_index, num; SwfdecAsArray *array_new; - if (object == NULL) + if (object == NULL || SWFDEC_IS_MOVIE (object)) return; length = swfdec_as_array_length (object); @@ -857,7 +858,7 @@ swfdec_as_array_splice (SwfdecAsContext *cx, SwfdecAsObject *object, gint32 length, start_index, num_remove, num_add; SwfdecAsArray *array_new; - if (object == NULL || argc == 0) + if (object == NULL || SWFDEC_IS_MOVIE (object) || argc == 0) return; length = swfdec_as_array_length (object); @@ -1277,7 +1278,7 @@ swfdec_as_array_sort (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc, gint32 options; SwfdecAsFunction *custom_compare_func; - if (object == NULL) + if (object == NULL || SWFDEC_IS_MOVIE (object)) return; pos = 0; @@ -1310,7 +1311,7 @@ swfdec_as_array_sortOn (SwfdecAsContext *cx, SwfdecAsObject *object, const char **fields; gint32 options; - if (object == NULL) + if (object == NULL || SWFDEC_IS_MOVIE (object)) return; if (argc < 1) commit 4013cd22bf88b0fd005fe495a4b25d76e576b17c Author: Pekka Lampila <pekka.lampila at iki.fi> Date: Tue Jan 15 09:24:58 2008 +0200 Remove moved files from test/trace/Makefile.am and add missing \ diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am index f73c024..10da4f2 100644 --- a/test/trace/Makefile.am +++ b/test/trace/Makefile.am @@ -306,31 +306,6 @@ EXTRA_DIST = \ boolean-properties-7.swf.trace \ boolean-properties-8.swf \ boolean-properties-8.swf.trace \ - button-events-button-5.swf \ - button-events-button-5.swf.act \ - button-events-button-5.swf.trace \ - button-events-button-6.swf \ - button-events-button-6.swf.act \ - button-events-button-6.swf.trace \ - button-events-button-7.swf \ - button-events-button-7.swf.act \ - button-events-button-7.swf.trace \ - button-events-button-8.swf \ - button-events-button-8.swf.act \ - button-events-button-8.swf.trace \ - button-events.c \ - button-events-menu-5.swf \ - button-events-menu-5.swf.act \ - button-events-menu-5.swf.trace \ - button-events-menu-6.swf \ - button-events-menu-6.swf.act \ - button-events-menu-6.swf.trace \ - button-events-menu-7.swf \ - button-events-menu-7.swf.act \ - button-events-menu-7.swf.trace \ - button-events-menu-8.swf \ - button-events-menu-8.swf.act \ - button-events-menu-8.swf.trace \ button-hittest-5.swf \ button-hittest-5.swf.act \ button-hittest-5.swf.trace \ @@ -703,20 +678,7 @@ EXTRA_DIST = \ date-properties-8.swf \ date-properties-8.swf.trace \ default.stas \ - default.sts - definebutton-5.swf \ - definebutton-5.swf.act \ - definebutton-5.swf.trace \ - definebutton-6.swf \ - definebutton-6.swf.act \ - definebutton-6.swf.trace \ - definebutton-7.swf \ - definebutton-7.swf.act \ - definebutton-7.swf.trace \ - definebutton-8.swf \ - definebutton-8.swf.act \ - definebutton-8.swf.trace \ - definebutton.xml \ + default.sts \ definefunction2-arguments.swf \ definefunction2-arguments.swf.trace \ definefunction2-arguments.xml \ @@ -1468,45 +1430,6 @@ EXTRA_DIST = \ microphone-properties-7.swf.trace \ microphone-properties-8.swf \ microphone-properties-8.swf.trace \ - mouse-addProperty-relevant.as \ - mouse-addProperty-relevant-5.swf \ - mouse-addProperty-relevant-5.swf.act \ - mouse-addProperty-relevant-5.swf.trace \ - mouse-addProperty-relevant-6.swf \ - mouse-addProperty-relevant-6.swf.act \ - mouse-addProperty-relevant-6.swf.trace \ - mouse-addProperty-relevant-7.swf \ - mouse-addProperty-relevant-7.swf.act \ - mouse-addProperty-relevant-7.swf.trace \ - mouse-addProperty-relevant-8.swf \ - mouse-addProperty-relevant-8.swf.act \ - mouse-addProperty-relevant-8.swf.trace \ - mouse-movie-below-movie.as \ - mouse-movie-below-movie-5.swf \ - mouse-movie-below-movie-5.swf.act \ - mouse-movie-below-movie-5.swf.trace \ - mouse-movie-below-movie-6.swf \ - mouse-movie-below-movie-6.swf.act \ - mouse-movie-below-movie-6.swf.trace \ - mouse-movie-below-movie-7.swf \ - mouse-movie-below-movie-7.swf.act \ - mouse-movie-below-movie-7.swf.trace \ - mouse-movie-below-movie-8.swf \ - mouse-movie-below-movie-8.swf.act \ - mouse-movie-below-movie-8.swf.trace \ - mouse-movie-below-nonevent-movie.as \ - mouse-movie-below-nonevent-movie-5.swf \ - mouse-movie-below-nonevent-movie-5.swf.act \ - mouse-movie-below-nonevent-movie-5.swf.trace \ - mouse-movie-below-nonevent-movie-6.swf \ - mouse-movie-below-nonevent-movie-6.swf.act \ - mouse-movie-below-nonevent-movie-6.swf.trace \ - mouse-movie-below-nonevent-movie-7.swf \ - mouse-movie-below-nonevent-movie-7.swf.act \ - mouse-movie-below-nonevent-movie-7.swf.trace \ - mouse-movie-below-nonevent-movie-8.swf \ - mouse-movie-below-nonevent-movie-8.swf.act \ - mouse-movie-below-nonevent-movie-8.swf.trace \ mouse-properties.as \ mouse-properties-5.swf \ mouse-properties-5.swf.trace \ @@ -1516,18 +1439,6 @@ EXTRA_DIST = \ mouse-properties-7.swf.trace \ mouse-properties-8.swf \ mouse-properties-8.swf.trace \ - mouse-scaled.as \ - mouse-scaled-5.swf \ - mouse-scaled-5.swf.act \ - mouse-scaled-5.swf.trace \ - mouse-scaled-6.swf \ - mouse-scaled-6.swf.act \ - mouse-scaled-6.swf.trace \ - mouse-scaled-6.swf.trace.org \ - mouse-scaled-7.swf \ - mouse-scaled-7.swf.act \ - mouse-scaled-7.swf.trace \ - mouse-scaled-7.swf.trace.org \ mouse-show-hide.as \ mouse-show-hide-5.swf \ mouse-show-hide-5.swf.trace \ commit b634e6d3e9fd6b1a5655645817c9da02d4b72573 Author: Pekka Lampila <pekka.lampila at iki.fi> Date: Mon Jan 14 12:13:13 2008 +0200 Fix handling of some 0x strings in swfdec_as_string_to_double diff --git a/libswfdec/swfdec_as_types.c b/libswfdec/swfdec_as_types.c index 3622ba1..ff959c3 100644 --- a/libswfdec/swfdec_as_types.c +++ b/libswfdec/swfdec_as_types.c @@ -482,10 +482,19 @@ swfdec_as_value_to_number (SwfdecAsContext *context, const SwfdecAsValue *value) char *end; double d; + // FIXME: We should most likely copy Tamarin's code here (MathUtils.cpp) s = SWFDEC_AS_VALUE_GET_STRING (&tmp); if (s == SWFDEC_AS_STR_EMPTY) return NAN; - d = g_ascii_strtod (s, &end); + if (s[0] == '0' && s[1] == 'x') { + if (context->version <= 5) + return NAN; + d = g_ascii_strtoll (s + 2, &end, 16); + } else { + if (strchr (s, 'x') != NULL) + return NAN; + d = g_ascii_strtod (s, &end); + } if (*end == '\0') return d == -0.0 ? 0.0 : d; else
Apparently Analagous Threads
- 59 commits - libswfdec-gtk/swfdec_gtk_widget.c libswfdec/swfdec_as_object.c libswfdec/swfdec_as_object.h libswfdec/swfdec_button.c libswfdec/swfdec_button.h libswfdec/swfdec_button_movie.c libswfdec/swfdec_button_movie.h libswfdec/swfdec_event.c
- 9 commits - configure.ac test/custom test/Makefile.am test/swfdec_test_initialize.as test/swfdec_test_initialize.h test/swfdec_test_test.c test/trace
- Changes to 'refs/tags/0.5.5'
- 12 commits - configure.ac doc/Makefile.am doc/swfdec-sections.txt libswfdec/jpeg libswfdec/swfdec_as_array.c libswfdec/swfdec_as_object.c libswfdec/swfdec_as_strings.c libswfdec/swfdec_player.c libswfdec/swfdec_player.h libswfdec/swfdec_player_internal.h
- 11 commits - libswfdec/swfdec_as_strings.c libswfdec/swfdec_sprite_movie_as.c libswfdec/swfdec_xml.c libswfdec/swfdec_xml.h libswfdec/swfdec_xml_node.c libswfdec/swfdec_xml_node.h test/image test/swfdec_test.c test/swfdec_test_image.c test/trace