[Swfdec] 8 commits - libswfdec/swfdec_as_interpret.c libswfdec/swfdec_sound.c libswfdec/swfdec_sound.h test/trace
Benjamin Otte
company at kemper.freedesktop.org
Mon Oct 15 09:34:46 PDT 2007
libswfdec/swfdec_as_interpret.c | 65 ++-------
libswfdec/swfdec_sound.c | 24 ---
libswfdec/swfdec_sound.h | 4
test/trace/Makefile.am | 27 +++
test/trace/enumerate-5.swf |binary
test/trace/enumerate-5.swf.trace | 6
test/trace/enumerate-6.swf |binary
test/trace/enumerate-6.swf.trace | 6
test/trace/enumerate-7.swf |binary
test/trace/enumerate-7.swf.trace | 6
test/trace/enumerate-8.swf |binary
test/trace/enumerate-8.swf.trace | 6
test/trace/enumerate.as | 27 +++
test/trace/enumerate2-5.swf |binary
test/trace/enumerate2-5.swf.trace | 235 ++++++++++++++++++++++++++++++++
test/trace/enumerate2-6.swf |binary
test/trace/enumerate2-6.swf.trace | 236 +++++++++++++++++++++++++++++++++
test/trace/enumerate2-7.swf |binary
test/trace/enumerate2-7.swf.trace | 236 +++++++++++++++++++++++++++++++++
test/trace/enumerate2-8.swf |binary
test/trace/enumerate2-8.swf.trace | 236 +++++++++++++++++++++++++++++++++
test/trace/enumerate2.as | 23 +++
test/trace/newobject-paths-5.swf |binary
test/trace/newobject-paths-5.swf.trace | 12 +
test/trace/newobject-paths-6.swf |binary
test/trace/newobject-paths-6.swf.trace | 12 +
test/trace/newobject-paths-7.swf |binary
test/trace/newobject-paths-7.swf.trace | 12 +
test/trace/newobject-paths-8.swf |binary
test/trace/newobject-paths-8.swf.trace | 12 +
test/trace/newobject-paths.as | 38 +++++
31 files changed, 1148 insertions(+), 75 deletions(-)
New commits:
commit b314c5ac8c59acbf4794dc52a5cc610fa9c96ee9
Merge: 1ab94d8... d964fa7...
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Oct 15 18:34:31 2007 +0200
Merge branch 'master' of ssh://company@git.freedesktop.org/git/swfdec/swfdec
commit 1ab94d8d0b1c17bbae07d358faf98b6b45a1d1ed
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Oct 15 18:34:15 2007 +0200
test for NewObject action fix
diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index 1657703..cd5b3ba 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -921,6 +921,15 @@ EXTRA_DIST = \
netstream-onstatus-notfound.as \
netstream-onstatus-notfound.swf \
netstream-onstatus-notfound.swf.trace \
+ newobject-paths.as \
+ newobject-paths-5.swf \
+ newobject-paths-5.swf.trace \
+ newobject-paths-6.swf \
+ newobject-paths-6.swf.trace \
+ newobject-paths-7.swf \
+ newobject-paths-7.swf.trace \
+ newobject-paths-8.swf \
+ newobject-paths-8.swf.trace \
number.swf \
number.swf.trace \
number-properties.as \
diff --git a/test/trace/newobject-paths-5.swf b/test/trace/newobject-paths-5.swf
new file mode 100644
index 0000000..7ef6951
Binary files /dev/null and b/test/trace/newobject-paths-5.swf differ
diff --git a/test/trace/newobject-paths-5.swf.trace b/test/trace/newobject-paths-5.swf.trace
new file mode 100644
index 0000000..e3ad0ee
--- /dev/null
+++ b/test/trace/newobject-paths-5.swf.trace
@@ -0,0 +1,12 @@
+Foo
+hi
+/:Foo
+hi
+/:::Foo
+undefined
+a.Bar
+undefined
+a/Bar
+undefined
+/a/..:a.Bar
+undefined
diff --git a/test/trace/newobject-paths-6.swf b/test/trace/newobject-paths-6.swf
new file mode 100644
index 0000000..cef530f
Binary files /dev/null and b/test/trace/newobject-paths-6.swf differ
diff --git a/test/trace/newobject-paths-6.swf.trace b/test/trace/newobject-paths-6.swf.trace
new file mode 100644
index 0000000..bc9a8c1
--- /dev/null
+++ b/test/trace/newobject-paths-6.swf.trace
@@ -0,0 +1,12 @@
+Foo
+hi
+/:Foo
+hi
+/:::Foo
+undefined
+a.Bar
+hi
+a/Bar
+undefined
+/a/..:a.Bar
+hi
diff --git a/test/trace/newobject-paths-7.swf b/test/trace/newobject-paths-7.swf
new file mode 100644
index 0000000..f5e80c3
Binary files /dev/null and b/test/trace/newobject-paths-7.swf differ
diff --git a/test/trace/newobject-paths-7.swf.trace b/test/trace/newobject-paths-7.swf.trace
new file mode 100644
index 0000000..bc9a8c1
--- /dev/null
+++ b/test/trace/newobject-paths-7.swf.trace
@@ -0,0 +1,12 @@
+Foo
+hi
+/:Foo
+hi
+/:::Foo
+undefined
+a.Bar
+hi
+a/Bar
+undefined
+/a/..:a.Bar
+hi
diff --git a/test/trace/newobject-paths-8.swf b/test/trace/newobject-paths-8.swf
new file mode 100644
index 0000000..03fb035
Binary files /dev/null and b/test/trace/newobject-paths-8.swf differ
diff --git a/test/trace/newobject-paths-8.swf.trace b/test/trace/newobject-paths-8.swf.trace
new file mode 100644
index 0000000..bc9a8c1
--- /dev/null
+++ b/test/trace/newobject-paths-8.swf.trace
@@ -0,0 +1,12 @@
+Foo
+hi
+/:Foo
+hi
+/:::Foo
+undefined
+a.Bar
+hi
+a/Bar
+undefined
+/a/..:a.Bar
+hi
diff --git a/test/trace/newobject-paths.as b/test/trace/newobject-paths.as
new file mode 100644
index 0000000..74f00f6
--- /dev/null
+++ b/test/trace/newobject-paths.as
@@ -0,0 +1,38 @@
+// makeswf -v 7 -s 200x150 -r 1 -o newobject-paths.swf newobject-paths.as
+
+function construct (s) {
+ var ret;
+ asm {
+ push "ret", 0, "s"
+ getvariable
+ dup
+ trace
+ new
+ setvariable
+ };
+ return ret;
+};
+
+function Foo () {
+ this.toString = function () {
+ return "hi";
+ };
+};
+
+createEmptyMovieClip ("a", 0);
+a.Bar = Foo;
+
+values = [
+ "Foo",
+ "/:Foo",
+ "/:::Foo",
+ "a.Bar",
+ "a/Bar",
+ "/a/..:a.Bar"
+];
+
+for (i = 0; i < values.length; i++) {
+ trace (construct (values[i]));
+}
+
+loadMovie ("FSCommand:quit", "");
commit 57213bb1748bd4efd1b171a70a35c964068f1594
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Oct 15 18:29:48 2007 +0200
make NewObject action call swfdec_action_get_variable() instead of swfdec_as_context_eval()
diff --git a/libswfdec/swfdec_as_interpret.c b/libswfdec/swfdec_as_interpret.c
index a3c0c15..f2022b4 100644
--- a/libswfdec/swfdec_as_interpret.c
+++ b/libswfdec/swfdec_as_interpret.c
@@ -677,24 +677,6 @@ swfdec_action_set_variable (SwfdecAsContext *cx, guint action, const guint8 *dat
swfdec_as_stack_pop_n (cx, 2);
}
-static const char *
-swfdec_as_interpret_eval (SwfdecAsContext *cx, SwfdecAsObject *obj,
- SwfdecAsValue *val)
-{
- if (SWFDEC_AS_VALUE_IS_STRING (val)) {
- const char *s = SWFDEC_AS_VALUE_GET_STRING (val);
- if (s != SWFDEC_AS_STR_EMPTY) {
- swfdec_as_context_eval (cx, obj, s, val);
- return s;
- }
- }
- if (obj != NULL)
- SWFDEC_AS_VALUE_SET_OBJECT (val, obj);
- else
- SWFDEC_AS_VALUE_SET_UNDEFINED (val);
- return SWFDEC_AS_STR_EMPTY;
-}
-
/* FIXME: this sucks */
extern struct {
gboolean needs_movie;
@@ -1647,16 +1629,15 @@ swfdec_action_new_object (SwfdecAsContext *cx, guint action, const guint8 *data,
SwfdecAsValue *constructor;
SwfdecAsFunction *fun;
guint n_args;
- const char *name;
swfdec_as_stack_ensure_size (cx, 2);
+ swfdec_action_get_variable (cx, action, data, len);
constructor = swfdec_as_stack_peek (cx, 1);
- name = swfdec_as_interpret_eval (cx, NULL, constructor);
n_args = swfdec_as_value_to_integer (cx, swfdec_as_stack_peek (cx, 2));
n_args = MIN (swfdec_as_stack_get_size (cx) - 2, n_args);
if (!SWFDEC_AS_VALUE_IS_OBJECT (constructor) ||
!SWFDEC_IS_AS_FUNCTION (fun = (SwfdecAsFunction *) SWFDEC_AS_VALUE_GET_OBJECT (constructor))) {
- SWFDEC_WARNING ("%s is not a constructor", name);
+ SWFDEC_WARNING ("not a constructor");
goto fail;
}
commit dd6073c7c787d63fade4d1d0cde9916e39675bf9
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Oct 15 18:15:44 2007 +0200
free startDrag action from swfdec_as_context_eval()
diff --git a/libswfdec/swfdec_as_interpret.c b/libswfdec/swfdec_as_interpret.c
index 2d8b733..a3c0c15 100644
--- a/libswfdec/swfdec_as_interpret.c
+++ b/libswfdec/swfdec_as_interpret.c
@@ -1599,9 +1599,6 @@ swfdec_action_start_drag (SwfdecAsContext *cx, guint action, const guint8 *data,
guint stack_size = 3;
swfdec_as_stack_ensure_size (cx, 3);
- if (swfdec_as_interpret_eval (cx, NULL, swfdec_as_stack_peek (cx, 1)) == SWFDEC_AS_STR_EMPTY) {
- SWFDEC_AS_VALUE_SET_OBJECT (swfdec_as_stack_peek (cx, 1), cx->frame->target);
- }
center = swfdec_as_value_to_boolean (cx, swfdec_as_stack_peek (cx, 2));
if (swfdec_as_value_to_number (cx, swfdec_as_stack_peek (cx, 3))) {
swfdec_as_stack_ensure_size (cx, 7);
@@ -1613,11 +1610,15 @@ swfdec_action_start_drag (SwfdecAsContext *cx, guint action, const guint8 *data,
stack_size = 7;
rectp = ▭
}
- if (SWFDEC_AS_VALUE_IS_OBJECT (swfdec_as_stack_peek (cx, 1)) &&
- SWFDEC_IS_MOVIE (movie = (SwfdecMovie *) SWFDEC_AS_VALUE_GET_OBJECT (swfdec_as_stack_peek (cx, 1)))) {
- swfdec_player_set_drag_movie (SWFDEC_PLAYER (cx), movie, center, rectp);
+ if (!SWFDEC_IS_PLAYER (cx)) {
+ SWFDEC_ERROR ("called startDrag on a non-SwfdecPlayer");
} else {
- SWFDEC_ERROR ("startDrag on something not a Movie");
+ movie = swfdec_player_get_movie_from_value (SWFDEC_PLAYER (cx), swfdec_as_stack_peek (cx, 1));
+ if (movie != NULL) {
+ swfdec_player_set_drag_movie (SWFDEC_PLAYER (cx), movie, center, rectp);
+ } else {
+ SWFDEC_ERROR ("startDrag on something not a Movie");
+ }
}
swfdec_as_stack_pop_n (cx, stack_size);
}
commit 5e4bd0ffcc35fc0f7cd8162f58c6d669ce90a47c
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Oct 15 17:58:20 2007 +0200
add enumerate tests
diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index 33cc77d..1657703 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -488,6 +488,24 @@ EXTRA_DIST = \
empty-stack.as \
empty-stack.swf \
empty-stack.swf.trace \
+ enumerate.as \
+ enumerate2-5.swf \
+ enumerate2-5.swf.trace \
+ enumerate2-6.swf \
+ enumerate2-6.swf.trace \
+ enumerate2-7.swf \
+ enumerate2-7.swf.trace \
+ enumerate2-8.swf \
+ enumerate2-8.swf.trace \
+ enumerate2.as \
+ enumerate-5.swf \
+ enumerate-5.swf.trace \
+ enumerate-6.swf \
+ enumerate-6.swf.trace \
+ enumerate-7.swf \
+ enumerate-7.swf.trace \
+ enumerate-8.swf \
+ enumerate-8.swf.trace \
equality.as \
equality-5.swf \
equality-5.swf.trace \
diff --git a/test/trace/enumerate-5.swf b/test/trace/enumerate-5.swf
new file mode 100644
index 0000000..6368876
Binary files /dev/null and b/test/trace/enumerate-5.swf differ
diff --git a/test/trace/enumerate-5.swf.trace b/test/trace/enumerate-5.swf.trace
new file mode 100644
index 0000000..5ec39bb
--- /dev/null
+++ b/test/trace/enumerate-5.swf.trace
@@ -0,0 +1,6 @@
+true
+true
+true
+true
+true
+true
diff --git a/test/trace/enumerate-6.swf b/test/trace/enumerate-6.swf
new file mode 100644
index 0000000..49c43a7
Binary files /dev/null and b/test/trace/enumerate-6.swf differ
diff --git a/test/trace/enumerate-6.swf.trace b/test/trace/enumerate-6.swf.trace
new file mode 100644
index 0000000..80126b0
--- /dev/null
+++ b/test/trace/enumerate-6.swf.trace
@@ -0,0 +1,6 @@
+false
+true
+true
+false
+false
+false
diff --git a/test/trace/enumerate-7.swf b/test/trace/enumerate-7.swf
new file mode 100644
index 0000000..aae1c72
Binary files /dev/null and b/test/trace/enumerate-7.swf differ
diff --git a/test/trace/enumerate-7.swf.trace b/test/trace/enumerate-7.swf.trace
new file mode 100644
index 0000000..80126b0
--- /dev/null
+++ b/test/trace/enumerate-7.swf.trace
@@ -0,0 +1,6 @@
+false
+true
+true
+false
+false
+false
diff --git a/test/trace/enumerate-8.swf b/test/trace/enumerate-8.swf
new file mode 100644
index 0000000..5ba2c5a
Binary files /dev/null and b/test/trace/enumerate-8.swf differ
diff --git a/test/trace/enumerate-8.swf.trace b/test/trace/enumerate-8.swf.trace
new file mode 100644
index 0000000..80126b0
--- /dev/null
+++ b/test/trace/enumerate-8.swf.trace
@@ -0,0 +1,6 @@
+false
+true
+true
+false
+false
+false
diff --git a/test/trace/enumerate.as b/test/trace/enumerate.as
new file mode 100644
index 0000000..f77ffe1
--- /dev/null
+++ b/test/trace/enumerate.as
@@ -0,0 +1,27 @@
+// makeswf -v 7 -s 200x150 -r 1 -o enumerate.swf enumerate.as
+
+x = 0;
+createEmptyMovieClip ("a", 0);
+a.y = 1;
+a.createEmptyMovieClip ("a", 0);
+a.a.z = { w: 42 };
+
+function do_test (x) {
+ asm {
+ push "x"
+ getvariable
+ enumerate
+ push undefined
+ equals
+ trace
+ };
+};
+
+tests = [ "/a/a", "a/../a::::a", "", "a/..:a", "a.a", "a.a.z" ];
+
+for (i = 0; i < tests.length; i++) {
+ do_test (tests[i]);
+};
+
+
+loadMovie ("FSCommand:quit", "");
diff --git a/test/trace/enumerate2-5.swf b/test/trace/enumerate2-5.swf
new file mode 100644
index 0000000..54bbdfc
Binary files /dev/null and b/test/trace/enumerate2-5.swf differ
diff --git a/test/trace/enumerate2-5.swf.trace b/test/trace/enumerate2-5.swf.trace
new file mode 100644
index 0000000..5233b1b
--- /dev/null
+++ b/test/trace/enumerate2-5.swf.trace
@@ -0,0 +1,235 @@
+valueOf called
+toString called
+toString called with
+valueOf called with
+0: valueOf!
+1: valueOf!
+2: valueOf!
+3: valueOf!
+4: valueOf!
+5: valueOf!
+6: valueOf!
+7: valueOf!
+8: valueOf!
+9: valueOf!
+10: valueOf!
+11: valueOf!
+12: valueOf!
+13: valueOf!
+14: valueOf!
+15: valueOf!
+16: valueOf!
+17: valueOf!
+18: valueOf!
+19: valueOf!
+20: valueOf!
+21: valueOf!
+22: valueOf!
+22: toString!
+23: valueOf!
+24: valueOf!
+24: toString!
+25: valueOf!
+25: toString!
+26: valueOf!
+26: toString!
+27: valueOf!
+27: toString!
+>>> (0) (undefined)
+undefined
+true
+>>> (1) null (null)
+null
+true
+>>> (2) true (boolean)
+true
+true
+>>> (3) false (boolean)
+false
+true
+>>> (4) 0 (number)
+0
+true
+>>> (5) 1 (number)
+1
+true
+>>> (6) 0.5 (number)
+0.5
+true
+>>> (7) -1 (number)
+-1
+true
+>>> (8) -0.5 (number)
+-0.5
+true
+>>> (9) Infinity (number)
+Infinity
+true
+>>> (10) -Infinity (number)
+-Infinity
+true
+>>> (11) NaN (number)
+NaN
+true
+>>> (12) (string)
+
+true
+>>> (13) 0 (string)
+0
+true
+>>> (14) -0 (string)
+-0
+true
+>>> (15) 0.0 (string)
+0.0
+true
+>>> (16) 1 (string)
+1
+true
+>>> (17) Hello World! (string)
+Hello World!
+true
+>>> (18) true (string)
+true
+true
+>>> (19) _level0 (string)
+_level0
+true
+>>> (20) äöü (string)
+äöü
+true
+>>> (21) _level0 (movieclip)
+_level0
+false
+>>> (22) [object Object] (object)
+[object Object]
+true
+>>> (23) (undefined)
+undefined
+true
+>>> (24) [type Object] (object)
+toString called
+[type Object]
+false
+>>> (25) [type Object] (object)
+toString called with
+[type Object]
+false
+>>> (26) [object Object] (object)
+[object Object]
+false
+>>> (27) (object)
+[type Object]
+true
+>>> (28) (object)
+0: toString!
+[type Object]
+false
+>>> (29) null (object)
+1: toString!
+[type Object]
+false
+>>> (30) true (object)
+2: toString!
+[type Object]
+false
+>>> (31) false (object)
+3: toString!
+[type Object]
+false
+>>> (32) 0 (object)
+4: toString!
+[type Object]
+false
+>>> (33) 1 (object)
+5: toString!
+[type Object]
+false
+>>> (34) 0.5 (object)
+6: toString!
+[type Object]
+false
+>>> (35) -1 (object)
+7: toString!
+[type Object]
+false
+>>> (36) -0.5 (object)
+8: toString!
+[type Object]
+false
+>>> (37) Infinity (object)
+9: toString!
+[type Object]
+false
+>>> (38) -Infinity (object)
+10: toString!
+[type Object]
+false
+>>> (39) NaN (object)
+11: toString!
+[type Object]
+false
+>>> (40) (object)
+12: toString!
+
+false
+>>> (41) 0 (object)
+13: toString!
+0
+false
+>>> (42) -0 (object)
+14: toString!
+-0
+false
+>>> (43) 0.0 (object)
+15: toString!
+0.0
+false
+>>> (44) 1 (object)
+16: toString!
+1
+false
+>>> (45) Hello World! (object)
+17: toString!
+Hello World!
+false
+>>> (46) true (object)
+18: toString!
+true
+false
+>>> (47) _level0 (object)
+19: toString!
+_level0
+false
+>>> (48) äöü (object)
+20: toString!
+äöü
+false
+>>> (49) _level0 (object)
+21: toString!
+[type Object]
+false
+>>> (50) [type Object] (object)
+22: toString!
+[type Object]
+false
+>>> (51) (object)
+23: toString!
+[type Object]
+false
+>>> (52) [type Object] (object)
+24: toString!
+[type Object]
+false
+>>> (53) [type Object] (object)
+25: toString!
+[type Object]
+false
+>>> (54) [type Object] (object)
+26: toString!
+[type Object]
+false
+>>> (55) [type Object] (object)
+27: toString!
+[type Object]
+false
diff --git a/test/trace/enumerate2-6.swf b/test/trace/enumerate2-6.swf
new file mode 100644
index 0000000..6e7354d
Binary files /dev/null and b/test/trace/enumerate2-6.swf differ
diff --git a/test/trace/enumerate2-6.swf.trace b/test/trace/enumerate2-6.swf.trace
new file mode 100644
index 0000000..2a0c2c1
--- /dev/null
+++ b/test/trace/enumerate2-6.swf.trace
@@ -0,0 +1,236 @@
+valueOf called
+toString called
+toString called with
+valueOf called with
+0: valueOf!
+1: valueOf!
+2: valueOf!
+3: valueOf!
+4: valueOf!
+5: valueOf!
+6: valueOf!
+7: valueOf!
+8: valueOf!
+9: valueOf!
+10: valueOf!
+11: valueOf!
+12: valueOf!
+13: valueOf!
+14: valueOf!
+15: valueOf!
+16: valueOf!
+17: valueOf!
+18: valueOf!
+19: valueOf!
+20: valueOf!
+21: valueOf!
+22: valueOf!
+22: toString!
+23: valueOf!
+23: toString!
+24: valueOf!
+24: toString!
+25: valueOf!
+25: toString!
+26: valueOf!
+26: toString!
+27: valueOf!
+27: toString!
+>>> (0) (undefined)
+undefined
+true
+>>> (1) null (null)
+null
+true
+>>> (2) true (boolean)
+true
+true
+>>> (3) false (boolean)
+false
+true
+>>> (4) 0 (number)
+0
+true
+>>> (5) 1 (number)
+1
+true
+>>> (6) 0.5 (number)
+0.5
+true
+>>> (7) -1 (number)
+-1
+true
+>>> (8) -0.5 (number)
+-0.5
+true
+>>> (9) Infinity (number)
+Infinity
+true
+>>> (10) -Infinity (number)
+-Infinity
+true
+>>> (11) NaN (number)
+NaN
+true
+>>> (12) (string)
+
+true
+>>> (13) 0 (string)
+0
+true
+>>> (14) -0 (string)
+-0
+true
+>>> (15) 0.0 (string)
+0.0
+true
+>>> (16) 1 (string)
+1
+true
+>>> (17) Hello World! (string)
+Hello World!
+true
+>>> (18) true (string)
+true
+true
+>>> (19) _level0 (string)
+_level0
+true
+>>> (20) äöü (string)
+äöü
+true
+>>> (21) _level0 (movieclip)
+_level0
+false
+>>> (22) [object Object] (object)
+[object Object]
+true
+>>> (23) [type Function] (function)
+[type Function]
+true
+>>> (24) [type Object] (object)
+toString called
+[type Object]
+false
+>>> (25) [type Object] (object)
+toString called with
+[type Object]
+false
+>>> (26) [object Object] (object)
+[object Object]
+false
+>>> (27) (object)
+[type Object]
+true
+>>> (28) (object)
+0: toString!
+[type Object]
+false
+>>> (29) null (object)
+1: toString!
+[type Object]
+false
+>>> (30) true (object)
+2: toString!
+[type Object]
+false
+>>> (31) false (object)
+3: toString!
+[type Object]
+false
+>>> (32) 0 (object)
+4: toString!
+[type Object]
+false
+>>> (33) 1 (object)
+5: toString!
+[type Object]
+false
+>>> (34) 0.5 (object)
+6: toString!
+[type Object]
+false
+>>> (35) -1 (object)
+7: toString!
+[type Object]
+false
+>>> (36) -0.5 (object)
+8: toString!
+[type Object]
+false
+>>> (37) Infinity (object)
+9: toString!
+[type Object]
+false
+>>> (38) -Infinity (object)
+10: toString!
+[type Object]
+false
+>>> (39) NaN (object)
+11: toString!
+[type Object]
+false
+>>> (40) (object)
+12: toString!
+
+false
+>>> (41) 0 (object)
+13: toString!
+0
+false
+>>> (42) -0 (object)
+14: toString!
+-0
+false
+>>> (43) 0.0 (object)
+15: toString!
+0.0
+false
+>>> (44) 1 (object)
+16: toString!
+1
+false
+>>> (45) Hello World! (object)
+17: toString!
+Hello World!
+false
+>>> (46) true (object)
+18: toString!
+true
+false
+>>> (47) _level0 (object)
+19: toString!
+_level0
+false
+>>> (48) äöü (object)
+20: toString!
+äöü
+false
+>>> (49) _level0 (object)
+21: toString!
+[type Object]
+false
+>>> (50) [type Object] (object)
+22: toString!
+[type Object]
+false
+>>> (51) [type Object] (object)
+23: toString!
+[type Object]
+false
+>>> (52) [type Object] (object)
+24: toString!
+[type Object]
+false
+>>> (53) [type Object] (object)
+25: toString!
+[type Object]
+false
+>>> (54) [type Object] (object)
+26: toString!
+[type Object]
+false
+>>> (55) [type Object] (object)
+27: toString!
+[type Object]
+false
diff --git a/test/trace/enumerate2-7.swf b/test/trace/enumerate2-7.swf
new file mode 100644
index 0000000..dfe2bf6
Binary files /dev/null and b/test/trace/enumerate2-7.swf differ
diff --git a/test/trace/enumerate2-7.swf.trace b/test/trace/enumerate2-7.swf.trace
new file mode 100644
index 0000000..94228be
--- /dev/null
+++ b/test/trace/enumerate2-7.swf.trace
@@ -0,0 +1,236 @@
+valueOf called
+toString called
+toString called with
+valueOf called with
+0: valueOf!
+1: valueOf!
+2: valueOf!
+3: valueOf!
+4: valueOf!
+5: valueOf!
+6: valueOf!
+7: valueOf!
+8: valueOf!
+9: valueOf!
+10: valueOf!
+11: valueOf!
+12: valueOf!
+13: valueOf!
+14: valueOf!
+15: valueOf!
+16: valueOf!
+17: valueOf!
+18: valueOf!
+19: valueOf!
+20: valueOf!
+21: valueOf!
+22: valueOf!
+22: toString!
+23: valueOf!
+23: toString!
+24: valueOf!
+24: toString!
+25: valueOf!
+25: toString!
+26: valueOf!
+26: toString!
+27: valueOf!
+27: toString!
+>>> (0) undefined (undefined)
+undefined
+true
+>>> (1) null (null)
+null
+true
+>>> (2) true (boolean)
+true
+true
+>>> (3) false (boolean)
+false
+true
+>>> (4) 0 (number)
+0
+true
+>>> (5) 1 (number)
+1
+true
+>>> (6) 0.5 (number)
+0.5
+true
+>>> (7) -1 (number)
+-1
+true
+>>> (8) -0.5 (number)
+-0.5
+true
+>>> (9) Infinity (number)
+Infinity
+true
+>>> (10) -Infinity (number)
+-Infinity
+true
+>>> (11) NaN (number)
+NaN
+true
+>>> (12) (string)
+
+true
+>>> (13) 0 (string)
+0
+true
+>>> (14) -0 (string)
+-0
+true
+>>> (15) 0.0 (string)
+0.0
+true
+>>> (16) 1 (string)
+1
+true
+>>> (17) Hello World! (string)
+Hello World!
+true
+>>> (18) true (string)
+true
+true
+>>> (19) _level0 (string)
+_level0
+true
+>>> (20) äöü (string)
+äöü
+true
+>>> (21) _level0 (movieclip)
+_level0
+false
+>>> (22) [object Object] (object)
+[object Object]
+true
+>>> (23) [type Function] (function)
+[type Function]
+true
+>>> (24) [type Object] (object)
+toString called
+[type Object]
+false
+>>> (25) [type Object] (object)
+toString called with
+[type Object]
+false
+>>> (26) [object Object] (object)
+[object Object]
+false
+>>> (27) undefined (object)
+[type Object]
+true
+>>> (28) undefined (object)
+0: toString!
+[type Object]
+false
+>>> (29) null (object)
+1: toString!
+[type Object]
+false
+>>> (30) true (object)
+2: toString!
+[type Object]
+false
+>>> (31) false (object)
+3: toString!
+[type Object]
+false
+>>> (32) 0 (object)
+4: toString!
+[type Object]
+false
+>>> (33) 1 (object)
+5: toString!
+[type Object]
+false
+>>> (34) 0.5 (object)
+6: toString!
+[type Object]
+false
+>>> (35) -1 (object)
+7: toString!
+[type Object]
+false
+>>> (36) -0.5 (object)
+8: toString!
+[type Object]
+false
+>>> (37) Infinity (object)
+9: toString!
+[type Object]
+false
+>>> (38) -Infinity (object)
+10: toString!
+[type Object]
+false
+>>> (39) NaN (object)
+11: toString!
+[type Object]
+false
+>>> (40) (object)
+12: toString!
+
+false
+>>> (41) 0 (object)
+13: toString!
+0
+false
+>>> (42) -0 (object)
+14: toString!
+-0
+false
+>>> (43) 0.0 (object)
+15: toString!
+0.0
+false
+>>> (44) 1 (object)
+16: toString!
+1
+false
+>>> (45) Hello World! (object)
+17: toString!
+Hello World!
+false
+>>> (46) true (object)
+18: toString!
+true
+false
+>>> (47) _level0 (object)
+19: toString!
+_level0
+false
+>>> (48) äöü (object)
+20: toString!
+äöü
+false
+>>> (49) _level0 (object)
+21: toString!
+[type Object]
+false
+>>> (50) [type Object] (object)
+22: toString!
+[type Object]
+false
+>>> (51) [type Object] (object)
+23: toString!
+[type Object]
+false
+>>> (52) [type Object] (object)
+24: toString!
+[type Object]
+false
+>>> (53) [type Object] (object)
+25: toString!
+[type Object]
+false
+>>> (54) [type Object] (object)
+26: toString!
+[type Object]
+false
+>>> (55) [type Object] (object)
+27: toString!
+[type Object]
+false
diff --git a/test/trace/enumerate2-8.swf b/test/trace/enumerate2-8.swf
new file mode 100644
index 0000000..7d706a7
Binary files /dev/null and b/test/trace/enumerate2-8.swf differ
diff --git a/test/trace/enumerate2-8.swf.trace b/test/trace/enumerate2-8.swf.trace
new file mode 100644
index 0000000..94228be
--- /dev/null
+++ b/test/trace/enumerate2-8.swf.trace
@@ -0,0 +1,236 @@
+valueOf called
+toString called
+toString called with
+valueOf called with
+0: valueOf!
+1: valueOf!
+2: valueOf!
+3: valueOf!
+4: valueOf!
+5: valueOf!
+6: valueOf!
+7: valueOf!
+8: valueOf!
+9: valueOf!
+10: valueOf!
+11: valueOf!
+12: valueOf!
+13: valueOf!
+14: valueOf!
+15: valueOf!
+16: valueOf!
+17: valueOf!
+18: valueOf!
+19: valueOf!
+20: valueOf!
+21: valueOf!
+22: valueOf!
+22: toString!
+23: valueOf!
+23: toString!
+24: valueOf!
+24: toString!
+25: valueOf!
+25: toString!
+26: valueOf!
+26: toString!
+27: valueOf!
+27: toString!
+>>> (0) undefined (undefined)
+undefined
+true
+>>> (1) null (null)
+null
+true
+>>> (2) true (boolean)
+true
+true
+>>> (3) false (boolean)
+false
+true
+>>> (4) 0 (number)
+0
+true
+>>> (5) 1 (number)
+1
+true
+>>> (6) 0.5 (number)
+0.5
+true
+>>> (7) -1 (number)
+-1
+true
+>>> (8) -0.5 (number)
+-0.5
+true
+>>> (9) Infinity (number)
+Infinity
+true
+>>> (10) -Infinity (number)
+-Infinity
+true
+>>> (11) NaN (number)
+NaN
+true
+>>> (12) (string)
+
+true
+>>> (13) 0 (string)
+0
+true
+>>> (14) -0 (string)
+-0
+true
+>>> (15) 0.0 (string)
+0.0
+true
+>>> (16) 1 (string)
+1
+true
+>>> (17) Hello World! (string)
+Hello World!
+true
+>>> (18) true (string)
+true
+true
+>>> (19) _level0 (string)
+_level0
+true
+>>> (20) äöü (string)
+äöü
+true
+>>> (21) _level0 (movieclip)
+_level0
+false
+>>> (22) [object Object] (object)
+[object Object]
+true
+>>> (23) [type Function] (function)
+[type Function]
+true
+>>> (24) [type Object] (object)
+toString called
+[type Object]
+false
+>>> (25) [type Object] (object)
+toString called with
+[type Object]
+false
+>>> (26) [object Object] (object)
+[object Object]
+false
+>>> (27) undefined (object)
+[type Object]
+true
+>>> (28) undefined (object)
+0: toString!
+[type Object]
+false
+>>> (29) null (object)
+1: toString!
+[type Object]
+false
+>>> (30) true (object)
+2: toString!
+[type Object]
+false
+>>> (31) false (object)
+3: toString!
+[type Object]
+false
+>>> (32) 0 (object)
+4: toString!
+[type Object]
+false
+>>> (33) 1 (object)
+5: toString!
+[type Object]
+false
+>>> (34) 0.5 (object)
+6: toString!
+[type Object]
+false
+>>> (35) -1 (object)
+7: toString!
+[type Object]
+false
+>>> (36) -0.5 (object)
+8: toString!
+[type Object]
+false
+>>> (37) Infinity (object)
+9: toString!
+[type Object]
+false
+>>> (38) -Infinity (object)
+10: toString!
+[type Object]
+false
+>>> (39) NaN (object)
+11: toString!
+[type Object]
+false
+>>> (40) (object)
+12: toString!
+
+false
+>>> (41) 0 (object)
+13: toString!
+0
+false
+>>> (42) -0 (object)
+14: toString!
+-0
+false
+>>> (43) 0.0 (object)
+15: toString!
+0.0
+false
+>>> (44) 1 (object)
+16: toString!
+1
+false
+>>> (45) Hello World! (object)
+17: toString!
+Hello World!
+false
+>>> (46) true (object)
+18: toString!
+true
+false
+>>> (47) _level0 (object)
+19: toString!
+_level0
+false
+>>> (48) äöü (object)
+20: toString!
+äöü
+false
+>>> (49) _level0 (object)
+21: toString!
+[type Object]
+false
+>>> (50) [type Object] (object)
+22: toString!
+[type Object]
+false
+>>> (51) [type Object] (object)
+23: toString!
+[type Object]
+false
+>>> (52) [type Object] (object)
+24: toString!
+[type Object]
+false
+>>> (53) [type Object] (object)
+25: toString!
+[type Object]
+false
+>>> (54) [type Object] (object)
+26: toString!
+[type Object]
+false
+>>> (55) [type Object] (object)
+27: toString!
+[type Object]
+false
diff --git a/test/trace/enumerate2.as b/test/trace/enumerate2.as
new file mode 100644
index 0000000..00f4f37
--- /dev/null
+++ b/test/trace/enumerate2.as
@@ -0,0 +1,23 @@
+// makeswf -v 7 -s 200x150 -r 1 -o enumerate2.swf enumerate2.as
+
+#include "values.as"
+
+function enum (x) {
+ asm {
+ push "x"
+ getvariable
+ dup
+ trace
+ enumerate2
+ push undefined
+ equals
+ trace
+ };
+};
+
+for (i = 0; i < values.length; i++) {
+ trace (">>> " + names[i]);
+ enum (values[i]);
+};
+
+loadMovie ("FSCommand:quit", "");
commit 6b1d9ab03b557daed4261e3a9fa3c7e5939e9e89
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Oct 15 17:19:28 2007 +0200
that function is unused
diff --git a/libswfdec/swfdec_sound.c b/libswfdec/swfdec_sound.c
index f086849..8bf57e5 100644
--- a/libswfdec/swfdec_sound.c
+++ b/libswfdec/swfdec_sound.c
@@ -552,27 +552,3 @@ swfdec_sound_buffer_render (gint16 *dest, const SwfdecBuffer *source,
}
}
-/**
- * swfdec_sound_render:
- * @sound: a #SwfdecSound
- * @dest: target to add to
- * @offset: offset in samples into the data
- * @n_samples: amount of samples to render
- *
- * Renders the given sound onto the existing data in @dest.
- **/
-void
-swfdec_sound_render (SwfdecSound *sound, gint16 *dest,
- guint offset, guint n_samples)
-{
- SwfdecBuffer *buffer;
- SwfdecAudioFormat format;
- g_return_if_fail (SWFDEC_IS_SOUND (sound));
- /* FIXME: I need a return_if_fail for !created_by_define_sound */
-
- buffer = swfdec_sound_get_decoded (sound, &format);
- if (buffer == NULL)
- return;
- swfdec_sound_buffer_render (dest, buffer, format,
- NULL, offset, n_samples);
-}
diff --git a/libswfdec/swfdec_sound.h b/libswfdec/swfdec_sound.h
index e3fd934..abcf5ad 100644
--- a/libswfdec/swfdec_sound.h
+++ b/libswfdec/swfdec_sound.h
@@ -88,10 +88,6 @@ int tag_func_define_button_sound (SwfdecSwfDecoder * s, guint tag);
SwfdecBuffer * swfdec_sound_get_decoded (SwfdecSound * sound,
SwfdecAudioFormat * format);
-void swfdec_sound_render (SwfdecSound * sound,
- gint16 * dest,
- guint offset,
- guint len);
void swfdec_sound_buffer_render (gint16 * dest,
const SwfdecBuffer * source,
SwfdecAudioFormat format,
commit 8b60c7a43c93a3887e7d0bc5eac17e5c24639122
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Oct 15 17:18:36 2007 +0200
make Enumerate action call GetVariable instead of as_context_eval()
diff --git a/libswfdec/swfdec_as_interpret.c b/libswfdec/swfdec_as_interpret.c
index 06bbc35..2d8b733 100644
--- a/libswfdec/swfdec_as_interpret.c
+++ b/libswfdec/swfdec_as_interpret.c
@@ -2234,16 +2234,14 @@ swfdec_action_do_enumerate (SwfdecAsContext *cx, SwfdecAsObject *object)
}
static void
-swfdec_action_enumerate (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
+swfdec_action_enumerate2 (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
{
SwfdecAsValue *val;
SwfdecAsObject *obj;
val = swfdec_as_stack_peek (cx, 1);
-
- swfdec_as_interpret_eval (cx, NULL, val);
if (!SWFDEC_AS_VALUE_IS_OBJECT (val)) {
- SWFDEC_ERROR ("Enumerate not pointing to an object");
+ SWFDEC_WARNING ("Enumerate called without an object");
SWFDEC_AS_VALUE_SET_UNDEFINED (val);
return;
}
@@ -2253,20 +2251,11 @@ swfdec_action_enumerate (SwfdecAsContext *cx, guint action, const guint8 *data,
}
static void
-swfdec_action_enumerate2 (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
+swfdec_action_enumerate (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
{
- SwfdecAsValue *val;
- SwfdecAsObject *obj;
-
- val = swfdec_as_stack_peek (cx, 1);
- if (!SWFDEC_AS_VALUE_IS_OBJECT (val)) {
- SWFDEC_ERROR ("Enumerate2 called without an object");
- SWFDEC_AS_VALUE_SET_UNDEFINED (val);
- return;
- }
- obj = SWFDEC_AS_VALUE_GET_OBJECT (val);
- SWFDEC_AS_VALUE_SET_UNDEFINED (val);
- swfdec_action_do_enumerate (cx, obj);
+ /* FIXME: make this proper functions */
+ swfdec_action_get_variable (cx, action, data, len);
+ swfdec_action_enumerate2 (cx, action, data, len);
}
static void
commit c803d8380f89165683f6d6034880b81314a91076
Author: Benjamin Otte <otte at gnome.org>
Date: Sun Oct 14 23:32:37 2007 +0200
Enumerate pushes an undefined at the end, not a null
diff --git a/libswfdec/swfdec_as_interpret.c b/libswfdec/swfdec_as_interpret.c
index 3055a7d..06bbc35 100644
--- a/libswfdec/swfdec_as_interpret.c
+++ b/libswfdec/swfdec_as_interpret.c
@@ -2244,11 +2244,11 @@ swfdec_action_enumerate (SwfdecAsContext *cx, guint action, const guint8 *data,
swfdec_as_interpret_eval (cx, NULL, val);
if (!SWFDEC_AS_VALUE_IS_OBJECT (val)) {
SWFDEC_ERROR ("Enumerate not pointing to an object");
- SWFDEC_AS_VALUE_SET_NULL (val);
+ SWFDEC_AS_VALUE_SET_UNDEFINED (val);
return;
}
obj = SWFDEC_AS_VALUE_GET_OBJECT (val);
- SWFDEC_AS_VALUE_SET_NULL (val);
+ SWFDEC_AS_VALUE_SET_UNDEFINED (val);
swfdec_action_do_enumerate (cx, obj);
}
@@ -2261,11 +2261,11 @@ swfdec_action_enumerate2 (SwfdecAsContext *cx, guint action, const guint8 *data,
val = swfdec_as_stack_peek (cx, 1);
if (!SWFDEC_AS_VALUE_IS_OBJECT (val)) {
SWFDEC_ERROR ("Enumerate2 called without an object");
- SWFDEC_AS_VALUE_SET_NULL (val);
+ SWFDEC_AS_VALUE_SET_UNDEFINED (val);
return;
}
obj = SWFDEC_AS_VALUE_GET_OBJECT (val);
- SWFDEC_AS_VALUE_SET_NULL (val);
+ SWFDEC_AS_VALUE_SET_UNDEFINED (val);
swfdec_action_do_enumerate (cx, obj);
}
More information about the Swfdec
mailing list