[Swfdec] 4 commits - libswfdec/Makefile.am libswfdec/swfdec_movie.c libswfdec/swfdec_shape_parser.c test/dump.c test/trace

Benjamin Otte company at kemper.freedesktop.org
Wed Jan 2 04:20:05 PST 2008


 libswfdec/Makefile.am                    |    2 
 libswfdec/swfdec_movie.c                 |   24 +++++-
 libswfdec/swfdec_shape_parser.c          |    4 -
 test/dump.c                              |    3 
 test/trace/Makefile.am                   |    9 ++
 test/trace/movieclip-version-5.swf       |binary
 test/trace/movieclip-version-5.swf.trace |  111 +++++++++++++++++++++++++++++++
 test/trace/movieclip-version-6.swf       |binary
 test/trace/movieclip-version-6.swf.trace |   31 ++++++++
 test/trace/movieclip-version-7.swf       |binary
 test/trace/movieclip-version-7.swf.trace |   31 ++++++++
 test/trace/movieclip-version-8.swf       |binary
 test/trace/movieclip-version-8.swf.trace |   31 ++++++++
 test/trace/movieclip-version.as          |   16 ++++
 14 files changed, 252 insertions(+), 10 deletions(-)

New commits:
commit 085c6c5d839fa7dc26d0412f0a0d612b82299b1e
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Jan 2 13:19:56 2008 +0100

    get rid of warning
    
    omitting styles without paths doesn't seem to cause issues

diff --git a/libswfdec/swfdec_shape_parser.c b/libswfdec/swfdec_shape_parser.c
index fc42fdf..d521a9c 100644
--- a/libswfdec/swfdec_shape_parser.c
+++ b/libswfdec/swfdec_shape_parser.c
@@ -274,10 +274,8 @@ swfdec_shape_parser_finish (SwfdecShapeParser *parser)
       swfdec_style_finish (style, (SwfdecSubPath *) (void *) parser->subpaths->data, 
 	  parser->subpaths2->len ? (SwfdecSubPath *) (void *) parser->subpaths2->data : NULL, FALSE);
       parser->draws = g_slist_prepend (parser->draws, g_object_ref (style->draw));
-    } else if (parser->parse_fill) {
-      SWFDEC_WARNING ("fillstyle %u has no path", i);
     } else {
-      SWFDEC_INFO ("fillstyle %u has no path (probably a space sign?)", i);
+      SWFDEC_INFO ("fillstyle %u has no path", i);
     }
   }
   for (i = 0; i < parser->linestyles->len; i++) {
commit db546facec9f7fb973c577586dc3796c6e2126ec
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Jan 2 13:16:12 2008 +0100

    treat $version as a normal property
    
    Also make strings with a $ in them use that $ sign, so the "$version"
    string evaluates to SWFDEC_AS_STR_$version.
    I hope that change didn't break too many shell escaping rules...

diff --git a/libswfdec/Makefile.am b/libswfdec/Makefile.am
index 322529c..78cdf62 100644
--- a/libswfdec/Makefile.am
+++ b/libswfdec/Makefile.am
@@ -365,7 +365,7 @@ swfdec_as_strings.h: swfdec_as_strings.c
 	  && echo -e "\nextern const char swfdec_as_strings[];\n" \
 	  && grep "  SWFDEC_AS_CONSTANT_STRING" swfdec_as_strings.c \
 	  | sed "s/.*(\"\(.*\)\").*/\1/" \
-	  | $(AWK) '{ if ($$0 == "") name = "EMPTY"; else if ($$0 == ",") name = "COMMA"; else if ($$0 == "/") name = "SLASH"; else name = $$0; gsub("[^a-zA-Z0-9]","_",name); print "#define SWFDEC_AS_STR_" name " &swfdec_as_strings[" x + 1 "]"; x = x + length ($$0) + 2 }' \
+	  | $(AWK) '{ if ($$0 == "") name = "EMPTY"; else if ($$0 == ",") name = "COMMA"; else if ($$0 == "/") name = "SLASH"; else name = $$0; gsub("[^a-zA-Z0-9\\$$]","_",name); print "#define SWFDEC_AS_STR_" name " &swfdec_as_strings[" x + 1 "]"; x = x + length ($$0) + 2 }' \
 	  && echo -e "\n#endif" ) > xgen-sas \
 	&& (cmp -s xgen-sas swfdec_as_strings.h || cp xgen-sas swfdec_as_strings.h ) \
 	&& rm -f xgen-sas
diff --git a/libswfdec/swfdec_movie.c b/libswfdec/swfdec_movie.c
index 8cdfd80..f06a289 100644
--- a/libswfdec/swfdec_movie.c
+++ b/libswfdec/swfdec_movie.c
@@ -1133,12 +1133,6 @@ swfdec_movie_get_variable (SwfdecAsObject *object, SwfdecAsObject *orig,
     *flags = 0;
     return TRUE;
   }
