[Swfdec] 2 commits - libswfdec/swfdec_script.c test/trace
Benjamin Otte
company at kemper.freedesktop.org
Wed Mar 7 03:35:37 PST 2007
libswfdec/swfdec_script.c | 14 ++++++++++++--
test/trace/Makefile.am | 2 ++
test/trace/gotoframe.swf |binary
test/trace/gotoframe.swf.trace | 13 +++++++++++++
4 files changed, 27 insertions(+), 2 deletions(-)
New commits:
diff-tree 12348410a3509928a6e8e4c8ca00292a58ff542c (from 46e62d4410c20c19774a45758d8ebf11cd0bdf96)
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Mar 7 12:35:34 2007 +0100
add GotoFrame2 test
diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index 2368dc6..a0fa2ca 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -69,6 +69,8 @@ EXTRA_DIST = \
goto4.swf.trace \
goto5.swf \
goto5.swf.trace \
+ gotoframe.swf \
+ gotoframe.swf.trace \
height1.swf \
height1.swf.trace \
height2.swf \
diff --git a/test/trace/gotoframe.swf b/test/trace/gotoframe.swf
new file mode 100755
index 0000000..0aa1970
Binary files /dev/null and b/test/trace/gotoframe.swf differ
diff --git a/test/trace/gotoframe.swf.trace b/test/trace/gotoframe.swf.trace
new file mode 100755
index 0000000..db5fe6d
--- /dev/null
+++ b/test/trace/gotoframe.swf.trace
@@ -0,0 +1,13 @@
+Check the effect of various GotoFrame2 commands
+6
+6
+6
+12
+15
+14
+14
+4
+4
+4
+4
+15
diff-tree 46e62d4410c20c19774a45758d8ebf11cd0bdf96 (from a4cbb09c7024047e4b128d87f5d27325adcfe2a0)
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Mar 7 12:34:24 2007 +0100
fix swfdec_value_to_frame to handle weird cases
diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c
index 88b1b1d..7d93740 100644
--- a/libswfdec/swfdec_script.c
+++ b/libswfdec/swfdec_script.c
@@ -291,16 +291,26 @@ swfdec_value_to_frame (JSContext *cx, Sw
if (JSVAL_IS_STRING (val)) {
const char *name = swfdec_js_to_string (cx, val);
+ char *end;
if (name == NULL ||
!SWFDEC_IS_SPRITE_MOVIE (movie))
return -1;
if (strchr (name, ':')) {
SWFDEC_ERROR ("FIXME: handle targets");
}
- frame = swfdec_sprite_get_frame (SWFDEC_SPRITE_MOVIE (movie)->sprite, name);
+ /* treat valid encoded numbers as numbers, otherwise assume it's a frame label */
+ frame = strtol (name, &end, 0);
+ if (*end != '\0')
+ frame = swfdec_sprite_get_frame (SWFDEC_SPRITE_MOVIE (movie)->sprite, name);
+ else
+ frame--;
+ } else if (JSVAL_IS_INT (val)) {
+ return JSVAL_TO_INT (val) - 1;
+ } else if (JSVAL_IS_DOUBLE (val)) {
+ return (int) *JSVAL_TO_DOUBLE (val) - 1;
} else {
/* FIXME: how do we treat undefined etc? */
- frame = swfdec_value_to_number (cx, val);
+ frame = -1;
}
return frame;
}
More information about the Swfdec
mailing list