Benjamin Otte
2007-Jul-26 15:13 UTC
[Swfdec] 2 commits - libswfdec/swfdec_as_context.c libswfdec/swfdec_as_object.c
libswfdec/swfdec_as_context.c | 29 ++++++++++++++++++++++------- libswfdec/swfdec_as_object.c | 6 +----- 2 files changed, 23 insertions(+), 12 deletions(-) New commits: diff-tree 570b76928de0ee2374c8b146f61fcf02ffaf7a45 (from 332c3fe1317e20967d0f7b89d384a9101635cb8e) Author: Benjamin Otte <otte at gnome.org> Date: Thu Jul 26 17:12:54 2007 +0200 implement ASSetPropFlags for strings diff --git a/libswfdec/swfdec_as_context.c b/libswfdec/swfdec_as_context.c index 5fc3b1a..a47028c 100644 --- a/libswfdec/swfdec_as_context.c +++ b/libswfdec/swfdec_as_context.c @@ -999,23 +999,30 @@ swfdec_as_context_eval_set (SwfdecAsCont /*** AS CODE ***/ +static void +swfdec_as_context_ASSetPropFlags_set_one_flag (SwfdecAsObject *object, const char *s, guint *flags) +{ + guint real; + + /* first set all relevant flags */ + real = flags[0] & flags[1]; + swfdec_as_object_set_variable_flags (object, s, real); + /* then unset all relevant flags */ + real = ~flags[0] & flags[1]; + swfdec_as_object_unset_variable_flags (object, s, real); +} + static gboolean swfdec_as_context_ASSetPropFlags_foreach (SwfdecAsObject *object, const char *s, SwfdecAsValue *val, guint cur_flags, gpointer data) { guint *flags = data; - guint real; /* shortcut if the flags already match */ if ((cur_flags & flags[1]) == flags[0]) return TRUE; - /* first set all relevant flags */ - real = flags[0] & flags[1]; - swfdec_as_object_set_variable_flags (object, s, real); - /* then unset all relevant flags */ - real = ~flags[0] & flags[1]; - swfdec_as_object_unset_variable_flags (object, s, real); + swfdec_as_context_ASSetPropFlags_set_one_flag (object, s, flags); return TRUE; } @@ -1036,6 +1043,14 @@ swfdec_as_context_ASSetPropFlags (Swfdec flags[1] = (argc > 3) ? swfdec_as_value_to_integer (cx, &argv[3]) : -1; if (SWFDEC_AS_VALUE_IS_NULL (&argv[1])) { swfdec_as_object_foreach (obj, swfdec_as_context_ASSetPropFlags_foreach, flags); + } else if (SWFDEC_AS_VALUE_IS_STRING (&argv[1])) { + char **split = g_strsplit (SWFDEC_AS_VALUE_GET_STRING (&argv[1]), ",", -1); + guint i; + for (i = 0; split[i]; i++) { + swfdec_as_context_ASSetPropFlags_set_one_flag (obj, + swfdec_as_context_get_string (cx, split[i]), flags); + } + g_strfreev (split); } else { SWFDEC_FIXME ("ASSetPropFlags for non-null properties not implemented yet"); } diff-tree 332c3fe1317e20967d0f7b89d384a9101635cb8e (from c2cef8e7f06bb5916c17839ae4c145241d26130a) Author: Benjamin Otte <otte at gnome.org> Date: Thu Jul 26 17:05:49 2007 +0200 oops, debugging left in diff --git a/libswfdec/swfdec_as_object.c b/libswfdec/swfdec_as_object.c index 7a21a48..6c4e199 100644 --- a/libswfdec/swfdec_as_object.c +++ b/libswfdec/swfdec_as_object.c @@ -162,12 +162,8 @@ swfdec_as_object_do_get (SwfdecAsObject if (var == NULL) return FALSE; - if (var->flags & SWFDEC_AS_VARIABLE_FLASH6_UP && object->context->version < 6) { - g_print ("HARHAR\n"); + if (var->flags & SWFDEC_AS_VARIABLE_FLASH6_UP && object->context->version < 6) return FALSE; - } else if (var->flags & SWFDEC_AS_VARIABLE_FLASH6_UP) { - g_print ("HI MOM\n"); - } if (var->get) { swfdec_as_function_call (var->get, object, 0, NULL, val);