-  if (movie->parent == NULL && variable == SWFDEC_AS_STR__version) {
-    SWFDEC_AS_VALUE_SET_STRING (val, swfdec_as_context_get_string (object->context,
-	  SWFDEC_PLAYER (object->context)->priv->system->version));
-    *flags = 0;
-    return TRUE;
-  }
   
   movie = swfdec_movie_get_by_name (movie, variable, FALSE);
   if (movie) {
@@ -1489,6 +1483,22 @@ swfdec_movie_set_depth (SwfdecMovie *movie, int depth)
   g_object_notify (G_OBJECT (movie), "depth");
 }
 
+static void
+swfdec_movie_set_version (SwfdecMovie *movie)
+{
+  SwfdecAsObject *o;
+  SwfdecAsContext *cx;
+  SwfdecAsValue val;
+
+  if (movie->parent != NULL)
+    return;
+
+  o = SWFDEC_AS_OBJECT (movie);
+  cx = o->context;
+  SWFDEC_AS_VALUE_SET_STRING (&val, swfdec_as_context_get_string (cx, SWFDEC_PLAYER (cx)->priv->system->version));
+  swfdec_as_object_set_variable (o, SWFDEC_AS_STR_$version, &val);
+}
+
 /**
  * swfdec_movie_new:
  * @player: a #SwfdecPlayer
@@ -1571,11 +1581,13 @@ swfdec_movie_new (SwfdecPlayer *player, int depth, SwfdecMovie *parent, SwfdecRe
   player->priv->movies = g_list_prepend (player->priv->movies, movie);
   /* only add the movie here, because it needs to be setup for the debugger */
   swfdec_as_object_add (SWFDEC_AS_OBJECT (movie), SWFDEC_AS_CONTEXT (player), size);
+  swfdec_movie_set_version (movie);
   /* only setup here, the resource assumes it can access the player via the movie */
   if (resource->movie == NULL) {
     g_assert (SWFDEC_IS_SPRITE_MOVIE (movie));
     resource->movie = SWFDEC_SPRITE_MOVIE (movie);
   }
+
   return movie;
 }
 
commit db0b62fc3863e4433fbeb86648469d2f2dfeaa45
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Jan 2 13:14:57 2008 +0100

    add check that ensures $version is a normal property

diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index 853be9b..00fdf11 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -1596,6 +1596,15 @@ EXTRA_DIST = \
 	movieclip-target-6.swf.trace \
 	movieclip-target-7.swf \
 	movieclip-target-7.swf.trace \
+	movieclip-version.as \
+	movieclip-version-5.swf \
+	movieclip-version-5.swf.trace \
+	movieclip-version-6.swf \
+	movieclip-version-6.swf.trace \
+	movieclip-version-7.swf \
+	movieclip-version-7.swf.trace \
+	movieclip-version-8.swf \
+	movieclip-version-8.swf.trace \
 	moviecliploader-constructor.as \
 	moviecliploader-constructor-5.swf \
 	moviecliploader-constructor-5.swf.trace \
