[Swfdec-commits] 54 commits - swfdec/swfdec_actor.c swfdec/swfdec_as_array.c swfdec/swfdec_asbroadcaster.c swfdec/swfdec_as_context.c swfdec/swfdec_as_date.c swfdec/swfdec_as_frame.c swfdec/swfdec_as_function.c swfdec/swfdec_as_internal.h swfdec/swfdec_as_interpret.c swfdec/swfdec_as_native_function.c swfdec/swfdec_as_native_function.h swfdec/swfdec_as_object.c swfdec/swfdec_as_object.h swfdec/swfdec_as_string.c swfdec/swfdec_as_types.c swfdec/swfdec_as_types.h swfdec/swfdec_bitmap_data.c swfdec/swfdec_color_as.c swfdec/swfdec_color_transform_as.c swfdec/swfdec_file_reference.c swfdec/swfdec_interval.c swfdec/swfdec_interval.h swfdec/swfdec_load_object_as.c swfdec/swfdec_movie_asprops.c swfdec/swfdec_movie.c swfdec/swfdec_net_stream.c swfdec/swfdec_player_as.c swfdec/swfdec_player.c swfdec/swfdec_resource.c swfdec/swfdec_sprite_movie_as.c swfdec/swfdec_style_sheet.c swfdec/swfdec_text_field_movie_as.c swfdec/swfdec_text_field_movie.c swfdec/swfdec_text_format.c swfdec/swfdec_transform_as.c swfdec/swfdec_transform_as.h test/various vivified/core
Benjamin Otte
company at kemper.freedesktop.org
Wed Oct 29 15:35:07 PDT 2008
swfdec/swfdec_actor.c | 8 -
swfdec/swfdec_as_array.c | 31 ++--
swfdec/swfdec_as_context.c | 17 +-
swfdec/swfdec_as_date.c | 2
swfdec/swfdec_as_frame.c | 6
swfdec/swfdec_as_function.c | 4
swfdec/swfdec_as_internal.h | 16 ++
swfdec/swfdec_as_interpret.c | 237 ++++++++++++++----------------------
swfdec/swfdec_as_native_function.c | 42 +++---
swfdec/swfdec_as_native_function.h | 3
swfdec/swfdec_as_object.c | 141 +++++++--------------
swfdec/swfdec_as_object.h | 12 -
swfdec/swfdec_as_string.c | 2
swfdec/swfdec_as_types.c | 101 +++++++--------
swfdec/swfdec_as_types.h | 31 +++-
swfdec/swfdec_asbroadcaster.c | 4
swfdec/swfdec_bitmap_data.c | 10 -
swfdec/swfdec_color_as.c | 15 --
swfdec/swfdec_color_transform_as.c | 2
swfdec/swfdec_file_reference.c | 8 -
swfdec/swfdec_interval.c | 42 +++---
swfdec/swfdec_interval.h | 3
swfdec/swfdec_load_object_as.c | 8 -
swfdec/swfdec_movie.c | 17 --
swfdec/swfdec_movie_asprops.c | 5
swfdec/swfdec_net_stream.c | 6
swfdec/swfdec_player.c | 11 +
swfdec/swfdec_player_as.c | 17 +-
swfdec/swfdec_resource.c | 13 -
swfdec/swfdec_sprite_movie_as.c | 46 ++----
swfdec/swfdec_style_sheet.c | 11 -
swfdec/swfdec_text_field_movie.c | 9 -
swfdec/swfdec_text_field_movie_as.c | 6
swfdec/swfdec_text_format.c | 4
swfdec/swfdec_transform_as.c | 10 -
swfdec/swfdec_transform_as.h | 2
test/various/gc.c | 6
vivified/core/vivi_breakpoint.c | 54 --------
vivified/core/vivi_wrap.c | 1
vivified/core/vivi_wrap_as.c | 4
40 files changed, 412 insertions(+), 555 deletions(-)
New commits:
commit 596a84ef3219debaf385717880287330006d17c3
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 23:18:43 2008 +0100
COMPOSITE => correct type in interpreter
diff --git a/swfdec/swfdec_as_interpret.c b/swfdec/swfdec_as_interpret.c
index 26f85bd..a1dc2fa 100644
--- a/swfdec/swfdec_as_interpret.c
+++ b/swfdec/swfdec_as_interpret.c
@@ -630,7 +630,7 @@ swfdec_action_get_variable (SwfdecAsContext *cx, guint action, const guint8 *dat
if (s) {
swfdec_as_object_get_variable (object, swfdec_as_context_get_string (cx, s), val);
} else {
- SWFDEC_AS_VALUE_SET_COMPOSITE (val, object);
+ SWFDEC_AS_VALUE_SET_MOVIE (val, SWFDEC_MOVIE (object));
}
} else {
swfdec_as_frame_get_variable (cx->frame, swfdec_as_context_get_string (cx, s), val);
@@ -738,10 +738,11 @@ swfdec_action_get_member (SwfdecAsContext *cx, guint action, const guint8 *data,
static void
swfdec_action_set_member (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
{
+ const char *name = swfdec_as_value_to_string (cx, swfdec_as_stack_peek (cx, 2));
if (SWFDEC_AS_VALUE_IS_COMPOSITE (swfdec_as_stack_peek (cx, 3))) {
- const char *name = swfdec_as_value_to_string (cx, swfdec_as_stack_peek (cx, 2));
- swfdec_as_object_set_variable (SWFDEC_AS_VALUE_GET_COMPOSITE (swfdec_as_stack_peek (cx, 3)),
- name, swfdec_as_stack_peek (cx, 1));
+ SwfdecAsObject *o = SWFDEC_AS_VALUE_GET_COMPOSITE (swfdec_as_stack_peek (cx, 3));
+ if (o)
+ swfdec_as_object_set_variable (o, name, swfdec_as_stack_peek (cx, 1));
}
swfdec_as_stack_pop_n (cx, 3);
}
@@ -770,9 +771,9 @@ swfdec_action_call (SwfdecAsContext *cx, guint n_args, SwfdecAsObject *super)
SwfdecAsFunction *fun;
SwfdecAsObject *thisp;
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (swfdec_as_stack_peek (cx, 1)))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (swfdec_as_stack_peek (cx, 1)))
goto error;
- fun = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_COMPOSITE (swfdec_as_stack_peek (cx, 1))->relay);
+ fun = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_OBJECT (swfdec_as_stack_peek (cx, 1))->relay);
if (!SWFDEC_IS_AS_FUNCTION (fun))
goto error;
if (!SWFDEC_AS_VALUE_IS_COMPOSITE (swfdec_as_stack_peek (cx, 2))) {
@@ -1674,8 +1675,8 @@ swfdec_action_new_object (SwfdecAsContext *cx, guint action, const guint8 *data,
constructor = swfdec_as_stack_peek (cx, 1);
n_args = swfdec_as_value_to_integer (cx, swfdec_as_stack_peek (cx, 2));
n_args = MIN (swfdec_as_stack_get_size (cx) - 2, n_args);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (constructor) ||
- !SWFDEC_IS_AS_FUNCTION (fun = (SwfdecAsFunction *) SWFDEC_AS_VALUE_GET_COMPOSITE (constructor)->relay)) {
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (constructor) ||
+ !SWFDEC_IS_AS_FUNCTION (fun = (SwfdecAsFunction *) SWFDEC_AS_VALUE_GET_OBJECT (constructor)->relay)) {
SWFDEC_WARNING ("not a constructor");
goto fail;
}
@@ -1713,8 +1714,8 @@ swfdec_action_new_method (SwfdecAsContext *cx, guint action, const guint8 *data,
swfdec_as_object_get_variable (SWFDEC_AS_VALUE_GET_COMPOSITE (constructor),
name, constructor);
}
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (constructor) ||
- !SWFDEC_IS_AS_FUNCTION (fun = (SwfdecAsFunction *) SWFDEC_AS_VALUE_GET_COMPOSITE (constructor)->relay)) {
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (constructor) ||
+ !SWFDEC_IS_AS_FUNCTION (fun = (SwfdecAsFunction *) SWFDEC_AS_VALUE_GET_OBJECT (constructor)->relay)) {
SWFDEC_WARNING ("%s is not a constructor", name);
goto fail;
}
@@ -1753,7 +1754,7 @@ swfdec_action_init_object (SwfdecAsContext *cx, guint action, const guint8 *data
swfdec_as_stack_pop_n (cx, 2);
}
swfdec_as_stack_pop_n (cx, size);
- SWFDEC_AS_VALUE_SET_COMPOSITE (swfdec_as_stack_push (cx), object);
+ SWFDEC_AS_VALUE_SET_OBJECT (swfdec_as_stack_push (cx), object);
}
static void
@@ -1776,7 +1777,7 @@ swfdec_action_init_array (SwfdecAsContext *cx, guint action, const guint8 *data,
swfdec_as_value_set_integer (cx, &val, n);
swfdec_as_object_set_variable (array, SWFDEC_AS_STR_length, &val);
}
- SWFDEC_AS_VALUE_SET_COMPOSITE (swfdec_as_stack_push (cx), array);
+ SWFDEC_AS_VALUE_SET_OBJECT (swfdec_as_stack_push (cx), array);
}
static void
@@ -1889,13 +1890,13 @@ swfdec_action_define_function (SwfdecAsContext *cx, guint action,
/* attach the function */
if (*function_name == '\0') {
swfdec_as_stack_ensure_free (cx, 1);
- SWFDEC_AS_VALUE_SET_COMPOSITE (swfdec_as_stack_push (cx),
+ SWFDEC_AS_VALUE_SET_OBJECT (swfdec_as_stack_push (cx),
swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (fun)));
} else {
SwfdecAsValue funval;
/* FIXME: really varobj? Not eval or sth like that? */
name = swfdec_as_context_get_string (cx, function_name);
- SWFDEC_AS_VALUE_SET_COMPOSITE (&funval, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (fun)));
+ SWFDEC_AS_VALUE_SET_OBJECT (&funval, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (fun)));
swfdec_as_object_set_variable (frame->target, name, &funval);
}
@@ -1970,17 +1971,15 @@ static void
swfdec_action_target_path (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
{
SwfdecAsValue *val;
- SwfdecMovie *movie;
char *s;
val = swfdec_as_stack_peek (cx, 1);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (val) ||
- !SWFDEC_IS_MOVIE (movie = (SwfdecMovie *) SWFDEC_AS_VALUE_GET_COMPOSITE (val))) {
+ if (!SWFDEC_AS_VALUE_IS_MOVIE (val)) {
SWFDEC_AS_VALUE_SET_UNDEFINED (val);
return;
}
- s = swfdec_movie_get_path (movie, TRUE);
+ s = swfdec_movie_get_path (SWFDEC_AS_VALUE_GET_MOVIE (val), TRUE);
SWFDEC_AS_VALUE_SET_STRING (val, swfdec_as_context_give_string (cx, s));
}
@@ -2028,8 +2027,9 @@ swfdec_action_delete (SwfdecAsContext *cx, guint action, const guint8 *data, gui
name = swfdec_as_value_to_string (cx, swfdec_as_stack_peek (cx, 1));
val = swfdec_as_stack_peek (cx, 2);
if (SWFDEC_AS_VALUE_IS_COMPOSITE (val)) {
- success = swfdec_as_object_delete_variable (
- SWFDEC_AS_VALUE_GET_COMPOSITE (val), name) == SWFDEC_AS_DELETE_DELETED;
+ SwfdecAsObject *o = SWFDEC_AS_VALUE_GET_COMPOSITE (val);
+ if (o)
+ success = swfdec_as_object_delete_variable (o, name) == SWFDEC_AS_DELETE_DELETED;
}
SWFDEC_AS_VALUE_SET_BOOLEAN (val, success);
swfdec_as_stack_pop_n (cx, 1);
@@ -2184,9 +2184,9 @@ swfdec_action_is_instance_of (SwfdecAsObject *object,
// FIXME: propflag tests are wrong, and we shouldn't get __proto__.prototype
swfdec_as_object_get_variable (constructor, SWFDEC_AS_STR_prototype, &val);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
return FALSE;
- prototype = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
+ prototype = SWFDEC_AS_VALUE_GET_OBJECT (&val);
class = object;
while ((class = swfdec_as_object_get_prototype (class)) != NULL) {
@@ -2209,8 +2209,8 @@ swfdec_action_instance_of (SwfdecAsContext *cx, guint action,
SwfdecAsObject *object, *constructor;
val = swfdec_as_stack_pop (cx);
- if (SWFDEC_AS_VALUE_IS_COMPOSITE (val)) {
- constructor = SWFDEC_AS_VALUE_GET_COMPOSITE (val);
+ if (SWFDEC_AS_VALUE_IS_OBJECT (val)) {
+ constructor = SWFDEC_AS_VALUE_GET_OBJECT (val);
} else {
constructor = NULL;
}
@@ -2247,8 +2247,8 @@ swfdec_action_cast (SwfdecAsContext *cx, guint action, const guint8 *data,
}
val = swfdec_as_stack_pop (cx);
- if (SWFDEC_AS_VALUE_IS_COMPOSITE (val)) {
- constructor = SWFDEC_AS_VALUE_GET_COMPOSITE (val);
+ if (SWFDEC_AS_VALUE_IS_OBJECT (val)) {
+ constructor = SWFDEC_AS_VALUE_GET_OBJECT (val);
} else {
constructor = NULL;
}
@@ -2270,7 +2270,7 @@ swfdec_action_implements (SwfdecAsContext *cx, guint action,
const guint8 *data, guint len)
{
SwfdecAsValue *val, *argv;
- SwfdecAsObject *object, *proto, *interface;
+ SwfdecAsObject *object, *proto;
int argc, i;
swfdec_as_stack_ensure_size (cx, 2);
@@ -2279,8 +2279,8 @@ swfdec_action_implements (SwfdecAsContext *cx, guint action,
if (SWFDEC_AS_VALUE_IS_COMPOSITE (val)) {
object = SWFDEC_AS_VALUE_GET_COMPOSITE (val);
swfdec_as_object_get_variable (object, SWFDEC_AS_STR_prototype, val);
- if (SWFDEC_AS_VALUE_IS_COMPOSITE (val)) {
- proto = SWFDEC_AS_VALUE_GET_COMPOSITE (val);
+ if (SWFDEC_AS_VALUE_IS_OBJECT (val)) {
+ proto = SWFDEC_AS_VALUE_GET_OBJECT (val);
} else {
proto = NULL;
}
@@ -2303,14 +2303,11 @@ swfdec_action_implements (SwfdecAsContext *cx, guint action,
return;
for (i = 0; i < argc; i++) {
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[i]))
- continue;
- interface = SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[i]);
- swfdec_as_object_get_variable (interface, SWFDEC_AS_STR_prototype, val);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (val))
+ swfdec_as_value_get_variable (cx, &argv[i], SWFDEC_AS_STR_prototype, val);
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (val))
continue;
proto->interfaces =
- g_slist_prepend (proto->interfaces, SWFDEC_AS_VALUE_GET_COMPOSITE (val));
+ g_slist_prepend (proto->interfaces, SWFDEC_AS_VALUE_GET_OBJECT (val));
}
}
@@ -2323,8 +2320,8 @@ swfdec_action_extends (SwfdecAsContext *cx, guint action, const guint8 *data, gu
superclass = swfdec_as_stack_peek (cx, 1);
subclass = swfdec_as_stack_peek (cx, 2);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (superclass) ||
- !SWFDEC_IS_AS_FUNCTION (SWFDEC_AS_VALUE_GET_COMPOSITE (superclass)->relay)) {
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (superclass) ||
+ !SWFDEC_IS_AS_FUNCTION (SWFDEC_AS_VALUE_GET_OBJECT (superclass)->relay)) {
SWFDEC_ERROR ("superclass is not a function");
goto fail;
}
@@ -2332,14 +2329,14 @@ swfdec_action_extends (SwfdecAsContext *cx, guint action, const guint8 *data, gu
SWFDEC_ERROR ("subclass is not an object");
goto fail;
}
- super = SWFDEC_AS_VALUE_GET_COMPOSITE (superclass);
+ super = SWFDEC_AS_VALUE_GET_OBJECT (superclass);
prototype = swfdec_as_object_new_empty (cx);
swfdec_as_object_get_variable (super, SWFDEC_AS_STR_prototype, &proto);
swfdec_as_object_set_variable_and_flags (prototype, SWFDEC_AS_STR___proto__, &proto,
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
swfdec_as_object_set_variable_and_flags (prototype, SWFDEC_AS_STR___constructor__,
superclass, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_VERSION_6_UP);
- SWFDEC_AS_VALUE_SET_COMPOSITE (&proto, prototype);
+ SWFDEC_AS_VALUE_SET_OBJECT (&proto, prototype);
swfdec_as_object_set_variable (SWFDEC_AS_VALUE_GET_COMPOSITE (subclass),
SWFDEC_AS_STR_prototype, &proto);
fail:
@@ -2397,12 +2394,12 @@ swfdec_action_enumerate2 (SwfdecAsContext *cx, guint action, const guint8 *data,
SwfdecAsObject *obj;
val = swfdec_as_stack_peek (cx, 1);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (val)) {
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (val) ||
+ (obj = SWFDEC_AS_VALUE_GET_COMPOSITE (val)) == NULL) {
SWFDEC_WARNING ("Enumerate called without an object");
SWFDEC_AS_VALUE_SET_UNDEFINED (val);
return;
}
- obj = SWFDEC_AS_VALUE_GET_COMPOSITE (val);
SWFDEC_AS_VALUE_SET_UNDEFINED (val);
swfdec_action_do_enumerate (cx, obj);
}
commit e26bfeda6c94fddd652142e802c2845c0fd7f210
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 22:53:27 2008 +0100
COMPOSITE => OBJECT for array code
diff --git a/swfdec/swfdec_as_array.c b/swfdec/swfdec_as_array.c
index 2c297c8..a5865ba 100644
--- a/swfdec/swfdec_as_array.c
+++ b/swfdec/swfdec_as_array.c
@@ -532,7 +532,7 @@ swfdec_as_array_join (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc,
const char *var, *str, *sep;
SwfdecAsValue val;
- if (object == NULL || SWFDEC_IS_MOVIE (object))
+ if (object == NULL || object->movie)
return;
if (argc > 0) {
@@ -567,7 +567,7 @@ void
swfdec_as_array_toString (SwfdecAsContext *cx, SwfdecAsObject *object,
guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
{
- if (object == NULL || SWFDEC_IS_MOVIE (object))
+ if (object == NULL || object->movie)
return;
swfdec_as_array_join (cx, object, 0, NULL, ret);
@@ -578,7 +578,7 @@ void
swfdec_as_array_do_push (SwfdecAsContext *cx, SwfdecAsObject *object,
guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
{
- if (object == NULL || SWFDEC_IS_MOVIE (object))
+ if (object == NULL || object->movie)
return;
// if 0 args, just return the length
@@ -600,7 +600,7 @@ swfdec_as_array_do_pop (SwfdecAsContext *cx, SwfdecAsObject *object,
gint32 length;
const char *var;
- if (object == NULL || SWFDEC_IS_MOVIE (object))
+ if (object == NULL || object->movie)
return;
// we allow negative indexes here, but not 0
@@ -626,7 +626,7 @@ swfdec_as_array_do_unshift (SwfdecAsContext *cx, SwfdecAsObject *object,
{
gint32 length;
- if (object == NULL || SWFDEC_IS_MOVIE (object))
+ if (object == NULL || object->movie)
return;
if (argc) {
@@ -650,7 +650,7 @@ swfdec_as_array_do_shift (SwfdecAsContext *cx, SwfdecAsObject *object,
gint32 length;
const char *var;
- if (object == NULL || SWFDEC_IS_MOVIE (object))
+ if (object == NULL || object->movie)
return;
// don't allow negative length
@@ -700,14 +700,14 @@ swfdec_as_array_reverse (SwfdecAsContext *cx, SwfdecAsObject *object,
{
gint32 length;
- if (object == NULL || SWFDEC_IS_MOVIE (object))
+ if (object == NULL || object->movie)
return;
length = swfdec_as_array_get_length (object);
swfdec_as_object_foreach_rename (object, swfdec_as_array_foreach_reverse,
&length);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
}
SWFDEC_AS_NATIVE (252, 3, swfdec_as_array_concat)
@@ -719,7 +719,7 @@ swfdec_as_array_concat (SwfdecAsContext *cx, SwfdecAsObject *object,
SwfdecAsObject *array_new;
const char *var;
- if (object == NULL || SWFDEC_IS_MOVIE (object))
+ if (object == NULL || object->movie)
return;
array_new = swfdec_as_array_new (cx);
@@ -727,11 +727,11 @@ swfdec_as_array_concat (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_array_append_array (array_new, object);
for (j = 0; j < argc; j++) {
- if (SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[j]) &&
- SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[j])->array)
+ if (SWFDEC_AS_VALUE_IS_OBJECT (&argv[j]) &&
+ SWFDEC_AS_VALUE_GET_OBJECT (&argv[j])->array)
{
swfdec_as_array_append_array (array_new,
- SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[j]));
+ SWFDEC_AS_VALUE_GET_OBJECT (&argv[j]));
}
else
{
@@ -741,7 +741,7 @@ swfdec_as_array_concat (SwfdecAsContext *cx, SwfdecAsObject *object,
}
}
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, array_new);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, array_new);
}
SWFDEC_AS_NATIVE (252, 6, swfdec_as_array_slice)
@@ -752,7 +752,7 @@ swfdec_as_array_slice (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc,
gint32 length, start_index, num;
SwfdecAsObject *array_new;
- if (object == NULL || SWFDEC_IS_MOVIE (object))
+ if (object == NULL || object->movie)
return;
length = swfdec_as_array_get_length (object);
@@ -780,7 +780,7 @@ swfdec_as_array_slice (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc,
swfdec_as_array_append_array_range (array_new, object, start_index, num);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, array_new);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, array_new);
}
SWFDEC_AS_NATIVE (252, 8, swfdec_as_array_splice)
@@ -791,7 +791,7 @@ swfdec_as_array_splice (SwfdecAsContext *cx, SwfdecAsObject *object,
gint32 length, start_index, num_remove, num_add, at_end;
SwfdecAsObject *array_new;
- if (object == NULL || SWFDEC_IS_MOVIE (object) || argc == 0)
+ if (object == NULL || object->movie || argc == 0)
return;
length = swfdec_as_array_get_length (object);
@@ -817,7 +817,7 @@ swfdec_as_array_splice (SwfdecAsContext *cx, SwfdecAsObject *object,
array_new = swfdec_as_array_new (cx);
swfdec_as_array_append_array_range (array_new, object, start_index,
num_remove);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, array_new);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, array_new);
/* move old data to the right spot */
swfdec_as_array_move_range (object, start_index + num_remove,
@@ -1069,13 +1069,13 @@ swfdec_as_array_do_sort (SwfdecAsContext *cx, SwfdecAsObject *object,
length = swfdec_as_array_get_length (object);
if (length == 0) {
// special case for empty array, because g_try_new0 would return NULL
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
return;
}
if (!swfdec_as_context_try_use_mem (cx, sizeof (SortEntry) * length)) {
SWFDEC_WARNING ("Array not sorted, too big (%i elements)", length);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
return;
}
@@ -1084,7 +1084,7 @@ swfdec_as_array_do_sort (SwfdecAsContext *cx, SwfdecAsObject *object,
array = g_try_new0 (SortEntry, length);
if (!array) {
SWFDEC_WARNING ("Array not sorted, too big (%i elements)", length);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
goto done;
}
@@ -1142,8 +1142,6 @@ swfdec_as_array_do_sort (SwfdecAsContext *cx, SwfdecAsObject *object,
if (options[0] & SORT_OPTION_RETURNINDEXEDARRAY) {
target = swfdec_as_array_new (cx);
- if (!target)
- goto done;
} else {
target = object;
}
@@ -1165,7 +1163,7 @@ swfdec_as_array_do_sort (SwfdecAsContext *cx, SwfdecAsObject *object,
}
}
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, target);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, target);
done:
g_free (array);
@@ -1181,16 +1179,16 @@ swfdec_as_array_sort (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc,
SortOption options;
SwfdecAsFunction *custom_function;
- if (object == NULL || SWFDEC_IS_MOVIE (object))
+ if (object == NULL || object->movie)
return;
pos = 0;
if (argc > pos && !SWFDEC_AS_VALUE_IS_NUMBER (&argv[pos])) {
SwfdecAsFunction *fun;
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[pos]) ||
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (&argv[pos]) ||
!SWFDEC_IS_AS_FUNCTION (
- fun = (SwfdecAsFunction *) SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[pos])->relay))
+ fun = (SwfdecAsFunction *) SWFDEC_AS_VALUE_GET_OBJECT (&argv[pos])->relay))
return;
custom_function = fun;
pos++;
@@ -1218,23 +1216,23 @@ swfdec_as_array_sortOn (SwfdecAsContext *cx, SwfdecAsObject *object,
SwfdecAsObject *array;
SwfdecAsValue val;
- if (object == NULL || SWFDEC_IS_MOVIE (object))
+ if (object == NULL || object->movie)
return;
if (argc < 1)
return;
- if (SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[0])) {
+ if (SWFDEC_AS_VALUE_IS_OBJECT (&argv[0])) {
- array = SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0]);
+ array = SWFDEC_AS_VALUE_GET_OBJECT (&argv[0]);
if (!array->array) {
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
return;
}
num_fields = swfdec_as_array_get_length (array);
if (num_fields <= 0) {
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
return;
}
@@ -1246,6 +1244,9 @@ swfdec_as_array_sortOn (SwfdecAsContext *cx, SwfdecAsObject *object,
fields[i] = NULL;
} else {
+ if (SWFDEC_AS_VALUE_IS_MOVIE (&argv[0])) {
+ SWFDEC_FIXME ("how do we treat movies here?");
+ }
num_fields = 1;
fields = g_new (const char *, num_fields + 1);
fields[0] = swfdec_as_value_to_string (cx, &argv[0]);
@@ -1255,8 +1256,8 @@ swfdec_as_array_sortOn (SwfdecAsContext *cx, SwfdecAsObject *object,
options = g_new0 (SortOption, num_fields);
if (argc > 1) {
- if (SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[1])) {
- array = SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[1]);
+ if (SWFDEC_AS_VALUE_IS_OBJECT (&argv[1])) {
+ array = SWFDEC_AS_VALUE_GET_OBJECT (&argv[1]);
if (array->array &&
swfdec_as_array_get_length (array) == num_fields) {
@@ -1288,7 +1289,7 @@ void
swfdec_as_array_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
{
- if (!cx->frame->construct) {
+ if (!swfdec_as_context_is_constructing (cx)) {
object = swfdec_as_object_new (cx, NULL);
swfdec_as_object_set_constructor_by_name (object, SWFDEC_AS_STR_Array, NULL);
}
@@ -1304,5 +1305,5 @@ swfdec_as_array_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_array_set_length (object, 0);
}
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
}
commit a7ea4a13cf2a9725a829567f6fecbafa6fb28c6f
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 22:13:39 2008 +0100
COMPOSITE => OBJECT in SwfdecAsFrame
diff --git a/swfdec/swfdec_as_frame.c b/swfdec/swfdec_as_frame.c
index 0e07fb1..08de247 100644
--- a/swfdec/swfdec_as_frame.c
+++ b/swfdec/swfdec_as_frame.c
@@ -599,7 +599,7 @@ swfdec_as_frame_preload (SwfdecAsFrame *frame)
next = next->next;
}
if (next != NULL) {
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (next->function)));
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (next->function)));
} else {
SWFDEC_AS_VALUE_SET_NULL (&val);
}
@@ -607,7 +607,7 @@ swfdec_as_frame_preload (SwfdecAsFrame *frame)
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
if (frame->function != NULL) {
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (frame->function)));
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (frame->function)));
} else {
SWFDEC_AS_VALUE_SET_NULL (&val);
}
@@ -628,12 +628,12 @@ swfdec_as_frame_preload (SwfdecAsFrame *frame)
swfdec_as_object_set_variable (object, SWFDEC_AS_STR_this, &val);
}
if (!(script->flags & SWFDEC_SCRIPT_SUPPRESS_ARGS)) {
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, args);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, args);
swfdec_as_object_set_variable (object, SWFDEC_AS_STR_arguments, &val);
}
if (!(script->flags & SWFDEC_SCRIPT_SUPPRESS_SUPER)) {
if (frame->super) {
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (frame->super)));
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (frame->super)));
} else {
SWFDEC_AS_VALUE_SET_UNDEFINED (&val);
}
@@ -672,11 +672,11 @@ swfdec_as_frame_preload (SwfdecAsFrame *frame)
}
}
if (script->flags & SWFDEC_SCRIPT_PRELOAD_ARGS && current_reg < script->n_registers) {
- SWFDEC_AS_VALUE_SET_COMPOSITE (&frame->registers[current_reg++], args);
+ SWFDEC_AS_VALUE_SET_OBJECT (&frame->registers[current_reg++], args);
}
if (script->flags & SWFDEC_SCRIPT_PRELOAD_SUPER && current_reg < script->n_registers) {
if (frame->super) {
- SWFDEC_AS_VALUE_SET_COMPOSITE (&frame->registers[current_reg++],
+ SWFDEC_AS_VALUE_SET_OBJECT (&frame->registers[current_reg++],
swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (frame->super)));
} else {
SWFDEC_AS_VALUE_SET_UNDEFINED (&frame->registers[current_reg++]);
@@ -695,7 +695,7 @@ swfdec_as_frame_preload (SwfdecAsFrame *frame)
current_reg++;
}
if (script->flags & SWFDEC_SCRIPT_PRELOAD_GLOBAL && current_reg < script->n_registers) {
- SWFDEC_AS_VALUE_SET_COMPOSITE (&frame->registers[current_reg++], context->global);
+ SWFDEC_AS_VALUE_SET_OBJECT (&frame->registers[current_reg++], context->global);
}
/* set block boundaries */
frame->block_start = frame->script->buffer->data;
commit c6f7057ed55c6eb8f982347b78d07904a1e0b565
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 22:13:30 2008 +0100
COMPOSITE => OBJECT for Date
diff --git a/swfdec/swfdec_as_date.c b/swfdec/swfdec_as_date.c
index d583cf2..5fea1f0 100644
--- a/swfdec/swfdec_as_date.c
+++ b/swfdec/swfdec_as_date.c
@@ -1056,7 +1056,7 @@ swfdec_as_date_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
guint i;
SwfdecAsDate *date;
- if (!cx->frame->construct) {
+ if (!swfdec_as_context_is_constructing (cx)) {
object = swfdec_as_object_new_empty (cx);
swfdec_as_object_set_constructor_by_name (object, SWFDEC_AS_STR_Date, NULL);
}
@@ -1192,6 +1192,6 @@ swfdec_as_date_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
}
}
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
}
commit f675cc3530037a175aaf91a51a1f9a05399b4cb0
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 22:09:52 2008 +0100
COMPOSITE => OBJECT for Number
diff --git a/swfdec/swfdec_as_number.c b/swfdec/swfdec_as_number.c
index e6d64ff..240a46c 100644
--- a/swfdec/swfdec_as_number.c
+++ b/swfdec/swfdec_as_number.c
@@ -62,7 +62,7 @@ swfdec_as_number_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
SwfdecAsNumber *num = g_object_new (SWFDEC_TYPE_AS_NUMBER, "context", cx, NULL);
num->number = d;
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (num));
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
} else {
swfdec_as_value_set_number (cx, ret, d);
}
commit a27ca92b9bfffd34c6434f5ac321a312db08ea98
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 22:09:16 2008 +0100
COMPOSITE => OBJECT for Object
diff --git a/swfdec/swfdec_as_object.c b/swfdec/swfdec_as_object.c
index 6f51403..1de27e3 100644
--- a/swfdec/swfdec_as_object.c
+++ b/swfdec/swfdec_as_object.c
@@ -564,9 +564,8 @@ swfdec_as_object_do_set (SwfdecAsObject *object, const char *variable,
}
if (variable == SWFDEC_AS_STR___proto__) {
- if (SWFDEC_AS_VALUE_IS_COMPOSITE (val) &&
- !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (val))) {
- object->prototype = SWFDEC_AS_VALUE_GET_COMPOSITE (val);
+ if (SWFDEC_AS_VALUE_IS_OBJECT(val)) {
+ object->prototype = SWFDEC_AS_VALUE_GET_OBJECT (val);
object->prototype_flags = var->flags;
} else {
object->prototype = NULL;
@@ -982,9 +981,9 @@ swfdec_as_object_get_variable_and_flags (SwfdecAsObject *object,
var = swfdec_as_object_hash_lookup (resolve, SWFDEC_AS_STR___resolve);
g_assert (var != NULL);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&var->value))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (&var->value))
return FALSE;
- fun = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_COMPOSITE (&var->value)->relay);
+ fun = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_OBJECT (&var->value)->relay);
if (!SWFDEC_IS_AS_FUNCTION (fun))
return FALSE;
SWFDEC_AS_VALUE_SET_STRING (&argv, variable);
@@ -1195,7 +1194,7 @@ swfdec_as_object_add_function (SwfdecAsObject *object, const char *name, SwfdecA
function = swfdec_as_native_function_new (cx, name, native);
name = swfdec_as_context_get_string (cx, name);
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (function)));
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (function)));
/* FIXME: I'd like to make sure no such property exists yet */
swfdec_as_object_set_variable_and_flags (object, name, &val,
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
@@ -1261,9 +1260,9 @@ swfdec_as_object_call (SwfdecAsObject *object, const char *name, guint argc,
if (return_value)
SWFDEC_AS_VALUE_SET_UNDEFINED (return_value);
swfdec_as_object_get_variable (object, name, &tmp);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&tmp))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (&tmp))
return FALSE;
- fun = (SwfdecAsFunction *) SWFDEC_AS_VALUE_GET_COMPOSITE (&tmp)->relay;
+ fun = (SwfdecAsFunction *) SWFDEC_AS_VALUE_GET_OBJECT (&tmp)->relay;
if (!SWFDEC_IS_AS_FUNCTION (fun))
return FALSE;
swfdec_as_function_call (fun, object, argc, argv, return_value ? return_value : &tmp);
@@ -1300,7 +1299,7 @@ swfdec_as_object_create (SwfdecAsFunction *fun, guint n_args,
swfdec_as_object_set_variable_and_flags (new, SWFDEC_AS_STR___proto__,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
}
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, fun_object);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, fun_object);
if (context->version < 7) {
swfdec_as_object_set_variable_and_flags (new, SWFDEC_AS_STR_constructor,
&val, SWFDEC_AS_VARIABLE_HIDDEN);
@@ -1342,11 +1341,11 @@ swfdec_as_object_set_constructor_by_namev (SwfdecAsObject *object,
do {
val = swfdec_as_object_peek_variable (cur, name);
if (val == NULL ||
- !SWFDEC_AS_VALUE_IS_COMPOSITE (val)) {
+ !SWFDEC_AS_VALUE_IS_OBJECT (val)) {
SWFDEC_WARNING ("could not find constructor %s", name);
return NULL;
}
- cur = SWFDEC_AS_VALUE_GET_COMPOSITE (val);
+ cur = SWFDEC_AS_VALUE_GET_OBJECT (val);
name = va_arg (args, const char *);
} while (name != NULL);
swfdec_as_object_set_constructor (object, cur);
@@ -1373,7 +1372,7 @@ swfdec_as_object_set_constructor (SwfdecAsObject *object, SwfdecAsObject *constr
g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
g_return_if_fail (SWFDEC_IS_AS_OBJECT (construct));
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, construct);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, construct);
swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_constructor,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
if (swfdec_as_object_get_variable (SWFDEC_AS_OBJECT (construct),
@@ -1456,11 +1455,11 @@ swfdec_as_object_addProperty (SwfdecAsContext *cx, SwfdecAsObject *object,
if (argc < 3)
return;
name = swfdec_as_value_to_string (cx, &argv[0]);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[1]) ||
- !SWFDEC_IS_AS_FUNCTION ((get = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[1])->relay))))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (&argv[1]) ||
+ !SWFDEC_IS_AS_FUNCTION ((get = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_OBJECT (&argv[1])->relay))))
return;
- if (SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[2])) {
- set = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[2])->relay);
+ if (SWFDEC_AS_VALUE_IS_OBJECT (&argv[2])) {
+ set = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_OBJECT (&argv[2])->relay);
if (!SWFDEC_IS_AS_FUNCTION (set))
return;
} else if (SWFDEC_AS_VALUE_IS_NULL (&argv[2])) {
@@ -1574,10 +1573,10 @@ swfdec_as_object_watch (SwfdecAsContext *cx, SwfdecAsObject *object,
name = swfdec_as_value_to_string (cx, &argv[0]);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[1]))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (&argv[1]))
return;
- if (!SWFDEC_IS_AS_FUNCTION (SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[1])->relay))
+ if (!SWFDEC_IS_AS_FUNCTION (SWFDEC_AS_VALUE_GET_OBJECT (&argv[1])->relay))
return;
if (object->watches == NULL) {
@@ -1588,12 +1587,12 @@ swfdec_as_object_watch (SwfdecAsContext *cx, SwfdecAsObject *object,
watch = g_hash_table_lookup (object->watches, name);
}
if (watch == NULL) {
- watch = swfdec_as_watch_new (SWFDEC_AS_FUNCTION (SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[1])->relay));
+ watch = swfdec_as_watch_new (SWFDEC_AS_FUNCTION (SWFDEC_AS_VALUE_GET_OBJECT (&argv[1])->relay));
if (watch == NULL)
return;
g_hash_table_insert (object->watches, (char *) name, watch);
} else {
- watch->watch = SWFDEC_AS_FUNCTION (SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[1])->relay);
+ watch->watch = SWFDEC_AS_FUNCTION (SWFDEC_AS_VALUE_GET_OBJECT (&argv[1])->relay);
}
if (argc >= 3) {
@@ -1715,22 +1714,22 @@ swfdec_as_object_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
{
if (argc > 0) {
- SwfdecAsObject *result = swfdec_as_value_to_object (cx, &argv[0]);
- if (result != NULL) {
- if (!cx->frame->construct) {
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, result);
- } else {
- SWFDEC_FIXME ("new Object (x) should return x");
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
- }
+ if (SWFDEC_AS_VALUE_IS_MOVIE (&argv[0])) {
+ *ret = argv[0];
return;
+ } else {
+ SwfdecAsObject *result = swfdec_as_value_to_object (cx, &argv[0]);
+ if (result != NULL) {
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, result);
+ return;
+ }
}
}
- if (!cx->frame->construct)
+ if (!swfdec_as_context_is_constructing (cx))
object = swfdec_as_object_new_empty (cx);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
}
void
@@ -1749,13 +1748,13 @@ swfdec_as_object_init_context (SwfdecAsContext *context)
fun_proto = swfdec_as_object_new_empty (context);
/* initialize Function */
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, function);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, function);
swfdec_as_object_set_variable_and_flags (context->global, SWFDEC_AS_STR_Function, &val,
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT | SWFDEC_AS_VARIABLE_VERSION_6_UP);
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, function);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, function);
swfdec_as_object_set_variable_and_flags (function, SWFDEC_AS_STR_constructor,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, fun_proto);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, fun_proto);
swfdec_as_object_set_variable_and_flags (function, SWFDEC_AS_STR_prototype,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
swfdec_as_object_set_variable_and_flags (function, SWFDEC_AS_STR___proto__,
@@ -1763,33 +1762,33 @@ swfdec_as_object_init_context (SwfdecAsContext *context)
SWFDEC_AS_VARIABLE_VERSION_6_UP);
/* initialize Function.prototype */
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, function);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, function);
swfdec_as_object_set_variable_and_flags (fun_proto, SWFDEC_AS_STR_constructor,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, obj_proto);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, obj_proto);
swfdec_as_object_set_variable_and_flags (fun_proto,
SWFDEC_AS_STR___proto__, &val,
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
/* initialize Object */
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, object);
swfdec_as_object_set_variable_and_flags (context->global, SWFDEC_AS_STR_Object, &val,
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, function);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, function);
swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_constructor,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, fun_proto);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, fun_proto);
swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR___proto__,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT |
SWFDEC_AS_VARIABLE_VERSION_6_UP);
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, obj_proto);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, obj_proto);
swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_prototype,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT |
SWFDEC_AS_VARIABLE_CONSTANT);
/* initialize Object.prototype */
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, object);
swfdec_as_object_set_variable_and_flags (obj_proto, SWFDEC_AS_STR_constructor,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
}
commit f48e861238e44b45c6781e41fa58019da9ebe304
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 21:53:17 2008 +0100
make vivified compile again
It's more broken again!
diff --git a/vivified/core/vivi_wrap.c b/vivified/core/vivi_wrap.c
index 98ac100..141f2e5 100644
--- a/vivified/core/vivi_wrap.c
+++ b/vivified/core/vivi_wrap.c
@@ -96,6 +96,7 @@ vivi_wrap_value (ViviApplication *app, SwfdecAsValue *dest, const SwfdecAsValue
SWFDEC_AS_VALUE_SET_OBJECT (dest,
vivi_wrap_object (app, SWFDEC_AS_VALUE_GET_OBJECT (src)));
break;
+ case SWFDEC_AS_TYPE_MOVIE:
case SWFDEC_AS_TYPE_INT:
default:
g_assert_not_reached ();
commit cdd28032b769df4d12dfcbdde352791b316af1d7
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 21:49:20 2008 +0100
make swfdec_as_native_function_new() not take a prototype anymore
That argument was unused. Also do COMPOSITE => OBJECT
diff --git a/swfdec/swfdec_as_internal.h b/swfdec/swfdec_as_internal.h
index 8307531..de49a9d 100644
--- a/swfdec/swfdec_as_internal.h
+++ b/swfdec/swfdec_as_internal.h
@@ -85,8 +85,8 @@ SwfdecAsFunction *
swfdec_as_native_function_new_bare
(SwfdecAsContext * context,
const char * name,
- SwfdecAsNative native,
- SwfdecAsObject * prototype);
+ SwfdecAsNative native);
+
/* swfdec_as_array.h */
void swfdec_as_array_remove_range (SwfdecAsObject * object,
gint32 start_index,
diff --git a/swfdec/swfdec_as_native_function.c b/swfdec/swfdec_as_native_function.c
index ec3d2d4..51f46c0 100644
--- a/swfdec/swfdec_as_native_function.c
+++ b/swfdec/swfdec_as_native_function.c
@@ -146,8 +146,6 @@ swfdec_as_native_function_init (SwfdecAsNativeFunction *function)
* @context: a #SwfdecAsContext
* @name: name of the function
* @native: function to call when executed
- * @prototype: The object to be used as "prototype" property for the created
- * function or %NULL for none.
*
* Creates a new native function, that will execute @native when called. You
* might want to use swfdec_as_object_add_function() instead of this function.
@@ -156,16 +154,15 @@ swfdec_as_native_function_init (SwfdecAsNativeFunction *function)
**/
SwfdecAsFunction *
swfdec_as_native_function_new (SwfdecAsContext *context, const char *name,
- SwfdecAsNative native, SwfdecAsObject *prototype)
+ SwfdecAsNative native)
{
SwfdecAsFunction *fun;
SwfdecAsObject *object;
g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), NULL);
g_return_val_if_fail (native != NULL, NULL);
- g_return_val_if_fail (prototype == NULL || SWFDEC_IS_AS_OBJECT (prototype), NULL);
- fun = swfdec_as_native_function_new_bare (context, name, native, prototype);
+ fun = swfdec_as_native_function_new_bare (context, name, native);
object = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (fun));
swfdec_as_object_set_constructor_by_name (object, SWFDEC_AS_STR_Function, NULL);
@@ -176,14 +173,13 @@ swfdec_as_native_function_new (SwfdecAsContext *context, const char *name,
SwfdecAsFunction *
swfdec_as_native_function_new_bare (SwfdecAsContext *context, const char *name,
- SwfdecAsNative native, SwfdecAsObject *prototype)
+ SwfdecAsNative native)
{
SwfdecAsNativeFunction *fun;
SwfdecAsObject *object;
g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), NULL);
g_return_val_if_fail (native != NULL, NULL);
- g_return_val_if_fail (prototype == NULL || SWFDEC_IS_AS_OBJECT (prototype), NULL);
fun = g_object_new (SWFDEC_TYPE_AS_NATIVE_FUNCTION, "context", context, NULL);
fun->native = native;
@@ -192,15 +188,6 @@ swfdec_as_native_function_new_bare (SwfdecAsContext *context, const char *name,
object = swfdec_as_object_new_empty (context);
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (fun));
- /* need to set prototype before setting the constructor or Function.constructor
- * being CONSTANT disallows setting it. */
- if (prototype) {
- SwfdecAsValue val;
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, prototype);
- swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_prototype,
- &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
- }
-
return SWFDEC_AS_FUNCTION (fun);
}
diff --git a/swfdec/swfdec_as_native_function.h b/swfdec/swfdec_as_native_function.h
index a8f7d35..add13a8 100644
--- a/swfdec/swfdec_as_native_function.h
+++ b/swfdec/swfdec_as_native_function.h
@@ -52,8 +52,7 @@ GType swfdec_as_native_function_get_type (void);
SwfdecAsFunction *swfdec_as_native_function_new (SwfdecAsContext * context,
const char * name,
- SwfdecAsNative native,
- SwfdecAsObject * prototype);
+ SwfdecAsNative native);
gboolean swfdec_as_native_function_check (SwfdecAsContext * cx,
SwfdecAsObject * object,
diff --git a/swfdec/swfdec_as_object.c b/swfdec/swfdec_as_object.c
index 6858686..6f51403 100644
--- a/swfdec/swfdec_as_object.c
+++ b/swfdec/swfdec_as_object.c
@@ -1192,7 +1192,7 @@ swfdec_as_object_add_function (SwfdecAsObject *object, const char *name, SwfdecA
cx = swfdec_gc_object_get_context (object);
if (!native)
native = swfdec_as_object_do_nothing;
- function = swfdec_as_native_function_new (cx, name, native, NULL);
+ function = swfdec_as_native_function_new (cx, name, native);
name = swfdec_as_context_get_string (cx, name);
SWFDEC_AS_VALUE_SET_COMPOSITE (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (function)));
@@ -1430,11 +1430,11 @@ swfdec_as_object_add_native_variable (SwfdecAsObject *object,
g_return_if_fail (get != NULL);
get_func =
- swfdec_as_native_function_new (swfdec_gc_object_get_context (object), variable, get, NULL);
+ swfdec_as_native_function_new (swfdec_gc_object_get_context (object), variable, get);
if (set != NULL) {
set_func =
- swfdec_as_native_function_new (swfdec_gc_object_get_context (object), variable, set, NULL);
+ swfdec_as_native_function_new (swfdec_gc_object_get_context (object), variable, set);
} else {
set_func = NULL;
}
@@ -1741,10 +1741,10 @@ swfdec_as_object_init_context (SwfdecAsContext *context)
SwfdecAsValue val;
/* initialize core objects */
- fun = swfdec_as_native_function_new_bare (context, SWFDEC_AS_STR_Object, swfdec_as_object_construct, NULL);
+ fun = swfdec_as_native_function_new_bare (context, SWFDEC_AS_STR_Object, swfdec_as_object_construct);
object = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (fun));
obj_proto = swfdec_as_object_new_empty (context);
- fun = swfdec_as_native_function_new_bare (context, SWFDEC_AS_STR_Function, swfdec_as_object_do_nothing, NULL);
+ fun = swfdec_as_native_function_new_bare (context, SWFDEC_AS_STR_Function, swfdec_as_object_do_nothing);
function = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (fun));
fun_proto = swfdec_as_object_new_empty (context);
diff --git a/swfdec/swfdec_player_as.c b/swfdec/swfdec_player_as.c
index 4e13277..d8f01a1 100644
--- a/swfdec/swfdec_player_as.c
+++ b/swfdec/swfdec_player_as.c
@@ -171,7 +171,7 @@ swfdec_get_asnative (SwfdecAsContext *cx, guint x, guint y)
x_exists = TRUE;
if (native_funcs[i].x == x && native_funcs[i].y == y) {
SwfdecAsFunction *fun = swfdec_as_native_function_new (cx, native_funcs[i].name,
- native_funcs[i].func, NULL);
+ native_funcs[i].func);
return fun;
}
}
@@ -179,8 +179,7 @@ swfdec_get_asnative (SwfdecAsContext *cx, guint x, guint y)
if (x_exists) {
SwfdecAsFunction *func;
char *name = g_strdup_printf ("ASnative (%u, %u)", x, y);
- func = swfdec_as_native_function_new (cx, name, swfdec_player_do_nothing,
- NULL);
+ func = swfdec_as_native_function_new (cx, name, swfdec_player_do_nothing);
g_free (name);
return func;
} else {
@@ -352,21 +351,21 @@ swfdec_player_preinit_global (SwfdecAsContext *context)
SwfdecAsValue val;
f = swfdec_as_native_function_new_bare (context,
- SWFDEC_AS_STR_ASnative, swfdec_player_ASnative, NULL);
+ SWFDEC_AS_STR_ASnative, swfdec_player_ASnative);
o = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (f));
SWFDEC_AS_VALUE_SET_OBJECT (&val, o);
swfdec_as_object_set_variable_and_flags (context->global, SWFDEC_AS_STR_ASnative,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
f = swfdec_as_native_function_new_bare (context,
- SWFDEC_AS_STR_ASconstructor, swfdec_player_ASconstructor, NULL);
+ SWFDEC_AS_STR_ASconstructor, swfdec_player_ASconstructor);
o = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (f));
SWFDEC_AS_VALUE_SET_OBJECT (&val, o);
swfdec_as_object_set_variable_and_flags (context->global, SWFDEC_AS_STR_ASconstructor,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
f = swfdec_as_native_function_new_bare (context,
- SWFDEC_AS_STR_enableDebugConsole, swfdec_player_enableDebugConsole, NULL);
+ SWFDEC_AS_STR_enableDebugConsole, swfdec_player_enableDebugConsole);
o = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (f));
SWFDEC_AS_VALUE_SET_OBJECT (&val, o);
swfdec_as_object_set_variable_and_flags (context->global, SWFDEC_AS_STR_enableDebugConsole,
diff --git a/swfdec/swfdec_text_format.c b/swfdec/swfdec_text_format.c
index 05c21fe..39e05e7 100644
--- a/swfdec/swfdec_text_format.c
+++ b/swfdec/swfdec_text_format.c
@@ -1046,7 +1046,7 @@ swfdec_text_format_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (format));
function = swfdec_as_native_function_new_bare (cx,
- SWFDEC_AS_STR_getTextExtent, swfdec_text_format_getTextExtent, NULL);
+ SWFDEC_AS_STR_getTextExtent, swfdec_text_format_getTextExtent);
SWFDEC_AS_VALUE_SET_OBJECT (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (function)));
swfdec_as_object_set_variable (object, SWFDEC_AS_STR_getTextExtent, &val);
@@ -1090,7 +1090,7 @@ swfdec_text_format_new_no_properties (SwfdecAsContext *context)
// FIXME: Need better way to create function without prototype/constructor
function = swfdec_as_native_function_new_bare (context,
- SWFDEC_AS_STR_getTextExtent, swfdec_text_format_getTextExtent, NULL);
+ SWFDEC_AS_STR_getTextExtent, swfdec_text_format_getTextExtent);
SWFDEC_AS_VALUE_SET_OBJECT (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (function)));
swfdec_as_object_set_variable (object, SWFDEC_AS_STR_getTextExtent, &val);
commit a45b5d5b170441b9d5caf5042066a80b126492c5
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 21:36:20 2008 +0100
COMPOSITE => OBJECT for String
diff --git a/swfdec/swfdec_as_string.c b/swfdec/swfdec_as_string.c
index 572cd19..21af2f7 100644
--- a/swfdec/swfdec_as_string.c
+++ b/swfdec/swfdec_as_string.c
@@ -298,7 +298,7 @@ swfdec_as_string_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_length,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
} else {
SWFDEC_AS_VALUE_SET_STRING (ret, s);
}
@@ -340,7 +340,7 @@ swfdec_as_string_split_5 (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_STRING_CHECK (&str, "");
arr = swfdec_as_array_new (cx);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, SWFDEC_AS_OBJECT (arr));
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, SWFDEC_AS_OBJECT (arr));
/* hi, i'm the special case */
if (argc < 1 || SWFDEC_AS_VALUE_IS_UNDEFINED (&argv[0])) {
delim = SWFDEC_AS_STR_COMMA;
@@ -392,7 +392,7 @@ swfdec_as_string_split_6 (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_STRING_CHECK (&str, "");
arr = swfdec_as_array_new (cx);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, SWFDEC_AS_OBJECT (arr));
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, SWFDEC_AS_OBJECT (arr));
/* hi, i'm the special case */
if (argc < 1 || SWFDEC_AS_VALUE_IS_UNDEFINED (&argv[0])) {
SWFDEC_AS_VALUE_SET_STRING (&val, str);
commit c7f26a9589ab3dbffb85ad6d03fd5f085554c538
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 21:36:12 2008 +0100
COMPOSITE => OBJECT for BitmapData
diff --git a/swfdec/swfdec_bitmap_data.c b/swfdec/swfdec_bitmap_data.c
index 55d9605..fe30e0a 100644
--- a/swfdec/swfdec_bitmap_data.c
+++ b/swfdec/swfdec_bitmap_data.c
@@ -171,7 +171,7 @@ swfdec_bitmap_data_loadBitmap (SwfdecAsContext *cx, SwfdecAsObject *object,
cairo_paint (cr);
cairo_destroy (cr);
cairo_surface_destroy (isurface);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (bitmap)));
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (bitmap)));
}
// properties
@@ -231,17 +231,11 @@ swfdec_bitmap_data_get_rectangle (SwfdecAsContext *cx, SwfdecAsObject *object,
return;
swfdec_as_object_get_variable (cx->global, SWFDEC_AS_STR_flash, args);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (args))
+ swfdec_as_value_get_variable (cx, args, SWFDEC_AS_STR_geom, args);
+ swfdec_as_value_get_variable (cx, args, SWFDEC_AS_STR_Rectangle, args);
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (args))
return;
- o = SWFDEC_AS_VALUE_GET_COMPOSITE (args);
- swfdec_as_object_get_variable (o, SWFDEC_AS_STR_geom, args);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (args))
- return;
- o = SWFDEC_AS_VALUE_GET_COMPOSITE (args);
- swfdec_as_object_get_variable (o, SWFDEC_AS_STR_Rectangle, args);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (args))
- return;
- o = SWFDEC_AS_VALUE_GET_COMPOSITE (args);
+ o = SWFDEC_AS_VALUE_GET_OBJECT (args);
if (!SWFDEC_IS_AS_FUNCTION (o->relay))
return;
@@ -733,7 +727,7 @@ swfdec_bitmap_data_clone (SwfdecAsContext *cx, SwfdecAsObject *object,
cairo_set_source_surface (cr, bitmap->surface, 0, 0);
cairo_paint (cr);
cairo_destroy (cr);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (clone)));
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (clone)));
}
SWFDEC_AS_NATIVE (1100, 22, swfdec_bitmap_data_do_dispose)
@@ -802,7 +796,7 @@ swfdec_bitmap_data_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
cairo_destroy (cr);
}
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (bitmap));
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
}
/*** PUBLIC API ***/
commit 9c56dfb69e319086350dc4a497b98631cc45e2c9
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 21:35:58 2008 +0100
COMPOSITE => OBJECT
diff --git a/swfdec/swfdec_as_types.c b/swfdec/swfdec_as_types.c
index 6d19160..a4c644e 100644
--- a/swfdec/swfdec_as_types.c
+++ b/swfdec/swfdec_as_types.c
@@ -593,12 +593,12 @@ swfdec_as_value_to_object (SwfdecAsContext *context, const SwfdecAsValue *value)
}
swfdec_as_object_get_variable (context->global, s, &val);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val) ||
- !SWFDEC_IS_AS_FUNCTION (fun = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_COMPOSITE (&val)->relay)))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (&val) ||
+ !SWFDEC_IS_AS_FUNCTION (fun = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_OBJECT (&val)->relay)))
return NULL;
swfdec_as_object_create (fun, 1, value, &val);
- if (SWFDEC_AS_VALUE_IS_COMPOSITE (&val)) {
- return SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
+ if (SWFDEC_AS_VALUE_IS_OBJECT (&val)) {
+ return SWFDEC_AS_VALUE_GET_OBJECT (&val);
} else {
SWFDEC_ERROR ("did not construct an object");
return NULL;
commit f4619f30bb28880cce51d88aba0d119ef08e5ac6
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 21:35:48 2008 +0100
COMPOSITE => OBJECT for super
diff --git a/swfdec/swfdec_as_super.c b/swfdec/swfdec_as_super.c
index 498072f..f6b2f16 100644
--- a/swfdec/swfdec_as_super.c
+++ b/swfdec/swfdec_as_super.c
@@ -49,8 +49,8 @@ swfdec_as_super_call (SwfdecAsFunction *function, SwfdecAsObject *thisp,
}
swfdec_as_object_get_variable (super->object, SWFDEC_AS_STR___constructor__, &val);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val) ||
- !SWFDEC_IS_AS_FUNCTION (fun = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_COMPOSITE (&val)->relay)))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (&val) ||
+ !SWFDEC_IS_AS_FUNCTION (fun = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_OBJECT (&val)->relay)))
return;
if (construct) {
commit d0a0d34643bcb540c47ee3ad1b6e37be1f00924f
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 21:31:34 2008 +0100
COMPOSITE => OBJECT in swfdec_as_relay_call()
diff --git a/swfdec/swfdec_as_relay.c b/swfdec/swfdec_as_relay.c
index 414ad29..2123aa1 100644
--- a/swfdec/swfdec_as_relay.c
+++ b/swfdec/swfdec_as_relay.c
@@ -107,9 +107,9 @@ swfdec_as_relay_call (SwfdecAsRelay *relay, const char *name, guint argc,
if (return_value)
SWFDEC_AS_VALUE_SET_UNDEFINED (return_value);
swfdec_as_object_get_variable (relay->relay, name, &tmp);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&tmp))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (&tmp))
return FALSE;
- fun = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_COMPOSITE (&tmp)->relay);
+ fun = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_OBJECT (&tmp)->relay);
if (!SWFDEC_IS_AS_FUNCTION (fun))
return FALSE;
swfdec_as_function_call (fun, relay->relay, argc, argv, return_value ? return_value : &tmp);
commit 1b95bac1d9de4387446546672371ec19328abe5a
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 21:31:17 2008 +0100
COMPOSITE => OBJECT when creating new script functions
diff --git a/swfdec/swfdec_as_script_function.c b/swfdec/swfdec_as_script_function.c
index c3fb58b..32d74a3 100644
--- a/swfdec/swfdec_as_script_function.c
+++ b/swfdec/swfdec_as_script_function.c
@@ -166,16 +166,16 @@ swfdec_as_script_function_new (SwfdecAsObject *target, const GSList *scope_chain
/* set prototype */
proto = swfdec_as_object_new_empty (context);
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, proto);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, proto);
swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_prototype,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, object);
swfdec_as_object_set_variable_and_flags (proto, SWFDEC_AS_STR_constructor,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
tmp = swfdec_as_object_peek_variable (context->global, SWFDEC_AS_STR_Object);
- if (tmp && SWFDEC_AS_VALUE_IS_COMPOSITE (tmp)) {
- tmp = swfdec_as_object_peek_variable (SWFDEC_AS_VALUE_GET_COMPOSITE (tmp),
+ if (tmp && SWFDEC_AS_VALUE_IS_OBJECT (tmp)) {
+ tmp = swfdec_as_object_peek_variable (SWFDEC_AS_VALUE_GET_OBJECT (tmp),
SWFDEC_AS_STR_prototype);
if (tmp) {
swfdec_as_object_set_variable_and_flags (proto, SWFDEC_AS_STR___proto__,
commit 0bf32b966c44555c50ffbd38f9a74993fe294d96
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 21:18:47 2008 +0100
COMPOSITE => OBJECT for ColorTransform
diff --git a/swfdec/swfdec_color_transform_as.c b/swfdec/swfdec_color_transform_as.c
index d1e3b6c..612c787 100644
--- a/swfdec/swfdec_color_transform_as.c
+++ b/swfdec/swfdec_color_transform_as.c
@@ -339,12 +339,12 @@ swfdec_color_transform_as_construct (SwfdecAsContext *cx,
{
SwfdecColorTransformAs *transform;
- if (!cx->frame->construct)
+ if (!swfdec_as_context_is_constructing (cx))
return;
transform = g_object_new (SWFDEC_TYPE_COLOR_TRANSFORM_AS, "context", cx, NULL);
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (transform));
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
if (argc < 8)
return;
commit 565b146cd6099438db8cc3c722f4f41169a3eb76
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 21:18:26 2008 +0100
COMPOSITE => OBJECT for Color
diff --git a/swfdec/swfdec_color_as.c b/swfdec/swfdec_color_as.c
index 9439409..a897071 100644
--- a/swfdec/swfdec_color_as.c
+++ b/swfdec/swfdec_color_as.c
@@ -35,20 +35,15 @@ static SwfdecMovie *
swfdec_movie_color_get_movie (SwfdecAsObject *object)
{
SwfdecAsValue val;
- SwfdecAsObject *target;
if (object == NULL)
return NULL;
swfdec_as_object_get_variable (object, SWFDEC_AS_STR_target, &val);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
+ if (!SWFDEC_AS_VALUE_IS_MOVIE (&val))
return NULL;
- target = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
- if (!SWFDEC_IS_MOVIE (target))
- return NULL;
-
- return SWFDEC_MOVIE (target);
+ return SWFDEC_AS_VALUE_GET_MOVIE(&val);
}
SWFDEC_AS_NATIVE (700, 2, swfdec_movie_color_getRGB)
@@ -102,7 +97,7 @@ swfdec_movie_color_getTransform (SwfdecAsContext *cx, SwfdecAsObject *obj,
add_variable (ret, SWFDEC_AS_STR_gb, movie->color_transform.gb);
add_variable (ret, SWFDEC_AS_STR_bb, movie->color_transform.bb);
add_variable (ret, SWFDEC_AS_STR_ab, movie->color_transform.ab);
- SWFDEC_AS_VALUE_SET_COMPOSITE (rval, ret);
+ SWFDEC_AS_VALUE_SET_OBJECT (rval, ret);
}
SWFDEC_AS_NATIVE (700, 0, swfdec_movie_color_setRGB)
@@ -167,6 +162,8 @@ swfdec_movie_color_setTransform (SwfdecAsContext *cx, SwfdecAsObject *obj,
if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[0]))
return;
parse = SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0]);
+ if (parse == NULL)
+ return;
parse_property (parse, SWFDEC_AS_STR_ra, &movie->color_transform.ra, TRUE);
parse_property (parse, SWFDEC_AS_STR_ga, &movie->color_transform.ga, TRUE);
parse_property (parse, SWFDEC_AS_STR_ba, &movie->color_transform.ba, TRUE);
commit e896eccecd4a69f2e6186cae03313b87b625707c
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 21:18:10 2008 +0100
COMPOSITE fixes for FileReference
diff --git a/swfdec/swfdec_file_reference.c b/swfdec/swfdec_file_reference.c
index e69ec01..d00a315 100644
--- a/swfdec/swfdec_file_reference.c
+++ b/swfdec/swfdec_file_reference.c
@@ -117,9 +117,9 @@ swfdec_file_reference_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
target = SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0]);
} else {
target = object;
- if (target == NULL)
- return;
}
+ if (target == NULL)
+ return;
swfdec_as_object_add_native_variable (target, SWFDEC_AS_STR_creationDate,
swfdec_file_reference_get_creationDate, NULL);
commit e3e323fcba62ab75c3183b40534ce1bae8d96b71
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 21:17:54 2008 +0100
COMPOSITE => OBJECT for filters
diff --git a/swfdec/swfdec_blur_filter_as.c b/swfdec/swfdec_blur_filter_as.c
index a4e3f0f..162f7f4 100644
--- a/swfdec/swfdec_blur_filter_as.c
+++ b/swfdec/swfdec_blur_filter_as.c
@@ -125,5 +125,5 @@ swfdec_blur_filter_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
filter->quality = CLAMP (quality, 0, 15);
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (filter));
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
}
diff --git a/swfdec/swfdec_color_matrix_filter_as.c b/swfdec/swfdec_color_matrix_filter_as.c
index 2f606ce..726e123 100644
--- a/swfdec/swfdec_color_matrix_filter_as.c
+++ b/swfdec/swfdec_color_matrix_filter_as.c
@@ -49,7 +49,7 @@ swfdec_color_matrix_filter_get_matrix (SwfdecAsContext *cx,
}
array = swfdec_as_array_new (cx);
swfdec_as_array_append (array, 20, val);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, array);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, array);
}
static void
@@ -106,5 +106,5 @@ swfdec_color_matrix_filter_contruct (SwfdecAsContext *cx,
swfdec_color_matrix_filter_do_set_matrix (cm, array);
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (cm));
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
}
diff --git a/swfdec/swfdec_filter_as.c b/swfdec/swfdec_filter_as.c
index 691a12c..f02108d 100644
--- a/swfdec/swfdec_filter_as.c
+++ b/swfdec/swfdec_filter_as.c
@@ -37,6 +37,6 @@ swfdec_filter_do_clone (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_FILTER, &filter, "");
filter = swfdec_filter_clone (filter);
- SWFDEC_AS_VALUE_SET_COMPOSITE (retval, SWFDEC_AS_OBJECT (filter));
+ SWFDEC_AS_VALUE_SET_OBJECT (retval, SWFDEC_AS_OBJECT (filter));
}
commit a299a1dada86988f22959bd2455eab55b3b370e8
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 21:02:04 2008 +0100
add an assertion that setting an object may not set a movie
and fix the failures
diff --git a/swfdec/swfdec_as_types.h b/swfdec/swfdec_as_types.h
index 2a20816..d9b0bf8 100644
--- a/swfdec/swfdec_as_types.h
+++ b/swfdec/swfdec_as_types.h
@@ -120,6 +120,7 @@ struct _SwfdecAsDoubleValue {
SwfdecAsValue *__val = (val); \
SwfdecAsObject *__o = (o); \
g_assert (__o != NULL); \
+ g_assert (!__o->movie); \
(__val)->type = SWFDEC_AS_TYPE_OBJECT; \
(__val)->value.object = __o; \
} G_STMT_END
diff --git a/swfdec/swfdec_text_field_movie_as.c b/swfdec/swfdec_text_field_movie_as.c
index 238195d..9d556b9 100644
--- a/swfdec/swfdec_text_field_movie_as.c
+++ b/swfdec/swfdec_text_field_movie_as.c
@@ -1558,5 +1558,5 @@ swfdec_text_field_movie_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
// FIXME: do object.addListener (object);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
}
commit bba8cde7ff9f70dd73af9e35af2e6a3bc808bec9
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 21:00:42 2008 +0100
COMPOSITE => MOVIE for movie properties
diff --git a/swfdec/swfdec_movie_asprops.c b/swfdec/swfdec_movie_asprops.c
index 13ad0e6..2009e85 100644
--- a/swfdec/swfdec_movie_asprops.c
+++ b/swfdec/swfdec_movie_asprops.c
@@ -26,6 +26,7 @@
#include <math.h>
#include "swfdec_movie.h"
+#include "swfdec_as_internal.h"
#include "swfdec_as_strings.h"
#include "swfdec_bits.h"
#include "swfdec_debug.h"
@@ -332,7 +333,7 @@ static void
mc_parent (SwfdecMovie *movie, SwfdecAsValue *rval)
{
if (movie->parent) {
- SWFDEC_AS_VALUE_SET_COMPOSITE (rval, SWFDEC_AS_OBJECT (movie->parent));
+ SWFDEC_AS_VALUE_SET_MOVIE (rval, movie->parent);
} else {
SWFDEC_AS_VALUE_SET_UNDEFINED (rval);
}
@@ -342,7 +343,7 @@ static void
mc_root (SwfdecMovie *movie, SwfdecAsValue *rval)
{
movie = swfdec_movie_get_root (movie);
- SWFDEC_AS_VALUE_SET_COMPOSITE (rval, SWFDEC_AS_OBJECT (movie));
+ SWFDEC_AS_VALUE_SET_MOVIE (rval, movie);
}
static void
commit 4bef3fe308d01a3c50434f8631ea19824c623969
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 20:41:55 2008 +0100
COMPOSIte => MOVIE
diff --git a/swfdec/swfdec_movie.c b/swfdec/swfdec_movie.c
index 8c156d2..ed62220 100644
--- a/swfdec/swfdec_movie.c
+++ b/swfdec/swfdec_movie.c
@@ -1140,7 +1140,7 @@ swfdec_movie_get_variable (SwfdecAsObject *object, SwfdecAsObject *orig,
/* FIXME: check that this is correct */
if (swfdec_gc_object_get_context (object)->version > 5 && variable == SWFDEC_AS_STR__global) {
- SWFDEC_AS_VALUE_SET_COMPOSITE (val, swfdec_as_relay_get_as_object (
+ SWFDEC_AS_VALUE_SET_OBJECT (val, swfdec_as_relay_get_as_object (
SWFDEC_AS_RELAY (movie->resource->sandbox)));
*flags = 0;
return TRUE;
@@ -1148,7 +1148,7 @@ swfdec_movie_get_variable (SwfdecAsObject *object, SwfdecAsObject *orig,
ret = swfdec_movie_get_by_name (movie, variable, FALSE);
if (ret) {
- SWFDEC_AS_VALUE_SET_COMPOSITE (val, SWFDEC_AS_OBJECT (ret));
+ SWFDEC_AS_VALUE_SET_MOVIE (val, ret);
*flags = 0;
return TRUE;
}
@@ -1266,7 +1266,7 @@ swfdec_movie_foreach_variable (SwfdecAsObject *object, SwfdecAsVariableForeach f
SwfdecMovie *cur = walk->data;
if (cur->original_name == SWFDEC_AS_STR_EMPTY)
continue;
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, walk->data);
+ SWFDEC_AS_VALUE_SET_MOVIE (&val, walk->data);
ret &= func (object, cur->name, &val, 0, data);
}
commit 17f730f9eaad47e186457b00f9a1df19e808d0fc
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 20:41:33 2008 +0100
COMPOSITE => OBJECT for MovieClipLoader
diff --git a/swfdec/swfdec_movie_clip_loader.c b/swfdec/swfdec_movie_clip_loader.c
index 3277084..d8a15aa 100644
--- a/swfdec/swfdec_movie_clip_loader.c
+++ b/swfdec/swfdec_movie_clip_loader.c
@@ -59,13 +59,13 @@ swfdec_movie_clip_loader_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (loader));
array = swfdec_as_array_new (cx);
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, object);
swfdec_as_array_push (array, &val);
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, array);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, array);
swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR__listeners,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
}
SWFDEC_AS_NATIVE (112, 100, swfdec_movie_clip_loader_loadClip)
@@ -116,7 +116,7 @@ swfdec_movie_clip_loader_getProgress (SwfdecAsContext *cx, SwfdecAsObject *objec
if (movie == NULL)
return;
ret = swfdec_as_object_new_empty (cx);
- SWFDEC_AS_VALUE_SET_COMPOSITE (rval, ret);
+ SWFDEC_AS_VALUE_SET_OBJECT (rval, ret);
resource = swfdec_movie_get_own_resource (movie);
if (resource == NULL || resource->decoder == NULL) {
swfdec_as_value_set_integer (cx, &loaded, 0);
commit c1d154b7f0f953d65e838c5ecf5ed3448d09a260
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 20:41:11 2008 +0100
COMPOSITE => OBJECT for NetStream and NetConnection
diff --git a/swfdec/swfdec_net_connection.c b/swfdec/swfdec_net_connection.c
index 48f7a35..29f0a04 100644
--- a/swfdec/swfdec_net_connection.c
+++ b/swfdec/swfdec_net_connection.c
@@ -75,7 +75,7 @@ swfdec_net_connection_onstatus (SwfdecNetConnection *conn, const char *code,
SWFDEC_AS_VALUE_SET_STRING (&value, description);
swfdec_as_object_set_variable (info, SWFDEC_AS_STR_description, &value);
}
- SWFDEC_AS_VALUE_SET_COMPOSITE (&value, info);
+ SWFDEC_AS_VALUE_SET_OBJECT (&value, info);
swfdec_as_relay_call (SWFDEC_AS_RELAY(conn), SWFDEC_AS_STR_onStatus, 1, &value, NULL);
}
diff --git a/swfdec/swfdec_net_stream.c b/swfdec/swfdec_net_stream.c
index 50e0673..8f7e8d4 100644
--- a/swfdec/swfdec_net_stream.c
+++ b/swfdec/swfdec_net_stream.c
@@ -55,7 +55,7 @@ swfdec_net_stream_onstatus (SwfdecNetStream *stream, const char *code, const cha
SWFDEC_AS_VALUE_SET_STRING (&val, level);
swfdec_as_object_set_variable (object, SWFDEC_AS_STR_level, &val);
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, object);
if (!swfdec_as_relay_call (SWFDEC_AS_RELAY (stream),
SWFDEC_AS_STR_onStatus, 1, &val, NULL)) {
// if it's an error message and the stream object didn't have onStatus
@@ -65,9 +65,9 @@ swfdec_net_stream_onstatus (SwfdecNetStream *stream, const char *code, const cha
swfdec_as_object_get_variable (cx->global,
SWFDEC_AS_STR_System, &system);
- if (SWFDEC_AS_VALUE_IS_COMPOSITE (&system)) {
- swfdec_as_object_call (SWFDEC_AS_VALUE_GET_COMPOSITE (&system),
- SWFDEC_AS_STR_onStatus, 1, &val, NULL);
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (&system) &&
+ (object = SWFDEC_AS_VALUE_GET_COMPOSITE (&system)) != NULL) {
+ swfdec_as_object_call (object, SWFDEC_AS_STR_onStatus, 1, &val, NULL);
}
}
}
diff --git a/swfdec/swfdec_net_stream_as.c b/swfdec/swfdec_net_stream_as.c
index 9f121a2..3bcf974 100644
--- a/swfdec/swfdec_net_stream_as.c
+++ b/swfdec/swfdec_net_stream_as.c
@@ -295,13 +295,13 @@ swfdec_net_stream_construct (SwfdecAsContext *cx, SwfdecAsObject *obj, guint arg
swfdec_net_stream_setup (cx, obj, 0, NULL, rval);
if (argc == 0 ||
- !SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[0]) ||
- !SWFDEC_IS_NET_CONNECTION ((conn = (SwfdecNetConnection *) SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0])))) {
+ !SWFDEC_AS_VALUE_IS_OBJECT (&argv[0]) ||
+ !SWFDEC_IS_NET_CONNECTION ((conn = (SwfdecNetConnection *) SWFDEC_AS_VALUE_GET_OBJECT (&argv[0])))) {
SWFDEC_WARNING ("no connection passed to NetStream ()");
return;
}
stream->conn = conn;
- SWFDEC_AS_VALUE_SET_COMPOSITE (rval, obj);
+ SWFDEC_AS_VALUE_SET_OBJECT (rval, obj);
}
void
@@ -322,16 +322,16 @@ swfdec_net_stream_init_context (SwfdecPlayer *player)
swfdec_as_object_add_function (proto, SWFDEC_AS_STR_pause, swfdec_net_stream_pause);
swfdec_as_object_add_function (proto, SWFDEC_AS_STR_play, swfdec_net_stream_play);
swfdec_as_object_add_function (proto, SWFDEC_AS_STR_seek, swfdec_net_stream_do_seek);
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, stream);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, stream);
swfdec_as_object_set_variable_and_flags (proto, SWFDEC_AS_STR_constructor,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
swfdec_as_object_get_variable (context->global, SWFDEC_AS_STR_Object, &val);
- if (SWFDEC_AS_VALUE_IS_COMPOSITE (&val)) {
- swfdec_as_object_get_variable (SWFDEC_AS_VALUE_GET_COMPOSITE (&val),
+ if (SWFDEC_AS_VALUE_IS_OBJECT (&val)) {
+ swfdec_as_object_get_variable (SWFDEC_AS_VALUE_GET_OBJECT (&val),
SWFDEC_AS_STR_prototype, &val);
swfdec_as_object_set_variable_and_flags (proto, SWFDEC_AS_STR___proto__, &val,
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, proto);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, proto);
swfdec_as_object_set_variable_and_flags (stream, SWFDEC_AS_STR_prototype, &val,
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
}
commit 56fe20b77ec65fc840cbdfd91bb69d802ed77370
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 20:02:52 2008 +0100
COMPOSITE => OBJECT / MOVIE for the toplevel functions
diff --git a/swfdec/swfdec_interval.c b/swfdec/swfdec_interval.c
index 1d2403d..68fd8c9 100644
--- a/swfdec/swfdec_interval.c
+++ b/swfdec/swfdec_interval.c
@@ -41,11 +41,10 @@ swfdec_interval_mark (SwfdecGcObject *object)
guint i;
SwfdecInterval *interval = SWFDEC_INTERVAL (object);
- swfdec_gc_object_mark (interval->object);
swfdec_gc_object_mark (interval->sandbox);
if (interval->fun_name)
swfdec_as_string_mark (interval->fun_name);
- for (i = 0; i < interval->n_args; i++) {
+ for (i = 0; i < interval->n_args + 1; i++) {
swfdec_as_value_mark (&interval->args[i]);
}
@@ -58,10 +57,10 @@ swfdec_interval_dispose (GObject *object)
SwfdecInterval *interval = SWFDEC_INTERVAL (object);
SwfdecAsContext *cx = swfdec_gc_object_get_context (interval);
- if (interval->n_args) {
+ if (interval->args) {
swfdec_as_context_unuse_mem (cx,
- interval->n_args * sizeof (SwfdecAsValue));
- g_free (interval->args);
+ (interval->n_args + 1) * sizeof (SwfdecAsValue));
+ g_slice_free1 ((interval->n_args + 1) * sizeof (SwfdecAsValue), interval->args);
interval->args = NULL;
interval->n_args = 0;
}
@@ -108,26 +107,30 @@ swfdec_interval_trigger (SwfdecTimeout *timeout)
}
swfdec_sandbox_use (interval->sandbox);
if (interval->fun_name) {
- swfdec_as_object_call (interval->object,
- interval->fun_name, interval->n_args, interval->args, &ret);
+ SwfdecAsObject *object = swfdec_as_value_to_object (context, &interval->args[0]);
+ if (object) {
+ swfdec_as_object_call (object,
+ interval->fun_name, interval->n_args, interval->args, &ret);
+ }
} else {
/* we check that the relay's type is correct upon adding the interval */
- swfdec_as_function_call (SWFDEC_AS_FUNCTION (interval->object->relay),
- NULL, interval->n_args, interval->args, &ret);
+ swfdec_as_function_call (SWFDEC_AS_FUNCTION (
+ SWFDEC_AS_VALUE_GET_OBJECT (&interval->args[0])->relay),
+ NULL, interval->n_args, &interval->args[1], &ret);
}
swfdec_sandbox_unuse (interval->sandbox);
}
static guint
swfdec_interval_new (SwfdecPlayer *player, guint msecs, gboolean repeat,
- SwfdecAsObject *object, const char *fun_name,
+ const SwfdecAsValue *src, const char *fun_name,
guint n_args, const SwfdecAsValue *args)
{
SwfdecAsContext *context;
SwfdecInterval *interval;
context = SWFDEC_AS_CONTEXT (player);
- if (n_args && !swfdec_as_context_try_use_mem (context, n_args * sizeof (SwfdecAsValue))) {
+ if (!swfdec_as_context_try_use_mem (context, (n_args + 1) * sizeof (SwfdecAsValue))) {
swfdec_as_context_abort (context,
"Too many arguments passed to setInterval/setTimeout");
return 0;
@@ -138,10 +141,12 @@ swfdec_interval_new (SwfdecPlayer *player, guint msecs, gboolean repeat,
interval->sandbox = swfdec_sandbox_get (player);
interval->msecs = msecs;
interval->repeat = repeat;
- interval->object = object;
interval->fun_name = fun_name;
interval->n_args = n_args;
- interval->args = g_memdup (args, n_args * sizeof (SwfdecAsValue));
+ interval->args = g_slice_alloc ((n_args + 1) * sizeof (SwfdecAsValue));
+ interval->args[0] = *src;
+ if (n_args)
+ memcpy (&interval->args[1], args, n_args * sizeof (SwfdecAsValue));
interval->timeout.timestamp = player->priv->time + SWFDEC_MSECS_TO_TICKS (interval->msecs);
interval->timeout.callback = swfdec_interval_trigger;
swfdec_player_add_timeout (player, &interval->timeout);
@@ -156,23 +161,26 @@ guint
swfdec_interval_new_function (SwfdecPlayer *player, guint msecs, gboolean repeat,
SwfdecAsFunction *fun, guint n_args, const SwfdecAsValue *args)
{
+ SwfdecAsValue val;
+
g_return_val_if_fail (SWFDEC_IS_PLAYER (player), 0);
g_return_val_if_fail (msecs > 0, 0);
g_return_val_if_fail (SWFDEC_IS_AS_FUNCTION (fun), 0);
g_return_val_if_fail (n_args == 0 || args != NULL, 0);
- return swfdec_interval_new (player, msecs, repeat,
- swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (fun)), NULL, n_args, args);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val,
+ swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (fun)));
+ return swfdec_interval_new (player, msecs, repeat, &val, NULL, n_args, args);
}
guint
swfdec_interval_new_object (SwfdecPlayer *player, guint msecs, gboolean repeat,
- SwfdecAsObject *thisp, const char *fun_name,
+ const SwfdecAsValue *thisp, const char *fun_name,
guint n_args, const SwfdecAsValue *args)
{
g_return_val_if_fail (SWFDEC_IS_PLAYER (player), 0);
g_return_val_if_fail (msecs > 0, 0);
- g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (thisp), 0);
+ g_return_val_if_fail (thisp != NULL, 0);
g_return_val_if_fail (fun_name != NULL, 0);
g_return_val_if_fail (n_args == 0 || args != NULL, 0);
diff --git a/swfdec/swfdec_interval.h b/swfdec/swfdec_interval.h
index 30838cb..2199695 100644
--- a/swfdec/swfdec_interval.h
+++ b/swfdec/swfdec_interval.h
@@ -46,7 +46,6 @@ struct _SwfdecInterval {
guint msecs; /* interval in milliseconds */
gboolean repeat; /* TRUE for calling in intervals, FALSE for single-shot */
/* if calling named function */
- SwfdecAsObject * object; /* this object or function to call (depending on fun_name) */
const char * fun_name; /* name of function or NULL if object is function */
guint n_args; /* number of arguments to call function with */
@@ -68,7 +67,7 @@ guint swfdec_interval_new_function (SwfdecPlayer * player,
guint swfdec_interval_new_object (SwfdecPlayer * player,
guint msecs,
gboolean repeat,
- SwfdecAsObject * thisp,
+ const SwfdecAsValue * thisp,
const char * fun_name,
guint n_args,
const SwfdecAsValue * args);
diff --git a/swfdec/swfdec_player_as.c b/swfdec/swfdec_player_as.c
index 2e3ee0d..4e13277 100644
--- a/swfdec/swfdec_player_as.c
+++ b/swfdec/swfdec_player_as.c
@@ -51,11 +51,11 @@ swfdec_player_do_set_interval (gboolean repeat, SwfdecAsContext *cx, guint argc,
return;
}
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[0])) {
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[0]) ||
+ (object = SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0])) == NULL) {
SWFDEC_WARNING ("first argument to setInterval is not an object");
return;
}
- object = SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0]);
if (SWFDEC_IS_AS_FUNCTION (object->relay)) {
msecs = swfdec_as_value_to_integer (cx, &argv[1]);
if (msecs < MIN_INTERVAL_TIME) {
@@ -76,7 +76,7 @@ swfdec_player_do_set_interval (gboolean repeat, SwfdecAsContext *cx, guint argc,
SWFDEC_INFO ("interval duration is %u, making it %u msecs", msecs, MIN_INTERVAL_TIME);
msecs = MIN_INTERVAL_TIME;
}
- id = swfdec_interval_new_object (player, msecs, repeat, object, name, argc - 3, &argv[3]);
+ id = swfdec_interval_new_object (player, msecs, repeat, &argv[0], name, argc - 3, &argv[3]);
}
swfdec_as_value_set_integer (cx, rval, id);
}
@@ -205,16 +205,16 @@ swfdec_player_ASconstructor (SwfdecAsContext *cx, SwfdecAsObject *object,
proto = swfdec_as_object_new (cx, SWFDEC_AS_STR_Object, NULL);
func_object = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (func));
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, proto);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, proto);
swfdec_as_object_set_variable_and_flags (func_object,
SWFDEC_AS_STR_prototype, &val,
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, func_object);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, func_object);
swfdec_as_object_set_variable_and_flags (proto, SWFDEC_AS_STR_constructor,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
- SWFDEC_AS_VALUE_SET_COMPOSITE (rval, func_object);
+ SWFDEC_AS_VALUE_SET_OBJECT (rval, func_object);
}
}
@@ -229,7 +229,7 @@ swfdec_player_ASnative (SwfdecAsContext *cx, SwfdecAsObject *object,
func = swfdec_get_asnative (cx, x, y);
if (func) {
- SWFDEC_AS_VALUE_SET_COMPOSITE (rval, swfdec_as_relay_get_as_object SWFDEC_AS_RELAY (func));
+ SWFDEC_AS_VALUE_SET_OBJECT (rval, swfdec_as_relay_get_as_object SWFDEC_AS_RELAY (func));
}
}
@@ -272,7 +272,7 @@ ASSetNative (SwfdecAsContext *cx, SwfdecAsObject *object,
function = swfdec_get_asnative (cx, x, y);
if (function == NULL)
break;
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (function)));
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (function)));
swfdec_as_object_set_variable_and_flags (target,
swfdec_as_context_get_string (cx, s), &val, flags);
y++;
@@ -332,13 +332,13 @@ swfdec_player_object_registerClass (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (0, NULL, "s", &name);
- if (argc < 2 || !SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[1])) {
+ if (argc < 2 || !SWFDEC_AS_VALUE_IS_OBJECT (&argv[1])) {
SWFDEC_AS_VALUE_SET_BOOLEAN (rval, FALSE);
return;
}
swfdec_player_set_export_class (SWFDEC_PLAYER (cx), name,
- SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[1]));
+ SWFDEC_AS_VALUE_GET_OBJECT (&argv[1]));
SWFDEC_AS_VALUE_SET_BOOLEAN (rval, TRUE);
}
@@ -354,21 +354,21 @@ swfdec_player_preinit_global (SwfdecAsContext *context)
f = swfdec_as_native_function_new_bare (context,
SWFDEC_AS_STR_ASnative, swfdec_player_ASnative, NULL);
o = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (f));
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, o);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, o);
swfdec_as_object_set_variable_and_flags (context->global, SWFDEC_AS_STR_ASnative,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
f = swfdec_as_native_function_new_bare (context,
SWFDEC_AS_STR_ASconstructor, swfdec_player_ASconstructor, NULL);
o = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (f));
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, o);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, o);
swfdec_as_object_set_variable_and_flags (context->global, SWFDEC_AS_STR_ASconstructor,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
f = swfdec_as_native_function_new_bare (context,
SWFDEC_AS_STR_enableDebugConsole, swfdec_player_enableDebugConsole, NULL);
o = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (f));
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, o);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, o);
swfdec_as_object_set_variable_and_flags (context->global, SWFDEC_AS_STR_enableDebugConsole,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
}
commit 6e96797e08d4a15127c1727ba710345551803c7c
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 19:13:36 2008 +0100
COMPOSITE => OBJECT / MOVIE for MovieClip and SwfdecResource
diff --git a/swfdec/swfdec_resource.c b/swfdec/swfdec_resource.c
index 506c218..d5dee5a 100644
--- a/swfdec/swfdec_resource.c
+++ b/swfdec/swfdec_resource.c
@@ -135,7 +135,7 @@ swfdec_resource_emit_signal (SwfdecResource *resource, const char *name, gboolea
SWFDEC_INFO ("not emitting onLoadInit - the movie is different");
return;
}
- SWFDEC_AS_VALUE_SET_COMPOSITE (&vals[1], SWFDEC_AS_OBJECT (movie));
+ SWFDEC_AS_VALUE_SET_MOVIE (&vals[1], movie);
} else {
SWFDEC_AS_VALUE_SET_UNDEFINED (&vals[1]);
movie = NULL;
@@ -681,10 +681,10 @@ swfdec_resource_load_movie (SwfdecPlayer *player, const SwfdecAsValue *target,
g_return_val_if_fail (url != NULL, FALSE);
g_return_val_if_fail (loader == NULL || SWFDEC_IS_MOVIE_CLIP_LOADER (loader), FALSE);
- if (SWFDEC_AS_VALUE_IS_COMPOSITE (target)) {
- SwfdecAsObject *object = SWFDEC_AS_VALUE_GET_COMPOSITE (target);
- if (SWFDEC_IS_SPRITE_MOVIE (object)) {
- swfdec_resource_load_internal (player, SWFDEC_SPRITE_MOVIE (object),
+ if (SWFDEC_AS_VALUE_IS_MOVIE (target)) {
+ movie = SWFDEC_AS_VALUE_GET_MOVIE (target);
+ if (SWFDEC_IS_SPRITE_MOVIE (movie)) {
+ swfdec_resource_load_internal (player, SWFDEC_SPRITE_MOVIE (movie),
NULL, url, buffer, loader);
return TRUE;
}
@@ -699,8 +699,7 @@ swfdec_resource_load_movie (SwfdecPlayer *player, const SwfdecAsValue *target,
g_strdup_printf ("_level%d", i));
swfdec_resource_load_internal (player, NULL, s, url, buffer, loader);
return TRUE;
- } else if (SWFDEC_AS_VALUE_IS_STRING (target) ||
- (SWFDEC_AS_VALUE_IS_COMPOSITE (target) && SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (target)))) {
+ } else if (SWFDEC_AS_VALUE_IS_STRING (target) || SWFDEC_AS_VALUE_IS_MOVIE(target)) {
s = swfdec_as_value_to_string (SWFDEC_AS_CONTEXT (player), target);
} else {
SWFDEC_WARNING ("target does not reference a movie, not loading %s", url);
diff --git a/swfdec/swfdec_sprite_movie_as.c b/swfdec/swfdec_sprite_movie_as.c
index d1cc2f7..cff5246 100644
--- a/swfdec/swfdec_sprite_movie_as.c
+++ b/swfdec/swfdec_sprite_movie_as.c
@@ -163,10 +163,10 @@ swfdec_sprite_movie_set_filters (SwfdecAsContext *cx, SwfdecAsObject *object,
for (i = 0; i < length; i++) {
if (!swfdec_as_object_get_variable (array,
swfdec_as_integer_to_string (cx, i), &val) ||
- !SWFDEC_AS_VALUE_IS_COMPOSITE (&val) ||
- !SWFDEC_IS_FILTER (SWFDEC_AS_VALUE_GET_COMPOSITE (&val)->relay))
+ !SWFDEC_AS_VALUE_IS_OBJECT (&val) ||
+ !SWFDEC_IS_FILTER (SWFDEC_AS_VALUE_GET_OBJECT (&val)->relay))
continue;
- filter = SWFDEC_FILTER (SWFDEC_AS_VALUE_GET_COMPOSITE (&val)->relay);
+ filter = SWFDEC_FILTER (SWFDEC_AS_VALUE_GET_OBJECT (&val)->relay);
filter = swfdec_filter_clone (filter);
list = g_slist_prepend (list, filter);
}
@@ -185,7 +185,7 @@ swfdec_sprite_movie_get_transform (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, &movie, "");
trans = swfdec_transform_as_new (cx, movie);
- SWFDEC_AS_VALUE_SET_COMPOSITE (rval, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (trans)));
+ SWFDEC_AS_VALUE_SET_OBJECT (rval, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (trans)));
}
SWFDEC_AS_NATIVE (900, 420, swfdec_sprite_movie_set_transform)
@@ -252,7 +252,7 @@ swfdec_sprite_movie_set_blendMode (SwfdecAsContext *cx, SwfdecAsObject *object,
break;
}
}
- } else if (SWFDEC_AS_VALUE_IS_COMPOSITE (&val)) {
+ } else if (SWFDEC_AS_VALUE_IS_OBJECT (&val)) {
blend_mode = 0;
} else {
blend_mode = 1;
@@ -355,7 +355,7 @@ swfdec_sprite_movie_getInstanceAtDepth (SwfdecAsContext *cx,
if (movie != NULL) {
if (!swfdec_movie_is_scriptable (movie))
movie = movie->parent;
- SWFDEC_AS_VALUE_SET_COMPOSITE (rval, SWFDEC_AS_OBJECT (movie));
+ SWFDEC_AS_VALUE_SET_MOVIE (rval, movie);
}
}
@@ -584,12 +584,9 @@ swfdec_sprite_movie_hitTest (SwfdecAsContext *cx, SwfdecAsObject *object,
SwfdecMovie *other;
SwfdecRect movie_rect, other_rect;
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[0]) ||
- !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0]))) {
- SWFDEC_AS_VALUE_SET_BOOLEAN (rval, FALSE);
- return;
- }
- other = SWFDEC_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0]));
+ SWFDEC_AS_VALUE_SET_BOOLEAN (rval, FALSE);
+ SWFDEC_AS_CHECK (0, NULL, "m", &other);
+
swfdec_movie_update (movie);
swfdec_movie_update (other);
movie_rect = movie->extents;
@@ -601,11 +598,12 @@ swfdec_sprite_movie_hitTest (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_VALUE_SET_BOOLEAN (rval, swfdec_rect_intersect (NULL, &movie_rect, &other_rect));
} else if (argc >= 2) {
double x, y;
- gboolean shape, ret;
+ gboolean shape = FALSE;
+ gboolean ret;
- x = swfdec_as_value_to_number (cx, &argv[0]) * SWFDEC_TWIPS_SCALE_FACTOR;
- y = swfdec_as_value_to_number (cx, &argv[1]) * SWFDEC_TWIPS_SCALE_FACTOR;
- shape = (argc >= 3 && swfdec_as_value_to_boolean (cx, &argv[2]));
+ SWFDEC_AS_CHECK (0, NULL, "nn|b", &x, &y, &shape);
+ x *= SWFDEC_TWIPS_SCALE_FACTOR;
+ y *= SWFDEC_TWIPS_SCALE_FACTOR;
if (shape) {
if (movie->parent)
@@ -667,15 +665,14 @@ swfdec_sprite_movie_swapDepths (SwfdecAsContext *cx, SwfdecAsObject *object,
SwfdecAsValue value;
int depth;
- SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, (gpointer)&movie, "v", &value);
+ SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, &movie, "v", &value);
if (movie->parent == NULL)
SWFDEC_FIXME ("swapDepths on root movie, should do something weird");
- if (SWFDEC_AS_VALUE_IS_COMPOSITE (&value)) {
- other = (SwfdecMovie *) SWFDEC_AS_VALUE_GET_COMPOSITE (&value);
- if (!SWFDEC_IS_MOVIE (other) ||
- other->parent != movie->parent)
+ if (SWFDEC_AS_VALUE_IS_MOVIE (&value)) {
+ other = SWFDEC_AS_VALUE_GET_MOVIE (&value);
+ if (other == NULL || other->parent != movie->parent)
return;
depth = other->depth;
} else {
@@ -683,7 +680,7 @@ swfdec_sprite_movie_swapDepths (SwfdecAsContext *cx, SwfdecAsObject *object,
if (movie->parent) {
other = swfdec_movie_find (movie->parent, depth);
} else {
- // special case: if root movie: we won't swap just, but just set depth
+ // special case: if root movie: we won't swap, but just set depth
other = NULL;
}
}
@@ -726,7 +723,7 @@ swfdec_sprite_movie_createEmptyMovieClip (SwfdecAsContext *cx, SwfdecAsObject *o
swfdec_movie_initialize (movie);
}
- SWFDEC_AS_VALUE_SET_COMPOSITE (rval, SWFDEC_AS_OBJECT (movie));
+ SWFDEC_AS_VALUE_SET_MOVIE (rval, movie);
}
static void
@@ -801,18 +798,13 @@ swfdec_sprite_movie_attachMovie (SwfdecAsContext *cx, SwfdecAsObject *object,
{
SwfdecMovie *movie;
SwfdecMovie *ret;
- SwfdecAsObject *initObject, *constructor;
+ SwfdecAsObject *initObject = NULL, *constructor;
const char *name, *export;
int depth;
SwfdecGraphic *sprite;
- SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, &movie, "ssi", &export, &name, &depth);
+ SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, &movie, "ssi|O", &export, &name, &depth, &initObject);
- if (argc > 3 && SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[3])) {
- initObject = SWFDEC_AS_VALUE_GET_COMPOSITE ((&argv[3]));
- } else {
- initObject = NULL;
- }
sprite = swfdec_resource_get_export (movie->resource, export);
if (!SWFDEC_IS_SPRITE (sprite)) {
if (sprite == NULL) {
@@ -841,7 +833,7 @@ swfdec_sprite_movie_attachMovie (SwfdecAsContext *cx, SwfdecAsObject *object,
}
swfdec_sprite_movie_init_from_object (ret, initObject);
- SWFDEC_AS_VALUE_SET_COMPOSITE (rval, SWFDEC_AS_OBJECT (ret));
+ SWFDEC_AS_VALUE_SET_MOVIE (rval, ret);
}
SWFDEC_AS_NATIVE (900, 18, swfdec_sprite_movie_duplicateMovieClip)
@@ -863,7 +855,7 @@ swfdec_sprite_movie_duplicateMovieClip (SwfdecAsContext *cx, SwfdecAsObject *obj
return;
swfdec_sprite_movie_copy_props (new, movie);
SWFDEC_LOG ("duplicated %s as %s to depth %u", movie->name, new->name, new->depth);
- SWFDEC_AS_VALUE_SET_COMPOSITE (rval, SWFDEC_AS_OBJECT (new));
+ SWFDEC_AS_VALUE_SET_MOVIE (rval, new);
}
SWFDEC_AS_NATIVE (900, 19, swfdec_sprite_movie_removeMovieClip)
@@ -939,7 +931,7 @@ swfdec_sprite_movie_getBounds (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_value_set_number (cx, &val, SWFDEC_TWIPS_TO_DOUBLE (y1));
swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_yMax, &val);
- SWFDEC_AS_VALUE_SET_COMPOSITE (rval, obj);
+ SWFDEC_AS_VALUE_SET_OBJECT (rval, obj);
}
SWFDEC_AS_NATIVE (900, 11, swfdec_sprite_movie_setMask)
commit da1f375469cadf9aaf181041785f36b3abac2274
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 18:51:54 2008 +0100
COMPOSITE => OBJECT for amf code
diff --git a/swfdec/swfdec_amf.c b/swfdec/swfdec_amf.c
index e991310..ec42946 100644
--- a/swfdec/swfdec_amf.c
+++ b/swfdec/swfdec_amf.c
@@ -100,7 +100,7 @@ swfdec_amf_parse_object (SwfdecAsContext *context, SwfdecBits *bits, SwfdecAsVal
object = swfdec_as_object_new (context, SWFDEC_AS_STR_Object, NULL);
if (!swfdec_amf_parse_properties (context, bits, object))
return FALSE;
- SWFDEC_AS_VALUE_SET_COMPOSITE (val, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (val, object);
return TRUE;
}
@@ -114,7 +114,7 @@ swfdec_amf_parse_mixed_array (SwfdecAsContext *context, SwfdecBits *bits, Swfdec
array = swfdec_as_array_new (context);
if (!swfdec_amf_parse_properties (context, bits, array))
return FALSE;
- SWFDEC_AS_VALUE_SET_COMPOSITE (val, array);
+ SWFDEC_AS_VALUE_SET_OBJECT (val, array);
return TRUE;
}
@@ -141,7 +141,7 @@ swfdec_amf_parse_array (SwfdecAsContext *context, SwfdecBits *bits, SwfdecAsValu
swfdec_as_array_push (array, &tmp);
}
- SWFDEC_AS_VALUE_SET_COMPOSITE (val, array);
+ SWFDEC_AS_VALUE_SET_OBJECT (val, array);
return TRUE;
fail:
@@ -161,7 +161,7 @@ swfdec_amf_parse_date (SwfdecAsContext *context, SwfdecBits *bits, SwfdecAsValue
date->utc_offset = swfdec_bits_get_bu16 (bits);
if (date->utc_offset > 12 * 60)
date->utc_offset -= 12 * 60;
- SWFDEC_AS_VALUE_SET_COMPOSITE (val, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (val, object);
return TRUE;
}
commit 541bfec5406a0847ce25328a9e3aa4d13dffc977
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 18:51:42 2008 +0100
COMPOSITE => OBJECT for Boolean
diff --git a/swfdec/swfdec_as_boolean.c b/swfdec/swfdec_as_boolean.c
index 5435621..fda7519 100644
--- a/swfdec/swfdec_as_boolean.c
+++ b/swfdec/swfdec_as_boolean.c
@@ -54,7 +54,7 @@ swfdec_as_boolean_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
SwfdecAsBoolean *b = g_object_new (SWFDEC_TYPE_AS_BOOLEAN, "context", cx, NULL);
b->boolean = argc > 0 ? swfdec_as_value_to_boolean (cx, &argv[0]) : FALSE;
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (b));
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
} else {
gboolean b;
SWFDEC_AS_CHECK (0, NULL, "b", &b);
commit ce3275a01e3885e00890befb88f844d76e28d68f
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 18:51:27 2008 +0100
COMPOSITE => MOVIE for Actor
diff --git a/swfdec/swfdec_actor.c b/swfdec/swfdec_actor.c
index 73cc981..a35b7bf 100644
--- a/swfdec/swfdec_actor.c
+++ b/swfdec/swfdec_actor.c
@@ -22,6 +22,7 @@
#endif
#include "swfdec_actor.h"
+#include "swfdec_as_internal.h"
#include "swfdec_as_strings.h"
#include "swfdec_debug.h"
#include "swfdec_button_movie.h"
@@ -252,16 +253,17 @@ swfdec_actor_execute (SwfdecActor *actor, SwfdecEventType condition,
return;
} else if (condition == SWFDEC_EVENT_SCROLL || condition == SWFDEC_EVENT_CHANGED) {
SwfdecAsValue argv[2];
+ SwfdecMovie *movie = SWFDEC_MOVIE (actor);
if (condition == SWFDEC_EVENT_SCROLL)
SWFDEC_AS_VALUE_SET_STRING (&argv[0], SWFDEC_AS_STR_onScroller);
else
SWFDEC_AS_VALUE_SET_STRING (&argv[0], SWFDEC_AS_STR_onChanged);
- SWFDEC_AS_VALUE_SET_COMPOSITE (&argv[1], SWFDEC_AS_OBJECT (actor));
- swfdec_sandbox_use (SWFDEC_MOVIE (actor)->resource->sandbox);
+ SWFDEC_AS_VALUE_SET_MOVIE (&argv[1], movie);
+ swfdec_sandbox_use (movie->resource->sandbox);
swfdec_as_object_call (SWFDEC_AS_OBJECT (actor),
SWFDEC_AS_STR_broadcastMessage, 2, argv, NULL);
- swfdec_sandbox_unuse (SWFDEC_MOVIE (actor)->resource->sandbox);
+ swfdec_sandbox_unuse (movie->resource->sandbox);
return;
}
commit 67b15005cea8105c1e6648551e6dd653c23e2d77
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 18:46:23 2008 +0100
COMPOSITE => OBJECT
diff --git a/swfdec/swfdec_player.c b/swfdec/swfdec_player.c
index 98ae78d..7241673 100644
--- a/swfdec/swfdec_player.c
+++ b/swfdec/swfdec_player.c
@@ -28,6 +28,7 @@
#include "swfdec_player_internal.h"
#include "swfdec_as_frame_internal.h"
+#include "swfdec_as_internal.h"
#include "swfdec_as_strings.h"
#include "swfdec_audio_internal.h"
#include "swfdec_button_movie.h" /* for mouse cursor */
@@ -1139,6 +1140,8 @@ swfdec_player_broadcast (SwfdecPlayer *player, const char *object_name,
if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&vals[0]))
return;
obj = SWFDEC_AS_VALUE_GET_COMPOSITE (&vals[0]);
+ if (obj == NULL)
+ return;
SWFDEC_AS_VALUE_SET_STRING (&vals[0], signal_name);
swfdec_as_object_call (obj, SWFDEC_AS_STR_broadcastMessage, argc + 1, vals, NULL);
swfdec_sandbox_unuse (sandbox);
@@ -1191,12 +1194,12 @@ swfdec_player_grab_focus (SwfdecPlayer *player, SwfdecActor *actor)
}
prev = priv->focus;
if (prev) {
- SWFDEC_AS_VALUE_SET_COMPOSITE (&vals[0], SWFDEC_AS_OBJECT (prev));
+ SWFDEC_AS_VALUE_SET_MOVIE (&vals[0], SWFDEC_MOVIE (prev));
} else {
SWFDEC_AS_VALUE_SET_NULL (&vals[0]);
}
if (actor) {
- SWFDEC_AS_VALUE_SET_COMPOSITE (&vals[1], SWFDEC_AS_OBJECT (actor));
+ SWFDEC_AS_VALUE_SET_MOVIE (&vals[1], SWFDEC_MOVIE (actor));
} else {
SWFDEC_AS_VALUE_SET_NULL (&vals[1]);
}
commit 10cc2a1fca1a43a8d64bc62b53b46734f06c1816
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 18:46:13 2008 +0100
COMPOSITE => OBJECT for Sound
diff --git a/swfdec/swfdec_sound_object.c b/swfdec/swfdec_sound_object.c
index 78d1875..ac553da 100644
--- a/swfdec/swfdec_sound_object.c
+++ b/swfdec/swfdec_sound_object.c
@@ -167,7 +167,7 @@ swfdec_sound_object_getTransform (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_value_set_integer (cx, &val, matrix->rr);
swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_rr, &val);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, obj);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, obj);
}
SWFDEC_AS_NATIVE (500, 2, swfdec_sound_object_getVolume)
@@ -457,6 +457,6 @@ swfdec_sound_object_construct (SwfdecAsContext *cx, SwfdecAsObject *object, guin
sound->target = swfdec_as_value_to_string (cx, &argv[0]);
}
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
}
commit e733edb72dc38e0c387a3701fd66a14825bd1e29
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 18:46:01 2008 +0100
COMPOSITE => OBJECT for PrintJob
diff --git a/swfdec/swfdec_print_job.c b/swfdec/swfdec_print_job.c
index 530e71c..1428a6a 100644
--- a/swfdec/swfdec_print_job.c
+++ b/swfdec/swfdec_print_job.c
@@ -98,14 +98,14 @@ swfdec_print_job_init_properties (SwfdecAsContext *cx)
g_return_if_fail (SWFDEC_IS_AS_CONTEXT (cx));
swfdec_as_object_get_variable (cx->global, SWFDEC_AS_STR_PrintJob, &val);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
return;
- xml = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
+ xml = SWFDEC_AS_VALUE_GET_OBJECT (&val);
swfdec_as_object_get_variable (xml, SWFDEC_AS_STR_prototype, &val);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
return;
- proto = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
+ proto = SWFDEC_AS_VALUE_GET_OBJECT (&val);
swfdec_as_object_add_native_variable (proto, SWFDEC_AS_STR_orientation,
swfdec_print_job_get_orientation, NULL);
commit 726436bb71804c768d99520472eb261ce6994211
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 18:44:39 2008 +0100
COMPOSITE => OBJECT for Stylesheet
diff --git a/swfdec/swfdec_style_sheet.c b/swfdec/swfdec_style_sheet.c
index 71d948a..d1a1546 100644
--- a/swfdec/swfdec_style_sheet.c
+++ b/swfdec/swfdec_style_sheet.c
@@ -69,7 +69,7 @@ swfdec_style_sheet_get_selector_object (SwfdecAsObject *object,
g_return_val_if_fail (name != NULL, NULL);
empty = swfdec_as_object_new_empty (swfdec_gc_object_get_context (object));
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, empty);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, empty);
swfdec_as_object_unset_variable_flags (object, name,
SWFDEC_AS_VARIABLE_CONSTANT);
swfdec_as_object_set_variable (object, name, &val);
@@ -255,7 +255,7 @@ swfdec_style_sheet_parseCSSInternal (SwfdecAsContext *cx,
if (values == NULL) {
SWFDEC_AS_VALUE_SET_NULL (rval);
} else {
- SWFDEC_AS_VALUE_SET_COMPOSITE (rval, values);
+ SWFDEC_AS_VALUE_SET_OBJECT (rval, values);
}
}
@@ -320,13 +320,12 @@ swfdec_style_sheet_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
sheet = g_object_new (SWFDEC_TYPE_STYLE_SHEET, "context", cx, NULL);
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (sheet));
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
}
static SwfdecTextFormat *
swfdec_style_sheet_get_format (SwfdecStyleSheet *style, const char *name)
{
- SwfdecAsObject *styles;
SwfdecAsValue val;
g_return_val_if_fail (SWFDEC_IS_STYLE_SHEET (style), NULL);
@@ -334,17 +333,13 @@ swfdec_style_sheet_get_format (SwfdecStyleSheet *style, const char *name)
swfdec_as_object_get_variable (SWFDEC_AS_OBJECT (style),
SWFDEC_AS_STR__styles, &val);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
+ swfdec_as_value_get_variable (swfdec_gc_object_get_context (style), &val, name, &val);
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
return NULL;
- styles = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
-
- swfdec_as_object_get_variable (styles, name, &val);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
- return NULL;
- if (!SWFDEC_IS_TEXT_FORMAT (SWFDEC_AS_VALUE_GET_COMPOSITE (&val)))
+ if (!SWFDEC_IS_TEXT_FORMAT (SWFDEC_AS_VALUE_GET_OBJECT (&val)->relay))
return NULL;
- return SWFDEC_TEXT_FORMAT (SWFDEC_AS_VALUE_GET_COMPOSITE (&val));
+ return SWFDEC_TEXT_FORMAT (SWFDEC_AS_VALUE_GET_OBJECT (&val)->relay);
}
SwfdecTextFormat *
commit 2d35a55fa2c71730034bff6469f403dff378d239
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 18:43:58 2008 +0100
add swfdec_as_value_get_variable()
diff --git a/swfdec/swfdec_as_types.c b/swfdec/swfdec_as_types.c
index b10ea7c..6d19160 100644
--- a/swfdec/swfdec_as_types.c
+++ b/swfdec/swfdec_as_types.c
@@ -670,6 +670,37 @@ swfdec_as_value_to_primitive (SwfdecAsValue *value)
}
}
+/**
+ * swfdec_as_value_get_variable:
+ * @cx: the context
+ * @value: the value to get the variable from
+ * @name: name of the variable to get
+ * @ret: The return value to set. May be identical to the passed in @value.
+ *
+ * Gets a variable from the given @value. This function is a shortcut for
+ * converting to a #SwfdecAsObject and then calling
+ * swfdec_As_object_get_variable(). When the @value cannot be converted to an
+ * object, @ret is set to undefined.
+ **/
+void
+swfdec_as_value_get_variable (SwfdecAsContext *cx, const SwfdecAsValue *value,
+ const char *name, SwfdecAsValue *ret)
+{
+ SwfdecAsObject *object;
+
+ g_return_if_fail (SWFDEC_IS_AS_CONTEXT (cx));
+ g_return_if_fail (value != NULL);
+ g_return_if_fail (name != NULL);
+ g_return_if_fail (ret != NULL);
+
+ object = swfdec_as_value_to_object (cx, value);
+ if (object == NULL) {
+ SWFDEC_AS_VALUE_SET_UNDEFINED (ret);
+ return;
+ }
+ swfdec_as_object_get_variable (object, name, ret);
+}
+
/* from swfdec_internal.h */
gboolean
swfdec_as_value_to_twips (SwfdecAsContext *context, const SwfdecAsValue *val,
diff --git a/swfdec/swfdec_as_types.h b/swfdec/swfdec_as_types.h
index a01ef63..2a20816 100644
--- a/swfdec/swfdec_as_types.h
+++ b/swfdec/swfdec_as_types.h
@@ -153,6 +153,12 @@ const char * swfdec_as_str_concat (SwfdecAsContext * cx,
const char * s1,
const char * s2);
+/* variable get/set */
+void swfdec_as_value_get_variable (SwfdecAsContext * cx,
+ const SwfdecAsValue * val,
+ const char * name,
+ SwfdecAsValue * ret);
+
G_END_DECLS
#endif
commit 19e606c7904495b585ef291f810bd58f1d1b524a
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 17:46:57 2008 +0100
COMPOSITE => OBJECT for TextField
diff --git a/swfdec/swfdec_text_field_movie.c b/swfdec/swfdec_text_field_movie.c
index d27adbb..acd79ba 100644
--- a/swfdec/swfdec_text_field_movie.c
+++ b/swfdec/swfdec_text_field_movie.c
@@ -401,19 +401,14 @@ swfdec_text_field_movie_init_movie (SwfdecMovie *movie)
swfdec_as_object_set_constructor_by_name (SWFDEC_AS_OBJECT (movie),
SWFDEC_AS_STR_TextField, NULL);
- /* create _listeners array */
+ /* create _listeners array containing self */
array = swfdec_as_array_new (cx);
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, SWFDEC_AS_OBJECT (movie));
+ SWFDEC_AS_VALUE_SET_MOVIE (&val, movie);
swfdec_as_array_push (array, &val);
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, array);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, array);
swfdec_as_object_set_variable_and_flags (SWFDEC_AS_OBJECT (movie), SWFDEC_AS_STR__listeners,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
- /* add self to listeners */
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, SWFDEC_AS_OBJECT (movie));
- swfdec_as_object_call (SWFDEC_AS_OBJECT (movie), SWFDEC_AS_STR_addListener,
- 1, &val, NULL);
-
text->border_color = SWFDEC_COLOR_COMBINE (0, 0, 0, 0);
text->background_color = SWFDEC_COLOR_COMBINE (255, 255, 255, 0);
diff --git a/swfdec/swfdec_text_field_movie_as.c b/swfdec/swfdec_text_field_movie_as.c
index fd80788..238195d 100644
--- a/swfdec/swfdec_text_field_movie_as.c
+++ b/swfdec/swfdec_text_field_movie_as.c
@@ -875,7 +875,7 @@ swfdec_text_field_movie_get_styleSheet (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
if (text->style_sheet != NULL) {
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, SWFDEC_AS_OBJECT (text->style_sheet));
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, SWFDEC_AS_OBJECT (text->style_sheet));
} else {
SWFDEC_AS_VALUE_SET_UNDEFINED (ret);
}
@@ -903,10 +903,8 @@ swfdec_text_field_movie_set_styleSheet (SwfdecAsContext *cx,
swfdec_as_value_to_number (cx, &argv[0]);
- if (SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[0])) {
- value = SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0]);
- if (SWFDEC_IS_MOVIE (value))
- value = NULL;
+ if (SWFDEC_AS_VALUE_IS_OBJECT (&argv[0])) {
+ value = SWFDEC_AS_VALUE_GET_OBJECT (&argv[0]);
} else {
value = NULL;
}
@@ -1072,7 +1070,7 @@ swfdec_text_field_movie_getNewTextFormat (SwfdecAsContext *cx,
SWFDEC_TEXT_ATTRIBUTES_MASK);
format->values_set = SWFDEC_TEXT_ATTRIBUTES_MASK;
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (format)));
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (format)));
}
SWFDEC_AS_NATIVE (104, 105, swfdec_text_field_movie_setNewTextFormat)
@@ -1140,12 +1138,12 @@ swfdec_text_field_movie_setTextFormat (SwfdecAsContext *cx,
if (start == end)
return;
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[i]))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (&argv[i]))
return;
- if (!SWFDEC_IS_TEXT_FORMAT (SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[i])->relay))
+ if (!SWFDEC_IS_TEXT_FORMAT (SWFDEC_AS_VALUE_GET_OBJECT (&argv[i])->relay))
return;
- format = SWFDEC_TEXT_FORMAT (SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[i])->relay);
+ format = SWFDEC_TEXT_FORMAT (SWFDEC_AS_VALUE_GET_OBJECT (&argv[i])->relay);
start = g_utf8_offset_to_pointer (string, start) - string;
end = g_utf8_offset_to_pointer (string, end) - string;
@@ -1183,7 +1181,7 @@ swfdec_text_field_movie_getTextFormat (SwfdecAsContext *cx,
length = g_utf8_strlen (string, -1);
format = swfdec_text_format_new (cx);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (format)));
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (format)));
if (argc == 0) {
start = 0;
@@ -1296,7 +1294,7 @@ swfdec_text_field_movie_getFontList (SwfdecAsContext *cx,
g_free (families);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, SWFDEC_AS_OBJECT (array));
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, array);
}
SWFDEC_AS_NATIVE (104, 106, swfdec_text_field_movie_getDepth)
@@ -1393,9 +1391,9 @@ swfdec_text_field_movie_createTextField (SwfdecAsContext *cx,
swfdec_movie_update (movie);
swfdec_as_object_get_variable (cx->global, SWFDEC_AS_STR_TextField, &val);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
return;
- fun_object = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
+ fun_object = SWFDEC_AS_VALUE_GET_OBJECT (&val);
if (!SWFDEC_IS_AS_FUNCTION (fun_object->relay))
return;
fun = SWFDEC_AS_FUNCTION (fun_object->relay);
@@ -1407,7 +1405,7 @@ swfdec_text_field_movie_createTextField (SwfdecAsContext *cx,
SWFDEC_AS_STR___proto__, &val,
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
}
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, fun_object);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, fun_object);
if (cx->version < 7) {
swfdec_as_object_set_variable_and_flags (SWFDEC_AS_OBJECT (movie),
SWFDEC_AS_STR_constructor, &val, SWFDEC_AS_VARIABLE_HIDDEN);
@@ -1433,13 +1431,13 @@ swfdec_text_field_movie_init_properties (SwfdecAsContext *cx)
g_return_if_fail (SWFDEC_IS_AS_CONTEXT (cx));
swfdec_as_object_get_variable (cx->global, SWFDEC_AS_STR_TextField, &val);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
return;
- object = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
+ object = SWFDEC_AS_VALUE_GET_OBJECT (&val);
swfdec_as_object_get_variable (object, SWFDEC_AS_STR_prototype, &val);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
return;
- proto = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
+ proto = SWFDEC_AS_VALUE_GET_OBJECT (&val);
// text
swfdec_as_object_add_native_variable (proto, SWFDEC_AS_STR_text,
@@ -1560,5 +1558,5 @@ swfdec_text_field_movie_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
// FIXME: do object.addListener (object);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
}
commit 052b315f9d918f15976c7da749388be97e6f7d1c
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 17:46:42 2008 +0100
COMPOSITE => OBJECT for TextFormat
diff --git a/swfdec/swfdec_text_format.c b/swfdec/swfdec_text_format.c
index 6671842..05c21fe 100644
--- a/swfdec/swfdec_text_format.c
+++ b/swfdec/swfdec_text_format.c
@@ -693,7 +693,7 @@ swfdec_text_format_do_get_tab_stops (SwfdecAsContext *cx,
swfdec_as_value_set_integer (cx, &val, format->attr.tab_stops[i]);
swfdec_as_array_push (array, &val);
}
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, array);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, array);
}
static void
@@ -722,15 +722,15 @@ swfdec_text_format_do_set_tab_stops (SwfdecAsContext *cx,
format->attr.n_tab_stops = 0;
SWFDEC_TEXT_ATTRIBUTE_UNSET (format->values_set, SWFDEC_TEXT_ATTRIBUTE_TAB_STOPS);
}
- else if (SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[0]) &&
- SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0])->array)
+ else if (SWFDEC_AS_VALUE_IS_OBJECT (&argv[0]) &&
+ SWFDEC_AS_VALUE_GET_OBJECT (&argv[0])->array)
{
SwfdecAsObject *array;
SwfdecAsValue val;
guint i;
int len;
- array = SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0]);
+ array = SWFDEC_AS_VALUE_GET_OBJECT (&argv[0]);
len = swfdec_as_array_get_length (array);
if (!SWFDEC_TEXT_ATTRIBUTE_IS_SET (format->values_set, SWFDEC_TEXT_ATTRIBUTE_TAB_STOPS)) {
@@ -864,7 +864,7 @@ swfdec_text_format_getTextExtent (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_value_set_integer (cx, &val, j);
swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_descent, &val);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, obj);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, obj);
g_object_unref (layout);
g_object_unref (buffer);
}
@@ -950,13 +950,13 @@ swfdec_text_format_init_properties (SwfdecAsContext *cx)
g_return_if_fail (SWFDEC_IS_AS_CONTEXT (cx));
swfdec_as_object_get_variable (cx->global, SWFDEC_AS_STR_TextFormat, &val);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
return;
- proto = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
+ proto = SWFDEC_AS_VALUE_GET_OBJECT (&val);
swfdec_as_object_get_variable (proto, SWFDEC_AS_STR_prototype, &val);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
return;
- proto = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
+ proto = SWFDEC_AS_VALUE_GET_OBJECT (&val);
swfdec_as_object_add_native_variable (proto, SWFDEC_AS_STR_align,
swfdec_text_format_do_get_align, swfdec_text_format_do_set_align);
@@ -1047,7 +1047,7 @@ swfdec_text_format_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
function = swfdec_as_native_function_new_bare (cx,
SWFDEC_AS_STR_getTextExtent, swfdec_text_format_getTextExtent, NULL);
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (function)));
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (function)));
swfdec_as_object_set_variable (object, SWFDEC_AS_STR_getTextExtent, &val);
for (i = 0; i < argc && arguments[i] != NULL; i++) {
@@ -1091,7 +1091,7 @@ swfdec_text_format_new_no_properties (SwfdecAsContext *context)
// FIXME: Need better way to create function without prototype/constructor
function = swfdec_as_native_function_new_bare (context,
SWFDEC_AS_STR_getTextExtent, swfdec_text_format_getTextExtent, NULL);
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (function)));
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (function)));
swfdec_as_object_set_variable (object, SWFDEC_AS_STR_getTextExtent, &val);
return ret;
commit ea1ba93562095f8293b8231eaf017b6d06ce9902
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 17:35:01 2008 +0100
COMPOSITE => OBJECT / MOVIE for Transform object
diff --git a/swfdec/swfdec_transform_as.c b/swfdec/swfdec_transform_as.c
index 2fdba38..9724425 100644
--- a/swfdec/swfdec_transform_as.c
+++ b/swfdec/swfdec_transform_as.c
@@ -92,7 +92,7 @@ swfdec_transform_as_get_matrix (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_value_set_number (cx, &val, SWFDEC_TWIPS_TO_DOUBLE (matrix->y0));
swfdec_as_object_set_variable (o, SWFDEC_AS_STR_ty, &val);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, o);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, o);
}
SWFDEC_AS_NATIVE (1106, 102, swfdec_transform_as_set_matrix)
@@ -159,7 +159,7 @@ swfdec_transform_as_get_colorTransform (SwfdecAsContext *cx,
ctrans = swfdec_color_transform_as_new_from_transform (cx,
&transform->target->color_transform);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (ctrans)));
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (ctrans)));
}
SWFDEC_AS_NATIVE (1106, 106, swfdec_transform_as_set_colorTransform)
@@ -208,7 +208,7 @@ swfdec_transform_as_get_concatenatedColorTransform (SwfdecAsContext *cx,
}
ctrans = swfdec_color_transform_as_new_from_transform (cx, &chain);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (ctrans)));
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (ctrans)));
}
SWFDEC_AS_NATIVE (1106, 108, swfdec_transform_as_set_concatenatedColorTransform)
@@ -245,21 +245,17 @@ swfdec_transform_as_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
{
SwfdecTransformAs *trans;
+ SwfdecMovie *movie;
if (!swfdec_as_context_is_constructing (cx))
return;
- if (argc < 1 ||
- !SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[0]) ||
- !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0]))) {
- SWFDEC_FIXME ("new Transform without movieclip should give undefined");
- return;
- }
+ SWFDEC_AS_CHECK (0, NULL, "M", &movie);
trans = g_object_new (SWFDEC_TYPE_TRANSFORM_AS, "context", cx, NULL);
- trans->target = SWFDEC_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0]));
+ trans->target = SWFDEC_AS_VALUE_GET_MOVIE (&argv[0]);
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (trans));
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
}
SwfdecTransformAs *
diff --git a/swfdec/swfdec_transform_as.h b/swfdec/swfdec_transform_as.h
index 1b4b93e..55b3227 100644
--- a/swfdec/swfdec_transform_as.h
+++ b/swfdec/swfdec_transform_as.h
@@ -39,7 +39,7 @@ typedef struct _SwfdecTransformAsClass SwfdecTransformAsClass;
struct _SwfdecTransformAs {
SwfdecAsRelay relay;
- SwfdecMovie * target;
+ SwfdecMovie * target; /* MovieClip in use or NULL if dead */
};
struct _SwfdecTransformAsClass {
commit 18d552e92c4a78caf5ed25ac0432852640a3fb32
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 17:34:39 2008 +0100
add checks for movie objects to SWFDEC_AS_CHECK
diff --git a/swfdec/swfdec_as_internal.h b/swfdec/swfdec_as_internal.h
index 3a2d921..8307531 100644
--- a/swfdec/swfdec_as_internal.h
+++ b/swfdec/swfdec_as_internal.h
@@ -23,6 +23,7 @@
#include <swfdec/swfdec_as_gcable.h>
#include <swfdec/swfdec_as_object.h>
#include <swfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_movie.h>
G_BEGIN_DECLS
diff --git a/swfdec/swfdec_as_native_function.c b/swfdec/swfdec_as_native_function.c
index b57daf6..ec3d2d4 100644
--- a/swfdec/swfdec_as_native_function.c
+++ b/swfdec/swfdec_as_native_function.c
@@ -1,5 +1,5 @@
/* Swfdec
- * Copyright (C) 2007 Benjamin Otte <otte at gnome.org>
+ * Copyright (C) 2007-2008 Benjamin Otte <otte at gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -246,6 +246,12 @@ swfdec_as_native_function_new_bare (SwfdecAsContext *context, const char *name,
* </para></listitem>
* <listitem><para>"i": convert to integer. Requires an %integer pointer
* </para></listitem>
+ * <listitem><para>"m": convert to an existing movieclip. This is only valid
+ * inside Swfdec. Requires a %SwfdecMovie pointer.
+ * </para></listitem>
+ * <listitem><para>"M": convert to a movieclip or %NULL. This is only valid
+ * inside Swfdec. If the movie has already been destroyed,
+ * the pointer will be set to %NULL</para></listitem>
* <listitem><para>"n": convert to number. Requires a %double pointer
* </para></listitem>
* <listitem><para>"o": convert to object. Requires a #SwfdecAsObject pointer.
@@ -339,6 +345,21 @@ swfdec_as_native_function_checkv (SwfdecAsContext *cx, SwfdecAsObject *object,
*j = swfdec_as_value_to_integer (cx, &argv[i]);
}
break;
+ case 'm':
+ case 'M':
+ {
+ SwfdecMovie *m;
+ SwfdecMovie **arg = va_arg (varargs, SwfdecMovie **);
+ if (SWFDEC_AS_VALUE_IS_MOVIE (&argv[i])) {
+ m = SWFDEC_AS_VALUE_GET_MOVIE (&argv[i]);
+ } else {
+ m = NULL;
+ }
+ if (m == NULL && *args != 'M')
+ return FALSE;
+ *arg = m;
+ }
+ break;
case 'n':
{
double *d = va_arg (varargs, double *);
commit 9a4c1a45f16afe62d4111cf4cb10ee70dfc753c6
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 17:24:52 2008 +0100
COMPOSITE => OBJECT
diff --git a/swfdec/swfdec_xml.c b/swfdec/swfdec_xml.c
index 3924905..f5503a6 100644
--- a/swfdec/swfdec_xml.c
+++ b/swfdec/swfdec_xml.c
@@ -478,20 +478,20 @@ swfdec_xml_add_id_map (SwfdecXml *xml, SwfdecXmlNode *node, const char *id)
if (context->version >= 8) {
if (swfdec_as_object_get_variable (object,
SWFDEC_AS_STR_idMap, &val)) {
- if (SWFDEC_AS_VALUE_IS_COMPOSITE (&val)) {
- object = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
+ if (SWFDEC_AS_VALUE_IS_OBJECT (&val)) {
+ object = SWFDEC_AS_VALUE_GET_OBJECT (&val);
} else {
return;
}
} else {
object = swfdec_as_object_new_empty (context);
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, object);
swfdec_as_object_set_variable (swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (xml)),
SWFDEC_AS_STR_idMap, &val);
}
}
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (node)));
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (node)));
swfdec_as_object_set_variable (object, id, &val);
}
@@ -815,7 +815,7 @@ swfdec_xml_createElement (SwfdecAsContext *cx, SwfdecAsObject *object,
node = swfdec_xml_node_new (cx, SWFDEC_XML_NODE_ELEMENT, s);
- SWFDEC_AS_VALUE_SET_COMPOSITE (rval, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (node)));
+ SWFDEC_AS_VALUE_SET_OBJECT (rval, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (node)));
}
SWFDEC_AS_NATIVE (253, 11, swfdec_xml_createTextNode)
@@ -835,7 +835,7 @@ swfdec_xml_createTextNode (SwfdecAsContext *cx, SwfdecAsObject *object,
node = swfdec_xml_node_new (cx, SWFDEC_XML_NODE_TEXT, s);
- SWFDEC_AS_VALUE_SET_COMPOSITE (rval, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (node)));
+ SWFDEC_AS_VALUE_SET_OBJECT (rval, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (node)));
}
static void
@@ -851,14 +851,14 @@ swfdec_xml_init_properties (SwfdecAsContext *cx)
g_return_if_fail (SWFDEC_IS_AS_CONTEXT (cx));
swfdec_as_object_get_variable (cx->global, SWFDEC_AS_STR_XML, &val);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
return;
- xml = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
+ xml = SWFDEC_AS_VALUE_GET_OBJECT (&val);
swfdec_as_object_get_variable (xml, SWFDEC_AS_STR_prototype, &val);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
return;
- proto = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
+ proto = SWFDEC_AS_VALUE_GET_OBJECT (&val);
swfdec_as_object_add_native_variable (proto, SWFDEC_AS_STR_ignoreWhite,
swfdec_xml_get_ignoreWhite, swfdec_xml_set_ignoreWhite);
diff --git a/swfdec/swfdec_xml_node.c b/swfdec/swfdec_xml_node.c
index fc02666..23ecee6 100644
--- a/swfdec/swfdec_xml_node.c
+++ b/swfdec/swfdec_xml_node.c
@@ -95,11 +95,11 @@ swfdec_xml_node_get_child (SwfdecXmlNode *node, gint32 index_)
swfdec_as_array_get_value (node->children, index_, &val);
- g_return_val_if_fail (SWFDEC_AS_VALUE_IS_COMPOSITE (&val), NULL);
+ g_return_val_if_fail (SWFDEC_AS_VALUE_IS_OBJECT (&val), NULL);
g_return_val_if_fail (SWFDEC_IS_VALID_XML_NODE (
- SWFDEC_AS_VALUE_GET_COMPOSITE (&val)->relay), NULL);
+ SWFDEC_AS_VALUE_GET_OBJECT (&val)->relay), NULL);
- return SWFDEC_XML_NODE (SWFDEC_AS_VALUE_GET_COMPOSITE (&val)->relay);
+ return SWFDEC_XML_NODE (SWFDEC_AS_VALUE_GET_OBJECT (&val)->relay);
}
static gint32
@@ -137,7 +137,7 @@ swfdec_xml_node_update_child_nodes (SwfdecXmlNode *node)
num = swfdec_xml_node_num_children (node);
vals = g_malloc (sizeof (SwfdecAsValue) * num);
for (i = 0; i < num; i++) {
- SWFDEC_AS_VALUE_SET_COMPOSITE (&vals[i], swfdec_as_relay_get_as_object (
+ SWFDEC_AS_VALUE_SET_OBJECT (&vals[i], swfdec_as_relay_get_as_object (
SWFDEC_AS_RELAY (swfdec_xml_node_get_child (node, i))));
}
swfdec_as_array_append_with_flags (node->child_nodes, num, vals,
@@ -446,7 +446,7 @@ swfdec_xml_node_get_attributes (SwfdecAsContext *cx, SwfdecAsObject *object,
if (!SWFDEC_IS_VALID_XML_NODE (node))
return;
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, node->attributes);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, node->attributes);
}
static void
@@ -461,7 +461,7 @@ swfdec_xml_node_get_parentNode (SwfdecAsContext *cx, SwfdecAsObject *object,
return;
if (node->parent != NULL) {
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret,
+ SWFDEC_AS_VALUE_SET_OBJECT (ret,
swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (node->parent)));
} else {
SWFDEC_AS_VALUE_SET_NULL (ret);
@@ -499,7 +499,7 @@ swfdec_xml_node_get_previousSibling (SwfdecAsContext *cx,
sibling = swfdec_xml_node_previousSibling (node);
if (sibling != NULL) {
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (sibling)));
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (sibling)));
} else {
SWFDEC_AS_VALUE_SET_NULL (ret);
}
@@ -533,7 +533,7 @@ swfdec_xml_node_get_nextSibling (SwfdecAsContext *cx, SwfdecAsObject *object,
sibling = swfdec_xml_node_nextSibling (node);
if (sibling != NULL) {
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (sibling)));
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (sibling)));
} else {
SWFDEC_AS_VALUE_SET_NULL (ret);
}
@@ -553,7 +553,7 @@ swfdec_xml_node_get_firstChild (SwfdecAsContext *cx, SwfdecAsObject *object,
child = swfdec_xml_node_get_child (node, 0);
if (child != NULL) {
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (child)));
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (child)));
} else {
SWFDEC_AS_VALUE_SET_NULL (ret);
}
@@ -581,7 +581,7 @@ swfdec_xml_node_get_lastChild (SwfdecAsContext *cx, SwfdecAsObject *object,
child = swfdec_xml_node_get_child (node, num - 1);
g_assert (child != NULL);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (child)));
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (child)));
}
static void
@@ -595,7 +595,7 @@ swfdec_xml_node_get_childNodes (SwfdecAsContext *cx, SwfdecAsObject *object,
if (!SWFDEC_IS_VALID_XML_NODE (node))
return;
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, node->child_nodes);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, node->child_nodes);
}
SWFDEC_AS_NATIVE (253, 7, swfdec_xml_node_do_getNamespaceForPrefix)
@@ -696,7 +696,7 @@ swfdec_xml_node_clone (SwfdecAsContext *cx, SwfdecXmlNode *node, gboolean deep)
child = swfdec_xml_node_get_child (node, i);
child_new = swfdec_xml_node_clone (cx, child, TRUE);
child_new->parent = new;
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (child_new)));
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (child_new)));
swfdec_as_array_push (new->children, &val);
}
@@ -721,7 +721,7 @@ swfdec_xml_node_cloneNode (SwfdecAsContext *cx, SwfdecAsObject *object,
new = swfdec_xml_node_clone (cx, node, deep);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (new)));
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (new)));
}
void
@@ -793,7 +793,7 @@ swfdec_xml_node_insertAt (SwfdecXmlNode *node, SwfdecXmlNode *child, gint32 ind)
swfdec_xml_node_removeNode (child);
// insert child to node's child_nodes array
- SWFDEC_AS_VALUE_SET_COMPOSITE (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (child)));
+ SWFDEC_AS_VALUE_SET_OBJECT (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (child)));
swfdec_as_array_insert (node->children, ind, &val);
swfdec_xml_node_update_child_nodes (node);
@@ -1026,14 +1026,14 @@ swfdec_xml_node_init_properties (SwfdecAsContext *cx)
g_return_if_fail (SWFDEC_IS_AS_CONTEXT (cx));
swfdec_as_object_get_variable (cx->global, SWFDEC_AS_STR_XMLNode, &val);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
return;
- node = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
+ node = SWFDEC_AS_VALUE_GET_OBJECT (&val);
swfdec_as_object_get_variable (node, SWFDEC_AS_STR_prototype, &val);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
return;
- proto = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
+ proto = SWFDEC_AS_VALUE_GET_OBJECT (&val);
swfdec_as_object_add_native_variable (proto, SWFDEC_AS_STR_nodeType,
swfdec_xml_node_get_nodeType, NULL);
@@ -1119,5 +1119,5 @@ swfdec_xml_node_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (node));
swfdec_xml_node_init_values (node, type, value);
- SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
+ SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
}
commit 20e978af4d787b0a568dd0188b3ceb86ee9d5aa2
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 14:26:57 2008 +0100
beautify equality operator
diff --git a/swfdec/swfdec_as_interpret.c b/swfdec/swfdec_as_interpret.c
index a402ebc..26f85bd 100644
--- a/swfdec/swfdec_as_interpret.c
+++ b/swfdec/swfdec_as_interpret.c
@@ -1457,53 +1457,30 @@ swfdec_action_equals2_6 (SwfdecAsContext *cx, guint action, const guint8 *data,
rval = swfdec_as_stack_peek (cx, 1);
lval = swfdec_as_stack_peek (cx, 2);
- ltype = SWFDEC_AS_VALUE_GET_TYPE (lval);
- rtype = SWFDEC_AS_VALUE_GET_TYPE (rval);
-
- /* get objects compared */
- if (ltype >= SWFDEC_AS_TYPE_OBJECT && rtype >= SWFDEC_AS_TYPE_OBJECT) {
- SwfdecAsObject *lo = SWFDEC_AS_VALUE_GET_COMPOSITE (lval);
- SwfdecAsObject *ro = SWFDEC_AS_VALUE_GET_COMPOSITE (rval);
-
- if (SWFDEC_IS_MOVIE (lo) && SWFDEC_IS_MOVIE (ro)) {
- lo = SWFDEC_AS_OBJECT (swfdec_movie_resolve (SWFDEC_MOVIE (lo)));
- ro = SWFDEC_AS_OBJECT (swfdec_movie_resolve (SWFDEC_MOVIE (ro)));
- } else if (SWFDEC_IS_MOVIE (lo)) {
- swfdec_as_value_to_primitive (rval);
- rtype = SWFDEC_AS_VALUE_GET_TYPE (rval);
- if (rtype != SWFDEC_AS_TYPE_MOVIE) {
- cond = FALSE;
- goto out;
- }
- ro = SWFDEC_AS_VALUE_GET_COMPOSITE (rval);
- } else if (SWFDEC_IS_MOVIE (ro)) {
- swfdec_as_value_to_primitive (lval);
- ltype = SWFDEC_AS_VALUE_GET_TYPE (lval);
- if (ltype != SWFDEC_AS_TYPE_MOVIE) {
- cond = FALSE;
- goto out;
- }
- lo = SWFDEC_AS_VALUE_GET_COMPOSITE (lval);
- }
- cond = lo == ro;
+ /* check objects before anything else */
+ if (SWFDEC_AS_VALUE_IS_OBJECT (lval) && SWFDEC_AS_VALUE_IS_OBJECT (rval)) {
+ cond = SWFDEC_AS_VALUE_GET_OBJECT (lval) == SWFDEC_AS_VALUE_GET_OBJECT (rval);
goto out;
}
-
- /* if one of the values is an object, call valueOf.
- * If it's still an object, return FALSE */
swfdec_as_value_to_primitive (lval);
- ltype = SWFDEC_AS_VALUE_GET_TYPE (lval);
- if (ltype == SWFDEC_AS_TYPE_OBJECT) {
- cond = FALSE;
+ swfdec_as_value_to_primitive (rval);
+
+ /* check if we have equal movieclips */
+ if (SWFDEC_AS_VALUE_IS_MOVIE (lval)) {
+ cond = SWFDEC_AS_VALUE_IS_MOVIE (rval) &&
+ SWFDEC_AS_VALUE_GET_MOVIE (lval) == SWFDEC_AS_VALUE_GET_MOVIE (rval);
goto out;
}
- swfdec_as_value_to_primitive (rval);
- rtype = SWFDEC_AS_VALUE_GET_TYPE (rval);
- if (rtype == SWFDEC_AS_TYPE_OBJECT) {
+
+ /* now all composites compare false */
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (lval) ||
+ SWFDEC_AS_VALUE_IS_COMPOSITE (rval)) {
cond = FALSE;
goto out;
}
- /* now we have a comparison without objects */
+
+ ltype = SWFDEC_AS_VALUE_GET_TYPE (lval);
+ rtype = SWFDEC_AS_VALUE_GET_TYPE (rval);
/* get rid of undefined and null */
cond = rtype == SWFDEC_AS_TYPE_UNDEFINED || rtype == SWFDEC_AS_TYPE_NULL;
@@ -1516,7 +1493,6 @@ swfdec_action_equals2_6 (SwfdecAsContext *cx, guint action, const guint8 *data,
/* compare strings */
if (ltype == SWFDEC_AS_TYPE_STRING && rtype == SWFDEC_AS_TYPE_STRING) {
- /* FIXME: flash 5 case insensitive? */
cond = SWFDEC_AS_VALUE_GET_STRING (lval) == SWFDEC_AS_VALUE_GET_STRING (rval);
goto out;
}
commit be474a82bb581785130b32b43bb9d5c28c61212a
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 14:05:40 2008 +0100
beautify equals2 comparison for Flash 5
diff --git a/swfdec/swfdec_as_interpret.c b/swfdec/swfdec_as_interpret.c
index 55d46ca..a402ebc 100644
--- a/swfdec/swfdec_as_interpret.c
+++ b/swfdec/swfdec_as_interpret.c
@@ -1384,52 +1384,42 @@ swfdec_action_equals2_5 (SwfdecAsContext *cx, guint action, const guint8 *data,
ltype = SWFDEC_AS_VALUE_GET_TYPE (<mp);
rtype = SWFDEC_AS_VALUE_GET_TYPE (&rtmp);
- /* get objects compared */
- if (ltype >= SWFDEC_AS_TYPE_OBJECT && rtype >= SWFDEC_AS_TYPE_OBJECT) {
- SwfdecAsObject *lo = SWFDEC_AS_VALUE_GET_COMPOSITE (<mp);
- SwfdecAsObject *ro = SWFDEC_AS_VALUE_GET_COMPOSITE (&rtmp);
-
- if (SWFDEC_IS_MOVIE (lo) && SWFDEC_IS_MOVIE (ro)) {
- lo = SWFDEC_AS_OBJECT (swfdec_movie_resolve (SWFDEC_MOVIE (lo)));
- ro = SWFDEC_AS_OBJECT (swfdec_movie_resolve (SWFDEC_MOVIE (ro)));
- } else if (SWFDEC_IS_MOVIE (lo)) {
- swfdec_as_value_to_primitive (rval);
- rtype = SWFDEC_AS_VALUE_GET_TYPE (rval);
- if (rtype != SWFDEC_AS_TYPE_MOVIE) {
- cond = FALSE;
- goto out;
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (<mp) && SWFDEC_AS_VALUE_IS_COMPOSITE (&rtmp)) {
+ /* get movies compared */
+ if (ltype == SWFDEC_AS_TYPE_MOVIE) {
+ if (rtype == SWFDEC_AS_TYPE_MOVIE) {
+ rval = &rtmp;
+ } else {
+ swfdec_as_value_to_primitive (rval);
}
- ro = SWFDEC_AS_VALUE_GET_COMPOSITE (rval);
- } else if (SWFDEC_IS_MOVIE (ro)) {
+ cond = SWFDEC_AS_VALUE_IS_MOVIE (rval) &&
+ SWFDEC_AS_VALUE_GET_MOVIE (<mp) == SWFDEC_AS_VALUE_GET_MOVIE (rval);
+ goto out;
+ }
+ if (rtype == SWFDEC_AS_TYPE_MOVIE) {
swfdec_as_value_to_primitive (lval);
- ltype = SWFDEC_AS_VALUE_GET_TYPE (lval);
- if (ltype != SWFDEC_AS_TYPE_MOVIE) {
- cond = FALSE;
- goto out;
- }
- lo = SWFDEC_AS_VALUE_GET_COMPOSITE (lval);
- } else {
- lo = SWFDEC_AS_VALUE_GET_COMPOSITE (lval);
- ro = SWFDEC_AS_VALUE_GET_COMPOSITE (rval);
+ cond = SWFDEC_AS_VALUE_IS_MOVIE (lval) &&
+ SWFDEC_AS_VALUE_GET_MOVIE (&rtmp) == SWFDEC_AS_VALUE_GET_MOVIE (lval);
+ goto out;
}
- cond = lo == ro;
+
+ cond = SWFDEC_AS_VALUE_GET_OBJECT (lval) == SWFDEC_AS_VALUE_GET_OBJECT (rval);
goto out;
}
/* compare strings */
if (ltype == SWFDEC_AS_TYPE_STRING && rtype == SWFDEC_AS_TYPE_STRING) {
- /* FIXME: flash 5 case insensitive? */
cond = SWFDEC_AS_VALUE_GET_STRING (<mp) == SWFDEC_AS_VALUE_GET_STRING (&rtmp);
goto out;
}
/* convert to numbers */
- if (SWFDEC_AS_VALUE_IS_COMPOSITE (<mp) && !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (<mp))) {
+ if (SWFDEC_AS_VALUE_IS_OBJECT (<mp)) {
l = swfdec_as_value_to_number (cx, lval);
} else {
l = swfdec_as_value_to_number (cx, <mp);
}
- if (SWFDEC_AS_VALUE_IS_COMPOSITE (&rtmp) && !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (&rtmp))) {
+ if (SWFDEC_AS_VALUE_IS_OBJECT (&rtmp)) {
r = swfdec_as_value_to_number (cx, rval);
} else {
r = swfdec_as_value_to_number (cx, &rtmp);
commit ec87a7d2e6b7681d09f7cda0f5276d153ecb862c
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 14:05:17 2008 +0100
whoops, checked wrong type here
diff --git a/swfdec/swfdec_as_internal.h b/swfdec/swfdec_as_internal.h
index 73ef069..3a2d921 100644
--- a/swfdec/swfdec_as_internal.h
+++ b/swfdec/swfdec_as_internal.h
@@ -35,7 +35,7 @@ G_BEGIN_DECLS
#define SWFDEC_AS_OBJECT_PROTOTYPE_RECURSION_LIMIT 256
/* swfdec_as_types.h */
-#define SWFDEC_AS_VALUE_IS_MOVIE(val) (SWFDEC_AS_VALUE_GET_TYPE (val) == SWFDEC_AS_TYPE_OBJECT)
+#define SWFDEC_AS_VALUE_IS_MOVIE(val) (SWFDEC_AS_VALUE_GET_TYPE (val) == SWFDEC_AS_TYPE_MOVIE)
#define SWFDEC_AS_VALUE_GET_MOVIE(val) (swfdec_movie_resolve (SWFDEC_MOVIE ((val)->value.object)))
#define SWFDEC_AS_VALUE_SET_MOVIE(val,m) G_STMT_START { \
SwfdecAsValue *__val = (val); \
commit 87feced1049f6a5962e9b6798b775cf921055677
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 13:35:53 2008 +0100
beautify comparison code
diff --git a/swfdec/swfdec_as_interpret.c b/swfdec/swfdec_as_interpret.c
index 2737fd0..55d46ca 100644
--- a/swfdec/swfdec_as_interpret.c
+++ b/swfdec/swfdec_as_interpret.c
@@ -993,23 +993,21 @@ swfdec_action_new_comparison (SwfdecAsContext *cx, guint action, const guint8 *d
}
/* comparison with object is always false */
swfdec_as_value_to_primitive (lval);
- if (SWFDEC_AS_VALUE_IS_COMPOSITE (lval) &&
- !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (lval))) {
+ if (SWFDEC_AS_VALUE_IS_OBJECT (lval)) {
swfdec_as_stack_pop (cx);
SWFDEC_AS_VALUE_SET_BOOLEAN (swfdec_as_stack_peek (cx, 1), FALSE);
return;
}
/* same for the rval */
swfdec_as_value_to_primitive (rval);
- if (SWFDEC_AS_VALUE_IS_COMPOSITE (rval) &&
- !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (rval))) {
+ if (SWFDEC_AS_VALUE_IS_OBJECT (rval)) {
swfdec_as_stack_pop (cx);
SWFDEC_AS_VALUE_SET_BOOLEAN (swfdec_as_stack_peek (cx, 1), FALSE);
return;
}
/* movieclips are not objects, but they evaluate to NaN, so we can handle them here */
- if (SWFDEC_AS_VALUE_IS_COMPOSITE (rval) ||
- SWFDEC_AS_VALUE_IS_COMPOSITE (lval)) {
+ if (SWFDEC_AS_VALUE_IS_MOVIE (rval) ||
+ SWFDEC_AS_VALUE_IS_MOVIE (lval)) {
swfdec_as_stack_pop (cx);
SWFDEC_AS_VALUE_SET_UNDEFINED (swfdec_as_stack_peek (cx, 1));
return;
commit 1e10138efb16043f050b361c54f2a5860923e052
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 13:32:32 2008 +0100
beautify add2 code
diff --git a/swfdec/swfdec_as_interpret.c b/swfdec/swfdec_as_interpret.c
index 76dc0f0..2737fd0 100644
--- a/swfdec/swfdec_as_interpret.c
+++ b/swfdec/swfdec_as_interpret.c
@@ -932,17 +932,15 @@ swfdec_action_add2_to_primitive (SwfdecAsValue *value)
SwfdecAsObject *object;
const char *name;
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (value))
- return;
- object = SWFDEC_AS_VALUE_GET_COMPOSITE (value);
- if (SWFDEC_IS_MOVIE (object))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (value))
return;
+ object = SWFDEC_AS_VALUE_GET_OBJECT (value);
if (SWFDEC_IS_AS_DATE (object->relay) && swfdec_gc_object_get_context (object)->version > 5)
name = SWFDEC_AS_STR_toString;
else
name = SWFDEC_AS_STR_valueOf;
- swfdec_as_object_call (SWFDEC_AS_VALUE_GET_COMPOSITE (value), name, 0, NULL, value);
+ swfdec_as_object_call (object, name, 0, NULL, value);
}
static void
@@ -955,10 +953,10 @@ swfdec_action_add2 (SwfdecAsContext *cx, guint action, const guint8 *data, guint
rtmp = *rval;
ltmp = *lval;
swfdec_action_add2_to_primitive (&rtmp);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&rtmp) || SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (&rtmp)))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (&rtmp))
rval = &rtmp;
swfdec_action_add2_to_primitive (<mp);
- if (!SWFDEC_AS_VALUE_IS_COMPOSITE (<mp) || SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (<mp)))
+ if (!SWFDEC_AS_VALUE_IS_OBJECT (<mp))
lval = <mp;
if (SWFDEC_AS_VALUE_IS_STRING (lval) || SWFDEC_AS_VALUE_IS_STRING (rval)) {
commit 12035ffe7b4268a495bf861d7f88e1e3a88e98c6
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 13:12:38 2008 +0100
cleanup code a bit
diff --git a/swfdec/swfdec_as_types.c b/swfdec/swfdec_as_types.c
index d83ee7f..b10ea7c 100644
--- a/swfdec/swfdec_as_types.c
+++ b/swfdec/swfdec_as_types.c
@@ -150,7 +150,7 @@
*/
/**
- * SWFDEC_AS_VALUE_GET_COMPOSITE:
+ * SWFDEC_AS_VALUE_GET_OBJECT:
* @val: value to get, the value must reference an object
*
* Gets the object associated with @val. If you are not sure that the value is
@@ -160,7 +160,7 @@
*/
/**
- * SWFDEC_AS_VALUE_SET_COMPOSITE:
+ * SWFDEC_AS_VALUE_SET_OBJECT:
* @val: value to set
* @o: garbage-collected #SwfdecAsObject to use
*
@@ -404,7 +404,7 @@ swfdec_as_value_to_string (SwfdecAsContext *context, const SwfdecAsValue *value)
return swfdec_as_double_to_string (context, SWFDEC_AS_VALUE_GET_NUMBER (value));
case SWFDEC_AS_TYPE_OBJECT:
{
- SwfdecAsObject *object = SWFDEC_AS_VALUE_GET_COMPOSITE (value);
+ SwfdecAsObject *object = SWFDEC_AS_VALUE_GET_OBJECT (value);
if (SWFDEC_IS_AS_STRING (object->relay)) {
return SWFDEC_AS_STRING (object->relay)->string;
} else {
@@ -412,9 +412,9 @@ swfdec_as_value_to_string (SwfdecAsContext *context, const SwfdecAsValue *value)
swfdec_as_object_call (object, SWFDEC_AS_STR_toString, 0, NULL, &ret);
if (SWFDEC_AS_VALUE_IS_STRING (&ret))
return SWFDEC_AS_VALUE_GET_STRING (&ret);
- else if (SWFDEC_IS_AS_SUPER (SWFDEC_AS_VALUE_GET_COMPOSITE (value)->relay))
+ else if (SWFDEC_IS_AS_SUPER (object->relay))
return SWFDEC_AS_STR__type_Object_;
- else if (SWFDEC_IS_AS_FUNCTION (SWFDEC_AS_VALUE_GET_COMPOSITE (value)->relay))
+ else if (SWFDEC_IS_AS_FUNCTION (object->relay))
return SWFDEC_AS_STR__type_Function_;
else
return SWFDEC_AS_STR__type_Object_;
commit c47ba23967887a15e52951e99e5136cffe94b31e
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 13:07:20 2008 +0100
introduce the SWFDEC_AS_TYPE_MOVIE and use it
This patch makes all SwfdecMovie instances use
SWFDEC_AS_VALUE_TYPE_MOVIE instead of SWFDEC_AS_VALUE_TYPE_OBJECT
previously.
diff --git a/swfdec/swfdec_as_internal.h b/swfdec/swfdec_as_internal.h
index 37dc083..73ef069 100644
--- a/swfdec/swfdec_as_internal.h
+++ b/swfdec/swfdec_as_internal.h
@@ -34,6 +34,17 @@ G_BEGIN_DECLS
#define SWFDEC_AS_OBJECT_PROTOTYPE_RECURSION_LIMIT 256
+/* swfdec_as_types.h */
+#define SWFDEC_AS_VALUE_IS_MOVIE(val) (SWFDEC_AS_VALUE_GET_TYPE (val) == SWFDEC_AS_TYPE_OBJECT)
+#define SWFDEC_AS_VALUE_GET_MOVIE(val) (swfdec_movie_resolve (SWFDEC_MOVIE ((val)->value.object)))
+#define SWFDEC_AS_VALUE_SET_MOVIE(val,m) G_STMT_START { \
+ SwfdecAsValue *__val = (val); \
+ SwfdecMovie *__m = (m); \
+ g_assert (SWFDEC_IS_MOVIE (__m)); \
+ (__val)->type = SWFDEC_AS_TYPE_MOVIE; \
+ (__val)->value.object = (SwfdecAsObject *) __m; \
+} G_STMT_END
+
/* swfdec_as_context.c */
gboolean swfdec_as_context_check_continue (SwfdecAsContext * context);
void swfdec_as_context_run (SwfdecAsContext * context);
diff --git a/swfdec/swfdec_as_interpret.c b/swfdec/swfdec_as_interpret.c
index 448e38b..76dc0f0 100644
--- a/swfdec/swfdec_as_interpret.c
+++ b/swfdec/swfdec_as_interpret.c
@@ -1389,7 +1389,7 @@ swfdec_action_equals2_5 (SwfdecAsContext *cx, guint action, const guint8 *data,
rtype = SWFDEC_AS_VALUE_GET_TYPE (&rtmp);
/* get objects compared */
- if (ltype == SWFDEC_AS_TYPE_OBJECT && rtype == SWFDEC_AS_TYPE_OBJECT) {
+ if (ltype >= SWFDEC_AS_TYPE_OBJECT && rtype >= SWFDEC_AS_TYPE_OBJECT) {
SwfdecAsObject *lo = SWFDEC_AS_VALUE_GET_COMPOSITE (<mp);
SwfdecAsObject *ro = SWFDEC_AS_VALUE_GET_COMPOSITE (&rtmp);
@@ -1399,7 +1399,7 @@ swfdec_action_equals2_5 (SwfdecAsContext *cx, guint action, const guint8 *data,
} else if (SWFDEC_IS_MOVIE (lo)) {
swfdec_as_value_to_primitive (rval);
rtype = SWFDEC_AS_VALUE_GET_TYPE (rval);
- if (rtype != SWFDEC_AS_TYPE_OBJECT) {
+ if (rtype != SWFDEC_AS_TYPE_MOVIE) {
cond = FALSE;
goto out;
}
@@ -1407,7 +1407,7 @@ swfdec_action_equals2_5 (SwfdecAsContext *cx, guint action, const guint8 *data,
} else if (SWFDEC_IS_MOVIE (ro)) {
swfdec_as_value_to_primitive (lval);
ltype = SWFDEC_AS_VALUE_GET_TYPE (lval);
- if (ltype != SWFDEC_AS_TYPE_OBJECT) {
+ if (ltype != SWFDEC_AS_TYPE_MOVIE) {
cond = FALSE;
goto out;
}
@@ -1475,7 +1475,7 @@ swfdec_action_equals2_6 (SwfdecAsContext *cx, guint action, const guint8 *data,
rtype = SWFDEC_AS_VALUE_GET_TYPE (rval);
/* get objects compared */
- if (ltype == SWFDEC_AS_TYPE_OBJECT && rtype == SWFDEC_AS_TYPE_OBJECT) {
+ if (ltype >= SWFDEC_AS_TYPE_OBJECT && rtype >= SWFDEC_AS_TYPE_OBJECT) {
SwfdecAsObject *lo = SWFDEC_AS_VALUE_GET_COMPOSITE (lval);
SwfdecAsObject *ro = SWFDEC_AS_VALUE_GET_COMPOSITE (rval);
@@ -1485,7 +1485,7 @@ swfdec_action_equals2_6 (SwfdecAsContext *cx, guint action, const guint8 *data,
} else if (SWFDEC_IS_MOVIE (lo)) {
swfdec_as_value_to_primitive (rval);
rtype = SWFDEC_AS_VALUE_GET_TYPE (rval);
- if (rtype != SWFDEC_AS_TYPE_OBJECT) {
+ if (rtype != SWFDEC_AS_TYPE_MOVIE) {
cond = FALSE;
goto out;
}
@@ -1493,7 +1493,7 @@ swfdec_action_equals2_6 (SwfdecAsContext *cx, guint action, const guint8 *data,
} else if (SWFDEC_IS_MOVIE (ro)) {
swfdec_as_value_to_primitive (lval);
ltype = SWFDEC_AS_VALUE_GET_TYPE (lval);
- if (ltype != SWFDEC_AS_TYPE_OBJECT) {
+ if (ltype != SWFDEC_AS_TYPE_MOVIE) {
cond = FALSE;
goto out;
}
@@ -1593,17 +1593,10 @@ swfdec_action_strict_equals (SwfdecAsContext *cx, guint action, const guint8 *da
cond = SWFDEC_AS_VALUE_GET_STRING (rval) == SWFDEC_AS_VALUE_GET_STRING (lval);
break;
case SWFDEC_AS_TYPE_OBJECT:
- {
- SwfdecAsObject *lo = SWFDEC_AS_VALUE_GET_COMPOSITE (lval);
- SwfdecAsObject *ro = SWFDEC_AS_VALUE_GET_COMPOSITE (rval);
- if (SWFDEC_IS_MOVIE (lo) && SWFDEC_IS_MOVIE (ro)) {
- cond = swfdec_movie_resolve (SWFDEC_MOVIE (lo)) == swfdec_movie_resolve (SWFDEC_MOVIE (ro));
- } else if (!SWFDEC_IS_MOVIE (lo) && !SWFDEC_IS_MOVIE (ro)) {
- cond = lo == ro;
- } else {
- cond = FALSE;
- }
- }
+ cond = SWFDEC_AS_VALUE_GET_OBJECT (lval) == SWFDEC_AS_VALUE_GET_OBJECT (rval);
+ break;
+ case SWFDEC_AS_TYPE_MOVIE:
+ cond = SWFDEC_AS_VALUE_GET_MOVIE (lval) == SWFDEC_AS_VALUE_GET_MOVIE (rval);
break;
case SWFDEC_AS_TYPE_INT:
default:
@@ -2173,22 +2166,25 @@ swfdec_action_type_of (SwfdecAsContext *cx, guint action, const guint8 *data, gu
break;
case SWFDEC_AS_TYPE_OBJECT:
{
- SwfdecAsObject *obj = SWFDEC_AS_VALUE_GET_COMPOSITE (val);
- if (SWFDEC_IS_MOVIE (obj)) {
- SwfdecMovie *movie = swfdec_movie_resolve (SWFDEC_MOVIE (obj));
- if (movie != NULL && SWFDEC_IS_TEXT_FIELD_MOVIE (movie) &&
- movie->state == SWFDEC_MOVIE_STATE_RUNNING) {
- type = SWFDEC_AS_STR_object;
- } else {
- type = SWFDEC_AS_STR_movieclip;
- }
- } else if (SWFDEC_IS_AS_FUNCTION (obj->relay)) {
+ SwfdecAsObject *obj = SWFDEC_AS_VALUE_GET_OBJECT (val);
+ if (SWFDEC_IS_AS_FUNCTION (obj->relay)) {
type = SWFDEC_AS_STR_function;
} else {
type = SWFDEC_AS_STR_object;
}
}
break;
+ case SWFDEC_AS_TYPE_MOVIE:
+ {
+ SwfdecMovie *movie = SWFDEC_AS_VALUE_GET_MOVIE (val);
+ if (movie != NULL && SWFDEC_IS_TEXT_FIELD_MOVIE (movie) &&
+ movie->state == SWFDEC_MOVIE_STATE_RUNNING) {
+ type = SWFDEC_AS_STR_object;
+ } else {
+ type = SWFDEC_AS_STR_movieclip;
+ }
+ }
+ break;
case SWFDEC_AS_TYPE_INT:
default:
g_assert_not_reached ();
diff --git a/swfdec/swfdec_as_types.c b/swfdec/swfdec_as_types.c
index e4bb3fe..d83ee7f 100644
--- a/swfdec/swfdec_as_types.c
+++ b/swfdec/swfdec_as_types.c
@@ -28,6 +28,7 @@
#include "swfdec_as_context.h"
#include "swfdec_as_function.h"
#include "swfdec_as_gcable.h"
+#include "swfdec_as_internal.h"
#include "swfdec_as_number.h"
#include "swfdec_as_object.h"
#include "swfdec_as_stack.h"
@@ -404,15 +405,7 @@ swfdec_as_value_to_string (SwfdecAsContext *context, const SwfdecAsValue *value)
case SWFDEC_AS_TYPE_OBJECT:
{
SwfdecAsObject *object = SWFDEC_AS_VALUE_GET_COMPOSITE (value);
- if (SWFDEC_IS_MOVIE (object)) {
- SwfdecMovie *movie = swfdec_movie_resolve (SWFDEC_MOVIE (object));
- if (movie == NULL) {
- return SWFDEC_AS_STR_EMPTY;
- } else {
- char *str = swfdec_movie_get_path (SWFDEC_MOVIE (object), TRUE);
- return swfdec_as_context_give_string (context, str);
- }
- } else if (SWFDEC_IS_AS_STRING (object->relay)) {
+ if (SWFDEC_IS_AS_STRING (object->relay)) {
return SWFDEC_AS_STRING (object->relay)->string;
} else {
SwfdecAsValue ret;
@@ -427,6 +420,16 @@ swfdec_as_value_to_string (SwfdecAsContext *context, const SwfdecAsValue *value)
return SWFDEC_AS_STR__type_Object_;
}
}
+ case SWFDEC_AS_TYPE_MOVIE:
+ {
+ SwfdecMovie *movie = SWFDEC_AS_VALUE_GET_MOVIE (value);
+ char *str;
+
+ if (movie == NULL)
+ return SWFDEC_AS_STR_EMPTY;
+ str = swfdec_movie_get_path (movie, TRUE);
+ return swfdec_as_context_give_string (context, str);
+ }
case SWFDEC_AS_TYPE_INT:
default:
g_assert_not_reached ();
@@ -493,6 +496,7 @@ swfdec_as_value_to_number (SwfdecAsContext *context, const SwfdecAsValue *value)
return NAN;
}
case SWFDEC_AS_TYPE_OBJECT:
+ case SWFDEC_AS_TYPE_MOVIE:
return (context->version >= 5) ? NAN : 0.0;
case SWFDEC_AS_TYPE_INT:
default:
@@ -580,6 +584,7 @@ swfdec_as_value_to_object (SwfdecAsContext *context, const SwfdecAsValue *value)
s = SWFDEC_AS_STR_Boolean;
break;
case SWFDEC_AS_TYPE_OBJECT:
+ case SWFDEC_AS_TYPE_MOVIE:
return SWFDEC_AS_VALUE_GET_COMPOSITE (value);
case SWFDEC_AS_TYPE_INT:
default:
@@ -636,6 +641,7 @@ swfdec_as_value_to_boolean (SwfdecAsContext *context, const SwfdecAsValue *value
return SWFDEC_AS_VALUE_GET_STRING (value) != SWFDEC_AS_STR_EMPTY;
}
case SWFDEC_AS_TYPE_OBJECT:
+ case SWFDEC_AS_TYPE_MOVIE:
return TRUE;
case SWFDEC_AS_TYPE_INT:
default:
@@ -658,8 +664,8 @@ swfdec_as_value_to_primitive (SwfdecAsValue *value)
{
g_return_if_fail (SWFDEC_IS_AS_VALUE (value));
- if (SWFDEC_AS_VALUE_IS_COMPOSITE (value) && !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (value))) {
- swfdec_as_object_call (SWFDEC_AS_VALUE_GET_COMPOSITE (value), SWFDEC_AS_STR_valueOf,
+ if (SWFDEC_AS_VALUE_IS_OBJECT (value)) {
+ swfdec_as_object_call (SWFDEC_AS_VALUE_GET_OBJECT (value), SWFDEC_AS_STR_valueOf,
0, NULL, value);
}
}
diff --git a/swfdec/swfdec_as_types.h b/swfdec/swfdec_as_types.h
index c79cdb7..a01ef63 100644
--- a/swfdec/swfdec_as_types.h
+++ b/swfdec/swfdec_as_types.h
@@ -33,7 +33,8 @@ typedef enum {
SWFDEC_AS_TYPE_NUMBER,
SWFDEC_AS_TYPE_STRING,
SWFDEC_AS_TYPE_NULL,
- SWFDEC_AS_TYPE_OBJECT
+ SWFDEC_AS_TYPE_OBJECT,
+ SWFDEC_AS_TYPE_MOVIE
} SwfdecAsValueType;
typedef struct _SwfdecAsContext SwfdecAsContext;
@@ -109,7 +110,7 @@ struct _SwfdecAsDoubleValue {
SwfdecAsValue *__val = (val); \
SwfdecAsObject *__o = (o); \
g_assert (__o != NULL); \
- (__val)->type = SWFDEC_AS_TYPE_OBJECT; \
+ (__val)->type = __o->movie ? SWFDEC_AS_TYPE_MOVIE : SWFDEC_AS_TYPE_OBJECT; \
(__val)->value.object = __o; \
} G_STMT_END
commit be29032fd5ed98dd9beab7267b3dea2b9da64461
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 09:55:42 2008 +0100
add a movie flag to SwfdecAsObject
diff --git a/swfdec/swfdec_as_object.h b/swfdec/swfdec_as_object.h
index cb21763..addf1de 100644
--- a/swfdec/swfdec_as_object.h
+++ b/swfdec/swfdec_as_object.h
@@ -62,6 +62,7 @@ struct _SwfdecAsObject {
/*< private >*/
gboolean array:1; /* TRUE if object is an array */
gboolean super:1; /* TRUE if object is a super object */
+ gboolean movie:1; /* TRUE if object is really a MovieClip */
SwfdecAsObject * prototype; /* prototype object (referred to as __proto__) */
guint prototype_flags; /* propflags for the prototype object */
GHashTable * properties; /* string->SwfdecAsVariable mapping or NULL when not in GC */
diff --git a/swfdec/swfdec_movie.c b/swfdec/swfdec_movie.c
index c59a27d..8c156d2 100644
--- a/swfdec/swfdec_movie.c
+++ b/swfdec/swfdec_movie.c
@@ -72,7 +72,9 @@ G_DEFINE_ABSTRACT_TYPE (SwfdecMovie, swfdec_movie, SWFDEC_TYPE_AS_OBJECT)
static void
swfdec_movie_init (SwfdecMovie * movie)
{
- movie->blend_mode = 1;
+ SWFDEC_AS_OBJECT (movie)->movie = TRUE;
+
+ movie->blend_mode = SWFDEC_BLEND_MODE_NORMAL;
movie->xscale = 100;
movie->yscale = 100;
commit efb9fbc8356c15659242f3081888bbe10c7543ed
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Oct 29 09:36:25 2008 +0100
rename SWFDEC_AS_VALUE_*_OBJECT to SWFDEC_AS_VALUE_*_COMPOSITE
First batch in splitting apart objects and movies
diff --git a/swfdec/swfdec_actor.c b/swfdec/swfdec_actor.c
index b54195d..73cc981 100644
--- a/swfdec/swfdec_actor.c
+++ b/swfdec/swfdec_actor.c
@@ -257,7 +257,7 @@ swfdec_actor_execute (SwfdecActor *actor, SwfdecEventType condition,
SWFDEC_AS_VALUE_SET_STRING (&argv[0], SWFDEC_AS_STR_onScroller);
else
SWFDEC_AS_VALUE_SET_STRING (&argv[0], SWFDEC_AS_STR_onChanged);
- SWFDEC_AS_VALUE_SET_OBJECT (&argv[1], SWFDEC_AS_OBJECT (actor));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&argv[1], SWFDEC_AS_OBJECT (actor));
swfdec_sandbox_use (SWFDEC_MOVIE (actor)->resource->sandbox);
swfdec_as_object_call (SWFDEC_AS_OBJECT (actor),
SWFDEC_AS_STR_broadcastMessage, 2, argv, NULL);
diff --git a/swfdec/swfdec_amf.c b/swfdec/swfdec_amf.c
index ec42946..e991310 100644
--- a/swfdec/swfdec_amf.c
+++ b/swfdec/swfdec_amf.c
@@ -100,7 +100,7 @@ swfdec_amf_parse_object (SwfdecAsContext *context, SwfdecBits *bits, SwfdecAsVal
object = swfdec_as_object_new (context, SWFDEC_AS_STR_Object, NULL);
if (!swfdec_amf_parse_properties (context, bits, object))
return FALSE;
- SWFDEC_AS_VALUE_SET_OBJECT (val, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (val, object);
return TRUE;
}
@@ -114,7 +114,7 @@ swfdec_amf_parse_mixed_array (SwfdecAsContext *context, SwfdecBits *bits, Swfdec
array = swfdec_as_array_new (context);
if (!swfdec_amf_parse_properties (context, bits, array))
return FALSE;
- SWFDEC_AS_VALUE_SET_OBJECT (val, array);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (val, array);
return TRUE;
}
@@ -141,7 +141,7 @@ swfdec_amf_parse_array (SwfdecAsContext *context, SwfdecBits *bits, SwfdecAsValu
swfdec_as_array_push (array, &tmp);
}
- SWFDEC_AS_VALUE_SET_OBJECT (val, array);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (val, array);
return TRUE;
fail:
@@ -161,7 +161,7 @@ swfdec_amf_parse_date (SwfdecAsContext *context, SwfdecBits *bits, SwfdecAsValue
date->utc_offset = swfdec_bits_get_bu16 (bits);
if (date->utc_offset > 12 * 60)
date->utc_offset -= 12 * 60;
- SWFDEC_AS_VALUE_SET_OBJECT (val, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (val, object);
return TRUE;
}
diff --git a/swfdec/swfdec_as_array.c b/swfdec/swfdec_as_array.c
index bd156d0..2c297c8 100644
--- a/swfdec/swfdec_as_array.c
+++ b/swfdec/swfdec_as_array.c
@@ -707,7 +707,7 @@ swfdec_as_array_reverse (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_object_foreach_rename (object, swfdec_as_array_foreach_reverse,
&length);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
}
SWFDEC_AS_NATIVE (252, 3, swfdec_as_array_concat)
@@ -727,11 +727,11 @@ swfdec_as_array_concat (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_array_append_array (array_new, object);
for (j = 0; j < argc; j++) {
- if (SWFDEC_AS_VALUE_IS_OBJECT (&argv[j]) &&
- SWFDEC_AS_VALUE_GET_OBJECT (&argv[j])->array)
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[j]) &&
+ SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[j])->array)
{
swfdec_as_array_append_array (array_new,
- SWFDEC_AS_VALUE_GET_OBJECT (&argv[j]));
+ SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[j]));
}
else
{
@@ -741,7 +741,7 @@ swfdec_as_array_concat (SwfdecAsContext *cx, SwfdecAsObject *object,
}
}
- SWFDEC_AS_VALUE_SET_OBJECT (ret, array_new);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, array_new);
}
SWFDEC_AS_NATIVE (252, 6, swfdec_as_array_slice)
@@ -780,7 +780,7 @@ swfdec_as_array_slice (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc,
swfdec_as_array_append_array_range (array_new, object, start_index, num);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, array_new);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, array_new);
}
SWFDEC_AS_NATIVE (252, 8, swfdec_as_array_splice)
@@ -817,7 +817,7 @@ swfdec_as_array_splice (SwfdecAsContext *cx, SwfdecAsObject *object,
array_new = swfdec_as_array_new (cx);
swfdec_as_array_append_array_range (array_new, object, start_index,
num_remove);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, array_new);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, array_new);
/* move old data to the right spot */
swfdec_as_array_move_range (object, start_index + num_remove,
@@ -1069,13 +1069,13 @@ swfdec_as_array_do_sort (SwfdecAsContext *cx, SwfdecAsObject *object,
length = swfdec_as_array_get_length (object);
if (length == 0) {
// special case for empty array, because g_try_new0 would return NULL
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
return;
}
if (!swfdec_as_context_try_use_mem (cx, sizeof (SortEntry) * length)) {
SWFDEC_WARNING ("Array not sorted, too big (%i elements)", length);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
return;
}
@@ -1084,7 +1084,7 @@ swfdec_as_array_do_sort (SwfdecAsContext *cx, SwfdecAsObject *object,
array = g_try_new0 (SortEntry, length);
if (!array) {
SWFDEC_WARNING ("Array not sorted, too big (%i elements)", length);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
goto done;
}
@@ -1165,7 +1165,7 @@ swfdec_as_array_do_sort (SwfdecAsContext *cx, SwfdecAsObject *object,
}
}
- SWFDEC_AS_VALUE_SET_OBJECT (ret, target);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, target);
done:
g_free (array);
@@ -1188,9 +1188,9 @@ swfdec_as_array_sort (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc,
if (argc > pos && !SWFDEC_AS_VALUE_IS_NUMBER (&argv[pos])) {
SwfdecAsFunction *fun;
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&argv[pos]) ||
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[pos]) ||
!SWFDEC_IS_AS_FUNCTION (
- fun = (SwfdecAsFunction *) SWFDEC_AS_VALUE_GET_OBJECT (&argv[pos])->relay))
+ fun = (SwfdecAsFunction *) SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[pos])->relay))
return;
custom_function = fun;
pos++;
@@ -1224,17 +1224,17 @@ swfdec_as_array_sortOn (SwfdecAsContext *cx, SwfdecAsObject *object,
if (argc < 1)
return;
- if (SWFDEC_AS_VALUE_IS_OBJECT (&argv[0])) {
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[0])) {
- array = SWFDEC_AS_VALUE_GET_OBJECT (&argv[0]);
+ array = SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0]);
if (!array->array) {
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
return;
}
num_fields = swfdec_as_array_get_length (array);
if (num_fields <= 0) {
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
return;
}
@@ -1255,8 +1255,8 @@ swfdec_as_array_sortOn (SwfdecAsContext *cx, SwfdecAsObject *object,
options = g_new0 (SortOption, num_fields);
if (argc > 1) {
- if (SWFDEC_AS_VALUE_IS_OBJECT (&argv[1])) {
- array = SWFDEC_AS_VALUE_GET_OBJECT (&argv[1]);
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[1])) {
+ array = SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[1]);
if (array->array &&
swfdec_as_array_get_length (array) == num_fields) {
@@ -1304,5 +1304,5 @@ swfdec_as_array_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_array_set_length (object, 0);
}
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
}
diff --git a/swfdec/swfdec_as_boolean.c b/swfdec/swfdec_as_boolean.c
index fda7519..5435621 100644
--- a/swfdec/swfdec_as_boolean.c
+++ b/swfdec/swfdec_as_boolean.c
@@ -54,7 +54,7 @@ swfdec_as_boolean_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
SwfdecAsBoolean *b = g_object_new (SWFDEC_TYPE_AS_BOOLEAN, "context", cx, NULL);
b->boolean = argc > 0 ? swfdec_as_value_to_boolean (cx, &argv[0]) : FALSE;
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (b));
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
} else {
gboolean b;
SWFDEC_AS_CHECK (0, NULL, "b", &b);
diff --git a/swfdec/swfdec_as_context.c b/swfdec/swfdec_as_context.c
index 3bcc2bf..2e7cfe2 100644
--- a/swfdec/swfdec_as_context.c
+++ b/swfdec/swfdec_as_context.c
@@ -335,8 +335,8 @@ swfdec_as_value_mark (SwfdecAsValue *value)
{
g_return_if_fail (SWFDEC_IS_AS_VALUE (value));
- if (SWFDEC_AS_VALUE_IS_OBJECT (value)) {
- swfdec_gc_object_mark (SWFDEC_AS_VALUE_GET_OBJECT (value));
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (value)) {
+ swfdec_gc_object_mark (SWFDEC_AS_VALUE_GET_COMPOSITE (value));
} else if (SWFDEC_AS_VALUE_IS_STRING (value) ||
SWFDEC_AS_VALUE_IS_NUMBER (value)) {
if (!SWFDEC_AS_GCABLE_FLAG_IS_SET (value->value.gcable, SWFDEC_AS_GC_ROOT))
@@ -987,9 +987,9 @@ swfdec_as_context_ASSetPropFlags (SwfdecAsContext *cx, SwfdecAsObject *object,
if (argc < 3)
return;
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&argv[0]))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[0]))
return;
- obj = SWFDEC_AS_VALUE_GET_OBJECT (&argv[0]);
+ obj = SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0]);
flags[0] = swfdec_as_value_to_integer (cx, &argv[2]);
flags[1] = (argc > 3) ? swfdec_as_value_to_integer (cx, &argv[3]) : 0;
diff --git a/swfdec/swfdec_as_date.c b/swfdec/swfdec_as_date.c
index 1d17aac..d583cf2 100644
--- a/swfdec/swfdec_as_date.c
+++ b/swfdec/swfdec_as_date.c
@@ -1192,6 +1192,6 @@ swfdec_as_date_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
}
}
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
}
diff --git a/swfdec/swfdec_as_frame.c b/swfdec/swfdec_as_frame.c
index 1bd236c..0e07fb1 100644
--- a/swfdec/swfdec_as_frame.c
+++ b/swfdec/swfdec_as_frame.c
@@ -346,7 +346,7 @@ swfdec_as_frame_return (SwfdecAsFrame *frame, SwfdecAsValue *return_value)
/* save return value in case it was on the stack somewhere */
if (frame->construct) {
- SWFDEC_AS_VALUE_SET_OBJECT (&retval, frame->thisp);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&retval, frame->thisp);
} else if (return_value) {
retval = *return_value;
} else {
@@ -599,7 +599,7 @@ swfdec_as_frame_preload (SwfdecAsFrame *frame)
next = next->next;
}
if (next != NULL) {
- SWFDEC_AS_VALUE_SET_OBJECT (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (next->function)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (next->function)));
} else {
SWFDEC_AS_VALUE_SET_NULL (&val);
}
@@ -607,7 +607,7 @@ swfdec_as_frame_preload (SwfdecAsFrame *frame)
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
if (frame->function != NULL) {
- SWFDEC_AS_VALUE_SET_OBJECT (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (frame->function)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (frame->function)));
} else {
SWFDEC_AS_VALUE_SET_NULL (&val);
}
@@ -621,19 +621,19 @@ swfdec_as_frame_preload (SwfdecAsFrame *frame)
/* set the default variables (unless suppressed */
if (!(script->flags & SWFDEC_SCRIPT_SUPPRESS_THIS)) {
if (frame->thisp) {
- SWFDEC_AS_VALUE_SET_OBJECT (&val, frame->thisp);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, frame->thisp);
} else {
SWFDEC_AS_VALUE_SET_UNDEFINED (&val);
}
swfdec_as_object_set_variable (object, SWFDEC_AS_STR_this, &val);
}
if (!(script->flags & SWFDEC_SCRIPT_SUPPRESS_ARGS)) {
- SWFDEC_AS_VALUE_SET_OBJECT (&val, args);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, args);
swfdec_as_object_set_variable (object, SWFDEC_AS_STR_arguments, &val);
}
if (!(script->flags & SWFDEC_SCRIPT_SUPPRESS_SUPER)) {
if (frame->super) {
- SWFDEC_AS_VALUE_SET_OBJECT (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (frame->super)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (frame->super)));
} else {
SWFDEC_AS_VALUE_SET_UNDEFINED (&val);
}
@@ -666,17 +666,17 @@ swfdec_as_frame_preload (SwfdecAsFrame *frame)
if ((script->flags & (SWFDEC_SCRIPT_PRELOAD_THIS | SWFDEC_SCRIPT_SUPPRESS_THIS)) == SWFDEC_SCRIPT_PRELOAD_THIS
&& current_reg < script->n_registers) {
if (frame->thisp) {
- SWFDEC_AS_VALUE_SET_OBJECT (&frame->registers[current_reg++], frame->thisp);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&frame->registers[current_reg++], frame->thisp);
} else {
SWFDEC_AS_VALUE_SET_UNDEFINED (&frame->registers[current_reg++]);
}
}
if (script->flags & SWFDEC_SCRIPT_PRELOAD_ARGS && current_reg < script->n_registers) {
- SWFDEC_AS_VALUE_SET_OBJECT (&frame->registers[current_reg++], args);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&frame->registers[current_reg++], args);
}
if (script->flags & SWFDEC_SCRIPT_PRELOAD_SUPER && current_reg < script->n_registers) {
if (frame->super) {
- SWFDEC_AS_VALUE_SET_OBJECT (&frame->registers[current_reg++],
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&frame->registers[current_reg++],
swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (frame->super)));
} else {
SWFDEC_AS_VALUE_SET_UNDEFINED (&frame->registers[current_reg++]);
@@ -695,7 +695,7 @@ swfdec_as_frame_preload (SwfdecAsFrame *frame)
current_reg++;
}
if (script->flags & SWFDEC_SCRIPT_PRELOAD_GLOBAL && current_reg < script->n_registers) {
- SWFDEC_AS_VALUE_SET_OBJECT (&frame->registers[current_reg++], context->global);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&frame->registers[current_reg++], context->global);
}
/* set block boundaries */
frame->block_start = frame->script->buffer->data;
diff --git a/swfdec/swfdec_as_function.c b/swfdec/swfdec_as_function.c
index 6e55f3c..63ccf15 100644
--- a/swfdec/swfdec_as_function.c
+++ b/swfdec/swfdec_as_function.c
@@ -140,12 +140,12 @@ swfdec_as_function_apply (SwfdecAsContext *cx, SwfdecAsObject *object,
if (thisp == NULL)
thisp = swfdec_as_object_new_empty (cx);
- if (argc > 1 && SWFDEC_AS_VALUE_IS_OBJECT (&argv[1])) {
+ if (argc > 1 && SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[1])) {
int i;
SwfdecAsObject *array;
SwfdecAsValue val;
- array = SWFDEC_AS_VALUE_GET_OBJECT (&argv[1]);
+ array = SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[1]);
swfdec_as_object_get_variable (array, SWFDEC_AS_STR_length, &val);
length = swfdec_as_value_to_integer (cx, &val);
diff --git a/swfdec/swfdec_as_interpret.c b/swfdec/swfdec_as_interpret.c
index ae9166e..448e38b 100644
--- a/swfdec/swfdec_as_interpret.c
+++ b/swfdec/swfdec_as_interpret.c
@@ -405,9 +405,9 @@ super_special_movie_lookup_magic (SwfdecAsContext *cx, SwfdecAsObject *o, const
}
if (!swfdec_as_object_get_variable (o, name, &val))
return NULL;
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
return NULL;
- return SWFDEC_AS_VALUE_GET_OBJECT (&val);
+ return SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
}
static SwfdecAsObject *
@@ -630,7 +630,7 @@ swfdec_action_get_variable (SwfdecAsContext *cx, guint action, const guint8 *dat
if (s) {
swfdec_as_object_get_variable (object, swfdec_as_context_get_string (cx, s), val);
} else {
- SWFDEC_AS_VALUE_SET_OBJECT (val, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (val, object);
}
} else {
swfdec_as_frame_get_variable (cx->frame, swfdec_as_context_get_string (cx, s), val);
@@ -738,9 +738,9 @@ swfdec_action_get_member (SwfdecAsContext *cx, guint action, const guint8 *data,
static void
swfdec_action_set_member (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
{
- if (SWFDEC_AS_VALUE_IS_OBJECT (swfdec_as_stack_peek (cx, 3))) {
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (swfdec_as_stack_peek (cx, 3))) {
const char *name = swfdec_as_value_to_string (cx, swfdec_as_stack_peek (cx, 2));
- swfdec_as_object_set_variable (SWFDEC_AS_VALUE_GET_OBJECT (swfdec_as_stack_peek (cx, 3)),
+ swfdec_as_object_set_variable (SWFDEC_AS_VALUE_GET_COMPOSITE (swfdec_as_stack_peek (cx, 3)),
name, swfdec_as_stack_peek (cx, 1));
}
swfdec_as_stack_pop_n (cx, 3);
@@ -770,15 +770,15 @@ swfdec_action_call (SwfdecAsContext *cx, guint n_args, SwfdecAsObject *super)
SwfdecAsFunction *fun;
SwfdecAsObject *thisp;
- if (!SWFDEC_AS_VALUE_IS_OBJECT (swfdec_as_stack_peek (cx, 1)))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (swfdec_as_stack_peek (cx, 1)))
goto error;
- fun = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_OBJECT (swfdec_as_stack_peek (cx, 1))->relay);
+ fun = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_COMPOSITE (swfdec_as_stack_peek (cx, 1))->relay);
if (!SWFDEC_IS_AS_FUNCTION (fun))
goto error;
- if (!SWFDEC_AS_VALUE_IS_OBJECT (swfdec_as_stack_peek (cx, 2))) {
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (swfdec_as_stack_peek (cx, 2))) {
thisp = NULL;
} else {
- thisp = SWFDEC_AS_VALUE_GET_OBJECT (swfdec_as_stack_peek (cx, 2));
+ thisp = SWFDEC_AS_VALUE_GET_COMPOSITE (swfdec_as_stack_peek (cx, 2));
}
swfdec_as_stack_pop_n (cx, 2);
/* sanitize argument count */
@@ -816,7 +816,7 @@ swfdec_action_call_function (SwfdecAsContext *cx, guint action, const guint8 *da
fun = swfdec_as_stack_peek (cx, 1);
obj = swfdec_as_frame_get_variable (frame, name, fun);
if (obj) {
- SWFDEC_AS_VALUE_SET_OBJECT (thisp, obj);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (thisp, obj);
} else {
SWFDEC_AS_VALUE_SET_NULL (thisp);
SWFDEC_AS_VALUE_SET_UNDEFINED (fun);
@@ -844,11 +844,11 @@ swfdec_action_call_method (SwfdecAsContext *cx, guint action, const guint8 *data
if (SWFDEC_AS_VALUE_IS_UNDEFINED (val) ||
name == SWFDEC_AS_STR_EMPTY) {
SWFDEC_AS_VALUE_SET_UNDEFINED (swfdec_as_stack_peek (cx, 3));
- SWFDEC_AS_VALUE_SET_OBJECT (swfdec_as_stack_peek (cx, 2), obj);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (swfdec_as_stack_peek (cx, 2), obj);
name = "";
pobj = obj;
} else {
- SWFDEC_AS_VALUE_SET_OBJECT (swfdec_as_stack_peek (cx, 3), obj);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (swfdec_as_stack_peek (cx, 3), obj);
swfdec_as_object_get_variable_and_flags (obj, name, swfdec_as_stack_peek (cx, 2), NULL, &pobj);
}
} else {
@@ -932,9 +932,9 @@ swfdec_action_add2_to_primitive (SwfdecAsValue *value)
SwfdecAsObject *object;
const char *name;
- if (!SWFDEC_AS_VALUE_IS_OBJECT (value))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (value))
return;
- object = SWFDEC_AS_VALUE_GET_OBJECT (value);
+ object = SWFDEC_AS_VALUE_GET_COMPOSITE (value);
if (SWFDEC_IS_MOVIE (object))
return;
@@ -942,7 +942,7 @@ swfdec_action_add2_to_primitive (SwfdecAsValue *value)
name = SWFDEC_AS_STR_toString;
else
name = SWFDEC_AS_STR_valueOf;
- swfdec_as_object_call (SWFDEC_AS_VALUE_GET_OBJECT (value), name, 0, NULL, value);
+ swfdec_as_object_call (SWFDEC_AS_VALUE_GET_COMPOSITE (value), name, 0, NULL, value);
}
static void
@@ -955,10 +955,10 @@ swfdec_action_add2 (SwfdecAsContext *cx, guint action, const guint8 *data, guint
rtmp = *rval;
ltmp = *lval;
swfdec_action_add2_to_primitive (&rtmp);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&rtmp) || SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_OBJECT (&rtmp)))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&rtmp) || SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (&rtmp)))
rval = &rtmp;
swfdec_action_add2_to_primitive (<mp);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (<mp) || SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_OBJECT (<mp)))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (<mp) || SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (<mp)))
lval = <mp;
if (SWFDEC_AS_VALUE_IS_STRING (lval) || SWFDEC_AS_VALUE_IS_STRING (rval)) {
@@ -995,23 +995,23 @@ swfdec_action_new_comparison (SwfdecAsContext *cx, guint action, const guint8 *d
}
/* comparison with object is always false */
swfdec_as_value_to_primitive (lval);
- if (SWFDEC_AS_VALUE_IS_OBJECT (lval) &&
- !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_OBJECT (lval))) {
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (lval) &&
+ !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (lval))) {
swfdec_as_stack_pop (cx);
SWFDEC_AS_VALUE_SET_BOOLEAN (swfdec_as_stack_peek (cx, 1), FALSE);
return;
}
/* same for the rval */
swfdec_as_value_to_primitive (rval);
- if (SWFDEC_AS_VALUE_IS_OBJECT (rval) &&
- !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_OBJECT (rval))) {
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (rval) &&
+ !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (rval))) {
swfdec_as_stack_pop (cx);
SWFDEC_AS_VALUE_SET_BOOLEAN (swfdec_as_stack_peek (cx, 1), FALSE);
return;
}
/* movieclips are not objects, but they evaluate to NaN, so we can handle them here */
- if (SWFDEC_AS_VALUE_IS_OBJECT (rval) ||
- SWFDEC_AS_VALUE_IS_OBJECT (lval)) {
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (rval) ||
+ SWFDEC_AS_VALUE_IS_COMPOSITE (lval)) {
swfdec_as_stack_pop (cx);
SWFDEC_AS_VALUE_SET_UNDEFINED (swfdec_as_stack_peek (cx, 1));
return;
@@ -1390,8 +1390,8 @@ swfdec_action_equals2_5 (SwfdecAsContext *cx, guint action, const guint8 *data,
/* get objects compared */
if (ltype == SWFDEC_AS_TYPE_OBJECT && rtype == SWFDEC_AS_TYPE_OBJECT) {
- SwfdecAsObject *lo = SWFDEC_AS_VALUE_GET_OBJECT (<mp);
- SwfdecAsObject *ro = SWFDEC_AS_VALUE_GET_OBJECT (&rtmp);
+ SwfdecAsObject *lo = SWFDEC_AS_VALUE_GET_COMPOSITE (<mp);
+ SwfdecAsObject *ro = SWFDEC_AS_VALUE_GET_COMPOSITE (&rtmp);
if (SWFDEC_IS_MOVIE (lo) && SWFDEC_IS_MOVIE (ro)) {
lo = SWFDEC_AS_OBJECT (swfdec_movie_resolve (SWFDEC_MOVIE (lo)));
@@ -1403,7 +1403,7 @@ swfdec_action_equals2_5 (SwfdecAsContext *cx, guint action, const guint8 *data,
cond = FALSE;
goto out;
}
- ro = SWFDEC_AS_VALUE_GET_OBJECT (rval);
+ ro = SWFDEC_AS_VALUE_GET_COMPOSITE (rval);
} else if (SWFDEC_IS_MOVIE (ro)) {
swfdec_as_value_to_primitive (lval);
ltype = SWFDEC_AS_VALUE_GET_TYPE (lval);
@@ -1411,10 +1411,10 @@ swfdec_action_equals2_5 (SwfdecAsContext *cx, guint action, const guint8 *data,
cond = FALSE;
goto out;
}
- lo = SWFDEC_AS_VALUE_GET_OBJECT (lval);
+ lo = SWFDEC_AS_VALUE_GET_COMPOSITE (lval);
} else {
- lo = SWFDEC_AS_VALUE_GET_OBJECT (lval);
- ro = SWFDEC_AS_VALUE_GET_OBJECT (rval);
+ lo = SWFDEC_AS_VALUE_GET_COMPOSITE (lval);
+ ro = SWFDEC_AS_VALUE_GET_COMPOSITE (rval);
}
cond = lo == ro;
goto out;
@@ -1428,12 +1428,12 @@ swfdec_action_equals2_5 (SwfdecAsContext *cx, guint action, const guint8 *data,
}
/* convert to numbers */
- if (SWFDEC_AS_VALUE_IS_OBJECT (<mp) && !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_OBJECT (<mp))) {
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (<mp) && !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (<mp))) {
l = swfdec_as_value_to_number (cx, lval);
} else {
l = swfdec_as_value_to_number (cx, <mp);
}
- if (SWFDEC_AS_VALUE_IS_OBJECT (&rtmp) && !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_OBJECT (&rtmp))) {
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (&rtmp) && !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (&rtmp))) {
r = swfdec_as_value_to_number (cx, rval);
} else {
r = swfdec_as_value_to_number (cx, &rtmp);
@@ -1476,8 +1476,8 @@ swfdec_action_equals2_6 (SwfdecAsContext *cx, guint action, const guint8 *data,
/* get objects compared */
if (ltype == SWFDEC_AS_TYPE_OBJECT && rtype == SWFDEC_AS_TYPE_OBJECT) {
- SwfdecAsObject *lo = SWFDEC_AS_VALUE_GET_OBJECT (lval);
- SwfdecAsObject *ro = SWFDEC_AS_VALUE_GET_OBJECT (rval);
+ SwfdecAsObject *lo = SWFDEC_AS_VALUE_GET_COMPOSITE (lval);
+ SwfdecAsObject *ro = SWFDEC_AS_VALUE_GET_COMPOSITE (rval);
if (SWFDEC_IS_MOVIE (lo) && SWFDEC_IS_MOVIE (ro)) {
lo = SWFDEC_AS_OBJECT (swfdec_movie_resolve (SWFDEC_MOVIE (lo)));
@@ -1489,7 +1489,7 @@ swfdec_action_equals2_6 (SwfdecAsContext *cx, guint action, const guint8 *data,
cond = FALSE;
goto out;
}
- ro = SWFDEC_AS_VALUE_GET_OBJECT (rval);
+ ro = SWFDEC_AS_VALUE_GET_COMPOSITE (rval);
} else if (SWFDEC_IS_MOVIE (ro)) {
swfdec_as_value_to_primitive (lval);
ltype = SWFDEC_AS_VALUE_GET_TYPE (lval);
@@ -1497,7 +1497,7 @@ swfdec_action_equals2_6 (SwfdecAsContext *cx, guint action, const guint8 *data,
cond = FALSE;
goto out;
}
- lo = SWFDEC_AS_VALUE_GET_OBJECT (lval);
+ lo = SWFDEC_AS_VALUE_GET_COMPOSITE (lval);
}
cond = lo == ro;
goto out;
@@ -1594,8 +1594,8 @@ swfdec_action_strict_equals (SwfdecAsContext *cx, guint action, const guint8 *da
break;
case SWFDEC_AS_TYPE_OBJECT:
{
- SwfdecAsObject *lo = SWFDEC_AS_VALUE_GET_OBJECT (lval);
- SwfdecAsObject *ro = SWFDEC_AS_VALUE_GET_OBJECT (rval);
+ SwfdecAsObject *lo = SWFDEC_AS_VALUE_GET_COMPOSITE (lval);
+ SwfdecAsObject *ro = SWFDEC_AS_VALUE_GET_COMPOSITE (rval);
if (SWFDEC_IS_MOVIE (lo) && SWFDEC_IS_MOVIE (ro)) {
cond = swfdec_movie_resolve (SWFDEC_MOVIE (lo)) == swfdec_movie_resolve (SWFDEC_MOVIE (ro));
} else if (!SWFDEC_IS_MOVIE (lo) && !SWFDEC_IS_MOVIE (ro)) {
@@ -1719,8 +1719,8 @@ swfdec_action_new_object (SwfdecAsContext *cx, guint action, const guint8 *data,
constructor = swfdec_as_stack_peek (cx, 1);
n_args = swfdec_as_value_to_integer (cx, swfdec_as_stack_peek (cx, 2));
n_args = MIN (swfdec_as_stack_get_size (cx) - 2, n_args);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (constructor) ||
- !SWFDEC_IS_AS_FUNCTION (fun = (SwfdecAsFunction *) SWFDEC_AS_VALUE_GET_OBJECT (constructor)->relay)) {
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (constructor) ||
+ !SWFDEC_IS_AS_FUNCTION (fun = (SwfdecAsFunction *) SWFDEC_AS_VALUE_GET_COMPOSITE (constructor)->relay)) {
SWFDEC_WARNING ("not a constructor");
goto fail;
}
@@ -1751,15 +1751,15 @@ swfdec_action_new_method (SwfdecAsContext *cx, guint action, const guint8 *data,
if (name == SWFDEC_AS_STR_EMPTY ||
SWFDEC_AS_VALUE_IS_UNDEFINED (swfdec_as_stack_peek (cx, 1))) {
} else {
- if (!SWFDEC_AS_VALUE_IS_OBJECT (constructor)) {
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (constructor)) {
SWFDEC_WARNING ("NewMethod called without an object to get variable %s from", name);
goto fail;
}
- swfdec_as_object_get_variable (SWFDEC_AS_VALUE_GET_OBJECT (constructor),
+ swfdec_as_object_get_variable (SWFDEC_AS_VALUE_GET_COMPOSITE (constructor),
name, constructor);
}
- if (!SWFDEC_AS_VALUE_IS_OBJECT (constructor) ||
- !SWFDEC_IS_AS_FUNCTION (fun = (SwfdecAsFunction *) SWFDEC_AS_VALUE_GET_OBJECT (constructor)->relay)) {
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (constructor) ||
+ !SWFDEC_IS_AS_FUNCTION (fun = (SwfdecAsFunction *) SWFDEC_AS_VALUE_GET_COMPOSITE (constructor)->relay)) {
SWFDEC_WARNING ("%s is not a constructor", name);
goto fail;
}
@@ -1798,7 +1798,7 @@ swfdec_action_init_object (SwfdecAsContext *cx, guint action, const guint8 *data
swfdec_as_stack_pop_n (cx, 2);
}
swfdec_as_stack_pop_n (cx, size);
- SWFDEC_AS_VALUE_SET_OBJECT (swfdec_as_stack_push (cx), object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (swfdec_as_stack_push (cx), object);
}
static void
@@ -1821,7 +1821,7 @@ swfdec_action_init_array (SwfdecAsContext *cx, guint action, const guint8 *data,
swfdec_as_value_set_integer (cx, &val, n);
swfdec_as_object_set_variable (array, SWFDEC_AS_STR_length, &val);
}
- SWFDEC_AS_VALUE_SET_OBJECT (swfdec_as_stack_push (cx), array);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (swfdec_as_stack_push (cx), array);
}
static void
@@ -1934,13 +1934,13 @@ swfdec_action_define_function (SwfdecAsContext *cx, guint action,
/* attach the function */
if (*function_name == '\0') {
swfdec_as_stack_ensure_free (cx, 1);
- SWFDEC_AS_VALUE_SET_OBJECT (swfdec_as_stack_push (cx),
+ SWFDEC_AS_VALUE_SET_COMPOSITE (swfdec_as_stack_push (cx),
swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (fun)));
} else {
SwfdecAsValue funval;
/* FIXME: really varobj? Not eval or sth like that? */
name = swfdec_as_context_get_string (cx, function_name);
- SWFDEC_AS_VALUE_SET_OBJECT (&funval, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (fun)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&funval, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (fun)));
swfdec_as_object_set_variable (frame->target, name, &funval);
}
@@ -2020,8 +2020,8 @@ swfdec_action_target_path (SwfdecAsContext *cx, guint action, const guint8 *data
val = swfdec_as_stack_peek (cx, 1);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (val) ||
- !SWFDEC_IS_MOVIE (movie = (SwfdecMovie *) SWFDEC_AS_VALUE_GET_OBJECT (val))) {
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (val) ||
+ !SWFDEC_IS_MOVIE (movie = (SwfdecMovie *) SWFDEC_AS_VALUE_GET_COMPOSITE (val))) {
SWFDEC_AS_VALUE_SET_UNDEFINED (val);
return;
}
@@ -2072,9 +2072,9 @@ swfdec_action_delete (SwfdecAsContext *cx, guint action, const guint8 *data, gui
name = swfdec_as_value_to_string (cx, swfdec_as_stack_peek (cx, 1));
val = swfdec_as_stack_peek (cx, 2);
- if (SWFDEC_AS_VALUE_IS_OBJECT (val)) {
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (val)) {
success = swfdec_as_object_delete_variable (
- SWFDEC_AS_VALUE_GET_OBJECT (val), name) == SWFDEC_AS_DELETE_DELETED;
+ SWFDEC_AS_VALUE_GET_COMPOSITE (val), name) == SWFDEC_AS_DELETE_DELETED;
}
SWFDEC_AS_VALUE_SET_BOOLEAN (val, success);
swfdec_as_stack_pop_n (cx, 1);
@@ -2173,7 +2173,7 @@ swfdec_action_type_of (SwfdecAsContext *cx, guint action, const guint8 *data, gu
break;
case SWFDEC_AS_TYPE_OBJECT:
{
- SwfdecAsObject *obj = SWFDEC_AS_VALUE_GET_OBJECT (val);
+ SwfdecAsObject *obj = SWFDEC_AS_VALUE_GET_COMPOSITE (val);
if (SWFDEC_IS_MOVIE (obj)) {
SwfdecMovie *movie = swfdec_movie_resolve (SWFDEC_MOVIE (obj));
if (movie != NULL && SWFDEC_IS_TEXT_FIELD_MOVIE (movie) &&
@@ -2226,9 +2226,9 @@ swfdec_action_is_instance_of (SwfdecAsObject *object,
// FIXME: propflag tests are wrong, and we shouldn't get __proto__.prototype
swfdec_as_object_get_variable (constructor, SWFDEC_AS_STR_prototype, &val);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
return FALSE;
- prototype = SWFDEC_AS_VALUE_GET_OBJECT (&val);
+ prototype = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
class = object;
while ((class = swfdec_as_object_get_prototype (class)) != NULL) {
@@ -2251,15 +2251,15 @@ swfdec_action_instance_of (SwfdecAsContext *cx, guint action,
SwfdecAsObject *object, *constructor;
val = swfdec_as_stack_pop (cx);
- if (SWFDEC_AS_VALUE_IS_OBJECT (val)) {
- constructor = SWFDEC_AS_VALUE_GET_OBJECT (val);
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (val)) {
+ constructor = SWFDEC_AS_VALUE_GET_COMPOSITE (val);
} else {
constructor = NULL;
}
val = swfdec_as_stack_pop (cx);
- if (SWFDEC_AS_VALUE_IS_OBJECT (val)) {
- object = SWFDEC_AS_VALUE_GET_OBJECT (val);
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (val)) {
+ object = SWFDEC_AS_VALUE_GET_COMPOSITE (val);
} else {
object = NULL;
}
@@ -2282,15 +2282,15 @@ swfdec_action_cast (SwfdecAsContext *cx, guint action, const guint8 *data,
SwfdecAsObject *object, *constructor;
val = swfdec_as_stack_pop (cx);
- if (SWFDEC_AS_VALUE_IS_OBJECT (val)) {
- object = SWFDEC_AS_VALUE_GET_OBJECT (val);
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (val)) {
+ object = SWFDEC_AS_VALUE_GET_COMPOSITE (val);
} else {
object = NULL;
}
val = swfdec_as_stack_pop (cx);
- if (SWFDEC_AS_VALUE_IS_OBJECT (val)) {
- constructor = SWFDEC_AS_VALUE_GET_OBJECT (val);
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (val)) {
+ constructor = SWFDEC_AS_VALUE_GET_COMPOSITE (val);
} else {
constructor = NULL;
}
@@ -2301,7 +2301,7 @@ swfdec_action_cast (SwfdecAsContext *cx, guint action, const guint8 *data,
}
if (swfdec_action_is_instance_of (object, constructor)) {
- SWFDEC_AS_VALUE_SET_OBJECT (swfdec_as_stack_push (cx), object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (swfdec_as_stack_push (cx), object);
} else {
SWFDEC_AS_VALUE_SET_NULL (swfdec_as_stack_push (cx));
}
@@ -2318,11 +2318,11 @@ swfdec_action_implements (SwfdecAsContext *cx, guint action,
swfdec_as_stack_ensure_size (cx, 2);
val = swfdec_as_stack_pop (cx);
- if (SWFDEC_AS_VALUE_IS_OBJECT (val)) {
- object = SWFDEC_AS_VALUE_GET_OBJECT (val);
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (val)) {
+ object = SWFDEC_AS_VALUE_GET_COMPOSITE (val);
swfdec_as_object_get_variable (object, SWFDEC_AS_STR_prototype, val);
- if (SWFDEC_AS_VALUE_IS_OBJECT (val)) {
- proto = SWFDEC_AS_VALUE_GET_OBJECT (val);
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (val)) {
+ proto = SWFDEC_AS_VALUE_GET_COMPOSITE (val);
} else {
proto = NULL;
}
@@ -2345,14 +2345,14 @@ swfdec_action_implements (SwfdecAsContext *cx, guint action,
return;
for (i = 0; i < argc; i++) {
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&argv[i]))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[i]))
continue;
- interface = SWFDEC_AS_VALUE_GET_OBJECT (&argv[i]);
+ interface = SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[i]);
swfdec_as_object_get_variable (interface, SWFDEC_AS_STR_prototype, val);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (val))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (val))
continue;
proto->interfaces =
- g_slist_prepend (proto->interfaces, SWFDEC_AS_VALUE_GET_OBJECT (val));
+ g_slist_prepend (proto->interfaces, SWFDEC_AS_VALUE_GET_COMPOSITE (val));
}
}
@@ -2365,24 +2365,24 @@ swfdec_action_extends (SwfdecAsContext *cx, guint action, const guint8 *data, gu
superclass = swfdec_as_stack_peek (cx, 1);
subclass = swfdec_as_stack_peek (cx, 2);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (superclass) ||
- !SWFDEC_IS_AS_FUNCTION (SWFDEC_AS_VALUE_GET_OBJECT (superclass)->relay)) {
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (superclass) ||
+ !SWFDEC_IS_AS_FUNCTION (SWFDEC_AS_VALUE_GET_COMPOSITE (superclass)->relay)) {
SWFDEC_ERROR ("superclass is not a function");
goto fail;
}
- if (!SWFDEC_AS_VALUE_IS_OBJECT (subclass)) {
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (subclass)) {
SWFDEC_ERROR ("subclass is not an object");
goto fail;
}
- super = SWFDEC_AS_VALUE_GET_OBJECT (superclass);
+ super = SWFDEC_AS_VALUE_GET_COMPOSITE (superclass);
prototype = swfdec_as_object_new_empty (cx);
swfdec_as_object_get_variable (super, SWFDEC_AS_STR_prototype, &proto);
swfdec_as_object_set_variable_and_flags (prototype, SWFDEC_AS_STR___proto__, &proto,
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
swfdec_as_object_set_variable_and_flags (prototype, SWFDEC_AS_STR___constructor__,
superclass, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_VERSION_6_UP);
- SWFDEC_AS_VALUE_SET_OBJECT (&proto, prototype);
- swfdec_as_object_set_variable (SWFDEC_AS_VALUE_GET_OBJECT (subclass),
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&proto, prototype);
+ swfdec_as_object_set_variable (SWFDEC_AS_VALUE_GET_COMPOSITE (subclass),
SWFDEC_AS_STR_prototype, &proto);
fail:
swfdec_as_stack_pop_n (cx, 2);
@@ -2439,12 +2439,12 @@ swfdec_action_enumerate2 (SwfdecAsContext *cx, guint action, const guint8 *data,
SwfdecAsObject *obj;
val = swfdec_as_stack_peek (cx, 1);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (val)) {
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (val)) {
SWFDEC_WARNING ("Enumerate called without an object");
SWFDEC_AS_VALUE_SET_UNDEFINED (val);
return;
}
- obj = SWFDEC_AS_VALUE_GET_OBJECT (val);
+ obj = SWFDEC_AS_VALUE_GET_COMPOSITE (val);
SWFDEC_AS_VALUE_SET_UNDEFINED (val);
swfdec_action_do_enumerate (cx, obj);
}
diff --git a/swfdec/swfdec_as_native_function.c b/swfdec/swfdec_as_native_function.c
index f7375af..b57daf6 100644
--- a/swfdec/swfdec_as_native_function.c
+++ b/swfdec/swfdec_as_native_function.c
@@ -196,7 +196,7 @@ swfdec_as_native_function_new_bare (SwfdecAsContext *context, const char *name,
* being CONSTANT disallows setting it. */
if (prototype) {
SwfdecAsValue val;
- SWFDEC_AS_VALUE_SET_OBJECT (&val, prototype);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, prototype);
swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_prototype,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
}
diff --git a/swfdec/swfdec_as_number.c b/swfdec/swfdec_as_number.c
index 240a46c..e6d64ff 100644
--- a/swfdec/swfdec_as_number.c
+++ b/swfdec/swfdec_as_number.c
@@ -62,7 +62,7 @@ swfdec_as_number_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
SwfdecAsNumber *num = g_object_new (SWFDEC_TYPE_AS_NUMBER, "context", cx, NULL);
num->number = d;
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (num));
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
} else {
swfdec_as_value_set_number (cx, ret, d);
}
diff --git a/swfdec/swfdec_as_object.c b/swfdec/swfdec_as_object.c
index 50e9ba1..6858686 100644
--- a/swfdec/swfdec_as_object.c
+++ b/swfdec/swfdec_as_object.c
@@ -564,9 +564,9 @@ swfdec_as_object_do_set (SwfdecAsObject *object, const char *variable,
}
if (variable == SWFDEC_AS_STR___proto__) {
- if (SWFDEC_AS_VALUE_IS_OBJECT (val) &&
- !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_OBJECT (val))) {
- object->prototype = SWFDEC_AS_VALUE_GET_OBJECT (val);
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (val) &&
+ !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (val))) {
+ object->prototype = SWFDEC_AS_VALUE_GET_COMPOSITE (val);
object->prototype_flags = var->flags;
} else {
object->prototype = NULL;
@@ -957,7 +957,7 @@ swfdec_as_object_get_variable_and_flags (SwfdecAsObject *object,
swfdec_as_object_hash_lookup (cur, SWFDEC_AS_STR___resolve);
if (var != NULL && (swfdec_gc_object_get_context (object)->version <= 6 ||
- SWFDEC_AS_VALUE_IS_OBJECT (&var->value)))
+ SWFDEC_AS_VALUE_IS_COMPOSITE (&var->value)))
resolve = cur;
}
cur = swfdec_as_object_get_prototype_internal (cur);
@@ -982,9 +982,9 @@ swfdec_as_object_get_variable_and_flags (SwfdecAsObject *object,
var = swfdec_as_object_hash_lookup (resolve, SWFDEC_AS_STR___resolve);
g_assert (var != NULL);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&var->value))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&var->value))
return FALSE;
- fun = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_OBJECT (&var->value)->relay);
+ fun = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_COMPOSITE (&var->value)->relay);
if (!SWFDEC_IS_AS_FUNCTION (fun))
return FALSE;
SWFDEC_AS_VALUE_SET_STRING (&argv, variable);
@@ -1195,7 +1195,7 @@ swfdec_as_object_add_function (SwfdecAsObject *object, const char *name, SwfdecA
function = swfdec_as_native_function_new (cx, name, native, NULL);
name = swfdec_as_context_get_string (cx, name);
- SWFDEC_AS_VALUE_SET_OBJECT (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (function)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (function)));
/* FIXME: I'd like to make sure no such property exists yet */
swfdec_as_object_set_variable_and_flags (object, name, &val,
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
@@ -1261,9 +1261,9 @@ swfdec_as_object_call (SwfdecAsObject *object, const char *name, guint argc,
if (return_value)
SWFDEC_AS_VALUE_SET_UNDEFINED (return_value);
swfdec_as_object_get_variable (object, name, &tmp);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&tmp))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&tmp))
return FALSE;
- fun = (SwfdecAsFunction *) SWFDEC_AS_VALUE_GET_OBJECT (&tmp)->relay;
+ fun = (SwfdecAsFunction *) SWFDEC_AS_VALUE_GET_COMPOSITE (&tmp)->relay;
if (!SWFDEC_IS_AS_FUNCTION (fun))
return FALSE;
swfdec_as_function_call (fun, object, argc, argv, return_value ? return_value : &tmp);
@@ -1300,7 +1300,7 @@ swfdec_as_object_create (SwfdecAsFunction *fun, guint n_args,
swfdec_as_object_set_variable_and_flags (new, SWFDEC_AS_STR___proto__,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
}
- SWFDEC_AS_VALUE_SET_OBJECT (&val, fun_object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, fun_object);
if (context->version < 7) {
swfdec_as_object_set_variable_and_flags (new, SWFDEC_AS_STR_constructor,
&val, SWFDEC_AS_VARIABLE_HIDDEN);
@@ -1342,11 +1342,11 @@ swfdec_as_object_set_constructor_by_namev (SwfdecAsObject *object,
do {
val = swfdec_as_object_peek_variable (cur, name);
if (val == NULL ||
- !SWFDEC_AS_VALUE_IS_OBJECT (val)) {
+ !SWFDEC_AS_VALUE_IS_COMPOSITE (val)) {
SWFDEC_WARNING ("could not find constructor %s", name);
return NULL;
}
- cur = SWFDEC_AS_VALUE_GET_OBJECT (val);
+ cur = SWFDEC_AS_VALUE_GET_COMPOSITE (val);
name = va_arg (args, const char *);
} while (name != NULL);
swfdec_as_object_set_constructor (object, cur);
@@ -1373,7 +1373,7 @@ swfdec_as_object_set_constructor (SwfdecAsObject *object, SwfdecAsObject *constr
g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
g_return_if_fail (SWFDEC_IS_AS_OBJECT (construct));
- SWFDEC_AS_VALUE_SET_OBJECT (&val, construct);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, construct);
swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_constructor,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
if (swfdec_as_object_get_variable (SWFDEC_AS_OBJECT (construct),
@@ -1456,11 +1456,11 @@ swfdec_as_object_addProperty (SwfdecAsContext *cx, SwfdecAsObject *object,
if (argc < 3)
return;
name = swfdec_as_value_to_string (cx, &argv[0]);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&argv[1]) ||
- !SWFDEC_IS_AS_FUNCTION ((get = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_OBJECT (&argv[1])->relay))))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[1]) ||
+ !SWFDEC_IS_AS_FUNCTION ((get = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[1])->relay))))
return;
- if (SWFDEC_AS_VALUE_IS_OBJECT (&argv[2])) {
- set = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_OBJECT (&argv[2])->relay);
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[2])) {
+ set = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[2])->relay);
if (!SWFDEC_IS_AS_FUNCTION (set))
return;
} else if (SWFDEC_AS_VALUE_IS_NULL (&argv[2])) {
@@ -1574,10 +1574,10 @@ swfdec_as_object_watch (SwfdecAsContext *cx, SwfdecAsObject *object,
name = swfdec_as_value_to_string (cx, &argv[0]);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&argv[1]))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[1]))
return;
- if (!SWFDEC_IS_AS_FUNCTION (SWFDEC_AS_VALUE_GET_OBJECT (&argv[1])->relay))
+ if (!SWFDEC_IS_AS_FUNCTION (SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[1])->relay))
return;
if (object->watches == NULL) {
@@ -1588,12 +1588,12 @@ swfdec_as_object_watch (SwfdecAsContext *cx, SwfdecAsObject *object,
watch = g_hash_table_lookup (object->watches, name);
}
if (watch == NULL) {
- watch = swfdec_as_watch_new (SWFDEC_AS_FUNCTION (SWFDEC_AS_VALUE_GET_OBJECT (&argv[1])->relay));
+ watch = swfdec_as_watch_new (SWFDEC_AS_FUNCTION (SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[1])->relay));
if (watch == NULL)
return;
g_hash_table_insert (object->watches, (char *) name, watch);
} else {
- watch->watch = SWFDEC_AS_FUNCTION (SWFDEC_AS_VALUE_GET_OBJECT (&argv[1])->relay);
+ watch->watch = SWFDEC_AS_FUNCTION (SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[1])->relay);
}
if (argc >= 3) {
@@ -1645,7 +1645,7 @@ swfdec_as_object_valueOf (SwfdecAsContext *cx, SwfdecAsObject *object,
guint argc, SwfdecAsValue *argv, SwfdecAsValue *retval)
{
if (object != NULL)
- SWFDEC_AS_VALUE_SET_OBJECT (retval, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (retval, object);
}
SWFDEC_AS_NATIVE (101, 4, swfdec_as_object_toString)
@@ -1718,10 +1718,10 @@ swfdec_as_object_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
SwfdecAsObject *result = swfdec_as_value_to_object (cx, &argv[0]);
if (result != NULL) {
if (!cx->frame->construct) {
- SWFDEC_AS_VALUE_SET_OBJECT (ret, result);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, result);
} else {
SWFDEC_FIXME ("new Object (x) should return x");
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
}
return;
}
@@ -1730,7 +1730,7 @@ swfdec_as_object_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
if (!cx->frame->construct)
object = swfdec_as_object_new_empty (cx);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
}
void
@@ -1749,13 +1749,13 @@ swfdec_as_object_init_context (SwfdecAsContext *context)
fun_proto = swfdec_as_object_new_empty (context);
/* initialize Function */
- SWFDEC_AS_VALUE_SET_OBJECT (&val, function);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, function);
swfdec_as_object_set_variable_and_flags (context->global, SWFDEC_AS_STR_Function, &val,
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT | SWFDEC_AS_VARIABLE_VERSION_6_UP);
- SWFDEC_AS_VALUE_SET_OBJECT (&val, function);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, function);
swfdec_as_object_set_variable_and_flags (function, SWFDEC_AS_STR_constructor,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
- SWFDEC_AS_VALUE_SET_OBJECT (&val, fun_proto);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, fun_proto);
swfdec_as_object_set_variable_and_flags (function, SWFDEC_AS_STR_prototype,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
swfdec_as_object_set_variable_and_flags (function, SWFDEC_AS_STR___proto__,
@@ -1763,33 +1763,33 @@ swfdec_as_object_init_context (SwfdecAsContext *context)
SWFDEC_AS_VARIABLE_VERSION_6_UP);
/* initialize Function.prototype */
- SWFDEC_AS_VALUE_SET_OBJECT (&val, function);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, function);
swfdec_as_object_set_variable_and_flags (fun_proto, SWFDEC_AS_STR_constructor,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
- SWFDEC_AS_VALUE_SET_OBJECT (&val, obj_proto);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, obj_proto);
swfdec_as_object_set_variable_and_flags (fun_proto,
SWFDEC_AS_STR___proto__, &val,
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
/* initialize Object */
- SWFDEC_AS_VALUE_SET_OBJECT (&val, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, object);
swfdec_as_object_set_variable_and_flags (context->global, SWFDEC_AS_STR_Object, &val,
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
- SWFDEC_AS_VALUE_SET_OBJECT (&val, function);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, function);
swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_constructor,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
- SWFDEC_AS_VALUE_SET_OBJECT (&val, fun_proto);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, fun_proto);
swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR___proto__,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT |
SWFDEC_AS_VARIABLE_VERSION_6_UP);
- SWFDEC_AS_VALUE_SET_OBJECT (&val, obj_proto);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, obj_proto);
swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_prototype,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT |
SWFDEC_AS_VARIABLE_CONSTANT);
/* initialize Object.prototype */
- SWFDEC_AS_VALUE_SET_OBJECT (&val, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, object);
swfdec_as_object_set_variable_and_flags (obj_proto, SWFDEC_AS_STR_constructor,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
}
diff --git a/swfdec/swfdec_as_relay.c b/swfdec/swfdec_as_relay.c
index 2123aa1..414ad29 100644
--- a/swfdec/swfdec_as_relay.c
+++ b/swfdec/swfdec_as_relay.c
@@ -107,9 +107,9 @@ swfdec_as_relay_call (SwfdecAsRelay *relay, const char *name, guint argc,
if (return_value)
SWFDEC_AS_VALUE_SET_UNDEFINED (return_value);
swfdec_as_object_get_variable (relay->relay, name, &tmp);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&tmp))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&tmp))
return FALSE;
- fun = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_OBJECT (&tmp)->relay);
+ fun = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_COMPOSITE (&tmp)->relay);
if (!SWFDEC_IS_AS_FUNCTION (fun))
return FALSE;
swfdec_as_function_call (fun, relay->relay, argc, argv, return_value ? return_value : &tmp);
diff --git a/swfdec/swfdec_as_script_function.c b/swfdec/swfdec_as_script_function.c
index 32d74a3..c3fb58b 100644
--- a/swfdec/swfdec_as_script_function.c
+++ b/swfdec/swfdec_as_script_function.c
@@ -166,16 +166,16 @@ swfdec_as_script_function_new (SwfdecAsObject *target, const GSList *scope_chain
/* set prototype */
proto = swfdec_as_object_new_empty (context);
- SWFDEC_AS_VALUE_SET_OBJECT (&val, proto);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, proto);
swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_prototype,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
- SWFDEC_AS_VALUE_SET_OBJECT (&val, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, object);
swfdec_as_object_set_variable_and_flags (proto, SWFDEC_AS_STR_constructor,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
tmp = swfdec_as_object_peek_variable (context->global, SWFDEC_AS_STR_Object);
- if (tmp && SWFDEC_AS_VALUE_IS_OBJECT (tmp)) {
- tmp = swfdec_as_object_peek_variable (SWFDEC_AS_VALUE_GET_OBJECT (tmp),
+ if (tmp && SWFDEC_AS_VALUE_IS_COMPOSITE (tmp)) {
+ tmp = swfdec_as_object_peek_variable (SWFDEC_AS_VALUE_GET_COMPOSITE (tmp),
SWFDEC_AS_STR_prototype);
if (tmp) {
swfdec_as_object_set_variable_and_flags (proto, SWFDEC_AS_STR___proto__,
diff --git a/swfdec/swfdec_as_string.c b/swfdec/swfdec_as_string.c
index 772140d..572cd19 100644
--- a/swfdec/swfdec_as_string.c
+++ b/swfdec/swfdec_as_string.c
@@ -63,7 +63,7 @@ swfdec_as_string_init (SwfdecAsString *string)
#define SWFDEC_AS_STRING_CHECK(result,...) G_STMT_START {\
if (object) {\
SwfdecAsValue _tmp; \
- SWFDEC_AS_VALUE_SET_OBJECT (&_tmp, object); \
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&_tmp, object); \
*(result) = swfdec_as_value_to_string (cx, &_tmp);\
} else {\
*(result) = SWFDEC_AS_STR_undefined; \
@@ -298,7 +298,7 @@ swfdec_as_string_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_length,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
} else {
SWFDEC_AS_VALUE_SET_STRING (ret, s);
}
@@ -340,7 +340,7 @@ swfdec_as_string_split_5 (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_STRING_CHECK (&str, "");
arr = swfdec_as_array_new (cx);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, SWFDEC_AS_OBJECT (arr));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, SWFDEC_AS_OBJECT (arr));
/* hi, i'm the special case */
if (argc < 1 || SWFDEC_AS_VALUE_IS_UNDEFINED (&argv[0])) {
delim = SWFDEC_AS_STR_COMMA;
@@ -392,7 +392,7 @@ swfdec_as_string_split_6 (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_STRING_CHECK (&str, "");
arr = swfdec_as_array_new (cx);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, SWFDEC_AS_OBJECT (arr));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, SWFDEC_AS_OBJECT (arr));
/* hi, i'm the special case */
if (argc < 1 || SWFDEC_AS_VALUE_IS_UNDEFINED (&argv[0])) {
SWFDEC_AS_VALUE_SET_STRING (&val, str);
diff --git a/swfdec/swfdec_as_super.c b/swfdec/swfdec_as_super.c
index f6b2f16..498072f 100644
--- a/swfdec/swfdec_as_super.c
+++ b/swfdec/swfdec_as_super.c
@@ -49,8 +49,8 @@ swfdec_as_super_call (SwfdecAsFunction *function, SwfdecAsObject *thisp,
}
swfdec_as_object_get_variable (super->object, SWFDEC_AS_STR___constructor__, &val);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&val) ||
- !SWFDEC_IS_AS_FUNCTION (fun = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_OBJECT (&val)->relay)))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val) ||
+ !SWFDEC_IS_AS_FUNCTION (fun = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_COMPOSITE (&val)->relay)))
return;
if (construct) {
diff --git a/swfdec/swfdec_as_types.c b/swfdec/swfdec_as_types.c
index 8485d84..e4bb3fe 100644
--- a/swfdec/swfdec_as_types.c
+++ b/swfdec/swfdec_as_types.c
@@ -149,7 +149,7 @@
*/
/**
- * SWFDEC_AS_VALUE_GET_OBJECT:
+ * SWFDEC_AS_VALUE_GET_COMPOSITE:
* @val: value to get, the value must reference an object
*
* Gets the object associated with @val. If you are not sure that the value is
@@ -159,7 +159,7 @@
*/
/**
- * SWFDEC_AS_VALUE_SET_OBJECT:
+ * SWFDEC_AS_VALUE_SET_COMPOSITE:
* @val: value to set
* @o: garbage-collected #SwfdecAsObject to use
*
@@ -403,7 +403,7 @@ swfdec_as_value_to_string (SwfdecAsContext *context, const SwfdecAsValue *value)
return swfdec_as_double_to_string (context, SWFDEC_AS_VALUE_GET_NUMBER (value));
case SWFDEC_AS_TYPE_OBJECT:
{
- SwfdecAsObject *object = SWFDEC_AS_VALUE_GET_OBJECT (value);
+ SwfdecAsObject *object = SWFDEC_AS_VALUE_GET_COMPOSITE (value);
if (SWFDEC_IS_MOVIE (object)) {
SwfdecMovie *movie = swfdec_movie_resolve (SWFDEC_MOVIE (object));
if (movie == NULL) {
@@ -419,9 +419,9 @@ swfdec_as_value_to_string (SwfdecAsContext *context, const SwfdecAsValue *value)
swfdec_as_object_call (object, SWFDEC_AS_STR_toString, 0, NULL, &ret);
if (SWFDEC_AS_VALUE_IS_STRING (&ret))
return SWFDEC_AS_VALUE_GET_STRING (&ret);
- else if (SWFDEC_IS_AS_SUPER (SWFDEC_AS_VALUE_GET_OBJECT (value)->relay))
+ else if (SWFDEC_IS_AS_SUPER (SWFDEC_AS_VALUE_GET_COMPOSITE (value)->relay))
return SWFDEC_AS_STR__type_Object_;
- else if (SWFDEC_IS_AS_FUNCTION (SWFDEC_AS_VALUE_GET_OBJECT (value)->relay))
+ else if (SWFDEC_IS_AS_FUNCTION (SWFDEC_AS_VALUE_GET_COMPOSITE (value)->relay))
return SWFDEC_AS_STR__type_Function_;
else
return SWFDEC_AS_STR__type_Object_;
@@ -580,7 +580,7 @@ swfdec_as_value_to_object (SwfdecAsContext *context, const SwfdecAsValue *value)
s = SWFDEC_AS_STR_Boolean;
break;
case SWFDEC_AS_TYPE_OBJECT:
- return SWFDEC_AS_VALUE_GET_OBJECT (value);
+ return SWFDEC_AS_VALUE_GET_COMPOSITE (value);
case SWFDEC_AS_TYPE_INT:
default:
g_assert_not_reached ();
@@ -588,12 +588,12 @@ swfdec_as_value_to_object (SwfdecAsContext *context, const SwfdecAsValue *value)
}
swfdec_as_object_get_variable (context->global, s, &val);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&val) ||
- !SWFDEC_IS_AS_FUNCTION (fun = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_OBJECT (&val)->relay)))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val) ||
+ !SWFDEC_IS_AS_FUNCTION (fun = (SwfdecAsFunction *) (SWFDEC_AS_VALUE_GET_COMPOSITE (&val)->relay)))
return NULL;
swfdec_as_object_create (fun, 1, value, &val);
- if (SWFDEC_AS_VALUE_IS_OBJECT (&val)) {
- return SWFDEC_AS_VALUE_GET_OBJECT (&val);
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (&val)) {
+ return SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
} else {
SWFDEC_ERROR ("did not construct an object");
return NULL;
@@ -658,8 +658,8 @@ swfdec_as_value_to_primitive (SwfdecAsValue *value)
{
g_return_if_fail (SWFDEC_IS_AS_VALUE (value));
- if (SWFDEC_AS_VALUE_IS_OBJECT (value) && !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_OBJECT (value))) {
- swfdec_as_object_call (SWFDEC_AS_VALUE_GET_OBJECT (value), SWFDEC_AS_STR_valueOf,
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (value) && !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (value))) {
+ swfdec_as_object_call (SWFDEC_AS_VALUE_GET_COMPOSITE (value), SWFDEC_AS_STR_valueOf,
0, NULL, value);
}
}
diff --git a/swfdec/swfdec_as_types.h b/swfdec/swfdec_as_types.h
index 5a89916..c79cdb7 100644
--- a/swfdec/swfdec_as_types.h
+++ b/swfdec/swfdec_as_types.h
@@ -102,6 +102,17 @@ struct _SwfdecAsDoubleValue {
#define SWFDEC_AS_VALUE_IS_NULL(val) (SWFDEC_AS_VALUE_GET_TYPE (val) == SWFDEC_AS_TYPE_NULL)
#define SWFDEC_AS_VALUE_SET_NULL(val) (val)->type = SWFDEC_AS_TYPE_NULL
+#define SWFDEC_AS_VALUE_IS_COMPOSITE(val) (SWFDEC_AS_VALUE_GET_TYPE (val) >= SWFDEC_AS_TYPE_OBJECT)
+#define SWFDEC_AS_VALUE_IS_PRIMITIVE(val) (!SWFDEC_AS_VALUE_IS_COMPOSITE(val))
+#define SWFDEC_AS_VALUE_GET_COMPOSITE(val) ((val)->value.object)
+#define SWFDEC_AS_VALUE_SET_COMPOSITE(val,o) G_STMT_START { \
+ SwfdecAsValue *__val = (val); \
+ SwfdecAsObject *__o = (o); \
+ g_assert (__o != NULL); \
+ (__val)->type = SWFDEC_AS_TYPE_OBJECT; \
+ (__val)->value.object = __o; \
+} G_STMT_END
+
#define SWFDEC_AS_VALUE_IS_OBJECT(val) (SWFDEC_AS_VALUE_GET_TYPE (val) == SWFDEC_AS_TYPE_OBJECT)
#define SWFDEC_AS_VALUE_GET_OBJECT(val) ((val)->value.object)
#define SWFDEC_AS_VALUE_SET_OBJECT(val,o) G_STMT_START { \
diff --git a/swfdec/swfdec_asbroadcaster.c b/swfdec/swfdec_asbroadcaster.c
index f15b828..091376a 100644
--- a/swfdec/swfdec_asbroadcaster.c
+++ b/swfdec/swfdec_asbroadcaster.c
@@ -51,10 +51,10 @@ broadcastMessage (SwfdecAsContext *cx, SwfdecAsObject *object,
argc--;
swfdec_as_object_get_variable (object, SWFDEC_AS_STR__listeners, &val);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
return;
- listeners = SWFDEC_AS_VALUE_GET_OBJECT (&val);
+ listeners = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
swfdec_as_object_get_variable (listeners, SWFDEC_AS_STR_length, &val);
length = swfdec_as_value_to_integer (cx, &val);
diff --git a/swfdec/swfdec_bitmap_data.c b/swfdec/swfdec_bitmap_data.c
index e57c085..55d9605 100644
--- a/swfdec/swfdec_bitmap_data.c
+++ b/swfdec/swfdec_bitmap_data.c
@@ -171,7 +171,7 @@ swfdec_bitmap_data_loadBitmap (SwfdecAsContext *cx, SwfdecAsObject *object,
cairo_paint (cr);
cairo_destroy (cr);
cairo_surface_destroy (isurface);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (bitmap)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (bitmap)));
}
// properties
@@ -231,17 +231,17 @@ swfdec_bitmap_data_get_rectangle (SwfdecAsContext *cx, SwfdecAsObject *object,
return;
swfdec_as_object_get_variable (cx->global, SWFDEC_AS_STR_flash, args);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (args))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (args))
return;
- o = SWFDEC_AS_VALUE_GET_OBJECT (args);
+ o = SWFDEC_AS_VALUE_GET_COMPOSITE (args);
swfdec_as_object_get_variable (o, SWFDEC_AS_STR_geom, args);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (args))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (args))
return;
- o = SWFDEC_AS_VALUE_GET_OBJECT (args);
+ o = SWFDEC_AS_VALUE_GET_COMPOSITE (args);
swfdec_as_object_get_variable (o, SWFDEC_AS_STR_Rectangle, args);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (args))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (args))
return;
- o = SWFDEC_AS_VALUE_GET_OBJECT (args);
+ o = SWFDEC_AS_VALUE_GET_COMPOSITE (args);
if (!SWFDEC_IS_AS_FUNCTION (o->relay))
return;
@@ -733,7 +733,7 @@ swfdec_bitmap_data_clone (SwfdecAsContext *cx, SwfdecAsObject *object,
cairo_set_source_surface (cr, bitmap->surface, 0, 0);
cairo_paint (cr);
cairo_destroy (cr);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (clone)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (clone)));
}
SWFDEC_AS_NATIVE (1100, 22, swfdec_bitmap_data_do_dispose)
@@ -802,7 +802,7 @@ swfdec_bitmap_data_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
cairo_destroy (cr);
}
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (bitmap));
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
}
/*** PUBLIC API ***/
diff --git a/swfdec/swfdec_blur_filter_as.c b/swfdec/swfdec_blur_filter_as.c
index 162f7f4..a4e3f0f 100644
--- a/swfdec/swfdec_blur_filter_as.c
+++ b/swfdec/swfdec_blur_filter_as.c
@@ -125,5 +125,5 @@ swfdec_blur_filter_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
filter->quality = CLAMP (quality, 0, 15);
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (filter));
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
}
diff --git a/swfdec/swfdec_color_as.c b/swfdec/swfdec_color_as.c
index c90ad70..9439409 100644
--- a/swfdec/swfdec_color_as.c
+++ b/swfdec/swfdec_color_as.c
@@ -41,10 +41,10 @@ swfdec_movie_color_get_movie (SwfdecAsObject *object)
return NULL;
swfdec_as_object_get_variable (object, SWFDEC_AS_STR_target, &val);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
return NULL;
- target = SWFDEC_AS_VALUE_GET_OBJECT (&val);
+ target = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
if (!SWFDEC_IS_MOVIE (target))
return NULL;
@@ -102,7 +102,7 @@ swfdec_movie_color_getTransform (SwfdecAsContext *cx, SwfdecAsObject *obj,
add_variable (ret, SWFDEC_AS_STR_gb, movie->color_transform.gb);
add_variable (ret, SWFDEC_AS_STR_bb, movie->color_transform.bb);
add_variable (ret, SWFDEC_AS_STR_ab, movie->color_transform.ab);
- SWFDEC_AS_VALUE_SET_OBJECT (rval, ret);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (rval, ret);
}
SWFDEC_AS_NATIVE (700, 0, swfdec_movie_color_setRGB)
@@ -164,9 +164,9 @@ swfdec_movie_color_setTransform (SwfdecAsContext *cx, SwfdecAsObject *obj,
if (movie == NULL)
return;
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&argv[0]))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[0]))
return;
- parse = SWFDEC_AS_VALUE_GET_OBJECT (&argv[0]);
+ parse = SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0]);
parse_property (parse, SWFDEC_AS_STR_ra, &movie->color_transform.ra, TRUE);
parse_property (parse, SWFDEC_AS_STR_ga, &movie->color_transform.ga, TRUE);
parse_property (parse, SWFDEC_AS_STR_ba, &movie->color_transform.ba, TRUE);
diff --git a/swfdec/swfdec_color_matrix_filter_as.c b/swfdec/swfdec_color_matrix_filter_as.c
index 726e123..2f606ce 100644
--- a/swfdec/swfdec_color_matrix_filter_as.c
+++ b/swfdec/swfdec_color_matrix_filter_as.c
@@ -49,7 +49,7 @@ swfdec_color_matrix_filter_get_matrix (SwfdecAsContext *cx,
}
array = swfdec_as_array_new (cx);
swfdec_as_array_append (array, 20, val);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, array);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, array);
}
static void
@@ -106,5 +106,5 @@ swfdec_color_matrix_filter_contruct (SwfdecAsContext *cx,
swfdec_color_matrix_filter_do_set_matrix (cm, array);
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (cm));
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
}
diff --git a/swfdec/swfdec_color_transform_as.c b/swfdec/swfdec_color_transform_as.c
index 953217a..d1e3b6c 100644
--- a/swfdec/swfdec_color_transform_as.c
+++ b/swfdec/swfdec_color_transform_as.c
@@ -344,7 +344,7 @@ swfdec_color_transform_as_construct (SwfdecAsContext *cx,
transform = g_object_new (SWFDEC_TYPE_COLOR_TRANSFORM_AS, "context", cx, NULL);
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (transform));
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
if (argc < 8)
return;
diff --git a/swfdec/swfdec_file_reference.c b/swfdec/swfdec_file_reference.c
index 4bbcd32..e69ec01 100644
--- a/swfdec/swfdec_file_reference.c
+++ b/swfdec/swfdec_file_reference.c
@@ -113,8 +113,8 @@ swfdec_file_reference_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_STUB ("FileReference");
- if (argc > 0 && SWFDEC_AS_VALUE_IS_OBJECT (&argv[0])) {
- target = SWFDEC_AS_VALUE_GET_OBJECT (&argv[0]);
+ if (argc > 0 && SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[0])) {
+ target = SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0]);
} else {
target = object;
if (target == NULL)
diff --git a/swfdec/swfdec_filter_as.c b/swfdec/swfdec_filter_as.c
index f02108d..691a12c 100644
--- a/swfdec/swfdec_filter_as.c
+++ b/swfdec/swfdec_filter_as.c
@@ -37,6 +37,6 @@ swfdec_filter_do_clone (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_FILTER, &filter, "");
filter = swfdec_filter_clone (filter);
- SWFDEC_AS_VALUE_SET_OBJECT (retval, SWFDEC_AS_OBJECT (filter));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (retval, SWFDEC_AS_OBJECT (filter));
}
diff --git a/swfdec/swfdec_load_object_as.c b/swfdec/swfdec_load_object_as.c
index d25b3a2..a38a251 100644
--- a/swfdec/swfdec_load_object_as.c
+++ b/swfdec/swfdec_load_object_as.c
@@ -129,11 +129,11 @@ swfdec_load_object_as_get_headers (SwfdecAsObject *object, guint *header_count,
if (!swfdec_as_object_get_variable (object, SWFDEC_AS_STR__customHeaders,
&val))
goto end;
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&val)) {
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val)) {
SWFDEC_WARNING ("_customHeaders is not an object");
goto end;
}
- list = SWFDEC_AS_VALUE_GET_OBJECT (&val);
+ list = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
swfdec_as_object_get_variable (list, SWFDEC_AS_STR_length, &val);
length = swfdec_as_value_to_integer (cx, &val);
@@ -192,7 +192,7 @@ swfdec_load_object_as_send (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_VALUE_SET_BOOLEAN (rval, FALSE);
SWFDEC_AS_CHECK (SWFDEC_TYPE_AS_OBJECT, &object, "s|ss", &url, &target, &method);
- SWFDEC_AS_VALUE_SET_OBJECT (&val, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, object);
data = swfdec_as_value_to_string (cx, &val);
if (method == NULL || g_ascii_strcasecmp (method, "GET") == 0) {
@@ -228,7 +228,7 @@ swfdec_load_object_as_sendAndLoad (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_AS_OBJECT, &object, "sO|s", &url, &target,
&method);
- SWFDEC_AS_VALUE_SET_OBJECT (&val, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, object);
data = swfdec_as_value_to_string (cx, &val);
if (method != NULL && g_ascii_strcasecmp (method, "GET") == 0) {
diff --git a/swfdec/swfdec_movie.c b/swfdec/swfdec_movie.c
index 5f3d704..c59a27d 100644
--- a/swfdec/swfdec_movie.c
+++ b/swfdec/swfdec_movie.c
@@ -1138,7 +1138,7 @@ swfdec_movie_get_variable (SwfdecAsObject *object, SwfdecAsObject *orig,
/* FIXME: check that this is correct */
if (swfdec_gc_object_get_context (object)->version > 5 && variable == SWFDEC_AS_STR__global) {
- SWFDEC_AS_VALUE_SET_OBJECT (val, swfdec_as_relay_get_as_object (
+ SWFDEC_AS_VALUE_SET_COMPOSITE (val, swfdec_as_relay_get_as_object (
SWFDEC_AS_RELAY (movie->resource->sandbox)));
*flags = 0;
return TRUE;
@@ -1146,7 +1146,7 @@ swfdec_movie_get_variable (SwfdecAsObject *object, SwfdecAsObject *orig,
ret = swfdec_movie_get_by_name (movie, variable, FALSE);
if (ret) {
- SWFDEC_AS_VALUE_SET_OBJECT (val, SWFDEC_AS_OBJECT (ret));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (val, SWFDEC_AS_OBJECT (ret));
*flags = 0;
return TRUE;
}
@@ -1264,7 +1264,7 @@ swfdec_movie_foreach_variable (SwfdecAsObject *object, SwfdecAsVariableForeach f
SwfdecMovie *cur = walk->data;
if (cur->original_name == SWFDEC_AS_STR_EMPTY)
continue;
- SWFDEC_AS_VALUE_SET_OBJECT (&val, walk->data);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, walk->data);
ret &= func (object, cur->name, &val, 0, data);
}
diff --git a/swfdec/swfdec_movie_asprops.c b/swfdec/swfdec_movie_asprops.c
index 23fe3a9..13ad0e6 100644
--- a/swfdec/swfdec_movie_asprops.c
+++ b/swfdec/swfdec_movie_asprops.c
@@ -332,7 +332,7 @@ static void
mc_parent (SwfdecMovie *movie, SwfdecAsValue *rval)
{
if (movie->parent) {
- SWFDEC_AS_VALUE_SET_OBJECT (rval, SWFDEC_AS_OBJECT (movie->parent));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (rval, SWFDEC_AS_OBJECT (movie->parent));
} else {
SWFDEC_AS_VALUE_SET_UNDEFINED (rval);
}
@@ -342,7 +342,7 @@ static void
mc_root (SwfdecMovie *movie, SwfdecAsValue *rval)
{
movie = swfdec_movie_get_root (movie);
- SWFDEC_AS_VALUE_SET_OBJECT (rval, SWFDEC_AS_OBJECT (movie));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (rval, SWFDEC_AS_OBJECT (movie));
}
static void
diff --git a/swfdec/swfdec_movie_clip_loader.c b/swfdec/swfdec_movie_clip_loader.c
index d8a15aa..3277084 100644
--- a/swfdec/swfdec_movie_clip_loader.c
+++ b/swfdec/swfdec_movie_clip_loader.c
@@ -59,13 +59,13 @@ swfdec_movie_clip_loader_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (loader));
array = swfdec_as_array_new (cx);
- SWFDEC_AS_VALUE_SET_OBJECT (&val, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, object);
swfdec_as_array_push (array, &val);
- SWFDEC_AS_VALUE_SET_OBJECT (&val, array);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, array);
swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR__listeners,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
}
SWFDEC_AS_NATIVE (112, 100, swfdec_movie_clip_loader_loadClip)
@@ -116,7 +116,7 @@ swfdec_movie_clip_loader_getProgress (SwfdecAsContext *cx, SwfdecAsObject *objec
if (movie == NULL)
return;
ret = swfdec_as_object_new_empty (cx);
- SWFDEC_AS_VALUE_SET_OBJECT (rval, ret);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (rval, ret);
resource = swfdec_movie_get_own_resource (movie);
if (resource == NULL || resource->decoder == NULL) {
swfdec_as_value_set_integer (cx, &loaded, 0);
diff --git a/swfdec/swfdec_net_connection.c b/swfdec/swfdec_net_connection.c
index 29f0a04..48f7a35 100644
--- a/swfdec/swfdec_net_connection.c
+++ b/swfdec/swfdec_net_connection.c
@@ -75,7 +75,7 @@ swfdec_net_connection_onstatus (SwfdecNetConnection *conn, const char *code,
SWFDEC_AS_VALUE_SET_STRING (&value, description);
swfdec_as_object_set_variable (info, SWFDEC_AS_STR_description, &value);
}
- SWFDEC_AS_VALUE_SET_OBJECT (&value, info);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&value, info);
swfdec_as_relay_call (SWFDEC_AS_RELAY(conn), SWFDEC_AS_STR_onStatus, 1, &value, NULL);
}
diff --git a/swfdec/swfdec_net_stream.c b/swfdec/swfdec_net_stream.c
index e039f51..50e0673 100644
--- a/swfdec/swfdec_net_stream.c
+++ b/swfdec/swfdec_net_stream.c
@@ -55,7 +55,7 @@ swfdec_net_stream_onstatus (SwfdecNetStream *stream, const char *code, const cha
SWFDEC_AS_VALUE_SET_STRING (&val, level);
swfdec_as_object_set_variable (object, SWFDEC_AS_STR_level, &val);
- SWFDEC_AS_VALUE_SET_OBJECT (&val, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, object);
if (!swfdec_as_relay_call (SWFDEC_AS_RELAY (stream),
SWFDEC_AS_STR_onStatus, 1, &val, NULL)) {
// if it's an error message and the stream object didn't have onStatus
@@ -65,8 +65,8 @@ swfdec_net_stream_onstatus (SwfdecNetStream *stream, const char *code, const cha
swfdec_as_object_get_variable (cx->global,
SWFDEC_AS_STR_System, &system);
- if (SWFDEC_AS_VALUE_IS_OBJECT (&system)) {
- swfdec_as_object_call (SWFDEC_AS_VALUE_GET_OBJECT (&system),
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (&system)) {
+ swfdec_as_object_call (SWFDEC_AS_VALUE_GET_COMPOSITE (&system),
SWFDEC_AS_STR_onStatus, 1, &val, NULL);
}
}
diff --git a/swfdec/swfdec_net_stream_as.c b/swfdec/swfdec_net_stream_as.c
index 3bcf974..9f121a2 100644
--- a/swfdec/swfdec_net_stream_as.c
+++ b/swfdec/swfdec_net_stream_as.c
@@ -295,13 +295,13 @@ swfdec_net_stream_construct (SwfdecAsContext *cx, SwfdecAsObject *obj, guint arg
swfdec_net_stream_setup (cx, obj, 0, NULL, rval);
if (argc == 0 ||
- !SWFDEC_AS_VALUE_IS_OBJECT (&argv[0]) ||
- !SWFDEC_IS_NET_CONNECTION ((conn = (SwfdecNetConnection *) SWFDEC_AS_VALUE_GET_OBJECT (&argv[0])))) {
+ !SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[0]) ||
+ !SWFDEC_IS_NET_CONNECTION ((conn = (SwfdecNetConnection *) SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0])))) {
SWFDEC_WARNING ("no connection passed to NetStream ()");
return;
}
stream->conn = conn;
- SWFDEC_AS_VALUE_SET_OBJECT (rval, obj);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (rval, obj);
}
void
@@ -322,16 +322,16 @@ swfdec_net_stream_init_context (SwfdecPlayer *player)
swfdec_as_object_add_function (proto, SWFDEC_AS_STR_pause, swfdec_net_stream_pause);
swfdec_as_object_add_function (proto, SWFDEC_AS_STR_play, swfdec_net_stream_play);
swfdec_as_object_add_function (proto, SWFDEC_AS_STR_seek, swfdec_net_stream_do_seek);
- SWFDEC_AS_VALUE_SET_OBJECT (&val, stream);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, stream);
swfdec_as_object_set_variable_and_flags (proto, SWFDEC_AS_STR_constructor,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
swfdec_as_object_get_variable (context->global, SWFDEC_AS_STR_Object, &val);
- if (SWFDEC_AS_VALUE_IS_OBJECT (&val)) {
- swfdec_as_object_get_variable (SWFDEC_AS_VALUE_GET_OBJECT (&val),
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (&val)) {
+ swfdec_as_object_get_variable (SWFDEC_AS_VALUE_GET_COMPOSITE (&val),
SWFDEC_AS_STR_prototype, &val);
swfdec_as_object_set_variable_and_flags (proto, SWFDEC_AS_STR___proto__, &val,
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
- SWFDEC_AS_VALUE_SET_OBJECT (&val, proto);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, proto);
swfdec_as_object_set_variable_and_flags (stream, SWFDEC_AS_STR_prototype, &val,
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
}
diff --git a/swfdec/swfdec_player.c b/swfdec/swfdec_player.c
index 76e2a97..98ae78d 100644
--- a/swfdec/swfdec_player.c
+++ b/swfdec/swfdec_player.c
@@ -1136,9 +1136,9 @@ swfdec_player_broadcast (SwfdecPlayer *player, const char *object_name,
SwfdecSandbox *sandbox = walk->data;
swfdec_sandbox_use (sandbox);
swfdec_as_object_get_variable (SWFDEC_AS_CONTEXT (player)->global, object_name, &vals[0]);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&vals[0]))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&vals[0]))
return;
- obj = SWFDEC_AS_VALUE_GET_OBJECT (&vals[0]);
+ obj = SWFDEC_AS_VALUE_GET_COMPOSITE (&vals[0]);
SWFDEC_AS_VALUE_SET_STRING (&vals[0], signal_name);
swfdec_as_object_call (obj, SWFDEC_AS_STR_broadcastMessage, argc + 1, vals, NULL);
swfdec_sandbox_unuse (sandbox);
@@ -1191,12 +1191,12 @@ swfdec_player_grab_focus (SwfdecPlayer *player, SwfdecActor *actor)
}
prev = priv->focus;
if (prev) {
- SWFDEC_AS_VALUE_SET_OBJECT (&vals[0], SWFDEC_AS_OBJECT (prev));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&vals[0], SWFDEC_AS_OBJECT (prev));
} else {
SWFDEC_AS_VALUE_SET_NULL (&vals[0]);
}
if (actor) {
- SWFDEC_AS_VALUE_SET_OBJECT (&vals[1], SWFDEC_AS_OBJECT (actor));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&vals[1], SWFDEC_AS_OBJECT (actor));
} else {
SWFDEC_AS_VALUE_SET_NULL (&vals[1]);
}
diff --git a/swfdec/swfdec_player_as.c b/swfdec/swfdec_player_as.c
index 9f4a53f..2e3ee0d 100644
--- a/swfdec/swfdec_player_as.c
+++ b/swfdec/swfdec_player_as.c
@@ -51,11 +51,11 @@ swfdec_player_do_set_interval (gboolean repeat, SwfdecAsContext *cx, guint argc,
return;
}
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&argv[0])) {
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[0])) {
SWFDEC_WARNING ("first argument to setInterval is not an object");
return;
}
- object = SWFDEC_AS_VALUE_GET_OBJECT (&argv[0]);
+ object = SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0]);
if (SWFDEC_IS_AS_FUNCTION (object->relay)) {
msecs = swfdec_as_value_to_integer (cx, &argv[1]);
if (msecs < MIN_INTERVAL_TIME) {
@@ -205,16 +205,16 @@ swfdec_player_ASconstructor (SwfdecAsContext *cx, SwfdecAsObject *object,
proto = swfdec_as_object_new (cx, SWFDEC_AS_STR_Object, NULL);
func_object = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (func));
- SWFDEC_AS_VALUE_SET_OBJECT (&val, proto);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, proto);
swfdec_as_object_set_variable_and_flags (func_object,
SWFDEC_AS_STR_prototype, &val,
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
- SWFDEC_AS_VALUE_SET_OBJECT (&val, func_object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, func_object);
swfdec_as_object_set_variable_and_flags (proto, SWFDEC_AS_STR_constructor,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
- SWFDEC_AS_VALUE_SET_OBJECT (rval, func_object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (rval, func_object);
}
}
@@ -229,7 +229,7 @@ swfdec_player_ASnative (SwfdecAsContext *cx, SwfdecAsObject *object,
func = swfdec_get_asnative (cx, x, y);
if (func) {
- SWFDEC_AS_VALUE_SET_OBJECT (rval, swfdec_as_relay_get_as_object SWFDEC_AS_RELAY (func));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (rval, swfdec_as_relay_get_as_object SWFDEC_AS_RELAY (func));
}
}
@@ -272,7 +272,7 @@ ASSetNative (SwfdecAsContext *cx, SwfdecAsObject *object,
function = swfdec_get_asnative (cx, x, y);
if (function == NULL)
break;
- SWFDEC_AS_VALUE_SET_OBJECT (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (function)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (function)));
swfdec_as_object_set_variable_and_flags (target,
swfdec_as_context_get_string (cx, s), &val, flags);
y++;
@@ -332,13 +332,13 @@ swfdec_player_object_registerClass (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (0, NULL, "s", &name);
- if (argc < 2 || !SWFDEC_AS_VALUE_IS_OBJECT (&argv[1])) {
+ if (argc < 2 || !SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[1])) {
SWFDEC_AS_VALUE_SET_BOOLEAN (rval, FALSE);
return;
}
swfdec_player_set_export_class (SWFDEC_PLAYER (cx), name,
- SWFDEC_AS_VALUE_GET_OBJECT (&argv[1]));
+ SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[1]));
SWFDEC_AS_VALUE_SET_BOOLEAN (rval, TRUE);
}
@@ -354,21 +354,21 @@ swfdec_player_preinit_global (SwfdecAsContext *context)
f = swfdec_as_native_function_new_bare (context,
SWFDEC_AS_STR_ASnative, swfdec_player_ASnative, NULL);
o = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (f));
- SWFDEC_AS_VALUE_SET_OBJECT (&val, o);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, o);
swfdec_as_object_set_variable_and_flags (context->global, SWFDEC_AS_STR_ASnative,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
f = swfdec_as_native_function_new_bare (context,
SWFDEC_AS_STR_ASconstructor, swfdec_player_ASconstructor, NULL);
o = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (f));
- SWFDEC_AS_VALUE_SET_OBJECT (&val, o);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, o);
swfdec_as_object_set_variable_and_flags (context->global, SWFDEC_AS_STR_ASconstructor,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
f = swfdec_as_native_function_new_bare (context,
SWFDEC_AS_STR_enableDebugConsole, swfdec_player_enableDebugConsole, NULL);
o = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (f));
- SWFDEC_AS_VALUE_SET_OBJECT (&val, o);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, o);
swfdec_as_object_set_variable_and_flags (context->global, SWFDEC_AS_STR_enableDebugConsole,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
}
diff --git a/swfdec/swfdec_print_job.c b/swfdec/swfdec_print_job.c
index 1428a6a..530e71c 100644
--- a/swfdec/swfdec_print_job.c
+++ b/swfdec/swfdec_print_job.c
@@ -98,14 +98,14 @@ swfdec_print_job_init_properties (SwfdecAsContext *cx)
g_return_if_fail (SWFDEC_IS_AS_CONTEXT (cx));
swfdec_as_object_get_variable (cx->global, SWFDEC_AS_STR_PrintJob, &val);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
return;
- xml = SWFDEC_AS_VALUE_GET_OBJECT (&val);
+ xml = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
swfdec_as_object_get_variable (xml, SWFDEC_AS_STR_prototype, &val);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
return;
- proto = SWFDEC_AS_VALUE_GET_OBJECT (&val);
+ proto = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
swfdec_as_object_add_native_variable (proto, SWFDEC_AS_STR_orientation,
swfdec_print_job_get_orientation, NULL);
diff --git a/swfdec/swfdec_resource.c b/swfdec/swfdec_resource.c
index 316c166..506c218 100644
--- a/swfdec/swfdec_resource.c
+++ b/swfdec/swfdec_resource.c
@@ -135,7 +135,7 @@ swfdec_resource_emit_signal (SwfdecResource *resource, const char *name, gboolea
SWFDEC_INFO ("not emitting onLoadInit - the movie is different");
return;
}
- SWFDEC_AS_VALUE_SET_OBJECT (&vals[1], SWFDEC_AS_OBJECT (movie));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&vals[1], SWFDEC_AS_OBJECT (movie));
} else {
SWFDEC_AS_VALUE_SET_UNDEFINED (&vals[1]);
movie = NULL;
@@ -681,8 +681,8 @@ swfdec_resource_load_movie (SwfdecPlayer *player, const SwfdecAsValue *target,
g_return_val_if_fail (url != NULL, FALSE);
g_return_val_if_fail (loader == NULL || SWFDEC_IS_MOVIE_CLIP_LOADER (loader), FALSE);
- if (SWFDEC_AS_VALUE_IS_OBJECT (target)) {
- SwfdecAsObject *object = SWFDEC_AS_VALUE_GET_OBJECT (target);
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (target)) {
+ SwfdecAsObject *object = SWFDEC_AS_VALUE_GET_COMPOSITE (target);
if (SWFDEC_IS_SPRITE_MOVIE (object)) {
swfdec_resource_load_internal (player, SWFDEC_SPRITE_MOVIE (object),
NULL, url, buffer, loader);
@@ -700,7 +700,7 @@ swfdec_resource_load_movie (SwfdecPlayer *player, const SwfdecAsValue *target,
swfdec_resource_load_internal (player, NULL, s, url, buffer, loader);
return TRUE;
} else if (SWFDEC_AS_VALUE_IS_STRING (target) ||
- (SWFDEC_AS_VALUE_IS_OBJECT (target) && SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_OBJECT (target)))) {
+ (SWFDEC_AS_VALUE_IS_COMPOSITE (target) && SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (target)))) {
s = swfdec_as_value_to_string (SWFDEC_AS_CONTEXT (player), target);
} else {
SWFDEC_WARNING ("target does not reference a movie, not loading %s", url);
diff --git a/swfdec/swfdec_sound_object.c b/swfdec/swfdec_sound_object.c
index ac553da..78d1875 100644
--- a/swfdec/swfdec_sound_object.c
+++ b/swfdec/swfdec_sound_object.c
@@ -167,7 +167,7 @@ swfdec_sound_object_getTransform (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_value_set_integer (cx, &val, matrix->rr);
swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_rr, &val);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, obj);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, obj);
}
SWFDEC_AS_NATIVE (500, 2, swfdec_sound_object_getVolume)
@@ -457,6 +457,6 @@ swfdec_sound_object_construct (SwfdecAsContext *cx, SwfdecAsObject *object, guin
sound->target = swfdec_as_value_to_string (cx, &argv[0]);
}
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
}
diff --git a/swfdec/swfdec_sprite_movie_as.c b/swfdec/swfdec_sprite_movie_as.c
index 1c33ea1..d1cc2f7 100644
--- a/swfdec/swfdec_sprite_movie_as.c
+++ b/swfdec/swfdec_sprite_movie_as.c
@@ -163,10 +163,10 @@ swfdec_sprite_movie_set_filters (SwfdecAsContext *cx, SwfdecAsObject *object,
for (i = 0; i < length; i++) {
if (!swfdec_as_object_get_variable (array,
swfdec_as_integer_to_string (cx, i), &val) ||
- !SWFDEC_AS_VALUE_IS_OBJECT (&val) ||
- !SWFDEC_IS_FILTER (SWFDEC_AS_VALUE_GET_OBJECT (&val)->relay))
+ !SWFDEC_AS_VALUE_IS_COMPOSITE (&val) ||
+ !SWFDEC_IS_FILTER (SWFDEC_AS_VALUE_GET_COMPOSITE (&val)->relay))
continue;
- filter = SWFDEC_FILTER (SWFDEC_AS_VALUE_GET_OBJECT (&val)->relay);
+ filter = SWFDEC_FILTER (SWFDEC_AS_VALUE_GET_COMPOSITE (&val)->relay);
filter = swfdec_filter_clone (filter);
list = g_slist_prepend (list, filter);
}
@@ -185,7 +185,7 @@ swfdec_sprite_movie_get_transform (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, &movie, "");
trans = swfdec_transform_as_new (cx, movie);
- SWFDEC_AS_VALUE_SET_OBJECT (rval, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (trans)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (rval, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (trans)));
}
SWFDEC_AS_NATIVE (900, 420, swfdec_sprite_movie_set_transform)
@@ -252,7 +252,7 @@ swfdec_sprite_movie_set_blendMode (SwfdecAsContext *cx, SwfdecAsObject *object,
break;
}
}
- } else if (SWFDEC_AS_VALUE_IS_OBJECT (&val)) {
+ } else if (SWFDEC_AS_VALUE_IS_COMPOSITE (&val)) {
blend_mode = 0;
} else {
blend_mode = 1;
@@ -355,7 +355,7 @@ swfdec_sprite_movie_getInstanceAtDepth (SwfdecAsContext *cx,
if (movie != NULL) {
if (!swfdec_movie_is_scriptable (movie))
movie = movie->parent;
- SWFDEC_AS_VALUE_SET_OBJECT (rval, SWFDEC_AS_OBJECT (movie));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (rval, SWFDEC_AS_OBJECT (movie));
}
}
@@ -584,12 +584,12 @@ swfdec_sprite_movie_hitTest (SwfdecAsContext *cx, SwfdecAsObject *object,
SwfdecMovie *other;
SwfdecRect movie_rect, other_rect;
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&argv[0]) ||
- !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_OBJECT (&argv[0]))) {
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[0]) ||
+ !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0]))) {
SWFDEC_AS_VALUE_SET_BOOLEAN (rval, FALSE);
return;
}
- other = SWFDEC_MOVIE (SWFDEC_AS_VALUE_GET_OBJECT (&argv[0]));
+ other = SWFDEC_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0]));
swfdec_movie_update (movie);
swfdec_movie_update (other);
movie_rect = movie->extents;
@@ -672,8 +672,8 @@ swfdec_sprite_movie_swapDepths (SwfdecAsContext *cx, SwfdecAsObject *object,
if (movie->parent == NULL)
SWFDEC_FIXME ("swapDepths on root movie, should do something weird");
- if (SWFDEC_AS_VALUE_IS_OBJECT (&value)) {
- other = (SwfdecMovie *) SWFDEC_AS_VALUE_GET_OBJECT (&value);
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (&value)) {
+ other = (SwfdecMovie *) SWFDEC_AS_VALUE_GET_COMPOSITE (&value);
if (!SWFDEC_IS_MOVIE (other) ||
other->parent != movie->parent)
return;
@@ -726,7 +726,7 @@ swfdec_sprite_movie_createEmptyMovieClip (SwfdecAsContext *cx, SwfdecAsObject *o
swfdec_movie_initialize (movie);
}
- SWFDEC_AS_VALUE_SET_OBJECT (rval, SWFDEC_AS_OBJECT (movie));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (rval, SWFDEC_AS_OBJECT (movie));
}
static void
@@ -808,8 +808,8 @@ swfdec_sprite_movie_attachMovie (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, &movie, "ssi", &export, &name, &depth);
- if (argc > 3 && SWFDEC_AS_VALUE_IS_OBJECT (&argv[3])) {
- initObject = SWFDEC_AS_VALUE_GET_OBJECT ((&argv[3]));
+ if (argc > 3 && SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[3])) {
+ initObject = SWFDEC_AS_VALUE_GET_COMPOSITE ((&argv[3]));
} else {
initObject = NULL;
}
@@ -841,7 +841,7 @@ swfdec_sprite_movie_attachMovie (SwfdecAsContext *cx, SwfdecAsObject *object,
}
swfdec_sprite_movie_init_from_object (ret, initObject);
- SWFDEC_AS_VALUE_SET_OBJECT (rval, SWFDEC_AS_OBJECT (ret));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (rval, SWFDEC_AS_OBJECT (ret));
}
SWFDEC_AS_NATIVE (900, 18, swfdec_sprite_movie_duplicateMovieClip)
@@ -863,7 +863,7 @@ swfdec_sprite_movie_duplicateMovieClip (SwfdecAsContext *cx, SwfdecAsObject *obj
return;
swfdec_sprite_movie_copy_props (new, movie);
SWFDEC_LOG ("duplicated %s as %s to depth %u", movie->name, new->name, new->depth);
- SWFDEC_AS_VALUE_SET_OBJECT (rval, SWFDEC_AS_OBJECT (new));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (rval, SWFDEC_AS_OBJECT (new));
}
SWFDEC_AS_NATIVE (900, 19, swfdec_sprite_movie_removeMovieClip)
@@ -939,7 +939,7 @@ swfdec_sprite_movie_getBounds (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_value_set_number (cx, &val, SWFDEC_TWIPS_TO_DOUBLE (y1));
swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_yMax, &val);
- SWFDEC_AS_VALUE_SET_OBJECT (rval, obj);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (rval, obj);
}
SWFDEC_AS_NATIVE (900, 11, swfdec_sprite_movie_setMask)
diff --git a/swfdec/swfdec_style_sheet.c b/swfdec/swfdec_style_sheet.c
index 300bbd8..71d948a 100644
--- a/swfdec/swfdec_style_sheet.c
+++ b/swfdec/swfdec_style_sheet.c
@@ -69,7 +69,7 @@ swfdec_style_sheet_get_selector_object (SwfdecAsObject *object,
g_return_val_if_fail (name != NULL, NULL);
empty = swfdec_as_object_new_empty (swfdec_gc_object_get_context (object));
- SWFDEC_AS_VALUE_SET_OBJECT (&val, empty);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, empty);
swfdec_as_object_unset_variable_flags (object, name,
SWFDEC_AS_VARIABLE_CONSTANT);
swfdec_as_object_set_variable (object, name, &val);
@@ -255,7 +255,7 @@ swfdec_style_sheet_parseCSSInternal (SwfdecAsContext *cx,
if (values == NULL) {
SWFDEC_AS_VALUE_SET_NULL (rval);
} else {
- SWFDEC_AS_VALUE_SET_OBJECT (rval, values);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (rval, values);
}
}
@@ -320,7 +320,7 @@ swfdec_style_sheet_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
sheet = g_object_new (SWFDEC_TYPE_STYLE_SHEET, "context", cx, NULL);
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (sheet));
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
}
static SwfdecTextFormat *
@@ -334,17 +334,17 @@ swfdec_style_sheet_get_format (SwfdecStyleSheet *style, const char *name)
swfdec_as_object_get_variable (SWFDEC_AS_OBJECT (style),
SWFDEC_AS_STR__styles, &val);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
return NULL;
- styles = SWFDEC_AS_VALUE_GET_OBJECT (&val);
+ styles = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
swfdec_as_object_get_variable (styles, name, &val);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
return NULL;
- if (!SWFDEC_IS_TEXT_FORMAT (SWFDEC_AS_VALUE_GET_OBJECT (&val)))
+ if (!SWFDEC_IS_TEXT_FORMAT (SWFDEC_AS_VALUE_GET_COMPOSITE (&val)))
return NULL;
- return SWFDEC_TEXT_FORMAT (SWFDEC_AS_VALUE_GET_OBJECT (&val));
+ return SWFDEC_TEXT_FORMAT (SWFDEC_AS_VALUE_GET_COMPOSITE (&val));
}
SwfdecTextFormat *
diff --git a/swfdec/swfdec_text_field_movie.c b/swfdec/swfdec_text_field_movie.c
index e36d581..d27adbb 100644
--- a/swfdec/swfdec_text_field_movie.c
+++ b/swfdec/swfdec_text_field_movie.c
@@ -403,14 +403,14 @@ swfdec_text_field_movie_init_movie (SwfdecMovie *movie)
/* create _listeners array */
array = swfdec_as_array_new (cx);
- SWFDEC_AS_VALUE_SET_OBJECT (&val, SWFDEC_AS_OBJECT (movie));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, SWFDEC_AS_OBJECT (movie));
swfdec_as_array_push (array, &val);
- SWFDEC_AS_VALUE_SET_OBJECT (&val, array);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, array);
swfdec_as_object_set_variable_and_flags (SWFDEC_AS_OBJECT (movie), SWFDEC_AS_STR__listeners,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
/* add self to listeners */
- SWFDEC_AS_VALUE_SET_OBJECT (&val, SWFDEC_AS_OBJECT (movie));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, SWFDEC_AS_OBJECT (movie));
swfdec_as_object_call (SWFDEC_AS_OBJECT (movie), SWFDEC_AS_STR_addListener,
1, &val, NULL);
diff --git a/swfdec/swfdec_text_field_movie_as.c b/swfdec/swfdec_text_field_movie_as.c
index 914bedc..fd80788 100644
--- a/swfdec/swfdec_text_field_movie_as.c
+++ b/swfdec/swfdec_text_field_movie_as.c
@@ -875,7 +875,7 @@ swfdec_text_field_movie_get_styleSheet (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
if (text->style_sheet != NULL) {
- SWFDEC_AS_VALUE_SET_OBJECT (ret, SWFDEC_AS_OBJECT (text->style_sheet));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, SWFDEC_AS_OBJECT (text->style_sheet));
} else {
SWFDEC_AS_VALUE_SET_UNDEFINED (ret);
}
@@ -903,8 +903,8 @@ swfdec_text_field_movie_set_styleSheet (SwfdecAsContext *cx,
swfdec_as_value_to_number (cx, &argv[0]);
- if (SWFDEC_AS_VALUE_IS_OBJECT (&argv[0])) {
- value = SWFDEC_AS_VALUE_GET_OBJECT (&argv[0]);
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[0])) {
+ value = SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0]);
if (SWFDEC_IS_MOVIE (value))
value = NULL;
} else {
@@ -1072,7 +1072,7 @@ swfdec_text_field_movie_getNewTextFormat (SwfdecAsContext *cx,
SWFDEC_TEXT_ATTRIBUTES_MASK);
format->values_set = SWFDEC_TEXT_ATTRIBUTES_MASK;
- SWFDEC_AS_VALUE_SET_OBJECT (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (format)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (format)));
}
SWFDEC_AS_NATIVE (104, 105, swfdec_text_field_movie_setNewTextFormat)
@@ -1140,12 +1140,12 @@ swfdec_text_field_movie_setTextFormat (SwfdecAsContext *cx,
if (start == end)
return;
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&argv[i]))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[i]))
return;
- if (!SWFDEC_IS_TEXT_FORMAT (SWFDEC_AS_VALUE_GET_OBJECT (&argv[i])->relay))
+ if (!SWFDEC_IS_TEXT_FORMAT (SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[i])->relay))
return;
- format = SWFDEC_TEXT_FORMAT (SWFDEC_AS_VALUE_GET_OBJECT (&argv[i])->relay);
+ format = SWFDEC_TEXT_FORMAT (SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[i])->relay);
start = g_utf8_offset_to_pointer (string, start) - string;
end = g_utf8_offset_to_pointer (string, end) - string;
@@ -1183,7 +1183,7 @@ swfdec_text_field_movie_getTextFormat (SwfdecAsContext *cx,
length = g_utf8_strlen (string, -1);
format = swfdec_text_format_new (cx);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (format)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (format)));
if (argc == 0) {
start = 0;
@@ -1296,7 +1296,7 @@ swfdec_text_field_movie_getFontList (SwfdecAsContext *cx,
g_free (families);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, SWFDEC_AS_OBJECT (array));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, SWFDEC_AS_OBJECT (array));
}
SWFDEC_AS_NATIVE (104, 106, swfdec_text_field_movie_getDepth)
@@ -1393,9 +1393,9 @@ swfdec_text_field_movie_createTextField (SwfdecAsContext *cx,
swfdec_movie_update (movie);
swfdec_as_object_get_variable (cx->global, SWFDEC_AS_STR_TextField, &val);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
return;
- fun_object = SWFDEC_AS_VALUE_GET_OBJECT (&val);
+ fun_object = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
if (!SWFDEC_IS_AS_FUNCTION (fun_object->relay))
return;
fun = SWFDEC_AS_FUNCTION (fun_object->relay);
@@ -1407,7 +1407,7 @@ swfdec_text_field_movie_createTextField (SwfdecAsContext *cx,
SWFDEC_AS_STR___proto__, &val,
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
}
- SWFDEC_AS_VALUE_SET_OBJECT (&val, fun_object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, fun_object);
if (cx->version < 7) {
swfdec_as_object_set_variable_and_flags (SWFDEC_AS_OBJECT (movie),
SWFDEC_AS_STR_constructor, &val, SWFDEC_AS_VARIABLE_HIDDEN);
@@ -1433,13 +1433,13 @@ swfdec_text_field_movie_init_properties (SwfdecAsContext *cx)
g_return_if_fail (SWFDEC_IS_AS_CONTEXT (cx));
swfdec_as_object_get_variable (cx->global, SWFDEC_AS_STR_TextField, &val);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
return;
- object = SWFDEC_AS_VALUE_GET_OBJECT (&val);
+ object = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
swfdec_as_object_get_variable (object, SWFDEC_AS_STR_prototype, &val);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
return;
- proto = SWFDEC_AS_VALUE_GET_OBJECT (&val);
+ proto = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
// text
swfdec_as_object_add_native_variable (proto, SWFDEC_AS_STR_text,
@@ -1560,5 +1560,5 @@ swfdec_text_field_movie_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
// FIXME: do object.addListener (object);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
}
diff --git a/swfdec/swfdec_text_format.c b/swfdec/swfdec_text_format.c
index 05c21fe..6671842 100644
--- a/swfdec/swfdec_text_format.c
+++ b/swfdec/swfdec_text_format.c
@@ -693,7 +693,7 @@ swfdec_text_format_do_get_tab_stops (SwfdecAsContext *cx,
swfdec_as_value_set_integer (cx, &val, format->attr.tab_stops[i]);
swfdec_as_array_push (array, &val);
}
- SWFDEC_AS_VALUE_SET_OBJECT (ret, array);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, array);
}
static void
@@ -722,15 +722,15 @@ swfdec_text_format_do_set_tab_stops (SwfdecAsContext *cx,
format->attr.n_tab_stops = 0;
SWFDEC_TEXT_ATTRIBUTE_UNSET (format->values_set, SWFDEC_TEXT_ATTRIBUTE_TAB_STOPS);
}
- else if (SWFDEC_AS_VALUE_IS_OBJECT (&argv[0]) &&
- SWFDEC_AS_VALUE_GET_OBJECT (&argv[0])->array)
+ else if (SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[0]) &&
+ SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0])->array)
{
SwfdecAsObject *array;
SwfdecAsValue val;
guint i;
int len;
- array = SWFDEC_AS_VALUE_GET_OBJECT (&argv[0]);
+ array = SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0]);
len = swfdec_as_array_get_length (array);
if (!SWFDEC_TEXT_ATTRIBUTE_IS_SET (format->values_set, SWFDEC_TEXT_ATTRIBUTE_TAB_STOPS)) {
@@ -864,7 +864,7 @@ swfdec_text_format_getTextExtent (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_value_set_integer (cx, &val, j);
swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_descent, &val);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, obj);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, obj);
g_object_unref (layout);
g_object_unref (buffer);
}
@@ -950,13 +950,13 @@ swfdec_text_format_init_properties (SwfdecAsContext *cx)
g_return_if_fail (SWFDEC_IS_AS_CONTEXT (cx));
swfdec_as_object_get_variable (cx->global, SWFDEC_AS_STR_TextFormat, &val);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
return;
- proto = SWFDEC_AS_VALUE_GET_OBJECT (&val);
+ proto = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
swfdec_as_object_get_variable (proto, SWFDEC_AS_STR_prototype, &val);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
return;
- proto = SWFDEC_AS_VALUE_GET_OBJECT (&val);
+ proto = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
swfdec_as_object_add_native_variable (proto, SWFDEC_AS_STR_align,
swfdec_text_format_do_get_align, swfdec_text_format_do_set_align);
@@ -1047,7 +1047,7 @@ swfdec_text_format_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
function = swfdec_as_native_function_new_bare (cx,
SWFDEC_AS_STR_getTextExtent, swfdec_text_format_getTextExtent, NULL);
- SWFDEC_AS_VALUE_SET_OBJECT (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (function)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (function)));
swfdec_as_object_set_variable (object, SWFDEC_AS_STR_getTextExtent, &val);
for (i = 0; i < argc && arguments[i] != NULL; i++) {
@@ -1091,7 +1091,7 @@ swfdec_text_format_new_no_properties (SwfdecAsContext *context)
// FIXME: Need better way to create function without prototype/constructor
function = swfdec_as_native_function_new_bare (context,
SWFDEC_AS_STR_getTextExtent, swfdec_text_format_getTextExtent, NULL);
- SWFDEC_AS_VALUE_SET_OBJECT (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (function)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (function)));
swfdec_as_object_set_variable (object, SWFDEC_AS_STR_getTextExtent, &val);
return ret;
diff --git a/swfdec/swfdec_transform_as.c b/swfdec/swfdec_transform_as.c
index eed7401..2fdba38 100644
--- a/swfdec/swfdec_transform_as.c
+++ b/swfdec/swfdec_transform_as.c
@@ -92,7 +92,7 @@ swfdec_transform_as_get_matrix (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_value_set_number (cx, &val, SWFDEC_TWIPS_TO_DOUBLE (matrix->y0));
swfdec_as_object_set_variable (o, SWFDEC_AS_STR_ty, &val);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, o);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, o);
}
SWFDEC_AS_NATIVE (1106, 102, swfdec_transform_as_set_matrix)
@@ -159,7 +159,7 @@ swfdec_transform_as_get_colorTransform (SwfdecAsContext *cx,
ctrans = swfdec_color_transform_as_new_from_transform (cx,
&transform->target->color_transform);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (ctrans)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (ctrans)));
}
SWFDEC_AS_NATIVE (1106, 106, swfdec_transform_as_set_colorTransform)
@@ -208,7 +208,7 @@ swfdec_transform_as_get_concatenatedColorTransform (SwfdecAsContext *cx,
}
ctrans = swfdec_color_transform_as_new_from_transform (cx, &chain);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (ctrans)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (ctrans)));
}
SWFDEC_AS_NATIVE (1106, 108, swfdec_transform_as_set_concatenatedColorTransform)
@@ -250,16 +250,16 @@ swfdec_transform_as_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
return;
if (argc < 1 ||
- !SWFDEC_AS_VALUE_IS_OBJECT (&argv[0]) ||
- !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_OBJECT (&argv[0]))) {
+ !SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[0]) ||
+ !SWFDEC_IS_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0]))) {
SWFDEC_FIXME ("new Transform without movieclip should give undefined");
return;
}
trans = g_object_new (SWFDEC_TYPE_TRANSFORM_AS, "context", cx, NULL);
- trans->target = SWFDEC_MOVIE (SWFDEC_AS_VALUE_GET_OBJECT (&argv[0]));
+ trans->target = SWFDEC_MOVIE (SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0]));
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (trans));
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
}
SwfdecTransformAs *
diff --git a/swfdec/swfdec_xml.c b/swfdec/swfdec_xml.c
index f5503a6..3924905 100644
--- a/swfdec/swfdec_xml.c
+++ b/swfdec/swfdec_xml.c
@@ -478,20 +478,20 @@ swfdec_xml_add_id_map (SwfdecXml *xml, SwfdecXmlNode *node, const char *id)
if (context->version >= 8) {
if (swfdec_as_object_get_variable (object,
SWFDEC_AS_STR_idMap, &val)) {
- if (SWFDEC_AS_VALUE_IS_OBJECT (&val)) {
- object = SWFDEC_AS_VALUE_GET_OBJECT (&val);
+ if (SWFDEC_AS_VALUE_IS_COMPOSITE (&val)) {
+ object = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
} else {
return;
}
} else {
object = swfdec_as_object_new_empty (context);
- SWFDEC_AS_VALUE_SET_OBJECT (&val, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, object);
swfdec_as_object_set_variable (swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (xml)),
SWFDEC_AS_STR_idMap, &val);
}
}
- SWFDEC_AS_VALUE_SET_OBJECT (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (node)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (node)));
swfdec_as_object_set_variable (object, id, &val);
}
@@ -815,7 +815,7 @@ swfdec_xml_createElement (SwfdecAsContext *cx, SwfdecAsObject *object,
node = swfdec_xml_node_new (cx, SWFDEC_XML_NODE_ELEMENT, s);
- SWFDEC_AS_VALUE_SET_OBJECT (rval, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (node)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (rval, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (node)));
}
SWFDEC_AS_NATIVE (253, 11, swfdec_xml_createTextNode)
@@ -835,7 +835,7 @@ swfdec_xml_createTextNode (SwfdecAsContext *cx, SwfdecAsObject *object,
node = swfdec_xml_node_new (cx, SWFDEC_XML_NODE_TEXT, s);
- SWFDEC_AS_VALUE_SET_OBJECT (rval, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (node)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (rval, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (node)));
}
static void
@@ -851,14 +851,14 @@ swfdec_xml_init_properties (SwfdecAsContext *cx)
g_return_if_fail (SWFDEC_IS_AS_CONTEXT (cx));
swfdec_as_object_get_variable (cx->global, SWFDEC_AS_STR_XML, &val);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
return;
- xml = SWFDEC_AS_VALUE_GET_OBJECT (&val);
+ xml = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
swfdec_as_object_get_variable (xml, SWFDEC_AS_STR_prototype, &val);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
return;
- proto = SWFDEC_AS_VALUE_GET_OBJECT (&val);
+ proto = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
swfdec_as_object_add_native_variable (proto, SWFDEC_AS_STR_ignoreWhite,
swfdec_xml_get_ignoreWhite, swfdec_xml_set_ignoreWhite);
diff --git a/swfdec/swfdec_xml_node.c b/swfdec/swfdec_xml_node.c
index 23ecee6..fc02666 100644
--- a/swfdec/swfdec_xml_node.c
+++ b/swfdec/swfdec_xml_node.c
@@ -95,11 +95,11 @@ swfdec_xml_node_get_child (SwfdecXmlNode *node, gint32 index_)
swfdec_as_array_get_value (node->children, index_, &val);
- g_return_val_if_fail (SWFDEC_AS_VALUE_IS_OBJECT (&val), NULL);
+ g_return_val_if_fail (SWFDEC_AS_VALUE_IS_COMPOSITE (&val), NULL);
g_return_val_if_fail (SWFDEC_IS_VALID_XML_NODE (
- SWFDEC_AS_VALUE_GET_OBJECT (&val)->relay), NULL);
+ SWFDEC_AS_VALUE_GET_COMPOSITE (&val)->relay), NULL);
- return SWFDEC_XML_NODE (SWFDEC_AS_VALUE_GET_OBJECT (&val)->relay);
+ return SWFDEC_XML_NODE (SWFDEC_AS_VALUE_GET_COMPOSITE (&val)->relay);
}
static gint32
@@ -137,7 +137,7 @@ swfdec_xml_node_update_child_nodes (SwfdecXmlNode *node)
num = swfdec_xml_node_num_children (node);
vals = g_malloc (sizeof (SwfdecAsValue) * num);
for (i = 0; i < num; i++) {
- SWFDEC_AS_VALUE_SET_OBJECT (&vals[i], swfdec_as_relay_get_as_object (
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&vals[i], swfdec_as_relay_get_as_object (
SWFDEC_AS_RELAY (swfdec_xml_node_get_child (node, i))));
}
swfdec_as_array_append_with_flags (node->child_nodes, num, vals,
@@ -446,7 +446,7 @@ swfdec_xml_node_get_attributes (SwfdecAsContext *cx, SwfdecAsObject *object,
if (!SWFDEC_IS_VALID_XML_NODE (node))
return;
- SWFDEC_AS_VALUE_SET_OBJECT (ret, node->attributes);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, node->attributes);
}
static void
@@ -461,7 +461,7 @@ swfdec_xml_node_get_parentNode (SwfdecAsContext *cx, SwfdecAsObject *object,
return;
if (node->parent != NULL) {
- SWFDEC_AS_VALUE_SET_OBJECT (ret,
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret,
swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (node->parent)));
} else {
SWFDEC_AS_VALUE_SET_NULL (ret);
@@ -499,7 +499,7 @@ swfdec_xml_node_get_previousSibling (SwfdecAsContext *cx,
sibling = swfdec_xml_node_previousSibling (node);
if (sibling != NULL) {
- SWFDEC_AS_VALUE_SET_OBJECT (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (sibling)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (sibling)));
} else {
SWFDEC_AS_VALUE_SET_NULL (ret);
}
@@ -533,7 +533,7 @@ swfdec_xml_node_get_nextSibling (SwfdecAsContext *cx, SwfdecAsObject *object,
sibling = swfdec_xml_node_nextSibling (node);
if (sibling != NULL) {
- SWFDEC_AS_VALUE_SET_OBJECT (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (sibling)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (sibling)));
} else {
SWFDEC_AS_VALUE_SET_NULL (ret);
}
@@ -553,7 +553,7 @@ swfdec_xml_node_get_firstChild (SwfdecAsContext *cx, SwfdecAsObject *object,
child = swfdec_xml_node_get_child (node, 0);
if (child != NULL) {
- SWFDEC_AS_VALUE_SET_OBJECT (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (child)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (child)));
} else {
SWFDEC_AS_VALUE_SET_NULL (ret);
}
@@ -581,7 +581,7 @@ swfdec_xml_node_get_lastChild (SwfdecAsContext *cx, SwfdecAsObject *object,
child = swfdec_xml_node_get_child (node, num - 1);
g_assert (child != NULL);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (child)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (child)));
}
static void
@@ -595,7 +595,7 @@ swfdec_xml_node_get_childNodes (SwfdecAsContext *cx, SwfdecAsObject *object,
if (!SWFDEC_IS_VALID_XML_NODE (node))
return;
- SWFDEC_AS_VALUE_SET_OBJECT (ret, node->child_nodes);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, node->child_nodes);
}
SWFDEC_AS_NATIVE (253, 7, swfdec_xml_node_do_getNamespaceForPrefix)
@@ -696,7 +696,7 @@ swfdec_xml_node_clone (SwfdecAsContext *cx, SwfdecXmlNode *node, gboolean deep)
child = swfdec_xml_node_get_child (node, i);
child_new = swfdec_xml_node_clone (cx, child, TRUE);
child_new->parent = new;
- SWFDEC_AS_VALUE_SET_OBJECT (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (child_new)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (child_new)));
swfdec_as_array_push (new->children, &val);
}
@@ -721,7 +721,7 @@ swfdec_xml_node_cloneNode (SwfdecAsContext *cx, SwfdecAsObject *object,
new = swfdec_xml_node_clone (cx, node, deep);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (new)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (new)));
}
void
@@ -793,7 +793,7 @@ swfdec_xml_node_insertAt (SwfdecXmlNode *node, SwfdecXmlNode *child, gint32 ind)
swfdec_xml_node_removeNode (child);
// insert child to node's child_nodes array
- SWFDEC_AS_VALUE_SET_OBJECT (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (child)));
+ SWFDEC_AS_VALUE_SET_COMPOSITE (&val, swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (child)));
swfdec_as_array_insert (node->children, ind, &val);
swfdec_xml_node_update_child_nodes (node);
@@ -1026,14 +1026,14 @@ swfdec_xml_node_init_properties (SwfdecAsContext *cx)
g_return_if_fail (SWFDEC_IS_AS_CONTEXT (cx));
swfdec_as_object_get_variable (cx->global, SWFDEC_AS_STR_XMLNode, &val);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
return;
- node = SWFDEC_AS_VALUE_GET_OBJECT (&val);
+ node = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
swfdec_as_object_get_variable (node, SWFDEC_AS_STR_prototype, &val);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
+ if (!SWFDEC_AS_VALUE_IS_COMPOSITE (&val))
return;
- proto = SWFDEC_AS_VALUE_GET_OBJECT (&val);
+ proto = SWFDEC_AS_VALUE_GET_COMPOSITE (&val);
swfdec_as_object_add_native_variable (proto, SWFDEC_AS_STR_nodeType,
swfdec_xml_node_get_nodeType, NULL);
@@ -1119,5 +1119,5 @@ swfdec_xml_node_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (node));
swfdec_xml_node_init_values (node, type, value);
- SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
+ SWFDEC_AS_VALUE_SET_COMPOSITE (ret, object);
}
commit 6f504b53ae9e2261f2a5ee36e0c1535ad88b0806
Author: Benjamin Otte <otte at gnome.org>
Date: Tue Oct 28 12:28:54 2008 +0100
delete code that caused compile errors
That makes vivified core even more useless
diff --git a/vivified/core/vivi_breakpoint.c b/vivified/core/vivi_breakpoint.c
index d83ab6e..627c3b7 100644
--- a/vivified/core/vivi_breakpoint.c
+++ b/vivified/core/vivi_breakpoint.c
@@ -90,18 +90,6 @@ static const struct {
{ "onSetVariable", "set-variable", G_CALLBACK (vivi_breakpoint_set_variable) }
};
-static guint
-vivi_breakpoint_find_event (const char *name)
-{
- guint i;
-
- for (i = 1; i < G_N_ELEMENTS (events); i++) {
- if (g_str_equal (events[i].event, name))
- return i;
- }
- return 0;
-}
-
static void
vivi_breakpoint_add (ViviBreakpoint *breakpoint, guint i)
{
@@ -128,44 +116,6 @@ vivi_breakpoint_remove (ViviBreakpoint *breakpoint, guint i)
}
static void
-vivi_breakpoint_set (SwfdecAsObject *object, const char *variable, const SwfdecAsValue *val, guint flags)
-{
- guint i;
-
- i = vivi_breakpoint_find_event (variable);
- if (i) {
- ViviBreakpoint *breakpoint = VIVI_BREAKPOINT (object);
- if (SWFDEC_AS_VALUE_IS_OBJECT (val) &&
- SWFDEC_IS_AS_FUNCTION (SWFDEC_AS_VALUE_GET_OBJECT (val))) {
- if (!breakpoint->handlers[i])
- vivi_breakpoint_add (breakpoint, i);
- } else {
- if (breakpoint->handlers[i])
- vivi_breakpoint_remove (breakpoint, i);
- }
- }
- SWFDEC_AS_OBJECT_CLASS (vivi_breakpoint_parent_class)->set (object, variable, val, flags);
-}
-
-static SwfdecAsDeleteReturn
-vivi_breakpoint_delete (SwfdecAsObject *object, const char *variable)
-{
- ViviBreakpoint *breakpoint = VIVI_BREAKPOINT (object);
- guint i;
- SwfdecAsDeleteReturn ret;
-
- ret = SWFDEC_AS_OBJECT_CLASS (vivi_breakpoint_parent_class)->del (object, variable);
-
- if (ret == SWFDEC_AS_DELETE_DELETED) {
- i = vivi_breakpoint_find_event (variable);
- if (i && breakpoint->handlers[i])
- vivi_breakpoint_remove (breakpoint, i);
- }
-
- return ret;
-}
-
-static void
vivi_breakpoint_dispose (GObject *object)
{
ViviBreakpoint *breakpoint = VIVI_BREAKPOINT (object);
@@ -179,12 +129,8 @@ static void
vivi_breakpoint_class_init (ViviBreakpointClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- SwfdecAsObjectClass *as_object_class = SWFDEC_AS_OBJECT_CLASS (klass);
object_class->dispose = vivi_breakpoint_dispose;
-
- as_object_class->set = vivi_breakpoint_set;
- as_object_class->del = vivi_breakpoint_delete;
}
static void
commit dec63141882f8b3e09e41d42d736480cd9c42610
Author: Benjamin Otte <otte at gnome.org>
Date: Tue Oct 28 12:11:30 2008 +0100
fix test to conform to new API
diff --git a/test/various/gc.c b/test/various/gc.c
index 6f485b6..2d4298c 100644
--- a/test/various/gc.c
+++ b/test/various/gc.c
@@ -64,7 +64,7 @@ check_objects (void)
swfdec_as_context_startup (context);
g_assert (check != NULL);
- object = swfdec_as_object_new (context);
+ object = swfdec_as_object_new (context, NULL);
g_object_add_weak_pointer (G_OBJECT (object), &check);
SWFDEC_AS_VALUE_SET_OBJECT (&val, object);
swfdec_as_object_set_variable (context->global, SWFDEC_AS_STR__root, &val);
@@ -99,8 +99,8 @@ check_object_variables (void)
swfdec_as_context_startup (context);
g_assert (check != NULL);
- o = swfdec_as_object_new (context);
- o2 = swfdec_as_object_new (context);
+ o = swfdec_as_object_new (context, NULL);
+ o2 = swfdec_as_object_new (context, NULL);
g_object_add_weak_pointer (G_OBJECT (o), &check);
g_object_add_weak_pointer (G_OBJECT (o2), &check2);
s = swfdec_as_context_get_string (context, "foo");
commit df6c4350bb4bdb69f6e12629dbdfba16c79f636f
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Oct 27 23:24:31 2008 +0100
compare the right values
fixes failing equality-5.swf test
diff --git a/swfdec/swfdec_as_interpret.c b/swfdec/swfdec_as_interpret.c
index fad3c00..ae9166e 100644
--- a/swfdec/swfdec_as_interpret.c
+++ b/swfdec/swfdec_as_interpret.c
@@ -1451,7 +1451,7 @@ swfdec_action_equals2_5 (SwfdecAsContext *cx, guint action, const guint8 *data,
/* else compare as numbers */
if (isnan (l) && isnan (r)) {
cond = (ltype == rtype && ltype == SWFDEC_AS_TYPE_NUMBER &&
- lval->value.gcable == rval->value.gcable);
+ ltmp.value.gcable == rtmp.value.gcable);
} else {
cond = l == r;
}
commit fc6757d182dfef1ea0fb514b7e37e8ce35eb6311
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Oct 27 23:23:53 2008 +0100
use SWFDEC_AS_VALUE_GET_TYPE()
diff --git a/swfdec/swfdec_as_interpret.c b/swfdec/swfdec_as_interpret.c
index f654505..fad3c00 100644
--- a/swfdec/swfdec_as_interpret.c
+++ b/swfdec/swfdec_as_interpret.c
@@ -1385,8 +1385,8 @@ swfdec_action_equals2_5 (SwfdecAsContext *cx, guint action, const guint8 *data,
ltmp = *lval;
swfdec_as_value_to_primitive (&rtmp);
swfdec_as_value_to_primitive (<mp);
- ltype = ltmp.type;
- rtype = rtmp.type;
+ ltype = SWFDEC_AS_VALUE_GET_TYPE (<mp);
+ rtype = SWFDEC_AS_VALUE_GET_TYPE (&rtmp);
/* get objects compared */
if (ltype == SWFDEC_AS_TYPE_OBJECT && rtype == SWFDEC_AS_TYPE_OBJECT) {
diff --git a/swfdec/swfdec_as_types.c b/swfdec/swfdec_as_types.c
index 765dd42..8485d84 100644
--- a/swfdec/swfdec_as_types.c
+++ b/swfdec/swfdec_as_types.c
@@ -457,7 +457,7 @@ swfdec_as_value_to_number (SwfdecAsContext *context, const SwfdecAsValue *value)
tmp = *value;
swfdec_as_value_to_primitive (&tmp);
- switch (tmp.type) {
+ switch (SWFDEC_AS_VALUE_GET_TYPE (&tmp)) {
case SWFDEC_AS_TYPE_UNDEFINED:
case SWFDEC_AS_TYPE_NULL:
return (context->version >= 7) ? NAN : 0.0;
commit 202803934aeb164acd4a9bc6dd77fecaada79346
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Oct 27 22:46:54 2008 +0100
remove set_flags and delete vfuncs
diff --git a/swfdec/swfdec_as_object.c b/swfdec/swfdec_as_object.c
index 4867265..50e9ba1 100644
--- a/swfdec/swfdec_as_object.c
+++ b/swfdec/swfdec_as_object.c
@@ -597,39 +597,6 @@ swfdec_as_object_do_set (SwfdecAsObject *object, const char *variable,
}
}
-static void
-swfdec_as_object_do_set_flags (SwfdecAsObject *object, const char *variable, guint flags, guint mask)
-{
- SwfdecAsVariable *var = swfdec_as_object_hash_lookup (object, variable);
-
- if (var) {
- var->flags = (var->flags & ~mask) | flags;
-
- if (variable == SWFDEC_AS_STR___proto__)
- object->prototype_flags = var->flags;
- }
-}
-
-static SwfdecAsDeleteReturn
-swfdec_as_object_do_delete (SwfdecAsObject *object, const char *variable)
-{
- SwfdecAsVariable *var;
-
- var = g_hash_table_lookup (object->properties, variable);
- if (var == NULL)
- return SWFDEC_AS_DELETE_NOT_FOUND;
- if (var->flags & SWFDEC_AS_VARIABLE_PERMANENT)
- return SWFDEC_AS_DELETE_NOT_DELETED;
-
- // Note: We won't remove object->prototype, even if __proto__ is deleted
-
- swfdec_as_object_free_property (NULL, var, object);
- if (!g_hash_table_remove (object->properties, variable)) {
- g_assert_not_reached ();
- }
- return SWFDEC_AS_DELETE_DELETED;
-}
-
typedef struct {
SwfdecAsObject * object;
SwfdecAsVariableForeach func;
@@ -784,8 +751,6 @@ swfdec_as_object_class_init (SwfdecAsObjectClass *klass)
klass->get = swfdec_as_object_do_get;
klass->set = swfdec_as_object_do_set;
- klass->set_flags = swfdec_as_object_do_set_flags;
- klass->del = swfdec_as_object_do_delete;
klass->foreach = swfdec_as_object_do_foreach;
}
@@ -1078,13 +1043,24 @@ swfdec_as_object_has_variable (SwfdecAsObject *object, const char *variable)
SwfdecAsDeleteReturn
swfdec_as_object_delete_variable (SwfdecAsObject *object, const char *variable)
{
- SwfdecAsObjectClass *klass;
+ SwfdecAsVariable *var;
g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (object), FALSE);
g_return_val_if_fail (variable != NULL, FALSE);
- klass = SWFDEC_AS_OBJECT_GET_CLASS (object);
- return klass->del (object, variable);
+ var = g_hash_table_lookup (object->properties, variable);
+ if (var == NULL)
+ return SWFDEC_AS_DELETE_NOT_FOUND;
+ if (var->flags & SWFDEC_AS_VARIABLE_PERMANENT)
+ return SWFDEC_AS_DELETE_NOT_DELETED;
+
+ // Note: We won't remove object->prototype, even if __proto__ is deleted
+
+ swfdec_as_object_free_property (NULL, var, object);
+ if (!g_hash_table_remove (object->properties, variable)) {
+ g_assert_not_reached ();
+ }
+ return SWFDEC_AS_DELETE_DELETED;
}
/**
@@ -1114,13 +1090,19 @@ void
swfdec_as_object_set_variable_flags (SwfdecAsObject *object,
const char *variable, SwfdecAsVariableFlag flags)
{
- SwfdecAsObjectClass *klass;
+ SwfdecAsVariable *var;
g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
g_return_if_fail (variable != NULL);
- klass = SWFDEC_AS_OBJECT_GET_CLASS (object);
- klass->set_flags (object, variable, flags, flags);
+ var = swfdec_as_object_hash_lookup (object, variable);
+ if (var == NULL)
+ return;
+
+ var->flags |= flags;
+
+ if (variable == SWFDEC_AS_STR___proto__)
+ object->prototype_flags = var->flags;
}
/**
@@ -1136,13 +1118,20 @@ void
swfdec_as_object_unset_variable_flags (SwfdecAsObject *object,
const char *variable, SwfdecAsVariableFlag flags)
{
- SwfdecAsObjectClass *klass;
+ SwfdecAsVariable *var;
+
g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
g_return_if_fail (variable != NULL);
- klass = SWFDEC_AS_OBJECT_GET_CLASS (object);
- klass->set_flags (object, variable, 0, flags);
+ var = swfdec_as_object_hash_lookup (object, variable);
+ if (var == NULL)
+ return;
+
+ var->flags &= ~flags;
+
+ if (variable == SWFDEC_AS_STR___proto__)
+ object->prototype_flags = var->flags;
}
/**
diff --git a/swfdec/swfdec_as_object.h b/swfdec/swfdec_as_object.h
index 4451319..cb21763 100644
--- a/swfdec/swfdec_as_object.h
+++ b/swfdec/swfdec_as_object.h
@@ -84,14 +84,6 @@ struct _SwfdecAsObjectClass {
const char * variable,
const SwfdecAsValue * val,
guint default_flags);
- /* set flags of a variable */
- void (* set_flags) (SwfdecAsObject * object,
- const char * variable,
- guint flags,
- guint mask);
- /* delete the variable - return TRUE if it exists */
- SwfdecAsDeleteReturn (* del) (SwfdecAsObject * object,
- const char * variable);
/* call with every variable until func returns FALSE */
gboolean (* foreach) (SwfdecAsObject * object,
SwfdecAsVariableForeach func,
commit 92e43799ddc8b4d2a293cd5b421ea95b6cef0efd
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Oct 27 22:04:54 2008 +0100
get rid of swfdec_as_value_to_debug()
diff --git a/swfdec/swfdec_as_object.c b/swfdec/swfdec_as_object.c
index b0a5c71..4867265 100644
--- a/swfdec/swfdec_as_object.c
+++ b/swfdec/swfdec_as_object.c
@@ -751,15 +751,6 @@ swfdec_as_object_foreach_rename (SwfdecAsObject *object, SwfdecAsVariableForeach
object->properties = fdata.properties_new;
}
-static char *
-swfdec_as_object_do_debug (SwfdecAsObject *object)
-{
- if (G_OBJECT_TYPE (object) != SWFDEC_TYPE_AS_OBJECT)
- return g_strdup (G_OBJECT_TYPE_NAME (object));
-
- return g_strdup ("Object");
-}
-
static GObject *
swfdec_as_object_constructor (GType type, guint n_construct_properties,
GObjectConstructParam *construct_properties)
@@ -796,7 +787,6 @@ swfdec_as_object_class_init (SwfdecAsObjectClass *klass)
klass->set_flags = swfdec_as_object_do_set_flags;
klass->del = swfdec_as_object_do_delete;
klass->foreach = swfdec_as_object_do_foreach;
- klass->debug = swfdec_as_object_do_debug;
}
static void
@@ -1816,27 +1806,6 @@ swfdec_as_object_init_context (SwfdecAsContext *context)
}
/**
- * swfdec_as_object_get_debug:
- * @object: a #SwfdecAsObject
- *
- * Gets a representation string suitable for debugging. This function is
- * guaranteed to not modify the state of the script engine, unlike
- * swfdec_as_value_to_string() for example.
- *
- * Returns: A newly allocated string. Free it with g_free() after use.
- **/
-char *
-swfdec_as_object_get_debug (SwfdecAsObject *object)
-{
- SwfdecAsObjectClass *klass;
-
- g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (object), NULL);
-
- klass = SWFDEC_AS_OBJECT_GET_CLASS (object);
- return klass->debug (object);
-}
-
-/**
* swfdec_as_object_resolve:
* @object: a #SwfdecAsObject
*
diff --git a/swfdec/swfdec_as_object.h b/swfdec/swfdec_as_object.h
index 89bb8ed..4451319 100644
--- a/swfdec/swfdec_as_object.h
+++ b/swfdec/swfdec_as_object.h
@@ -96,8 +96,6 @@ struct _SwfdecAsObjectClass {
gboolean (* foreach) (SwfdecAsObject * object,
SwfdecAsVariableForeach func,
gpointer data);
- /* get a debug string representation for this object */
- char * (* debug) (SwfdecAsObject * object);
};
GType swfdec_as_object_get_type (void);
@@ -120,7 +118,6 @@ void swfdec_as_object_create (SwfdecAsFunction * fun,
void swfdec_as_object_set_constructor(SwfdecAsObject * object,
SwfdecAsObject * construct);
SwfdecAsObject *swfdec_as_object_resolve (SwfdecAsObject * object);
-char * swfdec_as_object_get_debug (SwfdecAsObject * object);
void swfdec_as_object_set_relay (SwfdecAsObject * object,
SwfdecAsRelay * relay);
diff --git a/swfdec/swfdec_as_types.c b/swfdec/swfdec_as_types.c
index 92c87de..765dd42 100644
--- a/swfdec/swfdec_as_types.c
+++ b/swfdec/swfdec_as_types.c
@@ -435,40 +435,6 @@ swfdec_as_value_to_string (SwfdecAsContext *context, const SwfdecAsValue *value)
}
/**
- * swfdec_as_value_to_debug:
- * @value: a #SwfdecAsValue
- *
- * Converts the given @value to a string in a safe way. It will not call into
- * the scripting engine. Its intended use is for output in debuggers.
- *
- * Returns: a newly allocated string. Free with g_free().
- **/
-char *
-swfdec_as_value_to_debug (const SwfdecAsValue *value)
-{
- g_return_val_if_fail (SWFDEC_IS_AS_VALUE (value), NULL);
-
- switch (SWFDEC_AS_VALUE_GET_TYPE (value)) {
- case SWFDEC_AS_TYPE_STRING:
- return g_shell_quote (SWFDEC_AS_VALUE_GET_STRING (value));
- case SWFDEC_AS_TYPE_UNDEFINED:
- return g_strdup ("undefined");
- case SWFDEC_AS_TYPE_BOOLEAN:
- return g_strdup (SWFDEC_AS_VALUE_GET_BOOLEAN (value) ? "true" : "false");
- case SWFDEC_AS_TYPE_NULL:
- return g_strdup ("null");
- case SWFDEC_AS_TYPE_NUMBER:
- return g_strdup_printf ("%g", SWFDEC_AS_VALUE_GET_NUMBER (value));
- case SWFDEC_AS_TYPE_OBJECT:
- return swfdec_as_object_get_debug (SWFDEC_AS_VALUE_GET_OBJECT (value));
- case SWFDEC_AS_TYPE_INT:
- default:
- g_assert_not_reached ();
- return NULL;
- }
-}
-
-/**
* swfdec_as_value_to_number:
* @context: a #SwfdecAsContext
* @value: a #SwfdecAsValue used by context
diff --git a/swfdec/swfdec_as_types.h b/swfdec/swfdec_as_types.h
index b7640be..5a89916 100644
--- a/swfdec/swfdec_as_types.h
+++ b/swfdec/swfdec_as_types.h
@@ -130,7 +130,6 @@ SwfdecAsObject *swfdec_as_value_to_object (SwfdecAsContext * context,
void swfdec_as_value_to_primitive (SwfdecAsValue * value);
const char * swfdec_as_value_to_string (SwfdecAsContext * context,
const SwfdecAsValue * value);
-char * swfdec_as_value_to_debug (const SwfdecAsValue * value);
/* special conversion functions */
const char * swfdec_as_integer_to_string (SwfdecAsContext * context,
diff --git a/swfdec/swfdec_movie.c b/swfdec/swfdec_movie.c
index 104e279..5f3d704 100644
--- a/swfdec/swfdec_movie.c
+++ b/swfdec/swfdec_movie.c
@@ -1271,14 +1271,6 @@ swfdec_movie_foreach_variable (SwfdecAsObject *object, SwfdecAsVariableForeach f
return ret;
}
-static char *
-swfdec_movie_get_debug (SwfdecAsObject *object)
-{
- SwfdecMovie *movie = SWFDEC_MOVIE (object);
-
- return swfdec_movie_get_path (movie, TRUE);
-}
-
typedef struct {
SwfdecMovie * movie;
int depth;
@@ -1445,7 +1437,6 @@ swfdec_movie_class_init (SwfdecMovieClass * movie_class)
asobject_class->get = swfdec_movie_get_variable;
asobject_class->set = swfdec_movie_set_variable;
asobject_class->foreach = swfdec_movie_foreach_variable;
- asobject_class->debug = swfdec_movie_get_debug;
signals[MATRIX_CHANGED] = g_signal_new ("matrix-changed", G_TYPE_FROM_CLASS (movie_class),
G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID,
diff --git a/vivified/core/vivi_wrap_as.c b/vivified/core/vivi_wrap_as.c
index 79d942d..52deceb 100644
--- a/vivified/core/vivi_wrap_as.c
+++ b/vivified/core/vivi_wrap_as.c
@@ -31,7 +31,6 @@ vivi_wrap_toString (SwfdecAsContext *cx, SwfdecAsObject *this,
guint argc, SwfdecAsValue *argv, SwfdecAsValue *retval)
{
ViviWrap *wrap;
- char *s;
if (!VIVI_IS_WRAP (this))
return;
@@ -40,8 +39,7 @@ vivi_wrap_toString (SwfdecAsContext *cx, SwfdecAsObject *this,
if (wrap->wrap == NULL)
return;
- s = swfdec_as_object_get_debug (wrap->wrap);
- SWFDEC_AS_VALUE_SET_STRING (retval, swfdec_as_context_give_string (cx, s));
+ SWFDEC_AS_VALUE_SET_STRING (retval, swfdec_as_context_get_string (cx, "Here be debugging output"));
}
VIVI_FUNCTION ("wrap_get", vivi_wrap_get)
commit e072983376cc51ba7369c1c8ab716d0c8def20b5
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Oct 27 21:33:23 2008 +0100
unify the Gcable types
diff --git a/swfdec/swfdec_as_context.c b/swfdec/swfdec_as_context.c
index c256123..3bcc2bf 100644
--- a/swfdec/swfdec_as_context.c
+++ b/swfdec/swfdec_as_context.c
@@ -337,11 +337,10 @@ swfdec_as_value_mark (SwfdecAsValue *value)
if (SWFDEC_AS_VALUE_IS_OBJECT (value)) {
swfdec_gc_object_mark (SWFDEC_AS_VALUE_GET_OBJECT (value));
- } else if (SWFDEC_AS_VALUE_IS_STRING (value)) {
- if (!SWFDEC_AS_GCABLE_FLAG_IS_SET (value->value.string, SWFDEC_AS_GC_ROOT))
- SWFDEC_AS_GCABLE_SET_FLAG (value->value.string, SWFDEC_AS_GC_MARK);
- } else if (SWFDEC_AS_VALUE_IS_NUMBER (value)) {
- SWFDEC_AS_GCABLE_SET_FLAG (value->value.number, SWFDEC_AS_GC_MARK);
+ } else if (SWFDEC_AS_VALUE_IS_STRING (value) ||
+ SWFDEC_AS_VALUE_IS_NUMBER (value)) {
+ if (!SWFDEC_AS_GCABLE_FLAG_IS_SET (value->value.gcable, SWFDEC_AS_GC_ROOT))
+ SWFDEC_AS_GCABLE_SET_FLAG (value->value.gcable, SWFDEC_AS_GC_MARK);
}
}
diff --git a/swfdec/swfdec_as_interpret.c b/swfdec/swfdec_as_interpret.c
index 34bce10..f654505 100644
--- a/swfdec/swfdec_as_interpret.c
+++ b/swfdec/swfdec_as_interpret.c
@@ -1451,7 +1451,7 @@ swfdec_action_equals2_5 (SwfdecAsContext *cx, guint action, const guint8 *data,
/* else compare as numbers */
if (isnan (l) && isnan (r)) {
cond = (ltype == rtype && ltype == SWFDEC_AS_TYPE_NUMBER &&
- lval->value.number == rval->value.number);
+ lval->value.gcable == rval->value.gcable);
} else {
cond = l == r;
}
@@ -1541,7 +1541,7 @@ swfdec_action_equals2_6 (SwfdecAsContext *cx, guint action, const guint8 *data,
if (isnan (l) && isnan (r)) {
cond = (ltype == rtype && ltype == SWFDEC_AS_TYPE_NUMBER &&
- lval->value.number == rval->value.number);
+ lval->value.gcable == rval->value.gcable);
} else {
cond = l == r;
}
diff --git a/swfdec/swfdec_as_types.c b/swfdec/swfdec_as_types.c
index 1a61d66..92c87de 100644
--- a/swfdec/swfdec_as_types.c
+++ b/swfdec/swfdec_as_types.c
@@ -203,7 +203,7 @@ swfdec_as_value_set_number (SwfdecAsContext *context, SwfdecAsValue *val,
context->numbers = dval;
val->type = SWFDEC_AS_TYPE_NUMBER;
- val->value.number = dval;
+ val->value.gcable = (SwfdecAsGcable *) dval;
}
/**
diff --git a/swfdec/swfdec_as_types.h b/swfdec/swfdec_as_types.h
index 5b80456..b7640be 100644
--- a/swfdec/swfdec_as_types.h
+++ b/swfdec/swfdec_as_types.h
@@ -62,8 +62,7 @@ struct _SwfdecAsValue {
/*< private >*/
union {
gboolean boolean;
- SwfdecAsDoubleValue *number;
- SwfdecAsStringValue *string;
+ SwfdecAsGcable * gcable;
SwfdecAsObject * object;
} value;
};
@@ -90,13 +89,13 @@ struct _SwfdecAsDoubleValue {
};
#define SWFDEC_AS_VALUE_IS_NUMBER(val) (SWFDEC_AS_VALUE_GET_TYPE (val) == SWFDEC_AS_TYPE_NUMBER)
-#define SWFDEC_AS_VALUE_GET_NUMBER(val) ((val)->value.number->number)
+#define SWFDEC_AS_VALUE_GET_NUMBER(val) (((SwfdecAsDoubleValue *) (val)->value.gcable)->number)
#define SWFDEC_AS_VALUE_IS_STRING(val) (SWFDEC_AS_VALUE_GET_TYPE (val) == SWFDEC_AS_TYPE_STRING)
-#define SWFDEC_AS_VALUE_GET_STRING(val) ((val)->value.string->string)
+#define SWFDEC_AS_VALUE_GET_STRING(val) (((SwfdecAsStringValue *) (val)->value.gcable)->string)
#define SWFDEC_AS_VALUE_SET_STRING(val,s) G_STMT_START { \
SwfdecAsValue *__val = (val); \
- (__val)->value.string = (SwfdecAsStringValue *) ((guint8 *) (s) - G_STRUCT_OFFSET (SwfdecAsStringValue, string)); \
+ (__val)->value.gcable = (SwfdecAsGcable *) ((guint8 *) (s) - G_STRUCT_OFFSET (SwfdecAsStringValue, string)); \
(__val)->type = SWFDEC_AS_TYPE_STRING; \
} G_STMT_END
More information about the Swfdec-commits
mailing list