[Swfdec] Branch 'as' - 2 commits - libswfdec/swfdec_as_interpret.c

Benjamin Otte company at kemper.freedesktop.org
Mon Jul 2 08:27:37 PDT 2007


 libswfdec/swfdec_as_interpret.c |   33 ++++++++++++++++-----------------
 1 files changed, 16 insertions(+), 17 deletions(-)

New commits:
diff-tree 17cb8dc33b1e5d9b35a3f24ec559a0ab9b5a5dd4 (from e54ff783653aa2dd3fd1b25e6bf3010f2236707c)
Author: Andreas Henriksson <andreas at fatal.se>
Date:   Mon Jul 2 16:26:27 2007 +0100

    use swfdec_bits_get_string_with_version

diff --git a/libswfdec/swfdec_as_interpret.c b/libswfdec/swfdec_as_interpret.c
index f411c01..f709b6e 100644
--- a/libswfdec/swfdec_as_interpret.c
+++ b/libswfdec/swfdec_as_interpret.c
@@ -1512,7 +1512,7 @@ swfdec_action_define_function (SwfdecAsC
 	  args[i].preload = 0;
 	}
       }
-      args[i].name = swfdec_bits_get_string (&bits);
+      args[i].name = swfdec_bits_get_string_with_version (&bits, cx->version);
       if (args[i].name == NULL || args[i].name == '\0') {
 	SWFDEC_ERROR ("empty argument name not allowed");
 	g_free (args);
diff-tree e54ff783653aa2dd3fd1b25e6bf3010f2236707c (from a623e3051b6ec06c8d1c495687888e0b7ff7fea0)
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Jul 2 16:25:20 2007 +0100

    reimplement TargetPath

diff --git a/libswfdec/swfdec_as_interpret.c b/libswfdec/swfdec_as_interpret.c
index 7c9025d..f411c01 100644
--- a/libswfdec/swfdec_as_interpret.c
+++ b/libswfdec/swfdec_as_interpret.c
@@ -1638,25 +1638,26 @@ swfdec_action_to_integer (SwfdecAsContex
   SWFDEC_AS_VALUE_SET_INT (val, swfdec_as_value_to_integer (cx, val));
 }
 
-#if 0
 static void
 swfdec_action_target_path (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
 {
-  SwfdecMovie *movie = swfdec_scriptable_from_jsval (cx, cx->fp->sp[-1], SWFDEC_TYPE_MOVIE);
+  SwfdecAsValue *val;
+  SwfdecMovie *movie;
+  SwfdecAsStack *stack;
+  char *s;
 
-  if (movie == NULL) {
-    cx->fp->sp[-1] = JSVAL_VOID;
-  } else {
-    char *s = swfdec_movie_get_path (movie);
-    JSString *string = JS_NewStringCopyZ (cx, s);
-    g_free (s);
-    if (string == NULL)
-      return JS_FALSE;
-    cx->fp->sp[-1] = STRING_TO_JSVAL (string);
+  stack = cx->frame->stack;
+  val = swfdec_as_stack_peek (stack, 1);
+
+  if (!SWFDEC_AS_VALUE_IS_OBJECT (val) ||
+      !SWFDEC_IS_MOVIE (movie = (SwfdecMovie *) SWFDEC_AS_VALUE_GET_OBJECT (val))) {
+    SWFDEC_FIXME ("What's the TargetPath for non-movies?");
+    SWFDEC_AS_VALUE_SET_STRING (val, SWFDEC_AS_STR_EMPTY);
+    return;
   }
-  return JS_TRUE;
+  s = swfdec_movie_get_path (movie);
+  SWFDEC_AS_VALUE_SET_STRING (val, swfdec_as_context_give_string (cx, s));
 }
-#endif
 
 static void
 swfdec_action_define_local (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
@@ -2446,9 +2447,7 @@ const SwfdecActionSpec swfdec_as_actions
   [SWFDEC_AS_ACTION_INIT_ARRAY] = { "InitArray", NULL, -1, 1, { NULL, NULL, swfdec_action_init_array, swfdec_action_init_array, swfdec_action_init_array } },
   [SWFDEC_AS_ACTION_INIT_OBJECT] = { "InitObject", NULL, -1, 1, { NULL, NULL, swfdec_action_init_object, swfdec_action_init_object, swfdec_action_init_object } },
   [SWFDEC_AS_ACTION_TYPE_OF] = { "TypeOf", NULL, 1, 1, { NULL, NULL, swfdec_action_type_of, swfdec_action_type_of, swfdec_action_type_of } },
-#if 0
-  [0x45] = { "TargetPath", NULL, 1, 1, { NULL, NULL, swfdec_action_target_path, swfdec_action_target_path, swfdec_action_target_path } },
-#endif
+  [SWFDEC_AS_ACTION_TARGET_PATH] = { "TargetPath", NULL, 1, 1, { NULL, NULL, swfdec_action_target_path, swfdec_action_target_path, swfdec_action_target_path } },
   [SWFDEC_AS_ACTION_ENUMERATE] = { "Enumerate", NULL, 1, -1, { NULL, NULL, swfdec_action_enumerate, swfdec_action_enumerate, swfdec_action_enumerate } },
   [SWFDEC_AS_ACTION_ADD2] = { "Add2", NULL, 2, 1, { NULL, NULL, swfdec_action_add2, swfdec_action_add2, swfdec_action_add2 } },
   [SWFDEC_AS_ACTION_LESS2] = { "Less2", NULL, 2, 1, { NULL, NULL, swfdec_action_new_comparison, swfdec_action_new_comparison, swfdec_action_new_comparison } },


More information about the Swfdec mailing list