diff --git a/test/trace/movieclip-version-5.swf b/test/trace/movieclip-version-5.swf
new file mode 100644
index 0000000..efce6eb
Binary files /dev/null and b/test/trace/movieclip-version-5.swf differ
diff --git a/test/trace/movieclip-version-5.swf.trace b/test/trace/movieclip-version-5.swf.trace
new file mode 100644
index 0000000..8f59430
--- /dev/null
+++ b/test/trace/movieclip-version-5.swf.trace
@@ -0,0 +1,111 @@
+_level0
+WIN
+WIN
+_level8
+WIN
+WIN
+_level7
+WIN
+WIN
+_level6
+WIN
+WIN
+_level5
+WIN
+WIN
+_level8
+WIN
+WIN
+_level7
+WIN
+WIN
+_level6
+WIN
+WIN
+_level5
+WIN
+WIN
+_level8
+WIN
+WIN
+_level7
+WIN
+WIN
+_level6
+WIN
+WIN
+_level5
+WIN
+WIN
+_level8
+WIN
+WIN
+_level7
+WIN
+WIN
+_level6
+WIN
+WIN
+_level5
+WIN
+WIN
+_level8
+WIN
+WIN
+_level7
+WIN
+WIN
+_level6
+WIN
+WIN
+_level5
+WIN
+WIN
+_level8
+WIN
+WIN
+_level7
+WIN
+WIN
+_level6
+WIN
+WIN
+_level5
+WIN
+WIN
+_level8
+WIN
+WIN
+_level7
+WIN
+WIN
+_level6
+WIN
+WIN
+_level5
+WIN
+WIN
+_level8
+WIN
+WIN
+_level7
+WIN
+WIN
+_level6
+WIN
+WIN
+_level5
+WIN
+WIN
+_level8
+WIN
+WIN
+_level7
+WIN
+WIN
+_level6
+WIN
+WIN
+_level5
+WIN
+WIN
diff --git a/test/trace/movieclip-version-6.swf b/test/trace/movieclip-version-6.swf
new file mode 100644
index 0000000..b3d3f2f
Binary files /dev/null and b/test/trace/movieclip-version-6.swf differ
diff --git a/test/trace/movieclip-version-6.swf.trace b/test/trace/movieclip-version-6.swf.trace
new file mode 100644
index 0000000..d36c88b
--- /dev/null
+++ b/test/trace/movieclip-version-6.swf.trace
@@ -0,0 +1,31 @@
+_level0
+WIN
+WIN
+_level8
+WIN
+WIN
+_level0.m8
+undefined
+undefined
+undefined
+_level7
+WIN
+WIN
+_level0.m7
+undefined
+undefined
+undefined
+_level6
+WIN
+WIN
+_level0.m6
+undefined
+undefined
+undefined
+_level5
+WIN
+WIN
+_level0.m5
+undefined
+undefined
+undefined
diff --git a/test/trace/movieclip-version-7.swf b/test/trace/movieclip-version-7.swf
new file mode 100644
index 0000000..bddbadc
Binary files /dev/null and b/test/trace/movieclip-version-7.swf differ
diff --git a/test/trace/movieclip-version-7.swf.trace b/test/trace/movieclip-version-7.swf.trace
new file mode 100644
index 0000000..d36c88b
--- /dev/null
+++ b/test/trace/movieclip-version-7.swf.trace
@@ -0,0 +1,31 @@
+_level0
+WIN
+WIN
+_level8
+WIN
+WIN
+_level0.m8
+undefined
+undefined
+undefined
+_level7
+WIN
+WIN
+_level0.m7
+undefined
+undefined
+undefined
+_level6
+WIN
+WIN
+_level0.m6
+undefined
+undefined
+undefined
+_level5
+WIN
+WIN
+_level0.m5
+undefined
+undefined
+undefined
diff --git a/test/trace/movieclip-version-8.swf b/test/trace/movieclip-version-8.swf
new file mode 100644
index 0000000..8b790d2
Binary files /dev/null and b/test/trace/movieclip-version-8.swf differ
diff --git a/test/trace/movieclip-version-8.swf.trace b/test/trace/movieclip-version-8.swf.trace
new file mode 100644
index 0000000..d36c88b
--- /dev/null
+++ b/test/trace/movieclip-version-8.swf.trace
@@ -0,0 +1,31 @@
+_level0
+WIN
+WIN
+_level8
+WIN
+WIN
+_level0.m8
+undefined
+undefined
+undefined
+_level7
+WIN
+WIN
+_level0.m7
+undefined
+undefined
+undefined
+_level6
+WIN
+WIN
+_level0.m6
+undefined
+undefined
+undefined
+_level5
+WIN
+WIN
+_level0.m5
+undefined
+undefined
+undefined
diff --git a/test/trace/movieclip-version.as b/test/trace/movieclip-version.as
new file mode 100644
index 0000000..55e97ee
--- /dev/null
+++ b/test/trace/movieclip-version.as
@@ -0,0 +1,16 @@
+// makeswf -v 7 -s 200x150 -r 1 -o movieclip-version.swf movieclip-version.as
+
+trace (this);
+trace ($version.substr (0, 3));
+trace (this.$version.substr (0, 3));
+if (this == _root) {
+  for (i = 5; i <= 8; i++) {
+    createEmptyMovieClip ("m" + i, i);
+    loadMovie ("movieclip-version-" + i + ".swf", "m" + i);
+    loadMovie ("movieclip-version-" + i + ".swf", "_level" + i);
+  }
+} else {
+  delete this.$version;
+  trace (this.$version);
+  loadMovie ("fscommand:quit", "");
+}
commit d03071b49846f69e27903c68b91ad34a58b5e3b4
Author: Benjamin Otte <otte at gnome.org>
Date:   Tue Jan 1 21:42:58 2008 +0100

    add DoInitAction

diff --git a/test/dump.c b/test/dump.c
index 48f037d..efea56d 100644
--- a/test/dump.c
+++ b/test/dump.c
@@ -153,6 +153,9 @@ dump_sprite (SwfdecSwfDecoder *dec, SwfdecSprite *s)
 	case SWFDEC_TAG_EXPORTASSETS:
 	  g_print ("   %4u export\n", j);
 	  break;
+	case SWFDEC_TAG_DOINITACTION:
+	  g_print ("   %4u init action\n", j);
+	  break;
 	default:
 	  g_assert_not_reached ();
       }


More information about the Swfdec mailing list