[Swfdec-commits] swfdec/swfdec_amf.c swfdec/swfdec_as_array.c swfdec/swfdec_as_context.c swfdec/swfdec_as_date.c swfdec/swfdec_as_interpret.c swfdec/swfdec_as_math.c swfdec/swfdec_as_number.c swfdec/swfdec_as_object.c swfdec/swfdec_as_string.c swfdec/swfdec_as_types.c swfdec/swfdec_as_types.h swfdec/swfdec_bitmap_data.c swfdec/swfdec_blur_filter_as.c swfdec/swfdec_color_as.c swfdec/swfdec_color_matrix_filter_as.c swfdec/swfdec_color_transform_as.c swfdec/swfdec_key_as.c swfdec/swfdec_load_object_as.c swfdec/swfdec_mouse_as.c swfdec/swfdec_movie_asprops.c swfdec/swfdec_movie.c swfdec/swfdec_movie_clip_loader.c swfdec/swfdec_movie.h swfdec/swfdec_net_stream_as.c swfdec/swfdec_player_as.c swfdec/swfdec_resource.c swfdec/swfdec_selection.c swfdec/swfdec_sound_object.c swfdec/swfdec_sprite_movie_as.c swfdec/swfdec_sprite_movie.c swfdec/swfdec_stage_as.c swfdec/swfdec_style_sheet.c swfdec/swfdec_system_as.c swfdec/swfdec_text_field_movie_as.c swfdec/swfdec_text_field_movie.c swfdec/swfdec_text_field_movie_html.c swfdec/swfdec_text_format.c swfdec/swfdec_transform_as.c swfdec/swfdec_video_movie_as.c swfdec/swfdec_xml.c swfdec/swfdec_xml_node.c test/swfdec_test_buffer.c test/swfdec_test_socket.c test/swfdec_test_test.c
Benjamin Otte
company at kemper.freedesktop.org
Thu Nov 6 14:54:38 PST 2008
swfdec/swfdec_amf.c | 2
swfdec/swfdec_as_array.c | 14 +-
swfdec/swfdec_as_context.c | 20 +--
swfdec/swfdec_as_date.c | 24 ++--
swfdec/swfdec_as_interpret.c | 52 ++++-----
swfdec/swfdec_as_math.c | 36 +++---
swfdec/swfdec_as_number.c | 6 -
swfdec/swfdec_as_object.c | 6 -
swfdec/swfdec_as_string.c | 18 +--
swfdec/swfdec_as_types.c | 18 +--
swfdec/swfdec_as_types.h | 5
swfdec/swfdec_bitmap_data.c | 20 +--
swfdec/swfdec_blur_filter_as.c | 6 -
swfdec/swfdec_color_as.c | 4
swfdec/swfdec_color_matrix_filter_as.c | 2
swfdec/swfdec_color_transform_as.c | 18 +--
swfdec/swfdec_key_as.c | 4
swfdec/swfdec_load_object_as.c | 10 -
swfdec/swfdec_mouse_as.c | 4
swfdec/swfdec_movie.c | 12 --
swfdec/swfdec_movie.h | 21 +--
swfdec/swfdec_movie_asprops.c | 186 ++++++++++++++++-----------------
swfdec/swfdec_movie_clip_loader.c | 8 -
swfdec/swfdec_net_stream_as.c | 10 -
swfdec/swfdec_player_as.c | 2
swfdec/swfdec_resource.c | 12 +-
swfdec/swfdec_selection.c | 12 +-
swfdec/swfdec_sound_object.c | 12 +-
swfdec/swfdec_sprite_movie.c | 13 +-
swfdec/swfdec_sprite_movie_as.c | 34 +++---
swfdec/swfdec_stage_as.c | 8 -
swfdec/swfdec_style_sheet.c | 2
swfdec/swfdec_system_as.c | 8 -
swfdec/swfdec_text_field_movie.c | 23 +---
swfdec/swfdec_text_field_movie_as.c | 26 ++--
swfdec/swfdec_text_field_movie_html.c | 4
swfdec/swfdec_text_format.c | 20 +--
swfdec/swfdec_transform_as.c | 14 +-
swfdec/swfdec_video_movie_as.c | 6 -
swfdec/swfdec_xml.c | 2
swfdec/swfdec_xml_node.c | 4
test/swfdec_test_buffer.c | 5
test/swfdec_test_socket.c | 2
test/swfdec_test_test.c | 2
44 files changed, 356 insertions(+), 361 deletions(-)
New commits:
commit c74ef43b9f8eddbb0460828f5fa59ab28203d9fe
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Nov 6 23:53:33 2008 +0100
swfdec_as_value_set_number => swfdec_as_value_from_number
also rework API for swfdec_movie_property_[gs]et
diff --git a/swfdec/swfdec_amf.c b/swfdec/swfdec_amf.c
index 249a693..fceba82 100644
--- a/swfdec/swfdec_amf.c
+++ b/swfdec/swfdec_amf.c
@@ -40,7 +40,7 @@ swfdec_amf_parse_boolean (SwfdecAsContext *context, SwfdecBits *bits, SwfdecAsVa
static gboolean
swfdec_amf_parse_number (SwfdecAsContext *context, SwfdecBits *bits, SwfdecAsValue *val)
{
- swfdec_as_value_set_number (context, val, swfdec_bits_get_bdouble (bits));
+ *val = swfdec_as_value_from_number (context, swfdec_bits_get_bdouble (bits));
return TRUE;
}
diff --git a/swfdec/swfdec_as_array.c b/swfdec/swfdec_as_array.c
index 3aefeea..6f39136 100644
--- a/swfdec/swfdec_as_array.c
+++ b/swfdec/swfdec_as_array.c
@@ -115,7 +115,7 @@ swfdec_as_array_set_length_object (SwfdecAsObject *object, gint32 length)
was_array = object->array;
object->array = FALSE;
- swfdec_as_value_set_integer (object->context, &val, length);
+ val = swfdec_as_value_from_integer (object->context, length);
swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_length, &val,
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
@@ -138,7 +138,7 @@ swfdec_as_array_set_length (SwfdecAsObject *array, gint32 length)
g_return_if_fail (array != NULL);
g_return_if_fail (length >= 0);
- swfdec_as_value_set_integer (array->context, &val, length);
+ val = swfdec_as_value_from_integer (array->context, length);
swfdec_as_object_set_variable_and_flags (array,
SWFDEC_AS_STR_length, &val,
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
@@ -583,7 +583,7 @@ swfdec_as_array_do_push (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_array_set_length_object (object, length + argc);
}
- swfdec_as_value_set_integer (cx, ret, swfdec_as_array_length_as_integer (object));
+ *ret = swfdec_as_value_from_integer (cx, swfdec_as_array_length_as_integer (object));
}
SWFDEC_AS_NATIVE (252, 2, swfdec_as_array_do_pop)
@@ -633,7 +633,7 @@ swfdec_as_array_do_unshift (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_array_set_length_object (object, length);
}
- swfdec_as_value_set_integer (cx, ret, swfdec_as_array_get_length (object));
+ *ret = swfdec_as_value_from_integer (cx, swfdec_as_array_get_length (object));
}
SWFDEC_AS_NATIVE (252, 4, swfdec_as_array_do_shift)
@@ -1119,11 +1119,11 @@ swfdec_as_array_do_sort (SwfdecAsContext *cx, SwfdecAsObject *object,
break;
}
if (i < length - 1) {
- swfdec_as_value_set_integer (cx, ret, 0);
+ *ret = swfdec_as_value_from_integer (cx, 0);
goto done;
}
} else if (compare_data.equal_found) {
- swfdec_as_value_set_integer (cx, ret, 0);
+ *ret = swfdec_as_value_from_integer (cx, 0);
goto done;
}
}
@@ -1144,7 +1144,7 @@ swfdec_as_array_do_sort (SwfdecAsContext *cx, SwfdecAsObject *object,
var = swfdec_as_integer_to_string (cx, (descending ? length - i - 1 : i));
if (options[0] & SORT_OPTION_RETURNINDEXEDARRAY) {
- swfdec_as_value_set_integer (cx, &val, entry->index_);
+ val = swfdec_as_value_from_integer (cx, entry->index_);
swfdec_as_object_set_variable (target, var, &val);
} else {
swfdec_as_object_set_variable (target, var, &entry->value);
diff --git a/swfdec/swfdec_as_context.c b/swfdec/swfdec_as_context.c
index d5e163f..84ac4f7 100644
--- a/swfdec/swfdec_as_context.c
+++ b/swfdec/swfdec_as_context.c
@@ -1149,14 +1149,14 @@ swfdec_as_context_parseInt (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (0, NULL, "s|i", &s, &radix);
if (argc >= 2 && (radix < 2 || radix > 36)) {
- swfdec_as_value_set_number (cx, retval, NAN);
+ *retval = swfdec_as_value_from_number (cx, NAN);
return;
}
// special case, don't allow sign in front of the 0x
if ((s[0] == '-' || s[0] == '+') && s[1] == '0' &&
(s[2] == 'x' || s[2] == 'X')) {
- swfdec_as_value_set_number (cx, retval, NAN);
+ *retval = swfdec_as_value_from_number (cx, NAN);
return;
}
@@ -1182,7 +1182,7 @@ swfdec_as_context_parseInt (SwfdecAsContext *cx, SwfdecAsObject *object,
if (skip != s && (skip[0] == '-' || skip[0] == '+'))
skip++;
if (skip != s && skip[0] == '0' && (skip[1] == 'x' || skip[1] == 'X')) {
- swfdec_as_value_set_number (cx, retval, 0);
+ *retval = swfdec_as_value_from_number (cx, 0);
return;
}
}
@@ -1190,14 +1190,14 @@ swfdec_as_context_parseInt (SwfdecAsContext *cx, SwfdecAsObject *object,
i = g_ascii_strtoll (s, &tail, radix);
if (tail == s) {
- swfdec_as_value_set_number (cx, retval, NAN);
+ *retval = swfdec_as_value_from_number (cx, NAN);
return;
}
if (i > G_MAXINT32 || i < G_MININT32) {
- swfdec_as_value_set_number (cx, retval, i);
+ *retval = swfdec_as_value_from_number (cx, i);
} else {
- swfdec_as_value_set_integer (cx, retval, i);
+ *retval = swfdec_as_value_from_integer (cx, i);
}
}
@@ -1222,9 +1222,9 @@ swfdec_as_context_parseFloat (SwfdecAsContext *cx, SwfdecAsObject *object,
d = g_ascii_strtod (s, &tail);
if (tail == s) {
- swfdec_as_value_set_number (cx, retval, NAN);
+ *retval = swfdec_as_value_from_number (cx, NAN);
} else {
- swfdec_as_value_set_number (cx, retval, d);
+ *retval = swfdec_as_value_from_number (cx, d);
}
g_free (s);
@@ -1235,9 +1235,9 @@ swfdec_as_context_init_global (SwfdecAsContext *context)
{
SwfdecAsValue val;
- swfdec_as_value_set_number (context, &val, NAN);
+ val = swfdec_as_value_from_number (context, NAN);
swfdec_as_object_set_variable (context->global, SWFDEC_AS_STR_NaN, &val);
- swfdec_as_value_set_number (context, &val, HUGE_VAL);
+ val = swfdec_as_value_from_number (context, HUGE_VAL);
swfdec_as_object_set_variable (context->global, SWFDEC_AS_STR_Infinity, &val);
}
diff --git a/swfdec/swfdec_as_date.c b/swfdec/swfdec_as_date.c
index 1f23e09..2e89619 100644
--- a/swfdec/swfdec_as_date.c
+++ b/swfdec/swfdec_as_date.c
@@ -508,7 +508,7 @@ swfdec_as_date_set_field (SwfdecAsContext *cx, SwfdecAsObject *object,
}
}
- swfdec_as_value_set_number (cx, ret, date->milliseconds);
+ *ret = swfdec_as_value_from_number (cx, date->milliseconds);
}
static void
@@ -522,7 +522,7 @@ swfdec_as_date_get_field (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_AS_DATE, &date, "");
if (!swfdec_as_date_is_valid (date)) {
- swfdec_as_value_set_number (cx, ret, NAN);
+ *ret = swfdec_as_value_from_number (cx, NAN);
return;
}
@@ -532,7 +532,7 @@ swfdec_as_date_get_field (SwfdecAsContext *cx, SwfdecAsObject *object,
if (field == FIELD_FULL_YEAR)
number += 1900;
- swfdec_as_value_set_integer (cx, ret, number);
+ *ret = swfdec_as_value_from_integer (cx, number);
}
/*** AS CODE ***/
@@ -580,7 +580,7 @@ swfdec_as_date_getTime (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_AS_DATE, &date, "");
- swfdec_as_value_set_number (cx, ret, date->milliseconds);
+ *ret = swfdec_as_value_from_number (cx, date->milliseconds);
}
SWFDEC_AS_NATIVE (103, 18, swfdec_as_date_getTimezoneOffset)
@@ -593,7 +593,7 @@ swfdec_as_date_getTimezoneOffset (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_AS_DATE, &date, "");
// reverse of utc_offset
- swfdec_as_value_set_number (cx, ret, -(date->utc_offset));
+ *ret = swfdec_as_value_from_number (cx, -(date->utc_offset));
}
// get* functions
@@ -774,7 +774,7 @@ swfdec_as_date_setTime (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_date_set_milliseconds_utc (date, NAN);
}
- swfdec_as_value_set_number (cx, ret, date->milliseconds);
+ *ret = swfdec_as_value_from_number (cx, date->milliseconds);
}
SWFDEC_AS_NATIVE (103, 15, swfdec_as_date_setMilliseconds)
@@ -989,7 +989,7 @@ swfdec_as_date_UTC (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc,
&num)) {
brokentime.day_of_month = num;
} else {
- swfdec_as_value_set_number (cx, ret, d);
+ *ret = swfdec_as_value_from_number (cx, d);
return;
}
} else {
@@ -1001,7 +1001,7 @@ swfdec_as_date_UTC (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc,
&num)) {
brokentime.hours = num;
} else {
- swfdec_as_value_set_number (cx, ret, d);
+ *ret = swfdec_as_value_from_number (cx, d);
return;
}
}
@@ -1011,7 +1011,7 @@ swfdec_as_date_UTC (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc,
&num)) {
brokentime.minutes = num;
} else {
- swfdec_as_value_set_number (cx, ret, d);
+ *ret = swfdec_as_value_from_number (cx, d);
return;
}
}
@@ -1021,7 +1021,7 @@ swfdec_as_date_UTC (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc,
&num)) {
brokentime.seconds = num;
} else {
- swfdec_as_value_set_number (cx, ret, d);
+ *ret = swfdec_as_value_from_number (cx, d);
return;
}
}
@@ -1037,12 +1037,12 @@ swfdec_as_date_UTC (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc,
&num)) {
brokentime.milliseconds = num;
} else {
- swfdec_as_value_set_number (cx, ret, d);
+ *ret = swfdec_as_value_from_number (cx, d);
return;
}
}
- swfdec_as_value_set_number (cx, ret,
+ *ret = swfdec_as_value_from_number (cx,
swfdec_as_date_brokentime_to_milliseconds (&brokentime));
}
diff --git a/swfdec/swfdec_as_interpret.c b/swfdec/swfdec_as_interpret.c
index f2769c4..ca33a9d 100644
--- a/swfdec/swfdec_as_interpret.c
+++ b/swfdec/swfdec_as_interpret.c
@@ -342,7 +342,7 @@ swfdec_action_push (SwfdecAsContext *cx, guint action, const guint8 *data, guint
break;
}
case 1: /* float */
- swfdec_as_value_set_number (cx, swfdec_as_stack_push (cx),
+ *swfdec_as_stack_push (cx) = swfdec_as_value_from_number (cx,
swfdec_bits_get_float (&bits));
break;
case 2: /* null */
@@ -367,11 +367,11 @@ swfdec_action_push (SwfdecAsContext *cx, guint action, const guint8 *data, guint
swfdec_bits_get_u8 (&bits) ? TRUE : FALSE);
break;
case 6: /* double */
- swfdec_as_value_set_number (cx, swfdec_as_stack_push (cx),
+ *swfdec_as_stack_push (cx) = swfdec_as_value_from_number (cx,
swfdec_bits_get_double (&bits));
break;
case 7: /* 32bit int */
- swfdec_as_value_set_integer (cx, swfdec_as_stack_push (cx),
+ *swfdec_as_stack_push (cx) = swfdec_as_value_from_integer (cx,
swfdec_bits_get_s32 (&bits));
break;
case 8: /* 8bit ConstantPool address */
@@ -713,7 +713,7 @@ swfdec_action_get_property (SwfdecAsContext *cx, guint action, const guint8 *dat
SWFDEC_WARNING ("trying to GetProperty %u, doesn't exist", id);
SWFDEC_AS_VALUE_SET_UNDEFINED (swfdec_as_stack_peek (cx, 2));
} else {
- swfdec_movie_property_get (movie, id, swfdec_as_stack_peek (cx, 2));
+ *swfdec_as_stack_peek (cx, 2) = swfdec_movie_property_get (movie, id);
}
swfdec_as_stack_pop (cx);
}
@@ -737,7 +737,7 @@ swfdec_action_set_property (SwfdecAsContext *cx, guint action, const guint8 *dat
} else if (id > (cx->version > 4 ? 21 : 18)) {
SWFDEC_WARNING ("trying to SetProperty %u, doesn't exist", id);
} else {
- swfdec_movie_property_set (movie, id, swfdec_as_stack_peek (cx, 1));
+ swfdec_movie_property_set (movie, id, *swfdec_as_stack_peek (cx, 1));
}
swfdec_as_stack_pop_n (cx, 3);
}
@@ -951,7 +951,7 @@ swfdec_action_binary (SwfdecAsContext *cx, guint action, const guint8 *data, gui
break;
}
swfdec_as_stack_pop (cx);
- swfdec_as_value_set_number (cx, swfdec_as_stack_peek (cx, 1), l);
+ *swfdec_as_stack_peek (cx, 1) = swfdec_as_value_from_number (cx, l);
}
static void
@@ -1000,7 +1000,7 @@ swfdec_action_add2 (SwfdecAsContext *cx, guint action, const guint8 *data, guint
d2 = swfdec_as_value_to_number (cx, *rval);
d += d2;
swfdec_as_stack_pop (cx);
- swfdec_as_value_set_number (cx, swfdec_as_stack_peek (cx, 1), d);
+ *swfdec_as_stack_peek (cx, 1) = swfdec_as_value_from_number (cx, d);
}
}
@@ -1074,7 +1074,7 @@ swfdec_action_not (SwfdecAsContext *cx, guint action, const guint8 *data, guint
{
if (cx->version <= 4) {
double d = swfdec_as_value_to_number (cx, *swfdec_as_stack_peek (cx, 1));
- swfdec_as_value_set_number (cx, swfdec_as_stack_peek (cx, 1), d == 0 ? 1 : 0);
+ *swfdec_as_stack_peek (cx, 1) = swfdec_as_value_from_integer (cx, d == 0 ? 1 : 0);
} else {
SWFDEC_AS_VALUE_SET_BOOLEAN (swfdec_as_stack_peek (cx, 1),
!swfdec_as_value_to_boolean (cx, *swfdec_as_stack_peek (cx, 1)));
@@ -1114,7 +1114,7 @@ swfdec_action_decrement (SwfdecAsContext *cx, guint action, const guint8 *data,
SwfdecAsValue *val;
val = swfdec_as_stack_peek (cx, 1);
- swfdec_as_value_set_number (cx, val, swfdec_as_value_to_number (cx, *val) - 1);
+ *val = swfdec_as_value_from_number (cx, swfdec_as_value_to_number (cx, *val) - 1);
}
static void
@@ -1123,7 +1123,7 @@ swfdec_action_increment (SwfdecAsContext *cx, guint action, const guint8 *data,
SwfdecAsValue *val;
val = swfdec_as_stack_peek (cx, 1);
- swfdec_as_value_set_number (cx, val, swfdec_as_value_to_number (cx, *val) + 1);
+ *val = swfdec_as_value_from_number (cx, swfdec_as_value_to_number (cx, *val) + 1);
}
static void
@@ -1308,9 +1308,9 @@ swfdec_action_random_number (SwfdecAsContext *cx, guint action, const guint8 *da
max = swfdec_as_value_to_integer (cx, *val);
if (max <= 0)
- swfdec_as_value_set_number (cx, val, 0);
+ *val = swfdec_as_value_from_number (cx, 0);
else
- swfdec_as_value_set_number (cx, val, g_rand_int_range (cx->rand, 0, max));
+ *val = swfdec_as_value_from_number (cx, g_rand_int_range (cx->rand, 0, max));
}
static void
@@ -1334,7 +1334,7 @@ swfdec_action_old_compare (SwfdecAsContext *cx, guint action, const guint8 *data
}
swfdec_as_stack_pop (cx);
if (cx->version < 5) {
- swfdec_as_value_set_number (cx, swfdec_as_stack_peek (cx, 1), cond ? 1 : 0);
+ *swfdec_as_stack_peek (cx, 1) = swfdec_as_value_from_integer (cx, cond ? 1 : 0);
} else {
SWFDEC_AS_VALUE_SET_BOOLEAN (swfdec_as_stack_peek (cx, 1), cond);
}
@@ -1375,7 +1375,7 @@ swfdec_action_string_length (SwfdecAsContext *cx, guint action, const guint8 *da
v = swfdec_as_stack_peek (cx, 1);
s = swfdec_as_value_to_string (cx, *v);
- swfdec_as_value_set_integer (cx, v, g_utf8_strlen (s, -1));
+ *v = swfdec_as_value_from_integer (cx, g_utf8_strlen (s, -1));
}
static void
@@ -1403,7 +1403,7 @@ swfdec_action_string_compare (SwfdecAsContext *cx, guint action, const guint8 *d
}
swfdec_as_stack_pop (cx);
if (cx->version < 5) {
- swfdec_as_value_set_number (cx, swfdec_as_stack_peek (cx, 1), cond ? 1 : 0);
+ *swfdec_as_stack_peek (cx, 1) = swfdec_as_value_from_integer (cx, cond ? 1 : 0);
} else {
SWFDEC_AS_VALUE_SET_BOOLEAN (swfdec_as_stack_peek (cx, 1), cond);
}
@@ -1812,7 +1812,7 @@ swfdec_action_init_array (SwfdecAsContext *cx, guint action, const guint8 *data,
}
if (i != n) {
SwfdecAsValue val;
- swfdec_as_value_set_integer (cx, &val, n);
+ val = swfdec_as_value_from_integer (cx, n);
swfdec_as_object_set_variable (array, SWFDEC_AS_STR_length, &val);
}
SWFDEC_AS_VALUE_SET_OBJECT (swfdec_as_stack_push (cx), array);
@@ -1970,7 +1970,7 @@ swfdec_action_bitwise (SwfdecAsContext *cx, guint action, const guint8 *data, gu
}
swfdec_as_stack_pop (cx);
- swfdec_as_value_set_integer (cx, swfdec_as_stack_peek (cx, 1), a);
+ *swfdec_as_stack_peek (cx, 1) = swfdec_as_value_from_integer (cx, a);
}
static void
@@ -1997,7 +1997,7 @@ swfdec_action_shift (SwfdecAsContext *cx, guint action, const guint8 *data, guin
}
swfdec_as_stack_pop (cx);
- swfdec_as_value_set_integer (cx, swfdec_as_stack_peek (cx, 1), value);
+ *swfdec_as_stack_peek (cx, 1) = swfdec_as_value_from_integer (cx, value);
}
static void
@@ -2005,7 +2005,7 @@ swfdec_action_to_integer (SwfdecAsContext *cx, guint action, const guint8 *data,
{
SwfdecAsValue *val = swfdec_as_stack_peek (cx, 1);
- swfdec_as_value_set_integer (cx, val, swfdec_as_value_to_integer (cx, *val));
+ *val = swfdec_as_value_from_integer (cx, swfdec_as_value_to_integer (cx, *val));
}
static void
@@ -2121,7 +2121,7 @@ swfdec_action_modulo (SwfdecAsContext *cx, guint action, const guint8 *data, gui
}
}
swfdec_as_stack_pop (cx);
- swfdec_as_value_set_number (cx, swfdec_as_stack_peek (cx, 1), x);
+ *swfdec_as_stack_peek (cx, 1) = swfdec_as_value_from_number (cx, x);
}
static void
@@ -2133,7 +2133,7 @@ swfdec_action_swap (SwfdecAsContext *cx, guint action, const guint8 *data, guint
static void
swfdec_action_to_number (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
{
- swfdec_as_value_set_number (cx, swfdec_as_stack_peek (cx, 1),
+ *swfdec_as_stack_peek (cx, 1) = swfdec_as_value_from_number (cx,
swfdec_as_value_to_number (cx, *swfdec_as_stack_peek (cx, 1)));
}
@@ -2209,7 +2209,7 @@ swfdec_action_get_time (SwfdecAsContext *cx, guint action, const guint8 *data, g
diff *= 1000;
diff += (tv.tv_usec - cx->start_time.tv_usec) / 1000;
- swfdec_as_value_set_number (cx, swfdec_as_stack_push (cx), diff);
+ *swfdec_as_stack_push (cx) = swfdec_as_value_from_number (cx, diff);
}
static gboolean
@@ -2488,9 +2488,9 @@ swfdec_action_char_to_ascii (SwfdecAsContext *cx, guint action, const guint8 *da
if (ascii == NULL) {
/* This can happen if a Flash 5 movie gets loaded into a Flash 7 movie */
SWFDEC_FIXME ("Someone threw unconvertible text %s at Flash <= 5", s);
- swfdec_as_value_set_integer (cx, val, 0); /* FIXME: what to return??? */
+ *val = swfdec_as_value_from_integer (cx, 0); /* FIXME: what to return??? */
} else {
- swfdec_as_value_set_integer (cx, val, (guchar) ascii[0]);
+ *val = swfdec_as_value_from_integer (cx, (guchar) ascii[0]);
g_free (ascii);
}
} else {
@@ -2499,9 +2499,9 @@ swfdec_action_char_to_ascii (SwfdecAsContext *cx, guint action, const guint8 *da
if (uni == NULL) {
/* This should never happen, everything is valid UTF-8 in here */
g_warning ("conversion of character %s failed", s);
- swfdec_as_value_set_integer (cx, val, 0);
+ *val = swfdec_as_value_from_integer (cx, 0);
} else {
- swfdec_as_value_set_integer (cx, val, uni[0]);
+ *val = swfdec_as_value_from_integer (cx, uni[0]);
g_free (uni);
}
}
diff --git a/swfdec/swfdec_as_math.c b/swfdec/swfdec_as_math.c
index db07415..ad3942a 100644
--- a/swfdec/swfdec_as_math.c
+++ b/swfdec/swfdec_as_math.c
@@ -42,11 +42,11 @@ swfdec_as_math_ ## name (SwfdecAsContext *cx, SwfdecAsObject *object, \
{ \
double d, unused; \
\
- swfdec_as_value_set_number (cx, ret, NAN); \
+ *ret = swfdec_as_value_from_number (cx, NAN); \
SWFDEC_AS_CHECK (0, NULL, "n|n", &d, &unused); \
\
d = name (d); \
- swfdec_as_value_set_number (cx, ret, d); \
+ *ret = swfdec_as_value_from_number (cx, d); \
}
SWFDEC_AS_NATIVE (200, 16, swfdec_as_math_acos)
@@ -79,10 +79,10 @@ swfdec_as_math_abs (SwfdecAsContext *cx, SwfdecAsObject *object,
{
double d, unused;
- swfdec_as_value_set_number (cx, ret, NAN);
+ *ret = swfdec_as_value_from_number (cx, NAN);
SWFDEC_AS_CHECK (0, NULL, "n|n", &d, &unused);
- swfdec_as_value_set_number (cx, ret, fabs (d));
+ *ret = swfdec_as_value_from_number (cx, fabs (d));
}
SWFDEC_AS_NATIVE (200, 5, swfdec_as_math_atan2)
@@ -92,10 +92,10 @@ swfdec_as_math_atan2 (SwfdecAsContext *cx, SwfdecAsObject *object,
{
double x, y;
- swfdec_as_value_set_number (cx, ret, NAN);
+ *ret = swfdec_as_value_from_number (cx, NAN);
SWFDEC_AS_CHECK (0, NULL, "nn", &y, &x);
- swfdec_as_value_set_number (cx, ret, atan2 (y, x));
+ *ret = swfdec_as_value_from_number (cx, atan2 (y, x));
}
SWFDEC_AS_NATIVE (200, 2, swfdec_as_math_max)
@@ -106,13 +106,13 @@ swfdec_as_math_max (SwfdecAsContext *cx, SwfdecAsObject *object,
double x, y;
if (argc == 0) {
- swfdec_as_value_set_number (cx, ret, -HUGE_VAL);
+ *ret = swfdec_as_value_from_number (cx, -HUGE_VAL);
} else {
- swfdec_as_value_set_number (cx, ret, NAN);
+ *ret = swfdec_as_value_from_number (cx, NAN);
}
SWFDEC_AS_CHECK (0, NULL, "nn", &x, &y);
- swfdec_as_value_set_number (cx, ret, isnan (x) || isnan (y) ? NAN : MAX (x, y));
+ *ret = swfdec_as_value_from_number (cx, isnan (x) || isnan (y) ? NAN : MAX (x, y));
}
SWFDEC_AS_NATIVE (200, 1, swfdec_as_math_min)
@@ -123,13 +123,13 @@ swfdec_as_math_min (SwfdecAsContext *cx, SwfdecAsObject *object,
double x, y;
if (argc == 0) {
- swfdec_as_value_set_number (cx, ret, HUGE_VAL);
+ *ret = swfdec_as_value_from_number (cx, HUGE_VAL);
} else {
- swfdec_as_value_set_number (cx, ret, NAN);
+ *ret = swfdec_as_value_from_number (cx, NAN);
}
SWFDEC_AS_CHECK (0, NULL, "nn", &x, &y);
- swfdec_as_value_set_number (cx, ret, isnan (x) || isnan (y) ? NAN : MIN (x, y));
+ *ret = swfdec_as_value_from_number (cx, isnan (x) || isnan (y) ? NAN : MIN (x, y));
}
SWFDEC_AS_NATIVE (200, 17, swfdec_as_math_pow)
@@ -139,10 +139,10 @@ swfdec_as_math_pow (SwfdecAsContext *cx, SwfdecAsObject *object,
{
double x, y;
- swfdec_as_value_set_number (cx, ret, NAN);
+ *ret = swfdec_as_value_from_number (cx, NAN);
SWFDEC_AS_CHECK (0, NULL, "nn", &x, &y);
- swfdec_as_value_set_number (cx, ret, isfinite (x) ? pow (x, y): NAN);
+ *ret = swfdec_as_value_from_number (cx, isfinite (x) ? pow (x, y): NAN);
}
SWFDEC_AS_NATIVE (200, 11, swfdec_as_math_random)
@@ -152,10 +152,10 @@ swfdec_as_math_random (SwfdecAsContext *cx, SwfdecAsObject *object,
{
double unused, unused2;
- swfdec_as_value_set_number (cx, ret, NAN);
+ *ret = swfdec_as_value_from_number (cx, NAN);
SWFDEC_AS_CHECK (0, NULL, "|nn", &unused, &unused2);
- swfdec_as_value_set_number (cx, ret, g_rand_double (cx->rand));
+ *ret = swfdec_as_value_from_number (cx, g_rand_double (cx->rand));
}
SWFDEC_AS_NATIVE (200, 10, swfdec_as_math_round)
@@ -165,8 +165,8 @@ swfdec_as_math_round (SwfdecAsContext *cx, SwfdecAsObject *object,
{
double d, unused;
- swfdec_as_value_set_number (cx, ret, NAN);
+ *ret = swfdec_as_value_from_number (cx, NAN);
SWFDEC_AS_CHECK (0, NULL, "n|n", &d, &unused);
- swfdec_as_value_set_number (cx, ret, floor (d + 0.5));
+ *ret = swfdec_as_value_from_number (cx, floor (d + 0.5));
}
diff --git a/swfdec/swfdec_as_number.c b/swfdec/swfdec_as_number.c
index 3da13a2..06c74ea 100644
--- a/swfdec/swfdec_as_number.c
+++ b/swfdec/swfdec_as_number.c
@@ -64,7 +64,7 @@ swfdec_as_number_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (num));
SWFDEC_AS_VALUE_SET_OBJECT (ret, object);
} else {
- swfdec_as_value_set_number (cx, ret, d);
+ *ret = swfdec_as_value_from_number (cx, d);
}
}
@@ -126,7 +126,7 @@ swfdec_as_number_toString (SwfdecAsContext *cx, SwfdecAsObject *object,
if (radix == 10 || radix < 2 || radix > 36 || isinf (num->number) ||
isnan (num->number)) {
- swfdec_as_value_set_number (cx, &val, num->number);
+ val = swfdec_as_value_from_number (cx, num->number);
s = swfdec_as_value_to_string (cx, val);
} else {
s = swfdec_as_number_toStringRadix (cx, num->number, radix);
@@ -143,7 +143,7 @@ swfdec_as_number_valueOf (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_AS_NUMBER, &num, "");
- swfdec_as_value_set_number (cx, ret, num->number);
+ *ret = swfdec_as_value_from_number (cx, num->number);
}
// only available as ASnative
diff --git a/swfdec/swfdec_as_object.c b/swfdec/swfdec_as_object.c
index 1aeb8f4..fc91eab 100644
--- a/swfdec/swfdec_as_object.c
+++ b/swfdec/swfdec_as_object.c
@@ -660,7 +660,7 @@ swfdec_as_object_set_variable_and_flags (SwfdecAsObject *object,
guint prop_id = swfdec_movie_property_lookup (variable);
if (prop_id != G_MAXUINT) {
- swfdec_movie_property_set (movie, prop_id, value);
+ swfdec_movie_property_set (movie, prop_id, *value);
return;
}
@@ -775,7 +775,7 @@ swfdec_as_object_set_variable_and_flags (SwfdecAsObject *object,
length = swfdec_as_value_to_integer (context, tmp);
if (l >= length) {
object->array = FALSE;
- swfdec_as_value_set_integer (context, &tmp, l + 1);
+ tmp = swfdec_as_value_from_integer (context, l + 1);
swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_length, &tmp,
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
object->array = TRUE;
@@ -912,7 +912,7 @@ swfdec_as_object_get_variable_and_flags (SwfdecAsObject *object,
prop_id = swfdec_movie_property_lookup (variable);
if (prop_id != G_MAXUINT) {
- swfdec_movie_property_get (movie, prop_id, value);
+ *value = swfdec_movie_property_get (movie, prop_id);
*flags = 0;
*pobject = cur;
return TRUE;
diff --git a/swfdec/swfdec_as_string.c b/swfdec/swfdec_as_string.c
index 9a28915..2d2e269 100644
--- a/swfdec/swfdec_as_string.c
+++ b/swfdec/swfdec_as_string.c
@@ -95,7 +95,7 @@ swfdec_as_string_lastIndexOf (SwfdecAsContext *cx, SwfdecAsObject *object,
int offset = swfdec_as_value_to_integer (cx, argv[1]);
const char *tmp;
if (offset < 0) {
- swfdec_as_value_set_integer (cx, ret, -1);
+ *ret = swfdec_as_value_from_integer (cx, -1);
return;
}
tmp = string;
@@ -108,9 +108,9 @@ swfdec_as_string_lastIndexOf (SwfdecAsContext *cx, SwfdecAsObject *object,
}
s = g_strrstr_len (string, len, s);
if (s) {
- swfdec_as_value_set_integer (cx, ret, g_utf8_pointer_to_offset (string, s));
+ *ret = swfdec_as_value_from_integer (cx, g_utf8_pointer_to_offset (string, s));
} else {
- swfdec_as_value_set_integer (cx, ret, -1);
+ *ret = swfdec_as_value_from_integer (cx, -1);
}
}
@@ -137,7 +137,7 @@ swfdec_as_string_indexOf (SwfdecAsContext *cx, SwfdecAsObject *object,
i = g_utf8_pointer_to_offset (string, t);
}
- swfdec_as_value_set_integer (cx, ret, i);
+ *ret = swfdec_as_value_from_integer (cx, i);
}
SWFDEC_AS_NATIVE (251, 5, swfdec_as_string_charAt)
@@ -178,20 +178,20 @@ swfdec_as_string_charCodeAt (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_STRING_CHECK (&string, "i", &i);
if (i < 0) {
- swfdec_as_value_set_number (cx, ret, NAN);
+ *ret = swfdec_as_value_from_number (cx, NAN);
return;
}
s = swfdec_as_str_nth_char (string, i);
if (*s == 0) {
if (cx->version > 5) {
- swfdec_as_value_set_number (cx, ret, NAN);
+ *ret = swfdec_as_value_from_number (cx, NAN);
} else {
- swfdec_as_value_set_integer (cx, ret, 0);
+ *ret = swfdec_as_value_from_integer (cx, 0);
}
return;
}
c = g_utf8_get_char (s);
- swfdec_as_value_set_number (cx, ret, c);
+ *ret = swfdec_as_value_from_number (cx, c);
}
static void
@@ -294,7 +294,7 @@ swfdec_as_string_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
string->string = s;
swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (string));
- swfdec_as_value_set_integer (cx, &val, g_utf8_strlen (string->string, -1));
+ val = swfdec_as_value_from_integer (cx, g_utf8_strlen (string->string, -1));
swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_length,
&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
diff --git a/swfdec/swfdec_as_types.c b/swfdec/swfdec_as_types.c
index 0b7211d..93b8d38 100644
--- a/swfdec/swfdec_as_types.c
+++ b/swfdec/swfdec_as_types.c
@@ -175,35 +175,37 @@
* @val: value to set
* @i: integer value to set
*
+ * Creates a garbage-collected value representing @i and returns it.
* Sets @val to the given value. Currently this function is a macro that calls
* swfdec_as_value_set_number(), but this may change in future versions of
* Swfdec.
+ *
+ * Returns: The new value representing @i
*/
/**
* swfdec_as_value_set_number:
* @context: The context to use
- * @val: value to set
* @number: double value to set
*
- * Sets @val to the given value. If you are sure the value is a valid
- * integer value, use wfdec_as_value_set_int() instead.
+ * Creates a garbage-collected value representing @number and returns it.
+ *
+ * Returns: The new value representing @number
*/
-void
-swfdec_as_value_set_number (SwfdecAsContext *context, SwfdecAsValue *val,
+SwfdecAsValue
+swfdec_as_value_from_number (SwfdecAsContext *context,
double d)
{
SwfdecAsDoubleValue *dval;
- g_return_if_fail (SWFDEC_IS_AS_CONTEXT (context));
- g_return_if_fail (val != NULL);
+ g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), SWFDEC_AS_VALUE_UNDEFINED);
dval = swfdec_as_gcable_new (context, SwfdecAsDoubleValue);
dval->number = d;
SWFDEC_AS_GCABLE_SET_NEXT (dval, context->numbers);
context->numbers = dval;
- *val = SWFDEC_AS_VALUE_COMBINE (dval, SWFDEC_AS_TYPE_NUMBER);
+ return SWFDEC_AS_VALUE_COMBINE (dval, SWFDEC_AS_TYPE_NUMBER);
}
/**
diff --git a/swfdec/swfdec_as_types.h b/swfdec/swfdec_as_types.h
index ce863f8..bfa05b0 100644
--- a/swfdec/swfdec_as_types.h
+++ b/swfdec/swfdec_as_types.h
@@ -112,9 +112,8 @@ struct _SwfdecAsDoubleValue {
} G_STMT_END
/* value setters */
-#define swfdec_as_value_set_integer(cx, val, i) swfdec_as_value_set_number((cx), (val), (int) (i))
-void swfdec_as_value_set_number (SwfdecAsContext * context,
- SwfdecAsValue * value,
+#define swfdec_as_value_from_integer(cx, i) swfdec_as_value_from_number((cx), (int) (i))
+SwfdecAsValue swfdec_as_value_from_number (SwfdecAsContext * context,
double number);
/* value conversion functions */
diff --git a/swfdec/swfdec_bitmap_data.c b/swfdec/swfdec_bitmap_data.c
index da44d4f..1643f62 100644
--- a/swfdec/swfdec_bitmap_data.c
+++ b/swfdec/swfdec_bitmap_data.c
@@ -189,7 +189,7 @@ swfdec_bitmap_data_do_get_width (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_BITMAP_DATA, &bitmap, "");
- swfdec_as_value_set_integer (cx, ret, bitmap->surface ? (int) bitmap->width : -1);
+ *ret = swfdec_as_value_from_integer (cx, bitmap->surface ? (int) bitmap->width : -1);
}
SWFDEC_AS_NATIVE (1100, 101, swfdec_bitmap_data_set_width)
@@ -209,7 +209,7 @@ swfdec_bitmap_data_do_get_height (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_BITMAP_DATA, &bitmap, "");
- swfdec_as_value_set_integer (cx, ret, bitmap->surface ? (int) bitmap->height : -1);
+ *ret = swfdec_as_value_from_integer (cx, bitmap->surface ? (int) bitmap->height : -1);
}
SWFDEC_AS_NATIVE (1100, 103, swfdec_bitmap_data_set_height)
@@ -231,7 +231,7 @@ swfdec_bitmap_data_get_rectangle (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_BITMAP_DATA, &bitmap, "");
- swfdec_as_value_set_integer (cx, ret, -1);
+ *ret = swfdec_as_value_from_integer (cx, -1);
if (bitmap->surface == NULL)
return;
@@ -244,10 +244,10 @@ swfdec_bitmap_data_get_rectangle (SwfdecAsContext *cx, SwfdecAsObject *object,
if (!SWFDEC_IS_AS_FUNCTION (o->relay))
return;
- swfdec_as_value_set_integer (cx, &args[0], 0);
- swfdec_as_value_set_integer (cx, &args[1], 0);
- swfdec_as_value_set_integer (cx, &args[2], bitmap->width);
- swfdec_as_value_set_integer (cx, &args[3], bitmap->height);
+ args[0] = swfdec_as_value_from_integer (cx, 0);
+ args[1] = swfdec_as_value_from_integer (cx, 0);
+ args[2] = swfdec_as_value_from_integer (cx, bitmap->width);
+ args[3] = swfdec_as_value_from_integer (cx, bitmap->height);
swfdec_as_object_create (SWFDEC_AS_FUNCTION (o->relay), 4, args, ret);
}
@@ -273,7 +273,7 @@ swfdec_bitmap_data_get_transparent (SwfdecAsContext *cx,
SWFDEC_AS_VALUE_SET_BOOLEAN (ret,
swfdec_surface_has_alpha (bitmap->surface) ? TRUE : FALSE);
} else {
- swfdec_as_value_set_integer (cx, ret, -1);
+ *ret = swfdec_as_value_from_integer (cx, -1);
}
}
@@ -316,7 +316,7 @@ swfdec_bitmap_data_getPixel (SwfdecAsContext *cx, SwfdecAsObject *object,
color = swfdec_bitmap_data_get_pixel (bitmap, x, y);
color = SWFDEC_COLOR_UNMULTIPLY (color);
color &= SWFDEC_COLOR_COMBINE (0xFF, 0xFF, 0xFF, 0);
- swfdec_as_value_set_integer (cx, ret, color);
+ *ret = swfdec_as_value_from_integer (cx, color);
}
SWFDEC_AS_NATIVE (1100, 2, swfdec_bitmap_data_setPixel)
@@ -564,7 +564,7 @@ swfdec_bitmap_data_getPixel32 (SwfdecAsContext *cx, SwfdecAsObject *object,
color = swfdec_bitmap_data_get_pixel (bitmap, x, y);
color = SWFDEC_COLOR_UNMULTIPLY (color);
- swfdec_as_value_set_integer (cx, ret, color);
+ *ret = swfdec_as_value_from_integer (cx, color);
}
SWFDEC_AS_NATIVE (1100, 11, swfdec_bitmap_data_setPixel32)
diff --git a/swfdec/swfdec_blur_filter_as.c b/swfdec/swfdec_blur_filter_as.c
index 162f7f4..8da57e0 100644
--- a/swfdec/swfdec_blur_filter_as.c
+++ b/swfdec/swfdec_blur_filter_as.c
@@ -35,7 +35,7 @@ swfdec_blur_filter_get_blurX (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_BLUR_FILTER, &filter, "");
- swfdec_as_value_set_number (cx, ret, filter->x);
+ *ret = swfdec_as_value_from_number (cx, filter->x);
}
SWFDEC_AS_NATIVE (1102, 2, swfdec_blur_filter_set_blurX)
@@ -61,7 +61,7 @@ swfdec_blur_filter_get_blurY (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_BLUR_FILTER, &filter, "");
- swfdec_as_value_set_number (cx, ret, filter->y);
+ *ret = swfdec_as_value_from_number (cx, filter->y);
}
SWFDEC_AS_NATIVE (1102, 4, swfdec_blur_filter_set_blurY)
@@ -87,7 +87,7 @@ swfdec_blur_filter_get_quality (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_BLUR_FILTER, &filter, "");
- swfdec_as_value_set_integer (cx, ret, filter->quality);
+ *ret = swfdec_as_value_from_integer (cx, filter->quality);
}
SWFDEC_AS_NATIVE (1102, 6, swfdec_blur_filter_set_quality)
diff --git a/swfdec/swfdec_color_as.c b/swfdec/swfdec_color_as.c
index d10f749..2b68861 100644
--- a/swfdec/swfdec_color_as.c
+++ b/swfdec/swfdec_color_as.c
@@ -62,7 +62,7 @@ swfdec_movie_color_getRGB (SwfdecAsContext *cx, SwfdecAsObject *obj,
result = (movie->color_transform.rb << 16) |
((movie->color_transform.gb % 256) << 8) |
(movie->color_transform.bb % 256);
- swfdec_as_value_set_integer (cx, ret, result);
+ *ret = swfdec_as_value_from_integer (cx, result);
}
static void
@@ -70,7 +70,7 @@ add_variable (SwfdecAsObject *obj, const char *name, double value)
{
SwfdecAsValue val;
- swfdec_as_value_set_number (obj->context, &val, value);
+ val = swfdec_as_value_from_number (obj->context, value);
swfdec_as_object_set_variable (obj, name, &val);
}
diff --git a/swfdec/swfdec_color_matrix_filter_as.c b/swfdec/swfdec_color_matrix_filter_as.c
index 4ce6d14..76865ae 100644
--- a/swfdec/swfdec_color_matrix_filter_as.c
+++ b/swfdec/swfdec_color_matrix_filter_as.c
@@ -45,7 +45,7 @@ swfdec_color_matrix_filter_get_matrix (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_COLOR_MATRIX_FILTER, &cm, "");
for (i = 0; i < 20; i++) {
- swfdec_as_value_set_number (cx, &val[i], cm->matrix[i]);
+ val[i] = swfdec_as_value_from_number (cx, cm->matrix[i]);
}
array = swfdec_as_array_new (cx);
swfdec_as_array_append (array, 20, val);
diff --git a/swfdec/swfdec_color_transform_as.c b/swfdec/swfdec_color_transform_as.c
index 612c787..3f60aee 100644
--- a/swfdec/swfdec_color_transform_as.c
+++ b/swfdec/swfdec_color_transform_as.c
@@ -58,7 +58,7 @@ swfdec_color_transform_as_get_alphaMultiplier (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_COLOR_TRANSFORM_AS, &transform, "");
- swfdec_as_value_set_number (cx, ret, transform->aa);
+ *ret = swfdec_as_value_from_number (cx, transform->aa);
}
SWFDEC_AS_NATIVE (1105, 102, swfdec_color_transform_as_set_alphaMultiplier)
@@ -85,7 +85,7 @@ swfdec_color_transform_as_get_redMultiplier (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_COLOR_TRANSFORM_AS, &transform, "");
- swfdec_as_value_set_number (cx, ret, transform->ra);
+ *ret = swfdec_as_value_from_number (cx, transform->ra);
}
SWFDEC_AS_NATIVE (1105, 104, swfdec_color_transform_as_set_redMultiplier)
@@ -112,7 +112,7 @@ swfdec_color_transform_as_get_greenMultiplier (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_COLOR_TRANSFORM_AS, &transform, "");
- swfdec_as_value_set_number (cx, ret, transform->ga);
+ *ret = swfdec_as_value_from_number (cx, transform->ga);
}
SWFDEC_AS_NATIVE (1105, 106, swfdec_color_transform_as_set_greenMultiplier)
@@ -139,7 +139,7 @@ swfdec_color_transform_as_get_blueMultiplier (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_COLOR_TRANSFORM_AS, &transform, "");
- swfdec_as_value_set_number (cx, ret, transform->ba);
+ *ret = swfdec_as_value_from_number (cx, transform->ba);
}
SWFDEC_AS_NATIVE (1105, 108, swfdec_color_transform_as_set_blueMultiplier)
@@ -166,7 +166,7 @@ swfdec_color_transform_as_get_alphaOffset (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_COLOR_TRANSFORM_AS, &transform, "");
- swfdec_as_value_set_number (cx, ret, transform->ab);
+ *ret = swfdec_as_value_from_number (cx, transform->ab);
}
SWFDEC_AS_NATIVE (1105, 110, swfdec_color_transform_as_set_alphaOffset)
@@ -193,7 +193,7 @@ swfdec_color_transform_as_get_redOffset (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_COLOR_TRANSFORM_AS, &transform, "");
- swfdec_as_value_set_number (cx, ret, transform->rb);
+ *ret = swfdec_as_value_from_number (cx, transform->rb);
}
SWFDEC_AS_NATIVE (1105, 112, swfdec_color_transform_as_set_redOffset)
@@ -220,7 +220,7 @@ swfdec_color_transform_as_get_greenOffset (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_COLOR_TRANSFORM_AS, &transform, "");
- swfdec_as_value_set_number (cx, ret, transform->gb);
+ *ret = swfdec_as_value_from_number (cx, transform->gb);
}
SWFDEC_AS_NATIVE (1105, 114, swfdec_color_transform_as_set_greenOffset)
@@ -247,7 +247,7 @@ swfdec_color_transform_as_get_blueOffset (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_COLOR_TRANSFORM_AS, &transform, "");
- swfdec_as_value_set_number (cx, ret, transform->bb);
+ *ret = swfdec_as_value_from_number (cx, transform->bb);
}
SWFDEC_AS_NATIVE (1105, 116, swfdec_color_transform_as_set_blueOffset)
@@ -281,7 +281,7 @@ swfdec_color_transform_as_get_rgb (SwfdecAsContext *cx,
value |= swfdec_as_double_to_integer (transform->gb) << 8;
value |= swfdec_as_double_to_integer (transform->bb);
- swfdec_as_value_set_integer (cx, ret, value);
+ *ret = swfdec_as_value_from_integer (cx, value);
}
SWFDEC_AS_NATIVE (1105, 118, swfdec_color_transform_as_set_rgb)
diff --git a/swfdec/swfdec_key_as.c b/swfdec/swfdec_key_as.c
index 2530ef3..2c349e2 100644
--- a/swfdec/swfdec_key_as.c
+++ b/swfdec/swfdec_key_as.c
@@ -34,7 +34,7 @@ swfdec_key_getAscii (SwfdecAsContext *cx, SwfdecAsObject *object,
{
SwfdecPlayer *player = SWFDEC_PLAYER (cx);
- swfdec_as_value_set_integer (cx, retval, player->priv->last_character);
+ *retval = swfdec_as_value_from_integer (cx, player->priv->last_character);
}
SWFDEC_AS_NATIVE (800, 1, swfdec_key_getCode)
@@ -44,7 +44,7 @@ swfdec_key_getCode (SwfdecAsContext *cx, SwfdecAsObject *object,
{
SwfdecPlayer *player = SWFDEC_PLAYER (cx);
- swfdec_as_value_set_integer (cx, retval, player->priv->last_keycode);
+ *retval = swfdec_as_value_from_integer (cx, player->priv->last_keycode);
}
SWFDEC_AS_NATIVE (800, 2, swfdec_key_isDown)
diff --git a/swfdec/swfdec_load_object_as.c b/swfdec/swfdec_load_object_as.c
index 2b665df..97eb14e 100644
--- a/swfdec/swfdec_load_object_as.c
+++ b/swfdec/swfdec_load_object_as.c
@@ -60,14 +60,14 @@ swfdec_load_object_on_progress (SwfdecPlayer *player, const SwfdecAsValue *targe
object = SWFDEC_AS_VALUE_GET_COMPOSITE (*target);
if (object == NULL)
return;
- swfdec_as_value_set_number (cx, &val, loaded);
+ val = swfdec_as_value_from_number (cx, loaded);
swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR__bytesLoaded,
&val, SWFDEC_AS_VARIABLE_HIDDEN);
if (size >= 0) {
- swfdec_as_value_set_number (cx, &val, size);
+ val = swfdec_as_value_from_number (cx, size);
} else {
- swfdec_as_value_set_number (cx, &val, loaded);
+ val = swfdec_as_value_from_number (cx, loaded);
}
swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR__bytesTotal,
&val, SWFDEC_AS_VARIABLE_HIDDEN);
@@ -90,7 +90,7 @@ swfdec_load_object_as_load (SwfdecAsContext *cx, SwfdecAsObject *object, guint a
swfdec_load_object_create (SWFDEC_PLAYER (cx), &val, url, NULL, 0, NULL, NULL,
swfdec_load_object_on_progress, swfdec_load_object_on_finish);
- swfdec_as_value_set_integer (cx, &val, 0);
+ val = swfdec_as_value_from_integer (cx, 0);
swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR__bytesLoaded,
&val, SWFDEC_AS_VARIABLE_HIDDEN);
SWFDEC_AS_VALUE_SET_UNDEFINED (&val);
@@ -263,7 +263,7 @@ swfdec_load_object_as_sendAndLoad (SwfdecAsContext *cx, SwfdecAsObject *object,
header_values, swfdec_load_object_on_progress,
swfdec_load_object_on_finish);
- swfdec_as_value_set_integer (cx, &val, 0);
+ val = swfdec_as_value_from_integer (cx, 0);
swfdec_as_object_set_variable_and_flags (target, SWFDEC_AS_STR__bytesLoaded,
&val, SWFDEC_AS_VARIABLE_HIDDEN);
SWFDEC_AS_VALUE_SET_UNDEFINED (&val);
diff --git a/swfdec/swfdec_mouse_as.c b/swfdec/swfdec_mouse_as.c
index 9169b45..8b9ed9c 100644
--- a/swfdec/swfdec_mouse_as.c
+++ b/swfdec/swfdec_mouse_as.c
@@ -34,7 +34,7 @@ swfdec_mouse_show (SwfdecAsContext *cx, SwfdecAsObject *object,
{
SwfdecPlayer *player = SWFDEC_PLAYER (cx);
- swfdec_as_value_set_integer (cx, retval, player->priv->mouse_visible ? 1 : 0);
+ *retval = swfdec_as_value_from_integer (cx, player->priv->mouse_visible ? 1 : 0);
player->priv->mouse_visible = TRUE;
}
@@ -45,7 +45,7 @@ swfdec_mouse_hide (SwfdecAsContext *cx, SwfdecAsObject *object,
{
SwfdecPlayer *player = SWFDEC_PLAYER (cx);
- swfdec_as_value_set_integer (cx, retval, player->priv->mouse_visible ? 1 : 0);
+ *retval = swfdec_as_value_from_integer (cx, player->priv->mouse_visible ? 1 : 0);
player->priv->mouse_visible = FALSE;
}
diff --git a/swfdec/swfdec_movie.c b/swfdec/swfdec_movie.c
index fc7ab75..735cf78 100644
--- a/swfdec/swfdec_movie.c
+++ b/swfdec/swfdec_movie.c
@@ -1677,26 +1677,24 @@ swfdec_movie_get_own_resource (SwfdecMovie *movie)
}
void
-swfdec_movie_property_set (SwfdecMovie *movie, guint id, const SwfdecAsValue *val)
+swfdec_movie_property_set (SwfdecMovie *movie, guint id, SwfdecAsValue val)
{
SwfdecMovieClass *klass;
g_return_if_fail (SWFDEC_IS_MOVIE (movie));
- g_return_if_fail (val != NULL);
klass = SWFDEC_MOVIE_GET_CLASS (movie);
klass->property_set (movie, id, val);
}
-void
-swfdec_movie_property_get (SwfdecMovie *movie, guint id, SwfdecAsValue *val)
+SwfdecAsValue
+swfdec_movie_property_get (SwfdecMovie *movie, guint id)
{
SwfdecMovieClass *klass;
- g_return_if_fail (SWFDEC_IS_MOVIE (movie));
- g_return_if_fail (val != NULL);
+ g_return_val_if_fail (SWFDEC_IS_MOVIE (movie), SWFDEC_AS_VALUE_UNDEFINED);
klass = SWFDEC_MOVIE_GET_CLASS (movie);
- klass->property_get (movie, id, val);
+ return klass->property_get (movie, id);
}
diff --git a/swfdec/swfdec_movie.h b/swfdec/swfdec_movie.h
index 7963033..c0c1d7a 100644
--- a/swfdec/swfdec_movie.h
+++ b/swfdec/swfdec_movie.h
@@ -187,12 +187,11 @@ struct _SwfdecMovieClass {
/* general vfuncs */
void (* init_movie) (SwfdecMovie * movie);
void (* finish_movie) (SwfdecMovie * movie);
- void (* property_get) (SwfdecMovie * movie,
- guint prop_id,
- SwfdecAsValue * value);
+ SwfdecAsValue (* property_get) (SwfdecMovie * movie,
+ guint prop_id);
void (* property_set) (SwfdecMovie * movie,
guint prop_id,
- const SwfdecAsValue * value);
+ SwfdecAsValue value);
void (* replace) (SwfdecMovie * movie,
SwfdecGraphic * graphic);
void (* set_ratio) (SwfdecMovie * movie);
@@ -231,10 +230,9 @@ SwfdecMovie * swfdec_movie_get_by_name (SwfdecMovie * movie,
SwfdecMovie * swfdec_movie_get_root (SwfdecMovie * movie);
void swfdec_movie_property_set (SwfdecMovie * movie,
guint id,
- const SwfdecAsValue * val);
-void swfdec_movie_property_get (SwfdecMovie * movie,
- guint id,
- SwfdecAsValue * val);
+ SwfdecAsValue val);
+SwfdecAsValue swfdec_movie_property_get (SwfdecMovie * movie,
+ guint id);
void swfdec_movie_call_variable_listeners
(SwfdecMovie * movie,
const char * name,
@@ -304,10 +302,9 @@ SwfdecDepthClass
guint swfdec_movie_property_lookup (const char * name);
void swfdec_movie_property_do_set (SwfdecMovie * movie,
guint id,
- const SwfdecAsValue * val);
-void swfdec_movie_property_do_get (SwfdecMovie * movie,
- guint id,
- SwfdecAsValue * val);
+ SwfdecAsValue val);
+SwfdecAsValue swfdec_movie_property_do_get (SwfdecMovie * movie,
+ guint id);
void swfdec_movie_add_variable_listener (SwfdecMovie * movie,
gpointer data,
diff --git a/swfdec/swfdec_movie_asprops.c b/swfdec/swfdec_movie_asprops.c
index 59e4847..7d018ab 100644
--- a/swfdec/swfdec_movie_asprops.c
+++ b/swfdec/swfdec_movie_asprops.c
@@ -37,22 +37,24 @@
#include "swfdec_sprite_movie.h"
#include "swfdec_resource.h"
-static void
-mc_x_get (SwfdecMovie *movie, SwfdecAsValue *rval)
+static SwfdecAsValue
+mc_x_get (SwfdecMovie *movie)
{
double d;
+ SwfdecAsValue rval;
swfdec_movie_update (movie);
d = SWFDEC_TWIPS_TO_DOUBLE (movie->matrix.x0);
- swfdec_as_value_set_number (swfdec_gc_object_get_context (movie), rval, d);
+ rval = swfdec_as_value_from_number (swfdec_gc_object_get_context (movie), d);
+ return rval;
}
static void
-mc_x_set (SwfdecMovie *movie, const SwfdecAsValue *val)
+mc_x_set (SwfdecMovie *movie, SwfdecAsValue val)
{
SwfdecTwips x;
- if (!swfdec_as_value_to_twips (swfdec_gc_object_get_context (movie), val, FALSE, &x))
+ if (!swfdec_as_value_to_twips (swfdec_gc_object_get_context (movie), &val, FALSE, &x))
return;
movie->modified = TRUE;
if (x != movie->matrix.x0) {
@@ -62,22 +64,22 @@ mc_x_set (SwfdecMovie *movie, const SwfdecAsValue *val)
}
}
-static void
-mc_y_get (SwfdecMovie *movie, SwfdecAsValue *rval)
+static SwfdecAsValue
+mc_y_get (SwfdecMovie *movie)
{
double d;
swfdec_movie_update (movie);
d = SWFDEC_TWIPS_TO_DOUBLE (movie->matrix.y0);
- swfdec_as_value_set_number (swfdec_gc_object_get_context (movie), rval, d);
+ return swfdec_as_value_from_number (swfdec_gc_object_get_context (movie), d);
}
static void
-mc_y_set (SwfdecMovie *movie, const SwfdecAsValue *val)
+mc_y_set (SwfdecMovie *movie, SwfdecAsValue val)
{
SwfdecTwips y;
- if (!swfdec_as_value_to_twips (swfdec_gc_object_get_context (movie), val, FALSE, &y))
+ if (!swfdec_as_value_to_twips (swfdec_gc_object_get_context (movie), &val, FALSE, &y))
return;
movie->modified = TRUE;
if (y != movie->matrix.y0) {
@@ -87,18 +89,18 @@ mc_y_set (SwfdecMovie *movie, const SwfdecAsValue *val)
}
}
-static void
-mc_xscale_get (SwfdecMovie *movie, SwfdecAsValue *rval)
+static SwfdecAsValue
+mc_xscale_get (SwfdecMovie *movie)
{
- swfdec_as_value_set_number (swfdec_gc_object_get_context (movie), rval, movie->xscale);
+ return swfdec_as_value_from_number (swfdec_gc_object_get_context (movie), movie->xscale);
}
static void
-mc_xscale_set (SwfdecMovie *movie, const SwfdecAsValue *val)
+mc_xscale_set (SwfdecMovie *movie, SwfdecAsValue val)
{
double d;
- d = swfdec_as_value_to_number (swfdec_gc_object_get_context (movie), *val);
+ d = swfdec_as_value_to_number (swfdec_gc_object_get_context (movie), val);
if (!isfinite (d)) {
SWFDEC_WARNING ("trying to set xscale to a non-finite value, ignoring");
return;
@@ -111,18 +113,18 @@ mc_xscale_set (SwfdecMovie *movie, const SwfdecAsValue *val)
}
}
-static void
-mc_yscale_get (SwfdecMovie *movie, SwfdecAsValue *rval)
+static SwfdecAsValue
+mc_yscale_get (SwfdecMovie *movie)
{
- swfdec_as_value_set_number (swfdec_gc_object_get_context (movie), rval, movie->yscale);
+ return swfdec_as_value_from_number (swfdec_gc_object_get_context (movie), movie->yscale);
}
static void
-mc_yscale_set (SwfdecMovie *movie, const SwfdecAsValue *val)
+mc_yscale_set (SwfdecMovie *movie, SwfdecAsValue val)
{
double d;
- d = swfdec_as_value_to_number (swfdec_gc_object_get_context (movie), *val);
+ d = swfdec_as_value_to_number (swfdec_gc_object_get_context (movie), val);
if (!isfinite (d)) {
SWFDEC_WARNING ("trying to set yscale to a non-finite value, ignoring");
return;
@@ -135,32 +137,32 @@ mc_yscale_set (SwfdecMovie *movie, const SwfdecAsValue *val)
}
}
-static void
-mc_name_get (SwfdecMovie *movie, SwfdecAsValue *rval)
+static SwfdecAsValue
+mc_name_get (SwfdecMovie *movie)
{
- SWFDEC_AS_VALUE_SET_STRING (rval, movie->name);
+ return SWFDEC_AS_VALUE_FROM_STRING (movie->name);
}
static void
-mc_name_set (SwfdecMovie *movie, const SwfdecAsValue *val)
+mc_name_set (SwfdecMovie *movie, SwfdecAsValue val)
{
- movie->name = swfdec_as_value_to_string (swfdec_gc_object_get_context (movie), *val);
+ movie->name = swfdec_as_value_to_string (swfdec_gc_object_get_context (movie), val);
}
-static void
-mc_alpha_get (SwfdecMovie *movie, SwfdecAsValue *rval)
+static SwfdecAsValue
+mc_alpha_get (SwfdecMovie *movie)
{
- swfdec_as_value_set_number (swfdec_gc_object_get_context (movie), rval,
+ return swfdec_as_value_from_number (swfdec_gc_object_get_context (movie),
movie->color_transform.aa * 100.0 / 256.0);
}
static void
-mc_alpha_set (SwfdecMovie *movie, const SwfdecAsValue *val)
+mc_alpha_set (SwfdecMovie *movie, SwfdecAsValue val)
{
double d;
int alpha;
- d = swfdec_as_value_to_number (swfdec_gc_object_get_context (movie), *val);
+ d = swfdec_as_value_to_number (swfdec_gc_object_get_context (movie), val);
if (!isfinite (d)) {
SWFDEC_WARNING ("trying to set alpha to a non-finite value, ignoring");
return;
@@ -172,44 +174,44 @@ mc_alpha_set (SwfdecMovie *movie, const SwfdecAsValue *val)
}
}
-static void
-mc_visible_get (SwfdecMovie *movie, SwfdecAsValue *rval)
+static SwfdecAsValue
+mc_visible_get (SwfdecMovie *movie)
{
- SWFDEC_AS_VALUE_SET_BOOLEAN (rval, movie->visible);
+ return SWFDEC_AS_VALUE_FROM_BOOLEAN (movie->visible);
}
static void
-mc_visible_set (SwfdecMovie *movie, const SwfdecAsValue *val)
+mc_visible_set (SwfdecMovie *movie, SwfdecAsValue val)
{
gboolean b;
- b = swfdec_as_value_to_boolean (swfdec_gc_object_get_context (movie), *val);
+ b = swfdec_as_value_to_boolean (swfdec_gc_object_get_context (movie), val);
if (b != movie->visible) {
movie->visible = b;
swfdec_movie_invalidate_last (movie);
}
}
-static void
-mc_width_get (SwfdecMovie *movie, SwfdecAsValue *rval)
+static SwfdecAsValue
+mc_width_get (SwfdecMovie *movie)
{
double d;
swfdec_movie_update (movie);
d = rint (movie->extents.x1 - movie->extents.x0);
d = SWFDEC_TWIPS_TO_DOUBLE ((SwfdecTwips) d);
- swfdec_as_value_set_number (swfdec_gc_object_get_context (movie), rval, d);
+ return swfdec_as_value_from_number (swfdec_gc_object_get_context (movie), d);
}
static void
-mc_width_set (SwfdecMovie *movie, const SwfdecAsValue *val)
+mc_width_set (SwfdecMovie *movie, SwfdecAsValue val)
{
double d, cur;
/* property was readonly in Flash 4 and before */
if (swfdec_gc_object_get_context (movie)->version < 5)
return;
- d = swfdec_as_value_to_number (swfdec_gc_object_get_context (movie), *val);
+ d = swfdec_as_value_to_number (swfdec_gc_object_get_context (movie), val);
if (!isfinite (d)) {
SWFDEC_WARNING ("trying to set width to a non-finite value, ignoring");
return;
@@ -232,26 +234,26 @@ mc_width_set (SwfdecMovie *movie, const SwfdecAsValue *val)
swfdec_movie_end_update_matrix (movie);
}
-static void
-mc_height_get (SwfdecMovie *movie, SwfdecAsValue *rval)
+static SwfdecAsValue
+mc_height_get (SwfdecMovie *movie)
{
double d;
swfdec_movie_update (movie);
d = rint (movie->extents.y1 - movie->extents.y0);
d = SWFDEC_TWIPS_TO_DOUBLE ((SwfdecTwips) d);
- swfdec_as_value_set_number (swfdec_gc_object_get_context (movie), rval, d);
+ return swfdec_as_value_from_number (swfdec_gc_object_get_context (movie), d);
}
static void
-mc_height_set (SwfdecMovie *movie, const SwfdecAsValue *val)
+mc_height_set (SwfdecMovie *movie, SwfdecAsValue val)
{
double d, cur;
/* property was readonly in Flash 4 and before */
if (swfdec_gc_object_get_context (movie)->version < 5)
return;
- d = swfdec_as_value_to_number (swfdec_gc_object_get_context (movie), *val);
+ d = swfdec_as_value_to_number (swfdec_gc_object_get_context (movie), val);
if (!isfinite (d)) {
SWFDEC_WARNING ("trying to set height to a non-finite value, ignoring");
return;
@@ -274,19 +276,19 @@ mc_height_set (SwfdecMovie *movie, const SwfdecAsValue *val)
swfdec_movie_end_update_matrix (movie);
}
-static void
-mc_rotation_get (SwfdecMovie *movie, SwfdecAsValue *rval)
+static SwfdecAsValue
+mc_rotation_get (SwfdecMovie *movie)
{
- swfdec_as_value_set_number (swfdec_gc_object_get_context (movie), rval, movie->rotation);
+ return swfdec_as_value_from_number (swfdec_gc_object_get_context (movie), movie->rotation);
}
static void
-mc_rotation_set (SwfdecMovie *movie, const SwfdecAsValue *val)
+mc_rotation_set (SwfdecMovie *movie, SwfdecAsValue val)
{
double d;
/* FIXME: Flash 4 handles this differently */
- d = swfdec_as_value_to_number (swfdec_gc_object_get_context (movie), *val);
+ d = swfdec_as_value_to_number (swfdec_gc_object_get_context (movie), val);
if (isnan (d)) {
SWFDEC_WARNING ("setting rotation to NaN - not allowed");
return;
@@ -309,45 +311,45 @@ mc_rotation_set (SwfdecMovie *movie, const SwfdecAsValue *val)
}
}
-static void
-mc_xmouse_get (SwfdecMovie *movie, SwfdecAsValue *rval)
+static SwfdecAsValue
+mc_xmouse_get (SwfdecMovie *movie)
{
double x, y;
swfdec_movie_get_mouse (movie, &x, &y);
x = SWFDEC_TWIPS_TO_DOUBLE (rint (x));
- swfdec_as_value_set_number (swfdec_gc_object_get_context (movie), rval, x);
+ return swfdec_as_value_from_number (swfdec_gc_object_get_context (movie), x);
}
-static void
-mc_ymouse_get (SwfdecMovie *movie, SwfdecAsValue *rval)
+static SwfdecAsValue
+mc_ymouse_get (SwfdecMovie *movie)
{
double x, y;
swfdec_movie_get_mouse (movie, &x, &y);
y = SWFDEC_TWIPS_TO_DOUBLE (rint (y));
- swfdec_as_value_set_number (swfdec_gc_object_get_context (movie), rval, y);
+ return swfdec_as_value_from_number (swfdec_gc_object_get_context (movie), y);
}
-static void
-mc_parent (SwfdecMovie *movie, SwfdecAsValue *rval)
+static SwfdecAsValue
+mc_parent (SwfdecMovie *movie)
{
if (movie->parent) {
- SWFDEC_AS_VALUE_SET_MOVIE (rval, movie->parent);
+ return SWFDEC_AS_VALUE_FROM_MOVIE (movie->parent);
} else {
- SWFDEC_AS_VALUE_SET_UNDEFINED (rval);
+ return SWFDEC_AS_VALUE_UNDEFINED;
}
}
-static void
-mc_root (SwfdecMovie *movie, SwfdecAsValue *rval)
+static SwfdecAsValue
+mc_root (SwfdecMovie *movie)
{
movie = swfdec_movie_get_root (movie);
- SWFDEC_AS_VALUE_SET_MOVIE (rval, movie);
+ return SWFDEC_AS_VALUE_FROM_MOVIE (movie);
}
-static void
-mc_target_get (SwfdecMovie *movie, SwfdecAsValue *rval)
+static SwfdecAsValue
+mc_target_get (SwfdecMovie *movie)
{
GString *s;
@@ -358,31 +360,31 @@ mc_target_get (SwfdecMovie *movie, SwfdecAsValue *rval)
movie = movie->parent;
}
if (s->len == 0) {
- SWFDEC_AS_VALUE_SET_STRING (rval, SWFDEC_AS_STR_SLASH);
g_string_free (s, TRUE);
+ return SWFDEC_AS_VALUE_FROM_STRING (SWFDEC_AS_STR_SLASH);
} else {
- SWFDEC_AS_VALUE_SET_STRING (rval, swfdec_as_context_give_string (
+ return SWFDEC_AS_VALUE_FROM_STRING (swfdec_as_context_give_string (
swfdec_gc_object_get_context (movie), g_string_free (s, FALSE)));
}
}
-static void
-mc_url_get (SwfdecMovie *movie, SwfdecAsValue *rval)
+static SwfdecAsValue
+mc_url_get (SwfdecMovie *movie)
{
- SWFDEC_AS_VALUE_SET_STRING (rval, swfdec_as_context_get_string (
+ return SWFDEC_AS_VALUE_FROM_STRING (swfdec_as_context_get_string (
swfdec_gc_object_get_context (movie),
swfdec_url_get_url (swfdec_loader_get_url (movie->resource->loader))));
}
-static void
-mc_focusrect_get (SwfdecMovie *movie, SwfdecAsValue *rval)
+static SwfdecAsValue
+mc_focusrect_get (SwfdecMovie *movie)
{
SwfdecAsContext *cx;
SwfdecActor *actor;
if (!SWFDEC_IS_ACTOR (movie)) {
SWFDEC_FIXME ("should not be possible to get _focusrect on non-actors");
- return;
+ return SWFDEC_AS_VALUE_UNDEFINED;
}
actor = SWFDEC_ACTOR (movie);
cx = swfdec_gc_object_get_context (actor);
@@ -390,26 +392,27 @@ mc_focusrect_get (SwfdecMovie *movie, SwfdecAsValue *rval)
switch (actor->focusrect) {
case SWFDEC_FLASH_YES:
if (cx->version > 5)
- SWFDEC_AS_VALUE_SET_BOOLEAN (rval, TRUE);
+ return SWFDEC_AS_VALUE_TRUE;
else
- swfdec_as_value_set_integer (cx, rval, 1);
+ return swfdec_as_value_from_integer (cx, 1);
break;
case SWFDEC_FLASH_NO:
if (cx->version > 5)
- SWFDEC_AS_VALUE_SET_BOOLEAN (rval, FALSE);
+ return SWFDEC_AS_VALUE_FALSE;
else
- swfdec_as_value_set_integer (cx, rval, 0);
+ return swfdec_as_value_from_integer (cx, 0);
break;
case SWFDEC_FLASH_MAYBE:
- SWFDEC_AS_VALUE_SET_NULL (rval);
+ return SWFDEC_AS_VALUE_NULL;
break;
default:
g_assert_not_reached();
+ return SWFDEC_AS_VALUE_UNDEFINED;
}
}
static void
-mc_focusrect_set (SwfdecMovie *movie, const SwfdecAsValue *val)
+mc_focusrect_set (SwfdecMovie *movie, SwfdecAsValue val)
{
SwfdecAsContext *cx;
SwfdecActor *actor;
@@ -422,19 +425,19 @@ mc_focusrect_set (SwfdecMovie *movie, const SwfdecAsValue *val)
cx = swfdec_gc_object_get_context (movie);
actor = SWFDEC_ACTOR (movie);
- if (SWFDEC_AS_VALUE_IS_UNDEFINED (*val) ||
- SWFDEC_AS_VALUE_IS_NULL (*val)) {
+ if (SWFDEC_AS_VALUE_IS_UNDEFINED (val) ||
+ SWFDEC_AS_VALUE_IS_NULL (val)) {
if (movie->parent == NULL)
return;
b = SWFDEC_FLASH_MAYBE;
} else {
if (movie->parent == NULL) {
- double d = swfdec_as_value_to_number (cx, *val);
+ double d = swfdec_as_value_to_number (cx, val);
if (isnan (d))
return;
b = d ? SWFDEC_FLASH_YES : SWFDEC_FLASH_NO;
} else {
- b = swfdec_as_value_to_boolean (cx, *val) ? SWFDEC_FLASH_YES : SWFDEC_FLASH_NO;
+ b = swfdec_as_value_to_boolean (cx, val) ? SWFDEC_FLASH_YES : SWFDEC_FLASH_NO;
}
}
@@ -448,9 +451,9 @@ mc_focusrect_set (SwfdecMovie *movie, const SwfdecAsValue *val)
}
struct {
- const char *name;
- void (* get) (SwfdecMovie *movie, SwfdecAsValue *ret);
- void (* set) (SwfdecMovie *movie, const SwfdecAsValue *val);
+ const char * name;
+ SwfdecAsValue (* get) (SwfdecMovie *movie);
+ void (* set) (SwfdecMovie *movie, SwfdecAsValue val);
} swfdec_movieclip_props[] = {
{ SWFDEC_AS_STR__x, mc_x_get, mc_x_set },
{ SWFDEC_AS_STR__y, mc_y_get, mc_y_set },
@@ -490,21 +493,20 @@ swfdec_movie_property_lookup (const char *name)
return G_MAXUINT;
}
-void
-swfdec_movie_property_do_get (SwfdecMovie *movie, guint id,
- SwfdecAsValue *val)
+SwfdecAsValue
+swfdec_movie_property_do_get (SwfdecMovie *movie, guint id)
{
if (id >= G_N_ELEMENTS (swfdec_movieclip_props) ||
swfdec_movieclip_props[id].get == NULL) {
- SWFDEC_AS_VALUE_SET_UNDEFINED (val);
+ return SWFDEC_AS_VALUE_UNDEFINED;
} else {
- swfdec_movieclip_props[id].get (movie, val);
+ return swfdec_movieclip_props[id].get (movie);
}
}
void
swfdec_movie_property_do_set (SwfdecMovie *movie, guint id,
- const SwfdecAsValue *val)
+ SwfdecAsValue val)
{
if (id < G_N_ELEMENTS (swfdec_movieclip_props) &&
swfdec_movieclip_props[id].set != NULL) {
diff --git a/swfdec/swfdec_movie_clip_loader.c b/swfdec/swfdec_movie_clip_loader.c
index d8a15aa..2916a08 100644
--- a/swfdec/swfdec_movie_clip_loader.c
+++ b/swfdec/swfdec_movie_clip_loader.c
@@ -119,11 +119,11 @@ swfdec_movie_clip_loader_getProgress (SwfdecAsContext *cx, SwfdecAsObject *objec
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);
- swfdec_as_value_set_integer (cx, &total, 0);
+ loaded = swfdec_as_value_from_integer (cx, 0);
+ total = swfdec_as_value_from_integer (cx, 0);
} else {
- swfdec_as_value_set_integer (cx, &loaded, resource->decoder->bytes_loaded);
- swfdec_as_value_set_integer (cx, &total, resource->decoder->bytes_total);
+ loaded = swfdec_as_value_from_integer (cx, resource->decoder->bytes_loaded);
+ total = swfdec_as_value_from_integer (cx, resource->decoder->bytes_total);
}
swfdec_as_object_set_variable (ret, SWFDEC_AS_STR_bytesLoaded, &loaded);
swfdec_as_object_set_variable (ret, SWFDEC_AS_STR_bytesTotal, &total);
diff --git a/swfdec/swfdec_net_stream_as.c b/swfdec/swfdec_net_stream_as.c
index 60d500f..9167430 100644
--- a/swfdec/swfdec_net_stream_as.c
+++ b/swfdec/swfdec_net_stream_as.c
@@ -158,13 +158,13 @@ swfdec_net_stream_get_time (SwfdecAsContext *cx, SwfdecAsObject *object, guint a
if (stream->flvdecoder == NULL ||
!swfdec_flv_decoder_get_video_info (stream->flvdecoder, &msecs, NULL)) {
- swfdec_as_value_set_integer (cx, ret, 0);
+ *ret = swfdec_as_value_from_integer (cx, 0);
} else {
if (msecs >= stream->current_time)
msecs = 0;
else
msecs = stream->current_time - msecs;
- swfdec_as_value_set_number (cx, ret, msecs / 1000.);
+ *ret = swfdec_as_value_from_number (cx, msecs / 1000.);
}
}
@@ -177,9 +177,9 @@ swfdec_net_stream_get_bytesLoaded (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_NET_STREAM, &stream, "");
if (stream->loader == NULL)
- swfdec_as_value_set_integer (cx, ret, 0);
+ *ret = swfdec_as_value_from_integer (cx, 0);
else
- swfdec_as_value_set_number (cx, ret, swfdec_loader_get_loaded (stream->loader));
+ *ret = swfdec_as_value_from_number (cx, swfdec_loader_get_loaded (stream->loader));
}
static void
@@ -198,7 +198,7 @@ swfdec_net_stream_get_bytesTotal (SwfdecAsContext *cx, SwfdecAsObject *object, g
if (bytes < 0)
bytes = swfdec_loader_get_loaded (stream->loader);
}
- swfdec_as_value_set_number (cx, ret, bytes);
+ *ret = swfdec_as_value_from_number (cx, bytes);
}
static void
diff --git a/swfdec/swfdec_player_as.c b/swfdec/swfdec_player_as.c
index 0f7bfb6..8051be3 100644
--- a/swfdec/swfdec_player_as.c
+++ b/swfdec/swfdec_player_as.c
@@ -78,7 +78,7 @@ swfdec_player_do_set_interval (gboolean repeat, SwfdecAsContext *cx, guint argc,
}
id = swfdec_interval_new_object (player, msecs, repeat, &argv[0], name, argc - 3, &argv[3]);
}
- swfdec_as_value_set_integer (cx, rval, id);
+ *rval = swfdec_as_value_from_integer (cx, id);
}
SWFDEC_AS_NATIVE (2, 0, swfdec_player_ASnew)
diff --git a/swfdec/swfdec_resource.c b/swfdec/swfdec_resource.c
index b97269f..c1f498b 100644
--- a/swfdec/swfdec_resource.c
+++ b/swfdec/swfdec_resource.c
@@ -150,11 +150,11 @@ swfdec_resource_emit_signal (SwfdecResource *resource, const char *name, gboolea
res = NULL;
if (res && res->decoder) {
SwfdecDecoder *dec = res->decoder;
- swfdec_as_value_set_integer (cx, &vals[2], dec->bytes_loaded);
- swfdec_as_value_set_integer (cx, &vals[3], dec->bytes_total);
+ vals[2] = swfdec_as_value_from_integer (cx, dec->bytes_loaded);
+ vals[3] = swfdec_as_value_from_integer (cx, dec->bytes_total);
} else {
- swfdec_as_value_set_integer (cx, &vals[2], 0);
- swfdec_as_value_set_integer (cx, &vals[3], 0);
+ vals[2] = swfdec_as_value_from_integer (cx, 0);
+ vals[3] = swfdec_as_value_from_integer (cx, 0);
}
}
if (n_args)
@@ -172,7 +172,7 @@ swfdec_resource_emit_error (SwfdecResource *resource, const char *message)
SwfdecAsValue vals[2];
SWFDEC_AS_VALUE_SET_STRING (&vals[0], message);
- swfdec_as_value_set_integer (swfdec_gc_object_get_context (resource), &vals[1], 0);
+ vals[1] = swfdec_as_value_from_integer (swfdec_gc_object_get_context (resource), 0);
swfdec_resource_emit_signal (resource, SWFDEC_AS_STR_onLoadError, FALSE, vals, 2);
}
@@ -326,7 +326,7 @@ swfdec_resource_stream_target_close (SwfdecStreamTarget *target, SwfdecStream *s
swfdec_loader_set_data_type (SWFDEC_LOADER (stream), dec->data_type);
}
- swfdec_as_value_set_integer (swfdec_gc_object_get_context (resource), &val, 0); /* FIXME */
+ val = swfdec_as_value_from_integer (swfdec_gc_object_get_context (resource), 0); /* FIXME */
swfdec_resource_emit_signal (resource, SWFDEC_AS_STR_onLoadComplete, FALSE, &val, 1);
resource->state = SWFDEC_RESOURCE_COMPLETE;
if (swfdec_resource_abort_if_not_initialized (resource))
diff --git a/swfdec/swfdec_selection.c b/swfdec/swfdec_selection.c
index 14205e5..3491e87 100644
--- a/swfdec/swfdec_selection.c
+++ b/swfdec/swfdec_selection.c
@@ -44,13 +44,13 @@ swfdec_selection_getBeginIndex (SwfdecAsContext *cx, SwfdecAsObject *object,
const char *s;
if (!SWFDEC_IS_TEXT_FIELD_MOVIE (priv->focus)) {
- swfdec_as_value_set_integer (cx, ret, -1);
+ *ret = swfdec_as_value_from_integer (cx, -1);
return;
}
text = SWFDEC_TEXT_FIELD_MOVIE (priv->focus);
swfdec_text_buffer_get_selection (text->text, &start, &end);
s = swfdec_text_buffer_get_text (text->text);
- swfdec_as_value_set_integer (cx, ret, g_utf8_pointer_to_offset (s, s + start));
+ *ret = swfdec_as_value_from_integer (cx, g_utf8_pointer_to_offset (s, s + start));
}
SWFDEC_AS_NATIVE (600, 1, swfdec_selection_getEndIndex)
@@ -64,13 +64,13 @@ swfdec_selection_getEndIndex (SwfdecAsContext *cx, SwfdecAsObject *object,
const char *s;
if (!SWFDEC_IS_TEXT_FIELD_MOVIE (priv->focus)) {
- swfdec_as_value_set_integer (cx, ret, -1);
+ *ret = swfdec_as_value_from_integer (cx, -1);
return;
}
text = SWFDEC_TEXT_FIELD_MOVIE (priv->focus);
swfdec_text_buffer_get_selection (text->text, &start, &end);
s = swfdec_text_buffer_get_text (text->text);
- swfdec_as_value_set_integer (cx, ret, g_utf8_pointer_to_offset (s, s + end));
+ *ret = swfdec_as_value_from_integer (cx, g_utf8_pointer_to_offset (s, s + end));
}
SWFDEC_AS_NATIVE (600, 2, swfdec_selection_getCaretIndex)
@@ -83,12 +83,12 @@ swfdec_selection_getCaretIndex (SwfdecAsContext *cx, SwfdecAsObject *object,
const char *s;
if (!SWFDEC_IS_TEXT_FIELD_MOVIE (priv->focus)) {
- swfdec_as_value_set_integer (cx, ret, -1);
+ *ret = swfdec_as_value_from_integer (cx, -1);
return;
}
text = SWFDEC_TEXT_FIELD_MOVIE (priv->focus);
s = swfdec_text_buffer_get_text (text->text);
- swfdec_as_value_set_integer (cx, ret, g_utf8_pointer_to_offset (s,
+ *ret = swfdec_as_value_from_integer (cx, g_utf8_pointer_to_offset (s,
s + swfdec_text_buffer_get_cursor (text->text)));
}
diff --git a/swfdec/swfdec_sound_object.c b/swfdec/swfdec_sound_object.c
index efb6df7..5b8793b 100644
--- a/swfdec/swfdec_sound_object.c
+++ b/swfdec/swfdec_sound_object.c
@@ -137,7 +137,7 @@ swfdec_sound_object_getPan (SwfdecAsContext *cx, SwfdecAsObject *object,
if (matrix == NULL)
return;
- swfdec_as_value_set_integer (cx, ret, swfdec_sound_matrix_get_pan (matrix));
+ *ret = swfdec_as_value_from_integer (cx, swfdec_sound_matrix_get_pan (matrix));
}
SWFDEC_AS_NATIVE (500, 1, swfdec_sound_object_getTransform)
@@ -158,13 +158,13 @@ swfdec_sound_object_getTransform (SwfdecAsContext *cx, SwfdecAsObject *object,
obj = swfdec_as_object_new (cx, SWFDEC_AS_STR_Object, NULL);
- swfdec_as_value_set_integer (cx, &val, matrix->ll);
+ val = swfdec_as_value_from_integer (cx, matrix->ll);
swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_ll, &val);
- swfdec_as_value_set_integer (cx, &val, matrix->lr);
+ val = swfdec_as_value_from_integer (cx, matrix->lr);
swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_lr, &val);
- swfdec_as_value_set_integer (cx, &val, matrix->rl);
+ val = swfdec_as_value_from_integer (cx, matrix->rl);
swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_rl, &val);
- swfdec_as_value_set_integer (cx, &val, matrix->rr);
+ val = swfdec_as_value_from_integer (cx, matrix->rr);
swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_rr, &val);
SWFDEC_AS_VALUE_SET_OBJECT (ret, obj);
@@ -184,7 +184,7 @@ swfdec_sound_object_getVolume (SwfdecAsContext *cx, SwfdecAsObject *object,
if (matrix == NULL)
return;
- swfdec_as_value_set_integer (cx, ret, matrix->volume);
+ *ret = swfdec_as_value_from_integer (cx, matrix->volume);
}
SWFDEC_AS_NATIVE (500, 3, swfdec_sound_object_setPan)
diff --git a/swfdec/swfdec_sprite_movie.c b/swfdec/swfdec_sprite_movie.c
index d8415b3..f53dde2 100644
--- a/swfdec/swfdec_sprite_movie.c
+++ b/swfdec/swfdec_sprite_movie.c
@@ -770,25 +770,24 @@ swfdec_sprite_movie_finish_movie (SwfdecMovie *mov)
}
}
-static void
-swfdec_sprite_movie_property_get (SwfdecMovie *mov, guint prop_id, SwfdecAsValue *val)
+static SwfdecAsValue
+swfdec_sprite_movie_property_get (SwfdecMovie *mov, guint prop_id)
{
SwfdecSpriteMovie *movie = SWFDEC_SPRITE_MOVIE (mov);
SwfdecAsContext *cx = swfdec_gc_object_get_context (mov);
switch (prop_id) {
case SWFDEC_MOVIE_PROPERTY_CURRENTFRAME:
- swfdec_as_value_set_integer (cx, val, movie->frame);
+ return swfdec_as_value_from_integer (cx, movie->frame);
break;
case SWFDEC_MOVIE_PROPERTY_FRAMESLOADED:
- swfdec_as_value_set_integer (cx, val, swfdec_sprite_movie_get_frames_loaded (movie));
+ return swfdec_as_value_from_integer (cx, swfdec_sprite_movie_get_frames_loaded (movie));
break;
case SWFDEC_MOVIE_PROPERTY_TOTALFRAMES:
- swfdec_as_value_set_integer (cx, val, swfdec_sprite_movie_get_frames_total (movie));
+ return swfdec_as_value_from_integer (cx, swfdec_sprite_movie_get_frames_total (movie));
break;
default:
- SWFDEC_MOVIE_CLASS (swfdec_sprite_movie_parent_class)->property_get (mov, prop_id, val);
- break;
+ return SWFDEC_MOVIE_CLASS (swfdec_sprite_movie_parent_class)->property_get (mov, prop_id);
}
}
diff --git a/swfdec/swfdec_sprite_movie_as.c b/swfdec/swfdec_sprite_movie_as.c
index 7448876..a9bde25 100644
--- a/swfdec/swfdec_sprite_movie_as.c
+++ b/swfdec/swfdec_sprite_movie_as.c
@@ -288,8 +288,8 @@ swfdec_sprite_movie_localToGlobal (SwfdecAsContext *cx, SwfdecAsObject *object,
x = swfdec_as_double_to_integer (x * SWFDEC_TWIPS_SCALE_FACTOR);
y = swfdec_as_double_to_integer (y * SWFDEC_TWIPS_SCALE_FACTOR);
swfdec_movie_local_to_global (movie, &x, &y);
- swfdec_as_value_set_number (cx, xv, SWFDEC_TWIPS_TO_DOUBLE ((SwfdecTwips) x));
- swfdec_as_value_set_number (cx, yv, SWFDEC_TWIPS_TO_DOUBLE ((SwfdecTwips) y));
+ *xv = swfdec_as_value_from_number (cx, SWFDEC_TWIPS_TO_DOUBLE ((SwfdecTwips) x));
+ *yv = swfdec_as_value_from_number (cx, SWFDEC_TWIPS_TO_DOUBLE ((SwfdecTwips) y));
}
SWFDEC_AS_NATIVE (900, 3, swfdec_sprite_movie_globalToLocal)
@@ -316,8 +316,8 @@ swfdec_sprite_movie_globalToLocal (SwfdecAsContext *cx, SwfdecAsObject *object,
x = swfdec_as_double_to_integer (x * SWFDEC_TWIPS_SCALE_FACTOR);
y = swfdec_as_double_to_integer (y * SWFDEC_TWIPS_SCALE_FACTOR);
swfdec_movie_global_to_local (movie, &x, &y);
- swfdec_as_value_set_number (cx, xv, SWFDEC_TWIPS_TO_DOUBLE ((SwfdecTwips) x));
- swfdec_as_value_set_number (cx, yv, SWFDEC_TWIPS_TO_DOUBLE ((SwfdecTwips) y));
+ *xv = swfdec_as_value_from_number (cx, SWFDEC_TWIPS_TO_DOUBLE ((SwfdecTwips) x));
+ *yv = swfdec_as_value_from_number (cx, SWFDEC_TWIPS_TO_DOUBLE ((SwfdecTwips) y));
}
SWFDEC_AS_NATIVE (900, 8, swfdec_sprite_movie_attachAudio)
@@ -365,10 +365,10 @@ swfdec_sprite_movie_getSWFVersion (SwfdecAsContext *cx, SwfdecAsObject *object,
guint argc, SwfdecAsValue *argv, SwfdecAsValue *rval)
{
if (object != NULL && object->movie) {
- swfdec_as_value_set_integer (cx, rval,
+ *rval = swfdec_as_value_from_integer (cx,
swfdec_movie_get_version (SWFDEC_MOVIE (object->relay)));
} else {
- swfdec_as_value_set_integer (cx, rval, -1);
+ *rval = swfdec_as_value_from_integer (cx, -1);
}
}
@@ -445,9 +445,9 @@ swfdec_sprite_movie_getBytesLoaded (SwfdecAsContext *cx, SwfdecAsObject *object,
resource = swfdec_movie_get_own_resource (movie);
if (resource && resource->decoder) {
- swfdec_as_value_set_integer (cx, rval, resource->decoder->bytes_loaded);
+ *rval = swfdec_as_value_from_integer (cx, resource->decoder->bytes_loaded);
} else {
- swfdec_as_value_set_integer (cx, rval, 0);
+ *rval = swfdec_as_value_from_integer (cx, 0);
}
}
@@ -464,12 +464,12 @@ swfdec_sprite_movie_getBytesTotal (SwfdecAsContext *cx, SwfdecAsObject *object,
resource = swfdec_movie_get_own_resource (movie);
if (resource) {
if (resource->decoder) {
- swfdec_as_value_set_integer (cx, rval, resource->decoder->bytes_total);
+ *rval = swfdec_as_value_from_integer (cx, resource->decoder->bytes_total);
} else {
- swfdec_as_value_set_integer (cx, rval, -1);
+ *rval = swfdec_as_value_from_integer (cx, -1);
}
} else {
- swfdec_as_value_set_integer (cx, rval, 0);
+ *rval = swfdec_as_value_from_integer (cx, 0);
}
}
@@ -490,7 +490,7 @@ swfdec_sprite_movie_getNextHighestDepth (SwfdecAsContext *cx, SwfdecAsObject *ob
} else {
depth = 0;
}
- swfdec_as_value_set_integer (cx, rval, depth);
+ *rval = swfdec_as_value_from_integer (cx, depth);
}
static void
@@ -880,7 +880,7 @@ swfdec_sprite_movie_getDepth (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, &movie, "");
- swfdec_as_value_set_integer (cx, rval, movie->depth);
+ *rval = swfdec_as_value_from_integer (cx, movie->depth);
}
SWFDEC_AS_NATIVE (900, 5, swfdec_sprite_movie_getBounds)
@@ -922,13 +922,13 @@ swfdec_sprite_movie_getBounds (SwfdecAsContext *cx, SwfdecAsObject *object,
x1 = rect.x1;
y1 = rect.y1;
}
- swfdec_as_value_set_number (cx, &val, SWFDEC_TWIPS_TO_DOUBLE (x0));
+ val = swfdec_as_value_from_number (cx, SWFDEC_TWIPS_TO_DOUBLE (x0));
swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_xMin, &val);
- swfdec_as_value_set_number (cx, &val, SWFDEC_TWIPS_TO_DOUBLE (y0));
+ val = swfdec_as_value_from_number (cx, SWFDEC_TWIPS_TO_DOUBLE (y0));
swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_yMin, &val);
- swfdec_as_value_set_number (cx, &val, SWFDEC_TWIPS_TO_DOUBLE (x1));
+ val = swfdec_as_value_from_number (cx, SWFDEC_TWIPS_TO_DOUBLE (x1));
swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_xMax, &val);
- swfdec_as_value_set_number (cx, &val, SWFDEC_TWIPS_TO_DOUBLE (y1));
+ val = swfdec_as_value_from_number (cx, SWFDEC_TWIPS_TO_DOUBLE (y1));
swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_yMax, &val);
SWFDEC_AS_VALUE_SET_OBJECT (rval, obj);
diff --git a/swfdec/swfdec_stage_as.c b/swfdec/swfdec_stage_as.c
index 80f1548..84feaf4 100644
--- a/swfdec/swfdec_stage_as.c
+++ b/swfdec/swfdec_stage_as.c
@@ -136,9 +136,9 @@ get_width (SwfdecAsContext *cx, SwfdecAsObject *object,
SwfdecPlayerPrivate *priv = SWFDEC_PLAYER (cx)->priv;
if (priv->scale_mode == SWFDEC_SCALE_NONE)
- swfdec_as_value_set_integer (cx, ret, priv->internal_width);
+ *ret = swfdec_as_value_from_integer (cx, priv->internal_width);
else
- swfdec_as_value_set_integer (cx, ret, priv->width);
+ *ret = swfdec_as_value_from_integer (cx, priv->width);
}
SWFDEC_AS_NATIVE (666, 7, get_height)
@@ -149,9 +149,9 @@ get_height (SwfdecAsContext *cx, SwfdecAsObject *object,
SwfdecPlayerPrivate *priv = SWFDEC_PLAYER (cx)->priv;
if (priv->scale_mode == SWFDEC_SCALE_NONE)
- swfdec_as_value_set_integer (cx, ret, priv->internal_height);
+ *ret = swfdec_as_value_from_integer (cx, priv->internal_height);
else
- swfdec_as_value_set_integer (cx, ret, priv->height);
+ *ret = swfdec_as_value_from_integer (cx, priv->height);
}
/* FIXME: do this smarter */
diff --git a/swfdec/swfdec_style_sheet.c b/swfdec/swfdec_style_sheet.c
index d0d37ce..ed8b0b4 100644
--- a/swfdec/swfdec_style_sheet.c
+++ b/swfdec/swfdec_style_sheet.c
@@ -303,7 +303,7 @@ swfdec_style_sheet_parseColor (SwfdecAsContext *cx, SwfdecAsObject *object,
if (*tail != '\0')
return;
- swfdec_as_value_set_integer (cx, rval, result);
+ *rval = swfdec_as_value_from_integer (cx, result);
}
SWFDEC_AS_NATIVE (113, 0, swfdec_style_sheet_construct)
diff --git a/swfdec/swfdec_system_as.c b/swfdec/swfdec_system_as.c
index 023011d..a3e7d42 100644
--- a/swfdec/swfdec_system_as.c
+++ b/swfdec/swfdec_system_as.c
@@ -172,19 +172,19 @@ swfdec_system_manufacturer (SwfdecPlayer *player, SwfdecAsValue *ret)
static void
swfdec_system_screen_width (SwfdecPlayer *player, SwfdecAsValue *ret)
{
- swfdec_as_value_set_integer (SWFDEC_AS_CONTEXT (player), ret, player->priv->system->screen_width);
+ *ret = swfdec_as_value_from_integer (SWFDEC_AS_CONTEXT (player), player->priv->system->screen_width);
}
static void
swfdec_system_screen_height (SwfdecPlayer *player, SwfdecAsValue *ret)
{
- swfdec_as_value_set_integer (SWFDEC_AS_CONTEXT (player), ret, player->priv->system->screen_height);
+ *ret = swfdec_as_value_from_integer (SWFDEC_AS_CONTEXT (player), player->priv->system->screen_height);
}
static void
swfdec_system_screen_dpi (SwfdecPlayer *player, SwfdecAsValue *ret)
{
- swfdec_as_value_set_integer (SWFDEC_AS_CONTEXT (player), ret, player->priv->system->dpi);
+ *ret = swfdec_as_value_from_integer (SWFDEC_AS_CONTEXT (player), player->priv->system->dpi);
}
static void
@@ -197,7 +197,7 @@ swfdec_system_screen_color (SwfdecPlayer *player, SwfdecAsValue *ret)
static void
swfdec_system_screen_par (SwfdecPlayer *player, SwfdecAsValue *ret)
{
- swfdec_as_value_set_number (SWFDEC_AS_CONTEXT (player), ret, player->priv->system->par);
+ *ret = swfdec_as_value_from_number (SWFDEC_AS_CONTEXT (player), player->priv->system->par);
}
static void
diff --git a/swfdec/swfdec_text_field_movie.c b/swfdec/swfdec_text_field_movie.c
index fa1e998..9f0f0b0 100644
--- a/swfdec/swfdec_text_field_movie.c
+++ b/swfdec/swfdec_text_field_movie.c
@@ -851,9 +851,8 @@ swfdec_text_field_movie_key_release (SwfdecActor *actor, guint keycode, guint ch
//SwfdecTextFieldMovie *text = SWFDEC_TEXT_FIELD_MOVIE (actor);
}
-static void
-swfdec_text_field_movie_property_get (SwfdecMovie *movie, guint prop_id,
- SwfdecAsValue *val)
+static SwfdecAsValue
+swfdec_text_field_movie_property_get (SwfdecMovie *movie, guint prop_id)
{
SwfdecTextFieldMovie *text = SWFDEC_TEXT_FIELD_MOVIE (movie);
SwfdecAsContext *cx = swfdec_gc_object_get_context (text);
@@ -864,14 +863,12 @@ swfdec_text_field_movie_property_get (SwfdecMovie *movie, guint prop_id,
swfdec_text_field_movie_autosize (text);
swfdec_movie_update (movie);
d = SWFDEC_TWIPS_TO_DOUBLE (movie->matrix.x0 + text->extents.x0);
- swfdec_as_value_set_number (cx, val, d);
- return;
+ return swfdec_as_value_from_number (cx, d);
case SWFDEC_MOVIE_PROPERTY_Y:
swfdec_text_field_movie_autosize (text);
swfdec_movie_update (movie);
d = SWFDEC_TWIPS_TO_DOUBLE (movie->matrix.y0 + text->extents.y0);
- swfdec_as_value_set_number (cx, val, d);
- return;
+ return swfdec_as_value_from_number (cx, d);
case SWFDEC_MOVIE_PROPERTY_WIDTH:
case SWFDEC_MOVIE_PROPERTY_HEIGHT:
swfdec_text_field_movie_autosize (text);
@@ -880,12 +877,12 @@ swfdec_text_field_movie_property_get (SwfdecMovie *movie, guint prop_id,
break;
}
- SWFDEC_MOVIE_CLASS (swfdec_text_field_movie_parent_class)->property_get (movie, prop_id, val);
+ return SWFDEC_MOVIE_CLASS (swfdec_text_field_movie_parent_class)->property_get (movie, prop_id);
}
static void
swfdec_text_field_movie_property_set (SwfdecMovie *movie, guint prop_id,
- const SwfdecAsValue *val)
+ SwfdecAsValue val)
{
SwfdecTextFieldMovie *text = SWFDEC_TEXT_FIELD_MOVIE (movie);
SwfdecAsContext *cx = swfdec_gc_object_get_context (movie);
@@ -893,7 +890,7 @@ swfdec_text_field_movie_property_set (SwfdecMovie *movie, guint prop_id,
switch (prop_id) {
case SWFDEC_MOVIE_PROPERTY_X:
- if (!swfdec_as_value_to_twips (swfdec_gc_object_get_context (movie), val, FALSE, &twips))
+ if (!swfdec_as_value_to_twips (swfdec_gc_object_get_context (movie), &val, FALSE, &twips))
return;
movie->modified = TRUE;
twips -= text->extents.x0;
@@ -904,7 +901,7 @@ swfdec_text_field_movie_property_set (SwfdecMovie *movie, guint prop_id,
}
return;
case SWFDEC_MOVIE_PROPERTY_Y:
- if (!swfdec_as_value_to_twips (swfdec_gc_object_get_context (movie), val, FALSE, &twips))
+ if (!swfdec_as_value_to_twips (swfdec_gc_object_get_context (movie), &val, FALSE, &twips))
return;
movie->modified = TRUE;
twips -= text->extents.y0;
@@ -915,7 +912,7 @@ swfdec_text_field_movie_property_set (SwfdecMovie *movie, guint prop_id,
}
return;
case SWFDEC_MOVIE_PROPERTY_WIDTH:
- if (swfdec_as_value_to_twips (cx, val, TRUE, &twips)) {
+ if (swfdec_as_value_to_twips (cx, &val, TRUE, &twips)) {
movie->modified = TRUE;
if (text->extents.x1 != text->extents.x0 + twips) {
swfdec_movie_invalidate_next (movie);
@@ -927,7 +924,7 @@ swfdec_text_field_movie_property_set (SwfdecMovie *movie, guint prop_id,
return;
case SWFDEC_MOVIE_PROPERTY_HEIGHT:
movie->modified = TRUE;
- if (swfdec_as_value_to_twips (cx, val, TRUE, &twips)) {
+ if (swfdec_as_value_to_twips (cx, &val, TRUE, &twips)) {
movie->modified = TRUE;
if (text->extents.y1 != text->extents.y0 + twips) {
swfdec_movie_invalidate_next (movie);
diff --git a/swfdec/swfdec_text_field_movie_as.c b/swfdec/swfdec_text_field_movie_as.c
index 68569b3..a429883 100644
--- a/swfdec/swfdec_text_field_movie_as.c
+++ b/swfdec/swfdec_text_field_movie_as.c
@@ -182,7 +182,7 @@ swfdec_text_field_movie_get_length (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
- swfdec_as_value_set_integer (cx, ret, g_utf8_strlen (swfdec_text_buffer_get_text (text->text), -1));
+ *ret = swfdec_as_value_from_integer (cx, g_utf8_strlen (swfdec_text_buffer_get_text (text->text), -1));
}
/*
@@ -225,7 +225,7 @@ swfdec_text_field_movie_get_maxChars (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
if (text->max_chars != 0) {
- swfdec_as_value_set_integer (cx, ret, text->max_chars);
+ *ret = swfdec_as_value_from_integer (cx, text->max_chars);
} else {
SWFDEC_AS_VALUE_SET_NULL (ret);
}
@@ -433,7 +433,7 @@ swfdec_text_field_movie_get_textHeight (SwfdecAsContext *cx,
swfdec_movie_update (SWFDEC_MOVIE (text));
swfdec_text_field_movie_update_layout (text);
- swfdec_as_value_set_integer (cx, ret, floor (text->layout_height *
+ *ret = swfdec_as_value_from_integer (cx, floor (text->layout_height *
text->from_layout.yy / SWFDEC_TWIPS_SCALE_FACTOR));
}
@@ -448,7 +448,7 @@ swfdec_text_field_movie_get_textWidth (SwfdecAsContext *cx,
swfdec_movie_update (SWFDEC_MOVIE (text));
swfdec_text_field_movie_update_layout (text);
- swfdec_as_value_set_integer (cx, ret, floor (text->layout_width *
+ *ret = swfdec_as_value_from_integer (cx, floor (text->layout_width *
text->from_layout.xx / SWFDEC_TWIPS_SCALE_FACTOR));
}
@@ -494,7 +494,7 @@ swfdec_text_field_movie_get_backgroundColor (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
- swfdec_as_value_set_number (cx, ret,
+ *ret = swfdec_as_value_from_number (cx,
SWFDEC_COLOR_RED (text->background_color) << 16 |
SWFDEC_COLOR_GREEN (text->background_color) << 8 |
SWFDEC_COLOR_BLUE (text->background_color));
@@ -558,7 +558,7 @@ swfdec_text_field_movie_get_borderColor (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
- swfdec_as_value_set_number (cx, ret,
+ *ret = swfdec_as_value_from_number (cx,
SWFDEC_COLOR_RED (text->border_color) << 16 |
SWFDEC_COLOR_GREEN (text->border_color) << 8 |
SWFDEC_COLOR_BLUE (text->border_color));
@@ -594,7 +594,7 @@ swfdec_text_field_movie_get_bottomScroll (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
- swfdec_as_value_set_number (cx, ret, text->scroll + text->lines_visible);
+ *ret = swfdec_as_value_from_number (cx, text->scroll + text->lines_visible);
}
static void
@@ -606,7 +606,7 @@ swfdec_text_field_movie_do_get_hscroll (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
- swfdec_as_value_set_number (cx, ret, text->hscroll);
+ *ret = swfdec_as_value_from_number (cx, text->hscroll);
}
static void
@@ -636,7 +636,7 @@ swfdec_text_field_movie_get_maxhscroll (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
- swfdec_as_value_set_integer (cx, ret, swfdec_text_field_movie_get_hscroll_max (text));
+ *ret = swfdec_as_value_from_integer (cx, swfdec_text_field_movie_get_hscroll_max (text));
}
static void
@@ -648,7 +648,7 @@ swfdec_text_field_movie_get_maxscroll (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
- swfdec_as_value_set_number (cx, ret, text->scroll_max + 1);
+ *ret = swfdec_as_value_from_number (cx, text->scroll_max + 1);
}
static void
@@ -687,7 +687,7 @@ swfdec_text_field_movie_do_get_scroll (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
- swfdec_as_value_set_number (cx, ret, text->scroll + 1);
+ *ret = swfdec_as_value_from_number (cx, text->scroll + 1);
}
static void
@@ -940,7 +940,7 @@ swfdec_text_field_movie_get_textColor (SwfdecAsContext *cx,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
- swfdec_as_value_set_number (cx, ret,
+ *ret = swfdec_as_value_from_number (cx,
swfdec_text_buffer_get_default_attributes (text->text)->color);
}
@@ -1306,7 +1306,7 @@ swfdec_text_field_movie_getDepth (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FIELD_MOVIE, &text, "");
- swfdec_as_value_set_integer (cx, rval, SWFDEC_MOVIE (text)->depth);
+ *rval = swfdec_as_value_from_integer (cx, SWFDEC_MOVIE (text)->depth);
}
SWFDEC_AS_NATIVE (104, 103, swfdec_text_field_movie_removeTextField)
diff --git a/swfdec/swfdec_text_field_movie_html.c b/swfdec/swfdec_text_field_movie_html.c
index aa70fd0..21c1ce2 100644
--- a/swfdec/swfdec_text_field_movie_html.c
+++ b/swfdec/swfdec_text_field_movie_html.c
@@ -179,7 +179,7 @@ swfdec_text_field_movie_html_tag_set_attribute (ParserData *data,
SwfdecAsValue val_number;
if (value_length != 7 || *value != '#') {
- swfdec_as_value_set_number (cx, &val_number, 0);
+ val_number = swfdec_as_value_from_number (cx, 0);
} else {
int number;
char *tail;
@@ -187,7 +187,7 @@ swfdec_text_field_movie_html_tag_set_attribute (ParserData *data,
number = g_ascii_strtoll (value + 1, &tail, 16);
if (tail != value + 7)
number = 0;
- swfdec_as_value_set_number (cx, &val_number, number);
+ val_number = swfdec_as_value_from_number (cx, number);
}
swfdec_as_object_set_variable (object, SWFDEC_AS_STR_color, &val_number);
diff --git a/swfdec/swfdec_text_format.c b/swfdec/swfdec_text_format.c
index a3b756f..7ca2012 100644
--- a/swfdec/swfdec_text_format.c
+++ b/swfdec/swfdec_text_format.c
@@ -217,7 +217,7 @@ swfdec_text_format_get_integer (SwfdecAsObject *object,
return;
}
- swfdec_as_value_set_number (object->context, ret,
+ *ret = swfdec_as_value_from_number (object->context,
(double)G_STRUCT_MEMBER (int, format, property_offsets[property]));
}
@@ -412,7 +412,7 @@ swfdec_text_format_do_get_color (SwfdecAsContext *cx, SwfdecAsObject *object,
return;
}
- swfdec_as_value_set_number (cx, ret, format->attr.color);
+ *ret = swfdec_as_value_from_number (cx, format->attr.color);
}
static void
@@ -602,7 +602,7 @@ swfdec_text_format_do_get_letter_spacing (SwfdecAsContext *cx,
return;
}
- swfdec_as_value_set_number (cx, ret, format->attr.letter_spacing);
+ *ret = swfdec_as_value_from_number (cx, format->attr.letter_spacing);
}
static void
@@ -690,7 +690,7 @@ swfdec_text_format_do_get_tab_stops (SwfdecAsContext *cx,
array = swfdec_as_array_new (cx);
for (i = 0; i < format->attr.n_tab_stops; i++) {
- swfdec_as_value_set_integer (cx, &val, format->attr.tab_stops[i]);
+ val = swfdec_as_value_from_integer (cx, format->attr.tab_stops[i]);
swfdec_as_array_push (array, &val);
}
SWFDEC_AS_VALUE_SET_OBJECT (ret, array);
@@ -843,25 +843,25 @@ swfdec_text_format_getTextExtent (SwfdecAsContext *cx, SwfdecAsObject *object,
layout = swfdec_text_layout_new (buffer);
i = swfdec_text_layout_get_width (layout);
- swfdec_as_value_set_integer (cx, &val, i);
+ val = swfdec_as_value_from_integer (cx, i);
swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_width, &val);
if (i)
i += 4;
- swfdec_as_value_set_integer (cx, &val, i);
+ val = swfdec_as_value_from_integer (cx, i);
swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_textFieldWidth, &val);
i = swfdec_text_layout_get_height (layout);
- swfdec_as_value_set_integer (cx, &val, i);
+ val = swfdec_as_value_from_integer (cx, i);
swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_height, &val);
if (i)
i += 4;
- swfdec_as_value_set_integer (cx, &val, i);
+ val = swfdec_as_value_from_integer (cx, i);
swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_textFieldHeight, &val);
swfdec_text_layout_get_ascent_descent (layout, &i, &j);
- swfdec_as_value_set_integer (cx, &val, i);
+ val = swfdec_as_value_from_integer (cx, i);
swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_ascent, &val);
- swfdec_as_value_set_integer (cx, &val, j);
+ val = swfdec_as_value_from_integer (cx, j);
swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_descent, &val);
SWFDEC_AS_VALUE_SET_OBJECT (ret, obj);
diff --git a/swfdec/swfdec_transform_as.c b/swfdec/swfdec_transform_as.c
index 6c2cf13..29da103 100644
--- a/swfdec/swfdec_transform_as.c
+++ b/swfdec/swfdec_transform_as.c
@@ -77,19 +77,19 @@ swfdec_transform_as_get_matrix (SwfdecAsContext *cx, SwfdecAsObject *object,
swfdec_as_object_set_constructor_by_name (o, SWFDEC_AS_STR_flash,
SWFDEC_AS_STR_geom, SWFDEC_AS_STR_Matrix, NULL);
- swfdec_as_value_set_number (cx, &val, matrix->xx);
+ val = swfdec_as_value_from_number (cx, matrix->xx);
swfdec_as_object_set_variable (o, SWFDEC_AS_STR_a, &val);
- swfdec_as_value_set_number (cx, &val, matrix->yx);
+ val = swfdec_as_value_from_number (cx, matrix->yx);
swfdec_as_object_set_variable (o, SWFDEC_AS_STR_b, &val);
- swfdec_as_value_set_number (cx, &val, matrix->xy);
+ val = swfdec_as_value_from_number (cx, matrix->xy);
swfdec_as_object_set_variable (o, SWFDEC_AS_STR_c, &val);
- swfdec_as_value_set_number (cx, &val, matrix->yy);
+ val = swfdec_as_value_from_number (cx, matrix->yy);
swfdec_as_object_set_variable (o, SWFDEC_AS_STR_d, &val);
- swfdec_as_value_set_number (cx, &val, matrix->yy);
+ val = swfdec_as_value_from_number (cx, matrix->yy);
swfdec_as_object_set_variable (o, SWFDEC_AS_STR_d, &val);
- swfdec_as_value_set_number (cx, &val, SWFDEC_TWIPS_TO_DOUBLE (matrix->x0));
+ val = swfdec_as_value_from_number (cx, SWFDEC_TWIPS_TO_DOUBLE (matrix->x0));
swfdec_as_object_set_variable (o, SWFDEC_AS_STR_tx, &val);
- swfdec_as_value_set_number (cx, &val, SWFDEC_TWIPS_TO_DOUBLE (matrix->y0));
+ val = swfdec_as_value_from_number (cx, SWFDEC_TWIPS_TO_DOUBLE (matrix->y0));
swfdec_as_object_set_variable (o, SWFDEC_AS_STR_ty, &val);
SWFDEC_AS_VALUE_SET_OBJECT (ret, o);
diff --git a/swfdec/swfdec_video_movie_as.c b/swfdec/swfdec_video_movie_as.c
index 17bad0b..57ec895 100644
--- a/swfdec/swfdec_video_movie_as.c
+++ b/swfdec/swfdec_video_movie_as.c
@@ -74,7 +74,7 @@ swfdec_video_get_width (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc,
} else {
w = 0;
}
- swfdec_as_value_set_integer (cx, rval, w);
+ *rval = swfdec_as_value_from_integer (cx, w);
}
static void
@@ -91,7 +91,7 @@ swfdec_video_get_height (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc
} else {
h = 0;
}
- swfdec_as_value_set_integer (cx, rval, h);
+ *rval = swfdec_as_value_from_integer (cx, h);
}
static void
@@ -99,7 +99,7 @@ swfdec_video_get_deblocking (SwfdecAsContext *cx, SwfdecAsObject *object, guint
SwfdecAsValue *argv, SwfdecAsValue *rval)
{
SWFDEC_STUB ("Video.deblocking (get)");
- swfdec_as_value_set_integer (cx, rval, 0);
+ *rval = swfdec_as_value_from_integer (cx, 0);
}
static void
diff --git a/swfdec/swfdec_xml.c b/swfdec/swfdec_xml.c
index 7afd092..bc7f44a 100644
--- a/swfdec/swfdec_xml.c
+++ b/swfdec/swfdec_xml.c
@@ -337,7 +337,7 @@ swfdec_xml_get_status (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_XML, &xml, "");
- swfdec_as_value_set_integer (cx, ret, xml->status);
+ *ret = swfdec_as_value_from_integer (cx, xml->status);
}
static void
diff --git a/swfdec/swfdec_xml_node.c b/swfdec/swfdec_xml_node.c
index 6a9d91d..1d061bb 100644
--- a/swfdec/swfdec_xml_node.c
+++ b/swfdec/swfdec_xml_node.c
@@ -129,7 +129,7 @@ swfdec_xml_node_update_child_nodes (SwfdecXmlNode *node)
g_return_if_fail (SWFDEC_IS_VALID_XML_NODE (node));
// remove old
- swfdec_as_value_set_integer (swfdec_gc_object_get_context (node), &val, 0);
+ val = swfdec_as_value_from_integer (swfdec_gc_object_get_context (node), 0);
swfdec_as_object_set_variable (node->child_nodes,
SWFDEC_AS_STR_length, &val);
@@ -262,7 +262,7 @@ swfdec_xml_node_get_nodeType (SwfdecAsContext *cx, SwfdecAsObject *object,
if (!SWFDEC_IS_VALID_XML_NODE (node))
return;
- swfdec_as_value_set_integer (cx, ret, node->type);
+ *ret = swfdec_as_value_from_integer (cx, node->type);
}
static void
diff --git a/test/swfdec_test_buffer.c b/test/swfdec_test_buffer.c
index 733209c..0fe124e 100644
--- a/test/swfdec_test_buffer.c
+++ b/test/swfdec_test_buffer.c
@@ -180,11 +180,12 @@ swfdec_test_buffer_find (SwfdecAsContext *cx, SwfdecAsObject *object, guint argc
SWFDEC_AS_CHECK (SWFDEC_TYPE_TEST_BUFFER, &buffer, "i", &c);
- swfdec_as_value_set_integer (cx, retval, -1);
found = memchr (buffer->buffer->data, c, buffer->buffer->length);
if (found)
- swfdec_as_value_set_integer (cx, retval, found - buffer->buffer->data);
+ *retval = swfdec_as_value_from_integer (cx, found - buffer->buffer->data);
+ else
+ *retval = swfdec_as_value_from_integer (cx, -1);
}
SWFDEC_TEST_FUNCTION ("Buffer_load", swfdec_test_buffer_load)
diff --git a/test/swfdec_test_socket.c b/test/swfdec_test_socket.c
index 8683c87..1d51bf9 100644
--- a/test/swfdec_test_socket.c
+++ b/test/swfdec_test_socket.c
@@ -200,7 +200,7 @@ swfdec_test_socket_new (SwfdecTestTest *test, SwfdecTestPluginSocket *plugin)
swfdec_as_context_get_string (cx, plugin->host));
swfdec_as_object_set_variable (object,
swfdec_as_context_get_string (cx, "host"), &val);
- swfdec_as_value_set_integer (cx, &val, plugin->port);
+ val = swfdec_as_value_from_integer (cx, plugin->port);
swfdec_as_object_set_variable (object,
swfdec_as_context_get_string (cx, "port"), &val);
diff --git a/test/swfdec_test_test.c b/test/swfdec_test_test.c
index 75972fc..e7771ca 100644
--- a/test/swfdec_test_test.c
+++ b/test/swfdec_test_test.c
@@ -436,6 +436,6 @@ swfdec_test_test_get_rate (SwfdecAsContext *cx, SwfdecAsObject *object, guint ar
if (!test->plugin_loaded)
return;
- swfdec_as_value_set_number (cx, retval, test->plugin.rate / 256.0);
+ *retval = swfdec_as_value_from_number (cx, test->plugin.rate / 256.0);
}
More information about the Swfdec-commits
mailing list