[Swfdec] 2 commits - libswfdec/swfdec_as_context.c test/trace

Benjamin Otte company at kemper.freedesktop.org
Wed Aug 22 05:30:09 PDT 2007


 libswfdec/swfdec_as_context.c        |    4 +-
 test/trace/Makefile.am               |    9 +++++
 test/trace/rewind-remove-5.swf       |binary
 test/trace/rewind-remove-5.swf.trace |    7 ++++
 test/trace/rewind-remove-6.swf       |binary
 test/trace/rewind-remove-6.swf.trace |    7 ++++
 test/trace/rewind-remove-7.swf       |binary
 test/trace/rewind-remove-7.swf.trace |    7 ++++
 test/trace/rewind-remove-8.swf       |binary
 test/trace/rewind-remove-8.swf.trace |    7 ++++
 test/trace/rewind-remove.c           |   58 +++++++++++++++++++++++++++++++++++
 11 files changed, 98 insertions(+), 1 deletion(-)

New commits:
diff-tree f76008d4e5427597e9810132fb40a7571ca20ee3 (from 2145b52e9511f75b004c86347a63813a37cf5af8)
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Aug 22 14:30:00 2007 +0200

    only check as many Flash versions as we have functions for
    
    Those variables are named very unfortunate...

diff --git a/libswfdec/swfdec_as_context.c b/libswfdec/swfdec_as_context.c
index 59df631..ccb6a3c 100644
--- a/libswfdec/swfdec_as_context.c
+++ b/libswfdec/swfdec_as_context.c
@@ -834,7 +834,9 @@ start:
     exec = spec->exec[version];
     if (!exec) {
       guint real_version;
-      for (real_version = version + 1; !exec && real_version <= SWFDEC_AS_MAX_SCRIPT_VERSION; real_version++) {
+      for (real_version = version + 1; !exec && 
+	  real_version <= SWFDEC_AS_MAX_SCRIPT_VERSION - SWFDEC_AS_MIN_SCRIPT_VERSION; 
+	  real_version++) {
 	exec = spec->exec[real_version];
       }
       if (!exec) {
diff-tree 2145b52e9511f75b004c86347a63813a37cf5af8 (from 361082fdf6ede11a08266193ca00247490121f6e)
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Aug 22 14:29:28 2007 +0200

    add test for removing only the right movies on rewind

diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index aec7f1d..5911bb2 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -875,6 +875,15 @@ EXTRA_DIST = \
 	removesprite-depths-6.swf.trace \
 	removesprite-depths-7.swf \
 	removesprite-depths-7.swf.trace \
+	rewind-remove.c \
+	rewind-remove-5.swf \
+	rewind-remove-5.swf.trace \
+	rewind-remove-6.swf \
+	rewind-remove-6.swf.trace \
+	rewind-remove-7.swf \
+	rewind-remove-7.swf.trace \
+	rewind-remove-8.swf \
+	rewind-remove-8.swf.trace \
 	rotation-5.swf \
 	rotation-5.swf.trace \
 	rotation2.as \
diff --git a/test/trace/rewind-remove-5.swf b/test/trace/rewind-remove-5.swf
new file mode 100644
index 0000000..1b9884e
Binary files /dev/null and b/test/trace/rewind-remove-5.swf differ
diff --git a/test/trace/rewind-remove-5.swf.trace b/test/trace/rewind-remove-5.swf.trace
new file mode 100644
index 0000000..312bfa5
--- /dev/null
+++ b/test/trace/rewind-remove-5.swf.trace
@@ -0,0 +1,7 @@
+Make sure only the right movies get deleted
+undefined
+undefined
+undefined
+undefined
+undefined
+undefined
diff --git a/test/trace/rewind-remove-6.swf b/test/trace/rewind-remove-6.swf
new file mode 100644
index 0000000..39a6675
Binary files /dev/null and b/test/trace/rewind-remove-6.swf differ
diff --git a/test/trace/rewind-remove-6.swf.trace b/test/trace/rewind-remove-6.swf.trace
new file mode 100644
index 0000000..680839d
--- /dev/null
+++ b/test/trace/rewind-remove-6.swf.trace
@@ -0,0 +1,7 @@
+Make sure only the right movies get deleted
+_level0.foo0
+_level0.foo1
+undefined
+undefined
+_level0.foo4
+_level0.foo5
diff --git a/test/trace/rewind-remove-7.swf b/test/trace/rewind-remove-7.swf
new file mode 100644
index 0000000..c1125a8
Binary files /dev/null and b/test/trace/rewind-remove-7.swf differ
diff --git a/test/trace/rewind-remove-7.swf.trace b/test/trace/rewind-remove-7.swf.trace
new file mode 100644
index 0000000..680839d
--- /dev/null
+++ b/test/trace/rewind-remove-7.swf.trace
@@ -0,0 +1,7 @@
+Make sure only the right movies get deleted
+_level0.foo0
+_level0.foo1
+undefined
+undefined
+_level0.foo4
+_level0.foo5
diff --git a/test/trace/rewind-remove-8.swf b/test/trace/rewind-remove-8.swf
new file mode 100644
index 0000000..8007ab0
Binary files /dev/null and b/test/trace/rewind-remove-8.swf differ
diff --git a/test/trace/rewind-remove-8.swf.trace b/test/trace/rewind-remove-8.swf.trace
new file mode 100644
index 0000000..680839d
--- /dev/null
+++ b/test/trace/rewind-remove-8.swf.trace
@@ -0,0 +1,7 @@
+Make sure only the right movies get deleted
+_level0.foo0
+_level0.foo1
+undefined
+undefined
+_level0.foo4
+_level0.foo5
diff --git a/test/trace/rewind-remove.c b/test/trace/rewind-remove.c
new file mode 100644
index 0000000..e840b09
--- /dev/null
+++ b/test/trace/rewind-remove.c
@@ -0,0 +1,58 @@
+/* gcc `pkg-config --libs --cflags libming` rewind-remove.c -o rewind-remove && ./rewind-remove
+ */
+
+#include <ming.h>
+
+static void
+do_movie (int version)
+{
+  SWFMovie movie;
+  SWFMovieClip clip;
+  SWFDisplayItem item;
+  char name[100];
+
+  movie = newSWFMovieWithVersion (version);
+  movie = newSWFMovie();
+  SWFMovie_setRate (movie, 1);
+  SWFMovie_setDimension (movie, 200, 150);
+
+  SWFMovie_add (movie, (SWFBlock) newSWFAction (""
+	"if (was_here == undefined) {"
+	"  was_here = true;"
+	"  trace (\"Make sure only the right movies get deleted\");"
+	"  createEmptyMovieClip (\"foo0\", 1000000);"
+	"  createEmptyMovieClip (\"foo1\", 0);"
+	"  createEmptyMovieClip (\"foo2\", -1);"
+	"  createEmptyMovieClip (\"foo3\", -16384);"
+	"  createEmptyMovieClip (\"foo4\", -16385);"
+	"  createEmptyMovieClip (\"foo5\", -1000000);"
+	"} else {"
+	"  trace (foo0);"
+	"  trace (foo1);"
+	"  trace (foo2);"
+	"  trace (foo3);"
+	"  trace (foo4);"
+	"  trace (foo5);"
+	"  loadMovie (\"FSCommand:quit\", \"\");"
+	"}"
+	""));
+  SWFMovie_nextFrame (movie);
+  SWFMovie_nextFrame (movie);
+
+  sprintf (name, "rewind-remove-%d.swf", version);
+  SWFMovie_save (movie, name);
+}
+
+int
+main (int argc, char **argv)
+{
+  int i;
+
+  if (Ming_init ())
+    return 1;
+
+  for (i = 5; i < 9; i++)
+    do_movie (i);
+
+  return 0;
+}


More information about the Swfdec mailing list